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 PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Spring 2007 Homework 1 Questions

Questions?

I have added an append box at the bottom of the page. Colin Potts. This means you don't need to edit the page to add to it. Just type your text into the box.


I am trying to do my homework as well, and I keep having the JES crashing-problem. As soon as I attempt to load a picture, it just goes away. I don't know what to do, and am starting to get a little worried.

Emily Sanford
Emily, do you have a smaller picture to work with? This problem is not new with JES 3.0, but I think that people are using higher resolution images than last year as digital cameras get better. Try a low resolution image, such as one that you can grab from a web page. I'm sorry if you can't work with one of your own pictures and upload it to the gallery, but it's important to get your program working. The TAs will test it with an image that works. Colin Potts

1/22/07 10:40 –

I have finished my homework, and last night, I successfully posterized and wrote my picture to a path. Today, I go to show my friend what the program does, and JES 3.0 crashes. And by crashes, I mean goes back to the desktop, no error message...nothing. I have made no changes to the system and installed/uninstalled no new files. I haven't messed with the registry or even accessed a webpage since then.

Is bugginess a new property of JES 3.0? Ceteris paribus, it's not supposed to crash. I have sufficient free hard drive space (1 gig) and RAM (2.0 gig) to not crash the program posterizing a 1024x768 picture. It ran quickly and smoothly last night. What's going on? I have ran it in "Watcher" mode, but since it crashes (and ran correctly before), I can't figure it out. For academic honesty purposes, I won't post my code here, but I can send it to someone and have them check it out. Thank you in advance.

Yours truly,
Blake Nixon
Oh dear. We did expect a few minor problems, but not this. Generally, if JES crashes without warning, it has run out of memory – e.g. by trying to manipulate an image that is too large. Had you run the program using the same image as input the day before? Even though it should not choke on a picture this size, it would be good to know if anything at all was different this morning from yesterday. Presumably you restarted JES and the same thing happened again? We'll see what we can work out. Colin Potts

**Following up**:

Okay, well, I ran it again, with no changes, and it !worked!. I ran it again, it worked. Ran it with a different file, it worked. Is there a cache or a log that JES creates that clears itself out now and then? Or is Windows XP more of an unpredictable memory hog than I had previously feared? :P Anyways, this is better than the 12-13 crashes in a row that I got this morning, with multiple restarts in between.
I did ask Mark Guzdial about this. Apparently, the crashing is a known bug in Jython, not JES, and is not new to JES 3.0. Jython crashes without warning when it runs out of memory. Since JES is a Jython program, it crashes too. There is nothing that we can do about that. (There is a new version of Jython that does not have this bug, but that is in Alpha release, and is dangerously flakey for a 400-person class.) I suspect that the problem is being reported more frequently this semester than previously, because people are gradually using bigger, higer res pictures than before, and JES 3.0 may require more resident memory than version 2. You may not need to be processing a big picture at the time that Jython crashes. If there is a memory leak in Jython or the JVM, any use of memory over the past day or so may build up and not be reallocated, causing these unpredictable crashes. This is unfortunate, but we are going to have to live with this for now. As a last resort, rebooting your machine restarts the Java Virtual Machine. That really shouldn't have to be necessary, and it seems from your posting that you didn't do that overnight. You may be right about there being a cache (in the JVM probably) that got cleared out, but I don't know. Colin Potts
Yet another update: There is a quick fix for this. We think it should only be happening on Windows machines, not Linux or Macintoshes. For Windows, you can download a new jes.bat file and put it in your JES directory. (See downloads page.) The upgrade gives JES lots of extra memory. It might still crash with VERY large pictures, but not like it has been the past few days. Colin Potts

Ok, anyone having a problem with the writePictureTo() function (i.e., "The error java.io.IOException has occured"), watch out for these things:
1) Make sure JES doesn't basically reject the MyPictures folder, if so, save to desktop and it should work
2) You must start with a .jpg file otherwise it won't work (.npg turns purplish, etc.).
If it is another file type, you need to open and save the file in another file type before you can use and save it in JES.
If you haven't looked for either of these things, these might be possibly why. Also, try scaling your pics first to test.

(Moved from Bubble) Can you either post to the web or show in class a before and after example of a posterized picture? I would like to be able to see if what my program does is what it is actually supposed to do. Thanks!
Before:
Uploaded Image: beach-smaller.jpg
After:
Uploaded Image: posterizedBeach2.jpg
Colin Potts



I don't understand the error message in JES that says, "Your code contains at least one syntax error, meaning it is not legal jython." The line it references states, "setGreen(p, red value)". I was doing the part that said if the green value is less than 100, swap the green and red values and make the new green value the same as the old red value.
Is red value a variable you're using in your code? One hint, all variables used should be one word. Amanda Bennett

I was just getting started on the HW assignment, so I download jes.bat from the site. However, when I click on it, it shows up for a split second and disappears. Am I missing something? I haven't tried to load anything on it or anything like that, it just won't stay open. any help?
Try right clicking and going to "save as..." Chris Higgins
I assume that you saved the batch file in the same directory as JES (in other words that you overwrote the old one.) In that case, to run JES, don't double click on the .bat file icon; double click on the JES python icon just like before. Colin Potts

i have a mac... even tho JES did crash on me once already... when i test functions in class and my hw, the syntax seems to have no errors, but the picture looks exactly the same, even when it changed in my recitation on the overhead... is there something i am forgetting in the syntax at the beginning or end of my hw? or is this just my comp? thanks
The homework assignment asks you to write a program that changes the picture but it should not show the picture. So if you have done the homework correctly, you will not see any difference in the picture unless you show it in the command area after you have run your function. The function itself shouldn't be doing the showing. Colin Potts


I can not figure out how to take a picture in as an input, I know that we should use the templete but it keeps giving me the error (An attempt was made to call a function with a parameter of an invalid type. This means that you did something such as trying to pass a string to a method that is expecting an integer.) and i have no idea what I have done wrong.
A GUESS: You are probably trying to call your posterizeMe function with a file name as its input rather than a picture. Remember to call makePicture to make a picture. A file name is just that: a string of letters. It isn't a picture. HINT: When you get an error message like this, look at the name of the function that is generating it and the line number in your code. It probably contains a call to one of the JES functions such as getPixels. If my guess is right, you are probably trying to get all the pixels out of a file name, and JES can't do that because a file name doesn't contain pixels. Even if I guessed wrong, you should still look at the line that is wrong. Colin Potts

I am having trouble with the writePictureTo()function. When I initally tried to save my .jpg picture, I recieved this error: "java.io.IOException has occured". So I tried to save the picture to the desktop, as was mentioned to do (above on this page), and I recieved another error:"java.lang.NullPointerException". Does anyone have any suggestions? Thanks~
Where are you putting the command writePictureTo()? My guess would be that you aren't putting the commend in the right place. Look in the book for several very nice examples of where to put and how to use the function. If after that you are still stumped, come see a TA Toni Walden


I am also having trouble with the writePictureTo() function. Can you please explain where I should include it (like what to put in the program area and command area)? A .jpg file pops up after I do it but it does not show the picture.
Do not use writePictureTo in your program. However, you need to save your image so that you can upload it to the gallery. Do that in the command area. My suggestion is to make a copy of the image file you are using first (e.g. by copying it to another folder or by duplicating it): Then, if you type something like the following commands in the command area (your file names and picture names will vary): myPictureFileName = pickAFile() , theActualPicture=makePicture(myPictureFileName) and then posterizeMe(theActualPicture). You can subsequently say writePictureTo(theActualPicture, myPictureFileName). This will overwrite your fle with the changed version (which is why you have to make a copy first!) You can then upload that. Colin Potts

I have an apple computer and I typed in all the code correctly and load everything right, but my new picture looks exactly the same every time and I cant figure out why. It never changes color...I don't know what to do
Are you repainting the picture? If you are perhaps, you should see a TA at his/her office hours.Toni Walden

I tried to register on Webwork from the link that you posted. I read the waiver or whateer then it asked me for a series of gt-number and passwords. It said i am either not registered or not loaded in the system. I know im not registered so am i loaded in the system? I need help.-Samuel Baker
Do NOT use webwork to turn in your homework! We are using Sakai now, so please use that to turn your assignment in :)! Toni Walden

Where and how do we post homework again?

If we forgot our login/password, what do we do?
(1) Don't. (2) If you do, and (confession) I did this myself initially, dig in your email to find the message. You should save messages like this to a folder rather than delete them. (3) If you changed your password to something personally meaningful and then forgot what that was, and (confession) that's what I did, and really can't remember, send a message to Brittany to get a new password. She can't do that herself, but we will forward requests to CETL. (4) In the meantime, send your homework by email to your TA and explain why. Colin Potts

Is it ok if we turn in our homework first and then go back to complete the bonus (but do it before the deadline)?
You can complete the extra credit later since you don't need to use Sakai anymore. Just make sure to post the picture before the deadline on the coweb - Bobby Mathew

i wrote my program and when i load it and run it using posterizeMe(and the actual address of the pic) it works and runs perfectly. but when i try to run it the way the ta's are going to grade it i get a message saying An attempt was made to call a function with a parameter of an invalid type. This means that you did something such as trying to pass a string to a method that is expecting an integer. why wont it work that way but it works the other?
By "the actual address of the pic" I think you mean the path to the file containing the picture. A file name is not a picture. You need to make a picture and pass that to posterizeMe Colin Potts

I am trying to save my picture for extra credit and I type in all the right stuff so the program ran successfully but I cannot find the picture on my computer. Here is the address I used to save my pic: C:\Documents and Settings\Rafa\Desktop\rsartorato3.jpg. I just wanted to save it to my desktop, but it never appeared.
I'm not sure what you are doing, here. Follow the instructions I posted above in answer to a very similar question about making a backup copy and then overwriting the file that you made the picture from. Colin Potts

why does my picture for extra credit just show up as a link to (gth####.jpg) rather than posting the picture? Both the "upload to page" and "add a reference..." are selected as instructed.

I did not get any emails from my TA and so I dont have an account for Sakai. Other people in my class has a password that works but when I used it it doesnt work. How do I log in?



Links to this Page