Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.


This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Fall 2003 Take Home Exam 2 Questions

Questions on the Take Home Exam?

PLEASE REMEMBER THAT THIS IS A NON-COLLABORATIVE ACTIVITY!

Please do not post any of your code here. You may ask questions about past examples or homework (including HW4). You may ask clarification questions here.

Do not share or discuss your program with anyone except for Mark or the TAs!



Is it okay if we round the number of seconds?

No – show the decimal. Mark Guzdial


I'm having trouble understanding how to integrate the tables into the program. I'm referencing your example for homework 4, specifically in regards to how the "sample" part of it works, and I can't figure out how to break up the "sample" part so that it will work into the tables. I realize this is a very broad question, but any advice you could give me would be appriciated!
Student540
I recommend reading over the slides functions.ppt (and the corresponding chapter in the book) which I started Friday and will finish Monday. I'm talking exactly about how to integrate tags like that into samples pages. Mark Guzdial

even if there are a lot of decimals? some of them have like 10 decimals, I was thinking of rounding them to 2 decimals?

Does it really matter? It makes the program easier if you don't include it.

well actually rounding is pretty easy, round(number,number of decimals)
Leave the number of decimals alone, but there must be decimals. Mark Guzdial


Pro. Guzdial, how do you insert function into the html for example a print statement. So that you put it in (kinda like we do +file+ and it puts the results of the function in the html??

I think this is a legal question, sorry if it isn't
It's a legal question. If the result is numeric, the function str() will convert it into a string. Now you can add it into a string just like +file+. Mark Guzdial


How do you change the length of the sound in samples to seconds? Or can you just give me a hint of where to look to find this?

It's in the book, it's in the functions.ppt slides, and I just told the 1pm section on Friday in lecture. Considering that each lecture only had about 20 people in it, and there are over 300 registered for this class, my guess is that you weren't there. If folks are finding the take home exam hard, why not come to class and hear me explain how to make it easier? I am actually curious what drives so many people skipping class–is the class perceived as too easy, or the lectures too boring? Mark Guzdial

Actually I was at lecture on Friday, 1pm, but I didnt think we got that far in the lecture slides. I'm sorry for not hearing you say it, but actually I rarely miss your class.

I also rarely miss but sometimes it seems as if we stray away from the slides alot and go on to do more complicated examples that are hard to follow.

I think you just have a lot of older students in the class that have learned to "manage" the way the system works. I personally am taking 21 hours, and trying to rush from Tech Square to class and back when no busses run near the building is difficult enough - let alone when I have a test or project due later that afternoon. I think the class is fascinating - but it's my last semester and I'm just trying to make a bunch of pretty good grades and get out. It's not you or the class content. It's the way the system works. I personally think you do a great job - reading your personal pages and research reports have given me a lot of respect for you. There's just not enough time to pursue everything that we enjoy.

ok I got another question if it can be answered...you no where we first set what "samples" equal to. In hw4 we made it where it was printed out on the page, I don't need it on the page I just need to define it so I can use it below..
..by the way I rarely miss a class and I think you do a really good job of making what would usually be boring into something interesting

so let me see if i got this right...we will have around 4 functions/subfunctions in our program. the lecture really helped today and i think i have a much better understanding. the only part i am confused with now is how to create the table. i know where to insert the table but i'm not sure what to insert there. could anyone point me in the right direction as to how i go about finding that out?
Look at the HTML lecture, the content on <table> and </table>. It's also in the book chapters now online. Mark Guzdial

i created a folder with 3 sounds and 3 pictures in it to test my function. i have everything running correctly with the table, links, etc. when i open index.html it has taken all 3 sound files, but only 2 picture files and run the program. any ideas about what i am doing wrong?
That's debugging your program, which is not appropriate for me to answer here. Think about what could be going wrong, and read up on the debugging tips that I've given you in the past (there's a lecture on it and a chapter in the book on it.) Mark Guzdial

do all of our columns need to be the same width? if so, where can we find how to do that?
No, they don't. Mark Guzdial

Are we supposed to show the actual pictures in the table, or just have a link to that file?
Just a link to that file. Mark Guzdial

Hopefully, this is a legal question. I am having trouble integrating the table border ="number" into my code. I don't know exactly the placement of that. I have referenced the book, the lecture notes, and came to lecture, and I am struggling with that. Also, I am having a problem similar to the above one saying that basically I have 3 jpg files and they all show up in my table. The first one links perfectly to the picture, but the second and third ones send me to an internet page with the error beginning with The page cannot be displayed...any suggestions?
Again, this is debugging your code, which I can't help you with on a take-home exam. My suggestion is to read over the HTML you're generating and see if that makes sense. I'll repeat my suggestion that I made in lecture and in the chapter: WRITE THE HTML FIRST! Get the HTML file working all by itself, THEN write the program that generates that kind of HTML file. If you understand the tags, it goes much easier. Mark Guzdial

In reference to all the questions about tables and html, the Lab 5 assignment has a lot of info and links on writing html. Lauren Biddle

Lecture was great today. Thans so much for your help! I am SO close, but I only have a few problems to debug! Same as above with the picture problem. The last 2 of the three picture do not link to the original file, but to a page that says The page cannot be displayed.
Sorry – same answer as above. Mark Guzdial

The other problem is that I am creating 3 columns instead of 2. For the WAV files it displays the filename and link, a blank column, and then the length and for the pictures it displays the filename and link then the size in the second column and then another blank. I think that this might be because I did not make the seperate fileEntry function and am making the columns in two different places (both the wav and the jpg entry funtions). I did this because when I used the WAVEntry functions from clas today, the second line of the WAVEntry function gave me the error that samples could not be defined. I feel like I am so close but can't grasp these small concepts!
Sorry – see above answers. Mark Guzdial

I don't know if this helps anyone - but I've noticed that a bunch of my pictures, especially if I just create them in Paint, end up with .JPG (capitalized) which the program as written doesn't recognize.



Is it important to incorporate the doctype, title, and body functions into our function? Are we going to be counted off if we don't use them? Like say if we just completely leave out doctype and use other ways to do the title and body.
There are no requirements to use more than one function or to use any of the functions I provide. Mark Guzdial

I cannot for the life of me figure out how to incorporate the table stuff into my code. I have been coming to lecture, have looked at the slides, have looked at the book, and have looked at Lab 5. Nothing seems to be helping! I feel that many others are also very close, but cannot get a handle on the table thing. Is there any way that you could provide more detailed examples (i.e. where in the code this goes, how it's formatted properly, etc.)?
No. I recommend that you write some HTML files using Tables until they make sense to you. There are also LOTS of HTML tutorials on the Web that can help you learn about tags like tables. Mark Guzdial

I'm getting close, but I'm having trouble getting the information inside my table. I made the table and I have 'Filename:' in the first column, but not the actual filename. And I don't know how to get the size of the file in the seconde column. Any hints you could give?
Please see previous answers, the slides, and the book. Mark Guzdial

I have managed to get everything into a table just fine, but I can't figure out how to actually separate the information into two different columns. BTW, Prof. Guzdial, your lectures are very informative and not boring at all. The lecture you gave today was especially helpful for this.
Thanks. Please see previous answers. Mark Guzdial

Is it ok if the pics are in the first column and are the link instead of the actual file name? Do we have to have the filename also if we have the pic? The directions were just a bit unclear to me.
No pictures in the tables at all. Mark Guzdial

how do i define str(). i've been looking for it, b/c i was looking at the samples in the functions lecture, i just don't know where to find it. is it in the updates?
str() is a pre-defined function in Python. Mark Guzdial

Prof. Guzdial, can you please post what you have done in class with tables? And a simple example of program in JES would help. Thank you.
No, I'm sorry. You have to infer that part on your own. Mark Guzdial

Lab 5 has a bit about tables in it. It's worth taking a look at, because it walks you through how to build one. Student639
That's fair game, to use any content in the website. Mark Guzdial

Okay.. well my code works fine the images and sounds both are there and link to the appropriate picture/sound. Also, the details of both are also there and the heading is correct. I guess iam having the same problem as alot of other people.. I have looked at lab 5 and viewed the source of the takeExam page and understand the html that goes into making tables.. I just have no idea how to encorporate it into a Jes function... Are u going to give us any clues.. or is there hints in a powerpoint slide??
I suggest trying things out, debugging, and making the page separately from the function first, to figure out the tags. Mark Guzdial

everytime I run the program fileJPEGEntry (I copied it directly from the slide) I get syntax error at this line:
samples=img src="'

why is that so?
I'm sorry, but I can't answer questions about your program. (If it worked in class, but it isn't for you, then it's something that went wrong with your program and isn't a question about lecture anymore.) Mark Guzdial



do we need to add the list tags(<ul> and <li>) to put our pictures and sounds in a table? I am not sure if we should or should not to encorporate a table..
The take home exam does not require you to create lists, only a table. Mark Guzdial


How do we make tables line up, so that each row is equal length? Thank you.

You don't have to – don't worry about it. Mark Guzdial

What do you mean when you say "Clicking on "hello.wav" should go to that sound (as the destination of the link)" on the requirements. When I clickon a wav file, the page does not change but it simply plays the file. Is that all that needs to happen?

Yup, that's it. "Go to" a sound doesn't necessarily change what you see in the browser...on some browsers. On others, it does. The point is for the sound to be the target (href) of the anchor. Mark Guzdial

Along the same lines, when I click my "hello.wav" my window goes blank, and quicktime appears in the browser. When you press play on quicktime, "hello.wav" plays. Is that just a difference in browsers and therefore ok?
Right – that's how it works if you have QuickTime and not RealPlayer or WMA installed. There are lots of variations. Mark Guzdial

My tables are uneven and i know you said that was okay, but is there somewhere i can go to learn to make them even?
REMOVEDre! There are lots of websites on HTML for beginners. Go to http://www.google.com and do a search on "HTML tutorial." Mark Guzdial

When I click on my wave file in my table it doesn't just play the sound it cues me for a sound player or if I want to play it out of explorer, is that ok? Everything in my code look fine, and the table looks great, my sound just doesn't play right when I click on it. Does that me I don't have my sound card and stuff set up right? I'm confused. about that.
Sounds okay. Yes, it sounds like (no pun intended) you don't have your browser configured to handle WAV files. Not a problem. Student282


The requirements say nothing about this being right or wrong, but is it okay if the height/width and length parts are links also to the pictures and sounds?
No, just the files are the links. Mark Guzdial

My code works fine so far.. except i haven't quite figured out where to place the code for the table.. I was wondering could u tell me if it goes only in the main body function or the fileEntry function? or both like the list function? I added it to like 8 different spots last night and ended up more confused.. Thanks
I can't really say more than I am saying in lecture today. Sorry. Mark Guzdial

Does our table have to look exactly like the one you posted on the take home exam, or can it just be a variation as long as all the requirements are there? For example, mine says "Height: 143". Also, do we need to include column headings?
Variations are fine. For example, you don't have to have borders, but you do have to have a <table> tag. No, you don't have to include column headings, but it's not wrong if you do. Mark Guzdial


I have sat here for the last hour trying to just check the code on the lecture slides and even when i copy and past them they dont work, so what is the story?
You saw them work, so you know they do. My suggestion is, as always: Read the error message, put in print statements to figure out what's going on, then fix it. Mark Guzdial

What does it mean when a function is defined and the first line of the function is "print something" and it immediately gives a syntax error without printing anything?
It all depends on what the error is. If the error is name not found, that tells you a lot. Mark Guzdial

I am having the same kind of problem that a lot of people here are having... my program works fine, except for the fact that some of my jpegs link to the picture and some won't link at all (it goes to the "REMOVED Cannot be Displayed" page). I had a theory which I tested and it seems to work. If the jpeg file name has no spaces in it(e.g. mypicture.jpg) then it links correctly. If the jpeg file name has spaces in it (e.g. my picture.jpg), then it DOES NOT link correctly. I was wondering if this matters when we turn the program in??? Is there any way to fix this problem besides renaming all your files?
Hmm, interesting theory. Could be the case. The TA's will test with files with no spaces in it, in case your theory is true. Mark Guzdial
If you have something that your TA should know, please include it in your 'Notes to TA' section when turning in the assignment. That way, if something happens like what you describe above, you can either get partial or full credit on that section. Student56

Is there a certain number of wav and jpg files that we must have in our table? Can I just use of one each like the example on the instructions page? Also, I keep getting a syntax error like the other person said...even if I just define a function and then tell it to print something. I had this same problem on HW4, and Prof Guzdial said that it worked fine on his computer, but that I might just be calling something wrong on mine. However, I need to be able to test my program...can you explain how to call the function in HW4 so that it won't give me that syntax error?
Your program must work for ANY number of files. My suggestion for you is the same as the previous: READ the error. It does mean something. Mark Guzdial


how does one insert an integer into a string? For instance, if I had an integer x=9 and a string s="I have" and i wanted to do the following:

file.write(s+" "+x" cats")

to output to the file the string "i have 9 cats".
It seems that JES wont let me do this operation the way I have listed above. Thanks!
str(number) turns the number into a string. Mark Guzdial

alright, so almost everything works...when I go to my newly made website, and I click on a sound, it says that it cant find the file and to make sure that it is correct. I made sure it was and it still gave me the same answer. whats up with that?
See above answers. Figger it out. Mark Guzdial


when i run my program, all that happens is ....... and my folder doesn't have a link on it to a webpage. What is wrong? i'm pretty sure the code is right, and i don't get any errors.

You're not going to get a link to a Web page. You're going to get an HTML file created...if it's working. If you don't write out a file, you won't have one there. Mark Guzdial


does our code have to be able to take input from any directory the ta may create ?
yes, your directory is probably different from ours. Student56

or can i send them the pics and sounds i used with my turnin
just the file, no pics or sound. Student56

can you please explain what you mean by Level 1 (in regards to the heading) for the exam?
There are various sizes of headings in html that are created using different tags. A level 1 heading would be the largest. Check the "Simplest Webpage" example for more information. Lauren Biddle

I know my html code is correct, my problem is that I am having trouble generating the code in the if loop of my code.
if loop? do you mean for loop? Think about what the loop is actually used for and how you want to make the information the table data in each table row. Student56

I am having an odd problem: My program runs fine but when I execute it on files with two word filenames (ex: "Brad 1.jpg") it doesn't link correctly to the file...do I need to worry about this, and if so - where would I find information on it? My hypothesis is that like uploading pictures to coweb - files have to be a constant string of characters (ex: "Brad_1.jpg).
If you have a spacing issue, mention it in your 'Notes to TA' area when you turn it in. The TAs will most likely grade with files that do not contain spaces, but mention the conditions at which your program will and will not work. Student56


Someone else mentioned this, too. It may be an issue with your browser. No matter – we're willing to test ONLY with files that have no spaces in them, as Angela says. Mark Guzdial


I hate take home exam 2


function.ppt helped a lot. :)

MAJOR PROBLEM! No matter what function I use in JES the command area continually returns "Your code contains at least one syntax error, meaning it is not legal jython". I even tried just rerunning hw4 which ran perfectly last week, but I am still getting the same error. Anybody have any ideas on what the problem is?

I know it's not some stupid problem like forgetting to hit load because I have hit load about a gazillion times.



When you get that error, it means that you have non-matching quotes or parentheses. Mark Guzdial




Link to this Page