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

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Spring 2004 Take Home Exam 2 Questions Page

REMEMBER! This is a NON-COLLABORATIVE ACTIVITY!


You may not talk to anyone about their code, nor look at anyone else's code, nor allow anyone to see your code. This is a TAKE HOME EXAM. It is an "open book" exam. You may use your book, any slides, any material in the CoWeb, and any programs you've written (even with others).

On this page, you can ask clarifying questions and questions about topics in the course. YOU MAY NOT ASK ABOUT YOUR PROGRAM. DO NOT POST ANY PROGRAM CODE ON THIS PAGE!

NOTE!

This is the assignment that has been the source for almost all of the academic misconduct cases in this class. PLEASE DO NOT COLLABORATE ON THIS ASSIGNMENT! We really don't want to prosecute anyone for unauthorized collaboration, but we do find it and we are honor-bound to report it.

Questions on what assignment means or on topics in the course



The assignment shouldn't have anything done to wav files, right? In the example shown, there are wav files in he directory...

when can we expect our test grades from today to be posted? thanks...

No, don't do anything with WAV files at all. Midterm #2 will be graded April 1 (so that there's time for those taking make-ups to take it, like those at the NCAA tournament.) Mark Guzdial

Ha ha ha ha ha...

So, the links on the separations.html page should take you to the red, blue or green picture; not just the original, right?

Yes. Each of the four links (original, red, green, and blue) should take you to a different picture. You can read the example HTML to see how that's supposed to work. Mark Guzdial

We only turn in the JES file? Dont need to attach the html file we created?
We should be able to run the JES file to generate the HTML file for ourselves, so no, you don't need to turn in the HTML file. Mark Guzdial

So each of the links should lead to an original sized pictured of whatever color chosen? For example, a red picture should be linked to a an original sized red version of the picture?...Also, does it matter if my pictures go down the page instead of across? Lauren Patton
Yes, Lauren, that's how the links should work – all links are to original-sized images. The pictures should go across, not down the page. Mark Guzdial



Should our progarm work quickly? If we use some of parts from HW4 when we making canvas, we can make our progarm faster. However, it would not be applied for smaller pictures than the 100-high pictures.
Is that the matter? You-il Park

You-il, read the assignment again. We state REALLY CLEARLY that you are NOT shrinking any pictures here! You should not be scaling any pictures. Mark Guzdial

Is it necessary to have the spaces between the pictures? Or can they be side-by-side and only separated by the border showing that it is a link... I know that that is really minor when looking at the big picture, but I figured that I would ask.
I don't really care about the spacing, but it is really easy to insert a single space between them. Mark Guzdial

For this line of my function- for file in os.listdir(directory):
I got this error - An error occurred while making an operating system call. Please tell a TA what you were doing when this happened, so we may correct it. What do I do?
The error message is at fault (we need to fix it) – your directory is badly formed. Mark Guzdial

FYI: I won't be around this weekend (driving my family down to Florida for their Spring Break). The other instructors and TA's will be answering questions here this weekend. Mark Guzdial

One last thing, I have random numbers appearing beside my pictures. I don't know where they are coming from nor what their purpose is. Lauren Patton
That's a specific question about your program that I can't answer, Lauren, but if you look on the HW4 page, you may find the solution. Mark Guzdial

lol

Thanks Mark Lauren Patton

are we allowed to have more than one def?
Yes. Mark Guzdial

So this:
Each of these links should be a small version of the file, only 100 pixels high. You are not GENERATING thumbnail files here! You will get smaller versions of the pictures through use of HTML, not by creating SMALLER (scaled) JPEG images. You will simply specify height=100 on the image tags.
means that we're making the height all equal to 100 and changing the colors of the pictures and that's it, right?
This means that you are NOT RESIZING the images like you did in homework 4. What you are doing instead is using html to resize the pictures for you. Visit this site and pay attention to the area where it talks about optional tags. Larry Olson

And we're only doing height in the html, correct? (as far as size goes)
Yes. Mark Guzdial

For the question about using more than one def, it would be probably be helpful to refer to Homework 4 and how you did that assignment. Stephanie Weitzel
Yes, I agree, more than one def would likely be useful and you can refer to HW 4 for options on doing that Larry Olson

I have what I hope is a general question...if html changes the size of a picture (i.e. sets the width to 575), does it change the other dimension proportionally? (i.e., increases the width so that the picture remains the same with the new width of 575). Thanks. Karin Bowman
Yes, but you could always try it to see. (It was in the HTML slides.) Mark Guzdial

so we're making pictures, then linking them to red only, green only, and blue only pictures...so our first pictures should each have 3 new pictures in their link?
I don't understand the question, but I suspect that reading the assignment will answer it. Mark Guzdial

Is this supposed to be easier than hw4? Because it seems like there's more to do...make one picture red, then one green, then one blue, and all 100 pixels high then copy them onto a new canvas and make all four pictures go into a directory?? Am I making this way more complicated than it is? Or is it like a culmination of everything?
You are NOT making pictures 100 pixels high! You are NOT copying anything into any canvas! Mark Guzdial

how do we test this code? Melissa Boswell
I can't answer that, Melissa. Re-read the assignment. Mark Guzdial

i was wondering if i can find similar examples of the required tasks in the book? i know that yall have said look at hw4, but where else can i get some leads? book? slides? thanks...
Chapter 3 explains how to set pixel values and how to save pictures.Chapter 9 is on HTML. Mark Guzdial

what time can we expect our test grades to be up on thursday?
When we're done–it's always hard to predict how long it will take. Mark Guzdial

Here's what I'm confused about: do we need to use these specific pictures, or can it be whatever? So, can we just pick four of our pictures and put them in a file to test them out? Thanks!poof #2
The program should work for ANY directory with ANY number of JPEG pictures in it. Mark Guzdial

IS this suppose to take forever to run. i keep stopping it because i figure soething must be wrong. i mean...i have been waiting for, like, 5 minutes and it is still running.
Amelia Cipolla
You can always use printNow (p. 269) to get it to tell you where you're at in the program. Mark Guzdial

OK...so there is a problem I think. the program ran the entire time i was in the shower and getting ready. what is the deal? I dont know what the problem is because i am not getting an error. i dont see any problems. i am NOT using while loops, so i dont see how it could just be running for eternity. HELP!
Amelia Cipolla
We can't help you with your program, Amelia. I will say that, if you don't have any loops, your program can't be right. I will also suggest that you test your program with only a few small pictures in your directory. Mark Guzdial





How long is the program supossed to take?
Mine takes about 5minutes for three pictures.
Am I wrong??
You-il Park


Running time is dependent on the size of the pictures you have as input to the function and on how you coded the answer Larry Olson


Ok i am not sure if this is a valid question but everytime i try to execute my program I put in the specific directory but after execution it gives me an error for a different directory. I had this same problem with hw4 that it only worked for one specific directory that I did not specify
Paula Verden
I don't know, Paula. That's a question about your program, and I can't address it. Mark Guzdial

I'm confused about what's supposed to link to what, and I've read the directions many a times. Any help?
A good way to figure it out might be to read the HTML file at the bottom. You know what Anchor and Image tags do. You should be able to figure out from there what links to what. Mark Guzdial

Does it matter if our html code comes out to be unorginized and to be one long line of code? The page still comes out to be how the example is its just the code will be hard to read through if you view the source.
Nope – we don't care about reading the HTML file. Mark Guzdial

I'm receiving the "Your code contains at least one syntax error, meaning it is not legal jython." error. I have my mode set to expert already. Is there any way I can receive more direction on where my problem is? Stephanie Henderson
No, you'll just have to read your code carefully and consider the debuggig suggestions we've made in class and in the text. Mark Guzdial

You said something ealier about chapter 3, and how it tells you to save pictures...are we supposed to save the pictures (writePictureTo()) to the directory once their color has been changed? Susan Kommeth
I think that writePictureTo is the only way that you have to create pictures. Mark Guzdial

If I click on small red picture, then should the linked picture be the original size of a red picture or the original picture?
You-il Park

Same size as the original picture. Mark Guzdial

When I open the separations.html page is it the smaller picture that should be on that page - and the smaller picture (height =100) links to the original size picture? Thanks Andrea Dunlop
You should not be creating any smaller pictures. At all. The links all go to original size pictures. Mark Guzdial

Actually, I see my question was asked above and has been answered, Thanks. Andrea Dunlop

Can anyone point me in the right direction for instructions on making the images go across instead of down the page? I've read chapter 10 & searched the website for "align" and "across," but I'm still having difficulties...thanks!! Karin Bowman
Karin, read the HTML page at the bottom of the page again to see how we generated the HTML. Mark Guzdial

aha!! I figured it out ; ) disregard that question. Karin Bowman

For those trying to test their program, my TA gave me good advice that I pass on. Make a directory with two small pictures, Barbara and the flower. Insert one other file that is not a jpeg file. Use this to test your program. It should not take more than a minute to run.

i don't know how to position the makeRed/green/blue() functions . . . any helpful HINTS? THANK YOU!
You might look at the collage example in the book to see how subfunctions are positioned. Mark Guzdial


everytime i try to put it somewhere it tells me that my input is not a picture...which is why i'm having problems...the example in the book (on collages) doesn't use html...so it isn't really helping.

If your input is not a picture, that has NOTHING to do with HTML. Mark Guzdial

President Clough has asked all faculty to consider the NCAA Tournament in scheduling examinations. Based on his request, Take Home Exam #2 is now due Wednesday April 7 at noon. Mark Guzdial

Do you want our program to have the same title at the top of the web page as the example "C:\Documents and Settings\Mark Guzdial\My Documents\mediasources\pics", or do you want the title to be able to be changed to whatever file the pictures are taken from?
I'm not really concerned about the title, but it should not reference a directory on my disk. Mark Guzdial

I'm really not understanding how we are to make the red, green, and blue function...I tried looking at the collage example but it's not getting me anywhere...any help on how to get started with this part will be greatly appreciated...
I can talk about things in the book. Consider page 61, the function for clearing blue from a picture.
def clearBlue(picture):
  for p in getPixels(picture):
    setBlue(p,0)

Based on that, I think it's pretty easy to see how (for example) to clear both the blue and the green, in order to get the all red version of the picture. Given what you did in HW4, I think you can figure out how to (a) make a picture that's in a directory, (b) clear the blue and green, (c) save out the new picture as "red_" + the filename. Mark Guzdial

If you are worried about trying to position the 100 height image on the webpage, don't. It is not like a canvas file where you have to specify a target location. Mine lined up automatically.


A linked picture should be the original size of a Red, blue and green picture. Am I right???
Chris Park

thanks for the extension, this is great!!!

So since we are not copying pictures onto a canvas, any hints on how to simply create a copy of the picture???

Read one inch higher in the page. Mark Guzdial

What's the simplest way to find a syntax error? What are the most common ones?
To figure out where syntax errors are coming from, a great thing to do is print out your code, and look for parentheses and quotes. I bet that you have a problem with the same number of opening and closing parentheses and/or the same number of quotes. It gets confusing, especially with the quotes, so go back and check those. You're getting this error when you try to load the program, right? (just want to make sure we're talking about the same thing). Ashley Coker


Do we need to 'makePicture three different times?
Depends on how you set up your program. Ashley Coker

are we supposed to have three different pictures doing all the colors?
Not sure i understand what you're asking. Ashley Coker

Do the pictures have to be red, green, then blue, or can they be in any order?
I think any order is fine. Ashley Coker

so if we do makeEmptyPicture... thats wrong? Sabrina Hassanali
Sorry, can't answer, Sabrina. Mark Guzdial

In my line that includes makePicture(), i get this error. What does it mean??

makePicture(filename): There is no file at .\640x480.jpg
An error occurred attempting to pass an argument to a function.
Please check line 10 of C:\Documents and Settings\Annie Sistrunk\My Documents\exam2.py
catherine ann sistrunk
I can't answer questions about your program, Catherine. Sorry! Mark Guzdial

Can I show you the whole line? catherine ann sistrunk
No, please don't post any of your program code. Mark Guzdial

The page that i have made is the same as the example, but when i view the source, it isn't as pretty as the example html source. Does this matter? Are we graded on style?
No, no style points. Interesting idea, though! :-) Mark Guzdial

I would like to be sure of one thing – the assignment tells us that the file separations.html, we are to write out HTML so that, for each JPG file, the links are 100 pixels high. This clearly means that we cannot manipulate our JES code to include the height tags. Correct? Anyone?
Rizwan Ladha
Rizwan, I'm not sure what you're asking, but I will assure you that your code MUST generate the height tags. They won't appear in the file unless your program creates them. Mark Guzdial

Should our links to the original size pictures be through the 100 pixel height picture or be a text link using the filename? Or does it not matter? Jennifer Garrett

Well, next to the pictures, can we have a caption of whatever we want, or does it need to be a link that's the filename? (Cause I went back and it said to have a link that's the smaller height picture; so I am just wondering if we can have a simple caption like "Red Picture" that's not a link or if we have to have like "red_filename.jpg" that's also a link..?) Jennifer Garrett
The 100 height images link to the full-size images. See the HTML example. Mark Guzdial

my function wasn't showing the pictures, only the test and so i tried different solutions. I found out that the problem that it only works if there is one picture. If there is more than one it won't show anything. I don't know how detailed of a solution you can give since its an exam, but I am very confused why this is happening. and if it can't be fixed, would it be possible to just write a note to the grader that it needs to input a directory with only one picture

nevermind it is working for some really odd reason now, and i didn't change anything. this is why i will never understand this stuff
You're about to submit a functioning Take Home Exam 2 and you "will never understand this stuff"? Could you have written this program before you started on this class? I think you underestimate your (considerable!) talents at learning new things! Mark Guzdial


Everything on my program is perfect! Well... almost. After it prints out the four different pictures, it's prints "/n" after them. I checked all my parenthesis and they match up. What's going on?? Also, do we NEED to have something that says, "Filename:..."? Thanks.

If you didn't have "Filename:" and the actual filename, you probably wouldn't lose points, but how hard is it to add it and get it right? I can't help you with your program, I'm sorry, but I can observe that "/n" is amazingly similar to "\n" which Python uses to stand for "New line." Really quite similar. Mark Guzdial


I am getting an error on the second line of my function where I open a file in the directory called separations.html. The error comes when I execute the function, not when I load it. It is exactly the same as my HW 4, the book examples and the slides. I don't know what is wrong.

We can't answer questions about your program. Sorry. Mark Guzdial

what do we do if we forgot to put the statement "I did not provide nor receive any aid on this exam." in the notes to ta box?
Write in on a piece of paper, sign it, and give it to your TA or your instructor. Mark Guzdial

When I click on the link on my separations page, it takes me to the normal size image of the picture in the ORIGINAL colors? Is this correct, or is it supposed to take me to the normal size image in the Blue, Green, or Red
First link goes to normal, and the other three go to Blue, Green, and Red. Mark Guzdial

IN HOMEORK 4, WHEN I TRIED TO RUN IT, NOTHING HAPPENED. IT DID NOT CREATE A WEB PAGE OR ANYTHING IN THE SPECIFIED DIRECTORY WHEN I RAN IT. HOW DO I RECTIFY THIS PROBLEM, SO IT WON'T HAPPEN AGAIN? (SAY IN A CERTAIN EXAM?) Dawayland Cobb
Are you sure it ran? You might want to use printNow() to make sure. Mark Guzdial

In Homework 4 when trying to write the thumbnail images, it seems like most people wrote

Thumbnail(directory, file)

  1. before writing

def Thumbnail(directory, file):

won't this result in an error saying
A local or global name could not be found. You need to define the function or variable before you try to use it in any way.
How would one rectify this problem?
You can access functions before they're defined, if they're all in the same file. It works fine – look at the collage example in the book. Mark Guzdial





Link to this Page