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 Sp2001 P4 Milestone

P4 Q&A?

There is a temptation to do all of the Web interface in terms of templates, like one might use PHP. Be wary of this tempation:

The way to do this instead of templates is with ServerActions, which are described in the book and will be in next week's lectures. You probably WILL use template code, too, but probably keeping it to a minimum. Mark Guzdial

The PWS objectsInField method calls "self objectFromString: s". I can't find any implementers of that. –PatrickParker
You're right! It's weird! But I just tested, and that doesn't seem to be a problem – examples all still work. Mark Guzdial

It would be nice to use Flash for this project, if only squeak supported sound file compression to .swa files. However, compression to .swa is a painfully slow process. –PatrickParker

Sorry – you'll have to face HTML :-) Mark Guzdial

This isn't really milestone 4 specific, but it is still bugging me.

I've found that when I open my morph if I add anything to it BEFORE I've opened it it will have a black title bar. It will be completely unlabeled, and the X box and Label will be unreadable because of the big black blur. I got around this by opening the window first, then adding the morphs to it.

Now I have a PlayListMorph that opens when they click the PlayList button. As soon as that Morph opens it messes up the title in my JukeBoxMorph. They are seperate windows, both of them are subclasses of the SystemWindow class.

Does anyone know how to remedy this problem?

SystemWindow's should not have morphs added with addMorph:. Instead, you should use addMorph:frame:. Also, you might consider just using a SystemWindow and embedding your morph in it – do you really want a new kind of SystemWindow? (Actually, you don't need to create any new GUI classes for any of the milestones posted so far, unless you simply want to make things look nicer than usual.) -Lex Spoon

I have been using addMorph:frame: However, I still get this problem. Does this really have to do with the fact that I made it a subclass of SystemWindow?
Probably. SystemWindows aren't really designed to add things to interactively – they're more like Java windows that you're expected to set up within a method. You might want to just subclass AlignmentMorph and stuff everything into that. Mark Guzdial

Question about playing multiple files in a browser:
The first method listed on the page seems to be very dependent on the speed of your connection. You can find out the length of your song but there is no reliable way to estimate the time it is going to take for the client to download it from the server.
I don't completely understand the 3rd method. Are you suggesting that we implement a Netscape/IE plugin in Squeak? Is that even possible? I thought the Netscape plugin API only supported C++
On the first question, you can just allow the system to have big delays during the downloading. On the second, there is already a Squeak plugin that will download and run Squeak code for you. But you'd have to write a lot of Squeak code. -Lex Spoon

Is the download delay an issue? Will a page reload while it's still loading the embedded object? Try it – it's a simple test, i.e., reload after 1 second, but have a largish image on the page. It may be that the reload timer doesn't start until after the page is completely loaded. (BTW, the page you're referring to is Implementing Jukeboxes in Browsers – you don't have to put in the URL.) The Squeak plugin works on most platforms and browsers. Mark Guzdial

One interesting solution to downloading delays lies in the specifications of the socket layer in Squeak. If you are so inclined and have a little extra time, you might want to go check out the socket classes. That should give you a bit of an idea as to why PWS is so regrettably slow, and what you could do to deal with that issue. Of course, you really want your server to work pretty much the same regardless of the connection speed you're using, so maybe one fun way to do that would be to determine your average transfer rate during the file transfers, and then adjust an internal timer to make it so that your files arrive pretty much in a close interval around your wait times. This could conceivably require quite a bit of extra work, but if you are unfamiliar with sockets programming in general, it would most certainly be a good self done introduction, even though it really is out of the scope of the project (as far as I can see, I didn't notice anything about creating personalized (per connection anyway) transfers as far as speed is concerned.) Just a thought. Shaggz =)

After further consideration, this is a ridiculous idea. 8) Shaggz

We've got a Java plugin that will stream audio up at:
The source is available from
The idea is that you (using squeak) serve up a page that looks like: (with html decorations, of course)

<applet code=StreamingPlayerApplet
classpath= width=320 =height=300>
<param name=FILE0 value="foo.mp3">
<param name=FILE1 value="bar.aiff">
<param name=FILE2 value="baz.wav">
<param name=FILE3 value="bak.mid">

and the applet will handle the streaming/playing. This requires you download the JMF stuff from . We've used it successfully with both netscape and IE in windows and linux. Give it a whirl and let us know if it works for you! –Bryan Kennedy (

On timing, a trick a lot of people are overlooking is that you can transmit an entire file but for the last byte; transmit the last byte when you are ready for the browser to start using the new file.... (this mainly applies to the multipart approach, but also might be helpful for the reloaders) -Lex Spoon

Can we use a pop-up windows that loads a M3U playlist file remotely to achieve the effects of playing multiple sound files? We believe this solution is clean, easy to implement, and has good cross-platform compatibilities due to the fact that most media players today support M3U playlist file format.

(Doesn't anybody sign their posts here?) Do Macs support M3U? You'd end up with a low-grade if I ended up checking it and couldn't run it... Mark Guzdial

The previous post regarding M3U was from one of my teammates.
Just a note, any other of the proposed methods imply some combination/s of Web browser, OS, and maybe some extra, like a JRE supporting JMF. M3U files are just plain text files that contain a path or URL to an MP3 file (or even other formats) on each line. The MIME type tipically used ( I don't know if it has an standard assigned, but it's the most common) is: audio/x-mpegurl. It worked perfect with Netscape under Linux, and Netscape and IE under Windows. I don't have a Mac to test, but I just checked and there are a few Jukeboxes or media players available to download. I guess most of them will support M3U playlists, since it's something very common, standard, and that has existed for years. I couldn't find a JMF version for MAC in Sun's website. Although maybe there is some other substitute... Ignacio Llamas
I forgot to add that, of course, playing M3U's, as with MP3's, requires an external media player. In Windows we tested Windows Media Player and Winamp. In Linux XMMS. There are probably other players that can work with this approach. Ignacio Llamas (

Link to this Page