![]() ![]() |
| |||||||||
| Hotspots: Slides and Code TA Corner Comments? Announcements FAQ Static Webspace | ||||||||||
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| REMINDER: 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) that you already have direct access to. |
| Check JES Help or the book. Mark Guzdial |
| You must use <ul> Mark Guzdial |
| Yes, you must have it. Mark Guzdial |
| Try increasing the indentation. Instead of using 2 spaces per indentation level, try 3 or 4. I find that helps me to find indentation errors easier, and in moving to the new level, I usually fix the problem. Mark Guzdial |
| Try some <ul> examples in plain HTML files to make sure you understand it before trying to write your program. Try using it in JES to make sure that you understand it. Mark Guzdial |
| Yes, use those functions. You will already have to use IF to figure out if the file is a sound or a picture, so just use makePicture or makeSound once you know if it's a sound or a picture. Mark Guzdial |
| I just tried to do it, and it worked fine for me. Use lots of print statements to figure out what you're sending where. Mark Guzdial |
| Nah – just put it out however it comes out. Mark Guzdial |
| It sounds like you have the equation wrong, since all of our sounds are less than 10 seconds long. Mark Guzdial |
| Are you including list items in the list, by using <li>? Mark Guzdial |
| Use the function str(). Str() takes a number and returns a string. We've used it in lots of the examples the last few weeks. Mark Guzdial |
| There is no file on your disk named "barbara.jpg". There may be a file on your disk named "C:\Documents and Settings\Jessica Dickerson\My Documents\mediasources\barbara.jpg" Mark Guzdial |
| It means that you are calling a function with an input that that function can't make sense of. It can happen if you call a function with no inputs that expects one, or if you call a function for sound with a picture input. Mark Guzdial |
| Jessica, you may not think it's the case, but it must be. If it works in the command area, it can work in the program area. Programming is a humbling activity – you have to accept that there's a mistake someplace, and just work at it to figure it out. Mark Guzdial |
| How about every one of the movie examples? Check how the file name is made for the frames. Mark Guzdial |
| A function that returns the string representation of a number. Mark Guzdial |
| Recheck the sound lecture. The number of samples is not the same as the length in seconds. Mark Guzdial |
| Think it through slowly. Make the program work with just PART of what you need. Then add another part and make it work there. Then add more and make it work there, until you're done. (Read over the Design Lecture on bottom-up design.) Mark Guzdial |
| Absolutely not. Mark Guzdial |
| "Each one is indented more than the rest"? How can every one be indendent more than every other one? Mark Guzdial |
| Yes. Use the str() function to turn the numbers into strings. Add them into your HTML strings using "+" (Remember "Hello,"+"Mark"?). Write the result to an HTML file. Actually come to lecture so that you can ask questions there, see the examples, and hear my explanations of things, rather than just read them off the slides. Mark Guzdial |
| You have <ul> INSIDE the loop, so that you create a new ordered list each time, instead of just having a line item. Mark Guzdial |
| Did you use setMediaFolder, Sarah? Did you use getMediaPath, then, to get the correct path to 640x480.jpg? Mark Guzdial |
| Again, start out slow. Make the basic program work. Then add one additional feature. Make that work. Then add one additional feature. Make that work. Grow your program, don't expect it to work all at once. It doesn't work all at once for me, and I've been doing this for awhile! Mark Guzdial |
| Don't use "\". Use "//" as discussed in class. (We talked about you and your Midterm Review problem in class yesterday, Lauren. Shoulda been there – it was good stuff!) Mark Guzdial |
| It's very explicitly in the lecture slides. Mark Guzdial |
| Do the setMediaFolder() in the command area BEFORE executing your function. The TA's will know to do that. Use getMediaPath() to create a complete path to your files. But see my comment at the bottom of this page – I'm not sure why anyone is using getMediaPath() in this problem. You ONLY need to grab files out of the input directory, not out of the media folder. Mark Guzdial |
| Take a look at all the movie code examples. They use directory+"//"+filename over and over again. If you can get that code to work (and maybe use print statements to see what file is being opened), then maybe it'll help you figure out your code. Mark Guzdial |
| Either you're not printing the EXACT same thing that you're trying to open, or the file isn't really there. Don't make the mistake that Luke asked about in class last week. If "C:\MyDirectory\myfile.jpg" exists, getMediaPath("C:\MyDirectory\myfile.jpg") will most certainly NOT work. getMediaPath() will add a whole "C:\directorystuff" before the filename given as input. If you're using a complete directory path, do not ALSO use getMediaPath(). Mark Guzdial |
| Don't use getMediaPath. I can't think of a reason you'd want to use it here. You're not trying to get content out of a centralized media directory. You want to get files out of whatever directory was input. Mark Guzdial |
| Did you use r before the string? Did you print them before you used them to make sure what they are? Mark Guzdial |
| Put the "<ul>" before the loop, the "<li>" at each element in the loop, put "</ul>" after the loop. Mark Guzdial |
| There should not be any images at all. If you're using <image> tags, you're doing it wrong. Mark Guzdial |
| No, that would be wrong. That would be creating multiple unordered lists instead of just one. Mark Guzdial |
| Try showing the picture, Summer, and make sure that the makePicture worked. getHeight should then work. Mark Guzdial |
| You know how to get the length in samples, and you know how to get the number of samples per second (getSamplingRate). From there, you should be able to figure out the number of seconds – it's algebra. Mark Guzdial |
| It's not really – but it probably is if you're only trying to get your homework working. Make two of the HTML programs work on your computer, then make one of the Movie programs work on your computer. If you can get those to work, AND UNDERSTAND THEM, you should be able to figure out the exam. Mark Guzdial |
| Not at all! In fact, we should consider making that worth extra credit – it demonstrates debugging skills and that you really worked to understand the program! Mark Guzdial |
| getLength returns the length in samples. getSamplingRate returns the number of samples per second. x samples and y samples/second. You want z seconds. This is algebra. Mark Guzdial |
| Yes, it does mean that you did it wrong. Look at the answers above for the same question. Mark Guzdial |
| Summer, did you mean makePicture(directory"+//+"file)) or did you mean makePicture(directory+"//"+file))? Mark Guzdial |
| Like I said above, I don't why you would. Mark Guzdial |
| Did you try the suggestions earlier? Putting in print statements into your code to see what's being opened? Using str()? Make it work WITHOUT getLength etc., then add ONLY ONE of them, get that working, then add in the rest? Mark Guzdial |
| Yes, it must be in seconds. (Well, it can be in samples, but then you'll lose points. Mark Guzdial |
| Summer rules! Mark Guzdial |
| It depends. Is it just a really long decimal, but looks like it's about right lengthwise? Sure. If it's a number greater than 10,000? No. Mark Guzdial |
| Nope, sorry – that's a "lecture-only feature." Mark Guzdial |
| If you receive any help on this other than from me on this page, you may not submit your exam. There has been plenty of help on this page and in lecture. Work through these answers and see if you can figure it out. Mark Guzdial |
| Check your HTML file. Is the href right? If so, your browser just isn't configured properly to play the sound. Mark Guzdial |
| They're called "bullets" Mark Guzdial |
| As mentioned in class, check the Sandbox page to see how it's supposed to look. Mark Guzdial |
| Rolo, think str(). Mark Guzdial |
| You're using dot notation, or you're passing the wrong kind of object as input, or you've messed up where your parentheses are and Python is trying to interpret the HTML as Python. Mark Guzdial |
| If you're getting an error, then your directory or file variables aren't set correctly. Mark Guzdial |
| Try it in the Sandbox. Mark Guzdial |
| Think about it slowly, putting in print statements to see what's going on. Obviously, since you saw me do it, it's possible to do. You need to just slow down and think it through. Mark Guzdial |
| Your steps are in your program. You're turning that in. Why do you need to show it in HTML? Mark Guzdial |
| You really should be able to do that. Why don't you try different formulas? Make a sound, play it so that you know roughly how long it is, then get the length and the sampling rate, and try different equations of the two until you get a number that makes sense to you? Mark Guzdial |
| <p> and <br> tags are the ones that force different lines in HTML. Remove the extra ones. Mark Guzdial |
| I'm sorry – I can't tell. Check your code and compare it to what you generated. Mark Guzdial |
| Luke, even in a class of 120, you stand out! :-) Let's not call it a mistake you made – let's call it an interesting question you raised. Mark Guzdial |
| Dave, I've answered this many times now. str(). Mark Guzdial |
| See the same answer as Dave's. Mark Guzdial |
| Take them out of the quotes. Mark Guzdial |
| You're trying to make a picture out of something that isn't a valid JPEG picture. Mark Guzdial |
| Capitalized should work. Mark Guzdial |
| Did you move to a new computer? That sounds like an old version of Java. Mark Guzdial |
| Unzip it via Winzip at http://www.winzip.com – your homework will be inside the zip. Mark Guzdial |
| Show the actual image and play the sound (if configured correctly). The title doesn't matter. Mark Guzdial |
| No, they cannot. Mark Guzdial |
| Could be just how your browser shows unordered lists, or you've nested your lists (i.e., you have two <ul>'s). Mark Guzdial |
| Not all .jpg are created equal. Try opening it in your browser and see if it works there. Can you open ANY JPEG's? Have you moved computers? Do you need to re-install Java? Mark Guzdial |
| I'm not worried about it. Mark Guzdial |
| Your quotes are wrong. Check them. You have that code inside quotes inside of outside them. Mark Guzdial |
| Like Brittany said. Mark Guzdial |
| HTML doesn't understand any functions. Only Python does. You want Python to do the processing, not treat it like a string (just a bunch of characters). If you want the result of the functions, it has to be OUTSIDE of quotes. If you want the function to appear as text, put it INSIDE of quotes. Mark Guzdial |
| It does indent some – depending on your browser. If each list item indents MORE than the one before, you've nested your <ul> and put it in the wrong place. Mark Guzdial |
| This is answered earlier. You have no file named 640x480.jpg on your disk. You have a file named C:\Documents and Settings\your name\My Documents\mediasources\640x480.jpg on your disk. You need a complete path. You can get that from your Directory. Mark Guzdial |
| . | Re: Soapbox posting. I check the CoWeb quite frequently. If you need your questions answered next time, start earlier!. Mark Guzdial | . |