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

Ask questions here...

The link to ypatia.st isn't working. Could someone please put the file there so the link works?????
–Mike Langford

My bad: ypatia.zip contains ypatia.st. You can grab it now. Mark Guzdial

I am trying to perform initalization of an object with its creation. Right now, all I can do is call a function called 'initalize' after I use the class method 'new' (a la cs1311/1501). Is there any way of using 'new' to also perform initalization (like a constructor in java). Or do I need to make a factory class method to initalize and make the object the same time? Any pointers to places in the codebase that initalize and instansiate with 'new' would be greatly appreciated.
–Mike Langford

We're covering this on Tuesday. You can define the class method new to be ^super new initialize which does what you want – most of the time. See Chapter 3. Mark Guzdial

The requirements for MathEquation read:
"MathEquation will be the class that understands from: and will return a Form. If it gets a string, it just returns a graphical representation of that string. However, if it gets a different mathematical object, it will return that object."
I want to know if a MathEquation gets "a different mathematical object" is it supposed to return a graphical representation of all of the parts of the equation put together into a Form object? If not, is it just to treat it as an error??
–Mike Langford

MathEquation returns a Form, no matter what it gets. Mark Guzdial


From Newsgroup


Subject: 
               Questions For Milestone #1
         Date: 
               Fri, 19 May 2000 11:47:20 -0400
        From: 
               "Adam Blaiss" 
 Organization: 
               Georgia Institute of Technology, Atlanta GA, USA
 Newsgroups: 
               git.cc.class.cs2340




I'll get the ball rolling with some things I'm unclear on:

1. This is how it seems to me that the project is supposed to work:

MathFraction, GreekSymbol, MathSuperScript, and MathSubScript each format
the information given to it and return a "mathematical object" to eventually
be gotten by MathEquation, which will return a Form with all of information
collected.

Is this correct and if not, what don't I understand?

2. Is MathEquation creating a Form object to "draw" all of this information
on and display it or does MathEquation just create the Form object, draw the
information to it, and let the user make the Form display?

3. What is this "mathematical object" or "fractional object" that we are
supposed to return from most of our classes? Is this a type of object we
make up or that is already defined, and if we make it up, how is it to be
classified?

4. The definition for MathFraction says that MathEquation must format it
correctly. However, if all MathEquation is doing with a "mathematical
object" is to "return that object", how will it to format it correctly?

I guess that's it. Not too much? :-)  Any help that could be given would be
great as this is the only thing I've got to work on this weekend. Thanks
again for any help.

---
------------------------------------------------
Adam Blaiss      felder@resnet.gatech.edu
"Me fail English? That's unpossible!"
 - Ralph Wiggum, The Simpsons


#1 is correct.
#2: User makes the Form display (see the example at Summer 2000 Project Milestones)
#3: You will decide what the mathematical or fractional objects are. What objects do you need? Do you need a Numerator or Denominator class? Or can you just use instances of MathFraction? Design your classes.
#4: See above – I also fixed the writeup slightly at Summer 2000 Project Milestones. Mark Guzdial

Do the "subclasses" (MathFraction, GreekSymbol, and such) actually write to the Form that is going to display the information or do they just store the info that will be sent MathEquation and it will do all of the writing to the Form? Either way seems kind of loopy, because if the "subclasses" do the writing, how will they know about each other and properly format, but if MathEquation does the writing, it seems to make the OOD bad since all they do is hold values and MathEquation does all the real work.

I think I'm just confused on flow control. I mean, since it's all OO, everything should be able to easily go together (i.e. - make an equation with several fractions and subscripts) but I don't see how I can design it so that everything can fit and flow correctly. For example, MathFraction....it seems that you need to take the 2 numbers and create 3 text fields, one on top of the others and put a 3 on top, dash in the middle, and a 4 on the bottom. However, I don't see what this object is that I should be passing back to MathEquation. What would MathEquation do with this object if I've already effectively written the fraction to the Form? Thanks for any attempts in clearing up my utter confusion.

Adam Blaiss felder@resnet.gatech.edu

These are great questions, Adam! Ask these in class and we can discuss it some more. Brief answer, though: MathEquation should probably be doing the transformation to Form, but that doesn't mean that it doesn't send the individual parts messages! Don't think in terms of subroutines. For example, it's one task to figure out that you're a Beta, but it's another task (one that can't be done until EVERYTHING is laid out) that you're going to be a 9-point Beta. Make sense? Mark Guzdial

I was wondering if this needs to look pretty yet. Right now, I can make the Equations display correctly, however I haven't bothered putting in code to correctly size stuff automatically. Is looking pretty part of the First Milestone, or is okay for our equations to be ugly and all the text (e.g. superscripts) to be the same font size? I would rather wait to put this complexity on when we build the UI, that way the model is simple that we start expanding it on our teams.

And since we'll need to make this pretty eventually, I'll ask this now: What exactly does the 'point' on a 12 point font mean? The definition of that would really help to generate a general formatting solution that is font-independent.
–Mike Langford (gte910h@prism.gatech.edu)

You have to do it eventually. You might as well start doing it now. A point is 1/72 of an inch. Mark Guzdial

I was wondering if would be okay to scale the subforms graphically rather then by using font sizes. That would allow the Math group to express equations of the form "(99/(89/(78/(89+ (89/99))))) + 5^7" that it can't do if it uses fonts (without looking strange). The user could then still specify the base font size, and all would be well.
–Mike Langford (gte910h@prism.gatech.edu)

You could, but it would look yucky. You're best bet is to choose the appropriate point size, then graphically size beyond that. But I wrote the assignment so that you wouldn't have to go beyond the font definitions. Mark Guzdial

I cannot locate the keyboard key that "varrho" or lowercase "Upsilon"...I have done and exhautive search on the keys. Does anyone know an easy way to find it?
–Mike Langford gte910h@prism.gatech.edu
Oops – thought I removed the lowercase upsilon. Sorry! Varrho, you're definitely not required to do. You only have to cover the Greek characters actually in the Ypatia font. Mark Guzdial


OK, I feel like an idiot. I type:

1 to: 10 do: [:x | Transcript show: x; cr].

into an empty workspace, and when I try to doit, I get the error message "MessageNotUnderstood: do:" – any ideas? Thanks.
–Chris Campbell chrisc@greenbuffalo.com

You need to convert x into a String before passing it to Transcript show:. So you should use 1 to: 10 do: [:x | Transcript show: x asString; cr]. so it converts it to a string before show:ing it.
–Mike Langford


That was it. Thanks, Mike. That error message had me looking outside the block, and I couldn't see anything.
–Chris Campbell

asString works, but printString is better form – that's how you convert anything to strings. Mark Guzdial



I was noticing that you require that the greek symbols pop out in 9, 10, 14, or 18 point font. However, Ypatia has facilities for 10, 12, 14, 18, and 24. Are we allowed to add the other sizes directly to Ypatia, or do we need to make a subclass of Ypatia, or should we use some entirely other method?
–Mike Langford gte910h@prism.gatech.edu



Where do I require those, Mike? The sizes I gave you are fine, and I want to correctly wherever I talked about 9 point. Mark Guzdial

This may help

f := Form extent: 100@100.
p := Pen newOnForm: f.
p down.
20 timesRepeat: [p go: 10. p turn: 20.].
f display.

m _ 'Mark Guzdial' asDisplayText.
m displayOn: f
f display.

n _ 'Vandana' asDisplayText.
n displayOn: f at: 0@50.
f display.

morph := ImageMorph new openInWorld.
morph image: f.



You require the sizes on the milestone description under GreekSymbol.
But if the sizes ypatia does are fine, that's no skin off my back.
–Mike Langford gte910h@prism.gatech.edu


Could you give an example command using GreekSymbol and what is displayed, preferable one command that uses all the classes required and the expected output if displayed.
a
There's one in the PDF, Missing File (/cs2340/uploads/2340sum00-ProjDescr.pdf) Mark Guzdial

I am still confused about the Form in first part of P1. Problem says, "MathEquation will return a Form". Is this Form like the Form in the begining of lecture of chapter 3 ( Joe the Box) or a mathematic form (e.g. sinx/x)?

Thanks

A Form as in the class Form in Squeak. Eric Anderson

How do you change the actual size of a font? In TextStyle I've tried setting fontOfSize: 18 (for example) and it just gives me an error.
Thanks

This font size thing is hanging me up too...could we please get a hint; I have been using the tools we went over today in class too, and I still can't find the correct object.
–Mike Langford gte910h@prism.gatech.edu


('abcdefghijklmnopqrstuvwxyz' asParagraph
textStyle: (TextStyle named: 'Ypatia')) display

if I want to print it out on Transcript instead, how can I fix the above code?

thank you

I do not believe that you can do what you want to do. Basically the problem is that Transcript is an instance of TranscriptStream. And since it is basically just a Stream it wants some sort of collection (something that understands the message do:). The objects that can control their text styling (DisplayText, NewParagraph, and any of their subclasses) are obviously more than just a simple collection.

If you were really bent on doing it, then you could try getting the dependents of Transcript, figure out which ones of them are the views for the text and change the styling directly, but I would really recommend against this becuase it would be a very ugly hack.

Think of Transcript as the stdout for most programming langauges. Just as you would not send stylized text to C's printf statement you would also not send stylized text to Squeaks Transcript. It is meant for simply plain text output. Eric Anderson


Hey guys, quick question. I have the following line in my code:
(letter asParagraph textStyle: (TextStyle named: 'Ypatia') )
If I set letter to be #a and then display, it prints a lowercase alpha to the corner of the screen, which is great. If I set it to be #b, it prints a lowercase beta. However, if I set it to #c, #p, or any uppercase letter, it displays nothing. Any idea why?

Oh, and is there any easy way to do multiple conditionals, or is GreekSymbol named:sized: just going to be rather messy?

What you need is a hash table... there are collections that provide such things...
Mike Langford gte910h

Check out Dictionary Mark Guzdial

I downloaded the ypathia.zip file, and it seems that the .st file is not all text. There is a page or so of text and then a binch of binary. Has my computer gone loco? Does anyone else have this problem?

Have you tried filing it in anyway? Mine looked like that, but was correct. I believe the file should contain text definitions at the top and then the actual font information in binary beneath it. However, I could be wrong. I say to go ahead and try to file it in. - Bruce Labbate

('abcdefghijklmnopqrstuvwxyz' asDisplayText
textStyle: (TextStyle named: 'Ypatia')) display
This works fine in MVC, but not in Morphic.Why won't it work in Morphic?

Because DisplayText gets converted into a Paragraph to display it, and there seems to be a bug in Morphic that DisplayTexts forget their text style when converting to Paragraphs. Try:
('abcdefghijklmnopqrstuvwxyz' asParagraph 
        textStyle: (TextStyle named: 'Ypatia')) display



I looked that the method that did this conversion to Paragraphs that you mentioned and it turns out that in Morphic it doesn't convert to a paragraph. The method is composeForm in the DisplayText object. As you can see when in Morphic is uses TextMorph and nowhere does it tell TextMorph which instance of TextStyle it want it to use. This is probably because there is no setter method for the textstyle in TextMorph. I tried adding one and then telling the instance of TextMorph created in the composeForm method to use the specified TextStyle, but it still didn't work. So it looks like TextMorph does pay any attention to it's textstyle when display itself.

If you are really bent on doing this, a workaround would be to have the method convert to a Paragraph in Morphic also. So the new composeForm would look like:
composeForm

	form _ self asParagraph asForm

This creates the right effect, but most likely whoever wrote this method wanted to remove that dependency between DisplayText and Paragraph (having a dependency on a subclass is in general a bad idea). A better solution would be to fix TextMorph to use it's TextStyle. So you can either use this hack or just stick to displaying Paragraphs in Morphic for now. Eric Anderson




This was asked further up the page, but it didn't get an answer so I'm askin' it again.
The line:
('b' asParagraph textStyle: (TextStyle named:'Ypatia')) displayOn: f. (where f is my form).
Displays a lowercase beta. The same line with ANY capital letter doesn't give me anything. Any ideas?
Thanks,
Bill Tice gte578j@prism.gatech.edu

Looks like there's something going on with the default bounding box. Try (' B ' asParagraph textStyle: (TextStyle named:'Ypatia')) display. Mark Guzdial

From Email

	1. I like to know one scenario of what to do. I looked at the 
	pdf description, but the example is not combied with Ypatia
	format. What I am thinking if the scenario of this project
	in a large sclae is to input the MathEquation, MathFraction,
	and etc object with the integer or string of default format,
	and to output their graphical representation with Ypatia format.
	The thing is that I don't see specific connection between 
	getting the graphical representation of equation and use the
	Ypatia font. 
	
	2. for the super/sub-scritp, do I have to make the script smaller
	sized and "manually" move it in the proper position?

	3. for the graphical representation of fraftion, do I have to
	nicely print it so that

		sin(x)
		------
		  x
	instead of 
		sin(x)
		------
		x
	.
	the part of ----- in the middle of numerator and denominator
	can also vary. Do I have to change it into the proper size.
	Do I have to move the each of sine(x),---, x into the position
	in the code?

	Thank you.



#1: You only need the Ypatia font for the Greek symbols. Think about the 2 * Pi example that I did in class Tuesday.
#2: Yes, you absolutely have to make the script smaller and "manually" move it to the proper position.
#3: You should make it look as nice as you can, but you'll be graded more for readability than aesthetics. You do have to position everything yourself. Mark Guzdial

The project says that "MathEquation will be the class that understands from: and will return a Form. If it gets a string, it just returns a graphical representation of that string...".
I really do not know how to write a code for checking if the object passed in is a string or it belongs to any other types of class.
Please show me how to check if an object is a String object.
For example,
form: anObject
anObject = String ifTrue: [...]
I know this code is not right. Please show me codes for checking something like above example.
Thanks

I think a similar example of what you are looking for can be found at the beginning of AEDesc createFromText:. Check out the first line in that method and see if that helps you.

As a side note, you may not want to go this route. By testing for class types you will create more work for yourself and after a while you will end up with a whole lot of if statements testing for all the valid (and filtering out the invalid) objects that can be accepted. A better thing to do would be to give them all the same interface. This way no matter what object comes in you can just send that object a message and the object will give you what you want. For example: say you create the interface to be asDisplayText. Now if a string comes in you just say give me you as a DisplayText. If some math object comes in you still say give me you as a DisplayText. So if you want to add support for a new type of object you just implement the asDisplayText method in that object and your method will be able to support it.

This is one of the advantages to a typeless language. You don't care what object it is. All you care about is can I send it a certain message? With typed languages (take for example Java) you would have to explicitly create an interface. Have your object implement that interface. And then have your method cast whatever object is comming in to that interface. You can still do it, but there is a good bit more syntax and specifying involved (although some people would argue that this syntax and specifying leads to more reliable code. That is open to debate). Eric Anderson


Definitely don't cast anything! You can check types with isKindOf: and class. But best yet is just to have Strings handle the same interface as MathObjects, but to respond in a reasonable way for Strings. Mark Guzdial



I've noticed that for every example you have the user typing in "MathEquation from: ..."
I have to declare an instance of my MathEquation before I can get it to work, is this correct?
Thanks.

Your right. Probably better OO would dictate you would want to have something like.
myEquation := MathEquation new: SomeMathObject
myForm := myEquation form

But you can still keep good design and have the interface specified. All you have to do is have the from: class method in MathEquation have the code for what you would put in the workspace. That way you can still do it as above (create instances), and the from: class method ends up becoming a kind of shorthand constructor. The from: class method would create the instance for you, get the form from the instance, and return it to the user. Eric Anderson


Not at all! You have to have MathEquation class as the interface, but you don't necessarily have to create an instance of MathEquation. That's up to the user's perogative. What everyone has to code to is the interface – I don't care what happens on the inside. That's what y'all have to implement. The assignment requires a CLASS METHOD named from: Mark Guzdial


I still have absolutely no idea how to draw a line: I've tried using BitBlt and I've tried using pens but I can't seem to get it to work, any help?
Thanks

Try looking at the example in the Pen class (it is a class method called example). See if that helps any. Eric Anderson
Or Line example. Mark Guzdial



what command line would be used to create the expression:

H20 (chemical expression for water)
^(the 2 as a subscript)

i would assume we could use MathOperation and leave the operator argument as a blank string (i.e. '').

is my thinking about this correct?

thanks,
robert

That works for me, Robert. Mark Guzdial

More on Capital Letters in Ypatia


Well, I haven't figured out yet how to get DisplayText or Paragraph to display the capital letters in Ypatia correctly. But I did notice that TextMorphs and StringMorphs handle it all just fine. So I wrote this piece of code that gets you the Form representation of capital letters in Ypatia...and unfortunately, also gives up the secret of how to do multiple sizes :-) Mark Guzdial

yts := (TextStyle named: 'Ypatia').
s := (StringMorph contents: 'G' font: (yts fontOfSize: 10)).
s imageForm display



If an argument for, say, MathFraction is neither string nor math object, should I return the error message?


We won't do that. Mark Guzdial

Questions raised at office hours



Try this:
((Character value: 97) asString asParagraph textStyle: (TextStyle named: 'Ypatia')) display

You need to be able to create the association: #alpha -> 97


(MathEquation from: (GreekSymbol named: #alpha sized: 12)) display


(MathEquation from: 'Mark') display
should respond essentially the same as
'Mark' asDisplayText display


You can, if you want, but that's not very flexible.

MathEquation from: (MathFraction from: 'sin(x)' over: 'x')
would want sin(x)/x at one size, while
MathEquation from: (MathSuperscript from: 'y' with: (MathFraction from: 'sin(x)' over: 'x'))
would want sin(x)/x at another size.


Whatever you want in order to create the displayable fraction at the right size when you need to. Because this is a Design class, I underspecify things. I'm only telling you the INTERFACE that you must respond to. How you actually implement is up to you. Mark Guzdial


Can someone explain the meaning on the updated version of P1 when it said "object that responds to display and displayOn:..."
Do we need to implement both of this methods or just either one?
thanks!

Both methods must be acceptable to what MathEquation returns. If you return a Form or DisplayObject, you're already done. If you return something else, you must implement those. Mark Guzdial



I have a question on the lines you put up:

yts := (TextStyle named: 'Ypatia').
s := (StringMorph contents: 'G' font: (yts fontOfSize: 10)).
s imageForm display

Is it possible to get a StringMorph onto a form? I'm a little confused about what a StringMorph is.
Thanks,
nobody

We'll talk a lot about StringMorphs and the rest in less than two weeks. Basically, a StringMorph is a graphical object that can hold a string in a Morphic world. It knows how to format strings, obviously, so we'll use that part of its capabilities. You can't embed StringMorphs in a Form, but you can embed them in an ImageMorph, which may be what you decide to do for your team UI. Mark Guzdial


with the fractions as super and sub scripts, should
we be prepareded to do the following:
   sin(x) 
   ------
   sin(x)
 a       b
          sin(x)
          ------
          sin(x)
----------------  
   sin(x) 
   ------
   sin(x)
 a       b
          sin(x)
          ------
          sin(x)
 

if so, how small can these fonts get? it seems that at some point(no pun intended) this would be unreadable.

thanks,
robert

Yes, that's the limit of what I want you to support. Yes, it could get unreadable. You need to make some design decisions about how to handle it. Maybe your base font goes to 18 point if you need to show so much, and the sub/superscripts go to 10 point. Maybe you draw the whole thing at 12, then use shrink/magnify of forms to alter the look. You decide how best to balance readability and the complication of programming Mark Guzdial



I'm having a problem where I am trying to add a constant (which I return from a method in a Utility class like the number 10) to the width of a DisplayText ( someForm := 'asdf' asDisplayText ). It keeps giving me a problem with the + sign in my equation so I'm thinking that I cannot add the two. What should I do so that I can add the number 30 and the width of someForm?
Collin Lobb

I can't figure out what you're talking about re: "a Utility class like the number 10" – 10 is an instance of SmallInteger, not a class. But to get the width of a Form, send it boundingBox width That returns a number that you can add 30 to. Mark Guzdial



When I execute these lines of code it just gives me a black box, why don't I see any text?
yts := (TextStyle named: 'Ypatia').
s := (StringMorph contents: 'G' font: (yts fontOfSize: 10)).
s imageForm display
Mike Maniscalco

Are you doing this from MVC or Morphic? The above only works in Morphic. Mark Guzdial

I take that back – I just tried it in MVC, and it worked great for me there, too. Did you change something in your image like the screen bit depth? Mark Guzdial
That was it, I had it set to 16... I wasted a lot of time on something that easy!!! Thanks for the help, I would have been sitting here forever trying to figure this out.
Mike


Is it problem for the numerator and denominator to be the same size?
Does the whole fraction need to shrink so that it is the same size
as the other number?

Thanks.

keisuke
It sounds okay to me for the numerator and denominator to be the same size. Mark Guzdial


Addressing some more in-office questions


Alot of people (it seems) are getting hung up over "what does each thing return?" and "does it all have to be Forms?" and "who calls what?" Let me try to address some of that, using an example:

MathEquation from: (MathSuperscript from: 'y' with: (MathFraction from: 'sin(x)' over: 'x'))

What should (MathFraction from: 'sin(x)' over: 'x') return? It could be a Form, yes, but considering we're going to make it a superscript in the next message, and thus we'll want it to be small, returning a Form sounds like a bad idea. Let's say that we return an instance of the class MathFraction, holding the numerator and denominator as instance variables.

But at what point do we convert it to a Form (or something else) and who should do it? We do it when we need to, and we ask the object itself to do it! Whose job should it to be to represent a fraction as a Form? Sounds like a job for the fraction object! Let's say that MathFraction understands the message asFormSize:, so that we could send our fraction this message and tell it that we want it at 10 point (asFormSize: 10) or maybe even just smaller/larger (asFormSize: #small), and we define a method that does the conversion at that point.

You may be wondering: "But who converts the strings? Does String understand asFormSize:?" No, it doesn't. But imagine that you define a MathString object, that holds the actual string passed in as an instance variable. And whenever you get a String to deal with, you create a MathString object that contains the String. This MathString object COULD understand asFormSize:. Now, you have a single message that can be sent to any MathObject and can get a Form for that object. That's called polymorphism, and it makes your job easier. (Are you seeing what I meant by "You'll need at least those classes, but you'll probably want to create more"?)

The idea of "who calls what" is the wrong one. Just because MathFraction has returned something doesn't mean that it's "done" being "called." Just the opposite! You now HAVE a MathFraction object that can be told to do whatever you need MathFractions to do!

Once you have the Form for any given piece of the equation, you've probably discovered that Forms understand the message boundingBox that tells you the size of the form (as a Rectangle), and that you can ask the boundingBox things like its top, its width, its height, etc. So, given the size of any Form, and given what you know about the desired equation (e.g., what's a superscript, what's a fraction), you should be able to figure out where things need to sit (at what point it needs to be displayed via displayOn:) in order to create the right equation.

That's a general overview of what you need to do. FOR THOSE OF YOU WHO ALREADY FIGURED OUT ALL OF THIS OR ARE DOING IT ANOTHER WAY, GO AHEAD AND DO IT YOUR WAY! I just want to give some general directions to those who are still pretty lost. – Mark Guzdial

P.S. Don't get hung up over the size: parameter on GreekSymbol. If you have to make the GreekSymbol larger or smaller because it's a sub/super-script, you do it! Mark Guzdial

P.S. Part 2: Read Chapter 4 if you're getting lost about message sending – it might help. Mark Guzdial

I remember you talked about the change of variable names in the method. I got my variables changed to 't1', 't2', and so on.
I think that the cause is to do something like creating
new set of change set.
Could you tell me again when it exactly happen?
Thank you.

keisuke,



Could someone give me a rundown on the visual expectations for Milestone1? Do we have to display paranthesis on long expressions? Do we have to use smaller font for subscripts and superscripts? etc...


I know we are going to have to use Ypatia font for GreekSymbols though, of course.


Personally I'd think that we should not have to do displaying paranthesis or smaller/larger fonts at this point because we can
change that later in our UI or when we do the text parsing.

Just my .02 ^.^


Thanks,

Collin Lobb


Hi,

This may seem like a dumb question, but are we allowd to add functions to the String class. In my situation it would help out alot but I don't know if I will get marked off for it.

I was also wondering if there are going to be more than one of any math object in the same MathEquation. For instance something like
(MathEquation from: (MathOperation operator: '+'with: (MathFraction from: 'a' over: 'b') and: (MathFraction from: 'x' over: 'y'))).


Also is it acceptable for us to return a FormCanvas instead of a Form, or if we have gone the FormCanvas route do we need to convert to a form in some way before returning the Form object?

Any other words of wisdom to help us complete our projects would be greatly appreciated also,

Thanks,
Derrick


Is there any way to have a form size itself automatically?
Eg, have it set its own extent based on a text string it must display?

Just wondering.
~Warren



How do you create an instance of MathFraction from a MathFraction class method?

In the "Addressing some more in-office questions" that Mark wrote, he says to have denominator and numerator as instance variables in MathFraction. If you run "MathEquation from: (MathSuperscript from: 'y' with: (MathFraction from: 'sin(x)' over: 'x'))", how do you store the two MathFraction from: over: parameters as instance variables if there is no instance of it created? At what point is the Mathfraction instance created? Even after the MathFraction class method creates an instance of MathFraction, how does the MathEquation know the name of the instance and interface with it? If someone could help me with this, I would really appreciate it.

~Adam

I dunno if I understand your question but maybe this can help you a little bit. Right before he says to create instance variables he says to return an instance of that class. So if you set the instance variables for that class and then return self you can access the instance variables or any methods in that class when they are needed. Hope this helps a little,Mike


Could someone please post the correspondance between the English letters and their greek symbol in the Ypatia font so that I don't have to figure them all out by hand? for example, alpha=a, beta=b, psi=c, etc... Thomas Annandale



Jonathan LaCour->Thomas Annandale
We all had to do it =) It doesn't really take that long. I just looked at the milestone's website, and looked at the graphic he posted of the letters a-z and A-Z in Ypatia. Then I just counted accross and matched to the PDF file. Easy. Takes about 10 minutes.


How're we supposed to turn in our milestone? fileOut all of our stuff and print it and bring it to class? -Thomas Annandale

What is the deal with turnin, according to the book we are supposed to turn in a hardcopy of p1 in class and another using summer 2000 turnin information but there is nothing there, so do we not turn anything electronically and just bring the hardcopy to class?
What is the deal with turnin, according to the book we are supposed to turn in a hardcopy of p1 in
class and another using summer 2000 turnin information but there is nothing there, so do we not turn
anything electronically and just bring the hardcopy to class? claudia Iriele


Hi,
I think I am misunderstanding something here with the GreekSymbol. Can't we just make so whatever you send it in a string like 'P' it will display that correspoonding charachter. Why is there a need to make a table of values like everyone else is talking about.
I guess my question is in:

GreekSymbol named: aValue sized: x

what is "aValue" I have it as text, and i gets displayed as the corresponding charachter(s), Am I wrong?

Thanks,
Derrick

The "user" won't be sending in something like 'P'. They will be sending #Pi. So, you have to see which character corresponds to the string 'Pi'. Bruce Labbate




Does anyone know how we check to see if an Object is a String or and Integer or a Form....? Thanks.

Mike Maniscalco

((anObject class) = String) Bruce Labbate



May we assume that the arguments to these Class messages will be either Strings or MathObjects?


Turn-in?

Are we going to get some kind of response on what to do for the turnin that's due in close to 12 hours? I'd like to have some things set so that I don't have to scramble when I wake up tomorrow morning. Thanks for any help or insight towards this.

I've posted the turnin info to the following page (I can't get access to the turnin page for some reason) and the newsgroup. Temp Turnin Page Eric Anderson


The files that Squeak produces for fileOuts don't print very well under windows. I can't figure out a way to print it that doesn't get rid of all the return characters, making the print out unintelligible. Wouldn't it be easier to just email P1.st to a TA, or use turnin under workon? Am I going to lose points for turning in my code with no line carriages? (ie, should I go through the fileOut and put a return in all the right places?) Any suggestions? -Thomas Annandale

Also, should we be keeping our journals already? What are we supposed to write in them? Haven't received any information yet about what's expected in that area.

Yes. You should be keeping your journal already. It should be a transcript of troubles, solutions, anything you find interesting or personally useful, etc... Bruce Labbate

yts := (TextStyle named: 'Ypatia').
s := (StringMorph contents: 'G' font: (yts fontOfSize: 10)).
s imageForm display

Concerning the above lines of code, since we cannot put a StringMorph
onto a form, could you give a hint on how to manipulate the point size
if we're placing the text in a form?
Thanks.
John Haynes
return (s imageForm), display it onto another form, ect. An image form is just a type of a form. Someone add more insight if they have any. - Mike

I can't sign on from my Mac, and my wife's NT box won't let me edit the page (SIGH!), so let me try this way.


Some turnin info has been posted to Temp Turnin Page. Still don't know who is grading what so until we post who your TA is just e-mail it to the cs2340@cc account. Please follow the instruction on this page. Eric Anderson



Ok, quick question. Is there any easy way to find the next lowest text size down for a certain font, given the current size?
For example, if you're using the default text style, size 12, and you want to find the next lowest size (let's assume it's ... 9), is there any easy way to find out that what you want is 9?



When we talk about turnin information. What does a "hardcopy" mean? I always thought that was a print out. If that is true. Shoule we just fileout our project, file open the .st and then highlight everything, copy it to a text editor and print it there? Is there a way to print with in Squeak?

I am thinking that is wrong because it says:
"- You must turn in a fileOut. A fileOut has CR line endings, which won't look right on all platforms."

So does that mean a hardcopy is on a disk?


You will turnin an electronic version via Temp Turnin Page, and a printout (as in paper) version via class. Simply fileout and then print it on paper. We want a paper version so that we can mark comments on it and give it back to you. Eric Anderson


I know this has been beaten to death, but here is my question. I create my cs2340 catergory and fill it up with all the classes that I needed to write...I file it out to cs2340.st. I now have this file on a UNIX box or NT or whatever...its all one line so how do I print it properly to bring a hard copy? Do I have to write a perl script to format the text or what? Also, when we run the turnin script, should we get email confirmation, ro do we just assume that the script was successful?
Thanks,

Seth Markle

Alright to print it out (PAPER VERSION ONLY) to look pretty go to the file list. Select the file. Bring up the context sensitive menu and choose the more option. At the bottom is a "generate HTML" option (or something like that). Choose it and you should get a HTML version of your fileout. Now you print this and it will look pretty. Please do not turn the HTML version in electronically. I want to be able to directly file what you give me in so do not turnin the HTML version electronically. Only turn the file that Squeak outputs electronically.
As to the confirmation, that is a good point. We choose to e-mail the TA since that is easy, but I realize that getting a confirmation is important. I will look into this. I plan to add to the script (have it tarball the file so line ending don't matter, and have it as an attachment instead of inline) so I'll look into maybe doing something that will send a confirmation. For now just assume that it goes through. You can open the Transcript to see some info, and you can edit the script to CC yourself to provide some feedback. I'll try to work something out so that you can get better feedback in the future though. Eric Anderson



Okay, I am finishing up but i just realized that, in the workspace, something like MathEquation from: 'Mike' does not work, I have to execute MathEquation new from: 'Mike' for it to work. Do not know what, when, where, or why this happened but does anyone know what is wrong? Thanks, Mike.
BTW, where'd the form for submitting questions go to?

It needs to follow the interface we specified. Think about the difference between Instances and Classes to figure out why your code is doing this. Eric Anderson
NO, ERIC! They do NOT have to create an instance of MathEquation for this to work! Mike, it's supposed to work WITHOUT the "new". Mark Guzdial


A lot of people seem to be wondering if their turnins are getting through ok.
I highly recommend (and this is really simple, but I figured I'd post it anyway) that before you mail it to your TA, put your own address in as the TAEmail and check out the mail that gets sent to you. Make sure it's what you want your TA to see.
This should cut down on the number of messed up submissions, and "Did you get my file?" requests for the TAs.


How do you know who your TA is?

To find out who your TA is, find your name on the list on the TA and Student Grading Page for Summer 2000. For your TA's e-mail address, you'll want to check the Summer 2000 TA Office Hours Schedule. -Bruce Labbate - Still not a TA
I am encountering to a surprise. After I sent the file to my TA, I checked the filed-out to see if it still works by filling it in.
The file was fine except that all comments I wrote for each functions
are gone. I believe that they existed before I sent the file.

Thank you.

keisuke

Comments are stored in the .changes file. If you hosed your .changes file, you've lost your comments. Mark Guzdial


I have an instance, we'll call it a.

i have 2 instance methods, "setO: blah" and "displayOn: at: size:"
I do:
a setO: blah.
a displayOn: blah at: blah size: blah.
The first line runs fine, and the inspector shows it to be set.
The second line gives an error: "messageNotUnderstood: displayOn:at:size:". It is saying that the message isn't understood by this instance. But, I swear, its there. Its not declared in the class, its declared in the instance.... Is there anything I could be missing? Jason Foster

Check a – put in a "self halt" or printString to the Transcript. You may have a different instance than you think. Mark Guzdial

When I generated an html version of my project, it looks really ugly. There are a lot of exclaimation marks; my assignments and returns have been reduced to underscores and carrots. Is there anything I can do to fix it, or is it supposed to look like this?

Exclamation marks are part of the fileOut format – don't get rid of them or your TA will not be able to read in your code! Mark Guzdial

FOR "HARDCOPY"
Mark Guzdial

I have what is probably a easy question for most. How or where can I log in to find out how to solve fractions?

Link to this Page