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

Stuipd 101

Questions? This site is stupid 101

The posting page is locked again...

The homework says that the function hw1 should accept a picture as input...does that mean that the user will type in pict=pickAFile(), picture=makePicture(), and then hw1(picture), or do we need another function to do this for the user? Also, should we write the posterized picture to the file at the end of the function? Thanks!


I can't get MediaTools to work! It keeps saying that I have no pictures to examine. Any ideas?

Nevermind, the problem has been resolved.Shauntay Word

I'm having problems with just running simple commands in JES. Things such as: print makePicture(pickAFile()), are returning things like:
load image failed.
Was unable to load the image in C:\Documents and Settings\Shauntay Word\Desktop\SHAUNTAY\glen.JPG
Make sure it's a valid image file.
None
What does this mean, and why is this happening now? Before I could run these commands with no problems. Someone please help. Shauntay Word



"Submit" option on JES worked and I successfully uploaded lab2a.py so I tried same with hw1.py but it doesnt show on my TA's page. So I went upload.coweb and used "attach". TA's page shows my homework now, but it doesnt contain my gtg number. Is that how it's supposed to be?
No – the upload worked, but it's in the wrong format for the TA to grade. Sit down with your TA at breakout or office hours and figure out how to make JES turnin work. If it doesn't work at home, do it on-campus. Mark Guzdial

I've completed hw1. When I load my function, though, JES tells me I have a syntax error which I absolutely cannot locate! I can't load the function so I can't turn in my homework....help!
If you can't load the function, how do you know it works, and how do you know that you've completed HW1? It's not done until it runs correctly. (See the Grading Policy page.) Bring your laptop computer to Breakout or Office Hours, or bring a printout. Not being able to load typically means that you got the indentation wrong, or you have the wrong number of parentheses somewhere. Mark Guzdial

If you have a laptop, please bring your program to the breakout session or to someones office hour! We can try to help. If you don't have a laptop, print it out and bring it (although that will be harder to debug). Blair MacIntyre

Alright, i have writen the program, except for the part about if blue is less than 128, set it to the red value. I tried a number of things, but JES can't find the red value. What notation does it need to find the red value?
The red value is getRed(pixel). Mark Guzdial

When I attempt to upload my "posterized" picture to the HW 1 Posters page, I am asked for a user name and password. I tried my gtg# with my prism password and with my Web Work password but neither works. Any suggestions?
Read the FAQ. Off-campus, you'll be asked for a username/password which is attach/carmen. Mark Guzdial

I had the same problem and here is the answer! username: attach password: carmen Why this is like this? I have no idea, but it works!
We were having problems with overseas folks using our CoWebs for storage spaces for illegal MP3's, software, and images. We locked them to prevent non-campus folks from using our upload space. Mark Guzdial


Quick question... when we turn in, do we have to attach the picture that we "posterized"?

Nope – it has to work for any picture, so the TA's will try it with a picture of their own. Mark Guzdial

i am having a problem bringing up jes on my computer. i did my first 2 labs fine, but now when i click on the black jes console icon, the black box flashes on the screen and then disappears. i cant open it. any ideas...

I have writen the program, but when i run it it turn the whole thing a uniform gray.

I wrote the program except for the part that says, "If the blue channel is less than 128, set it to whatever the red channel value is." What does that mean? I read the question above where it talks about this and I put in getRed(pixel) but that did nothing. I don't know what to do. Thanks.
That means that once you getRed(pixel) you want to setBlue(to the pixel value of red that you just found). Think about how can you combine those two functions so that you will be setting the blue value to that of the red value? Summer McWilliams

If my picture did not upload to the galleries correctly what should be done? How can it be erased from the site or fixed? When I browsed to select the picture to attach, I viewed the thumbnail, and it existed there, but when it was attached, there was a problem. What does this mean and what should I do?
If your picture was named "...diskspinner.jpg" If ixed it for you, but you need to go back and add your name. When you upload a picture, make sure that you have "upload to the page" and "add a reference to the upload at the end of the page" both selected so that it will automatically show up on the page. Also, (this is in reference to when you have a blank box with the red X show up) you can't have spaces in your name of the file. Summer McWilliams

So, we are writing a generic program. This mean the the grading TA will be completing in the command area the steps of choosing the pic and making it a picture, and then running our program correct?
Exactly, you should not call a specific picture in your program. Summer McWilliams

In the part of the homework, to put a copy of a picture that has been posterized on the web, when I click on the attach button, it brings up a window to enter a username and a password to access that part of the site. What am I supposed to be using for this information?
This question has been answered a couple of times already-y'all please make sure you are keeping up with previously asked questions so things aren't asked repeatedly please! Anytime you attach to the coweb the username is "attach" and the password is "carmen". Summer McWilliams

On the part to set the blue pixel to the red pixel value, once I nest another set of "if" statements to find the value of the red do I just simply say setBlue = getRed(pixel)?

Nevermind on the above, I figured it out. Thanks.

If we are not calling a specific picture in our program, then how are we to see the changes made to a picture and to post that picture on coweb?


You can either manually make and show the picture from the command area, or if you're brave, you could write another function that loads and displays the picture before and after hw1(). Check out some of the earlier lecture slides on how to do picture from the command area. Adam Wilson

How come "C:\JES\MediaSources\barbara.jpg" is considered a valid image file, but 'C:\\JES\\MediaSources\\barbara.jpg' is not, even though when I did pickAFile() it gave me the latter address?

You sure it wasn't "C://JES//MedisSources//barbara.jpg" The direction of the slashes matter. Mark Guzdial

I re-checked and pickAFile did give me the \\ direction slashes (which is what I had), its just that for some reason when I use the double slashes that I got from PickAfile its not considered a valid image file. I was messing around trying to get it to work and the single slashes (\) do work. Is this something I have to do every time?



You're okay with using single slashes, or using the backslashes (like Windows normally does) with an "r" in front of the string. We'll talk more about this in a couple weeks. Mark Guzdial


So about this getRed(pixel) part...where EXACTLY in the blue part of tha recipe are we supposed to put this in and how should it read? I'm lost on this part and I need it explained in simple, understandable terms please :) Thanks.
Be sure to ask in breakout this week! You need to setBlue(pixel,getRed(pixel)). Mark Guzdial


I was wandering where our grades are being posted

WebWorks (the link is on the main page)


I'm having problems understanding the getRed(pixel) part too. I have no idea how it's supposed to look. Please help.

Be sure that your first line of your homework looks like this:

def hw1(picture):
and your file should be named hw1.py.

Your hw1 should work for ANY input picture, not one specific picture.
Mark Guzdial



Why is the first line "def hw1(picture):" instead of "def posterize(picture):"? Is it ok if we have "def posterize (picture):"?
Absolutely NOT. The TA's are expecting to execute hw1(mypicture) in the command area. Mark Guzdial

Nevermind on the question above. I got it to work.

When I try to run the function in the command area after completing the program, I am getting this message:
>>> hw1(picture)
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.

Does anyone know what I need to change here?
It may help if you know what my first few lines of code are:
def hw1(picture):
file = pickAFile()
picture = makePicture(file)
show(picture)
i kept getting the same response until I remembered to load the program before doing anything in the command prompt....
Exactly – forgetting to Load is the most common cause of such errors. Mark Guzdial

You're calling the function with the variable "picture", yet "picture" is not defined outside the function. For homework 1, your function needs to input a picture as input, so you need to makePicture first (i.e. in the command area) and used that as input. Houman Khalili
The real problem in the above code is the picture is passed in as input AND is then defined inside the function. If you do that, the picture will be redefined. It won't be the input. Mark Guzdial


When I uploaded my posturized picture (library fountain1), the picture is not showing up. I've comare it to others, and what I've written is the same. Will it not show only because its too big? Do I need to do another one? Jenn Arsenault
You need to make the name of your picture have no spaces. Right now it has a space between library and fountain. You need to rename it "libraryfountain1". Ashley Coker

A question about the code above (discussion about picture not being the input). Would you then proceed to simply leave out the input picture and just have the first line of the code to be: def hw1(). Would that be okay for this hw?? or do the TA's want something there so that we have to define picture outside of the function?? Tracy Lee

The above being when we utilize pickAFile()

We want the picture outside of the function. Program the code so that it takes in a picture. The TA will goto the command area and do something like >>>file = makePicture(pickAFile()). They will then do >>>hw1(file) to test your code Larry Olson

what if I cant remember my user name and password? where would i go to find that out so i can put my picture on that web site? Thanks! Rachel King
This question has been asked many times now. If you are off-campus, you will be required to put in a user name and password. The user name is attach and the password is carmen. Ashley Coker

Is HW1 due @ 5:00 on Friday as the labs have been?
Yep! Ashley Coker

In the command area I have done >>>file = makePicture(pickAFile()). Then I have done >>>hw1(file). How do I make it show up? I have tried >>>show(file) and >>>repaint(file) and still nothing. I know my program is correct because I have had it checked by my TA, so it is definitely a command area error. thanks :)
hmmm...that's interesting because those commands should work and bring up a picture. It did that to me, too a couple times. I'm not sure how I fixed it exactly except that I just kept trying. I closed and re-opened JES, too. Anyone have any ideas??? Ashley Coker

Ashley:
I finally got it to work, I just had to reboot and then it worked. thanks.
Great! Weird, but glad to know you got it working. Did you just reboot JES or did you shut down and restart your entire machine? Ashley Coker

i don't understand how to apply the picture recipe to the chosen picture. should i type a function in the command area? "repaint" doesn't work...
In the command area, you need to first select and make a picture- type picture=makePicture(pickAFile())-and then you need to do run the program- type hw1(picture). Then, you can either do show(picture) or if you already have the picture up-repaint(picture). Summer McWilliams

the line with "whatever the red channel value is" i still can't get to work...should we load the picture first to determine what the red value is?
Think about what getRed(pixel) does...It gives you the red value of a pixel right, you used it in the top of the program. But, the red value is going to be different in almost every pixel, so you can't find each one and set each blue value to that value on your own, especially since the TA won't be using the same picture you will. You can instead use getRed(p) soemway to get the red value of a particualr pixel and instead of setting the blue value to some number- by typing setBlue(pixel, somenumber) you can set it to the value you got for red right? Summer McWilliams
So basically you're setting the blue value to getRed of the pixel. Ashley Coker

Did someone lock the edit & attach pages for homework one? It's NOT asking me for username and password, I'm ON campus, and I tried using "carmen" to post/upload my picture.
For the above and below comments, we will try to get that fixed soon. Sorry! In the future, y'all, please don't lock the coweb pages (unless it's your personal page that you don't want people to change). Ashley Coker

Hi, it's Monica here and it looks as though somebody has password protected the editing of the poster gallery page. (I'm not talking about the username/password being asked for even before you select your file to upload for display.) After you do that and want to save, the page is locked. Any suggestions?


I understand how to set the blue value to the red value, but I'm not sure whether you want the original red value, or the red value as it was changed in the posterizing function. Thanks. Emily Matthews
You're setting the blue value within the "posterizing function" which has not been done yet. You don't have one specific red value to set to. You want more of a generalization. Therefore, you would set blue to getRed(pixel) or getRed(p) or getRed(px) whatever you named your pixels to be. Ashley Coker

Sorry, that password is incorrect (upload failed). Hit the back button and try again; otherwise, contact the system administrator to clear the lock. THis is what I get when I try to upload my pic. Lauren Patton

I can't upload my picture to the poster gallery because it's asking for a password(not the initial username and password). Can someone either let me know what the password is or fix this problem?

yeah, someone locked the plce where we post our pictures


i cannot get the picture to load and i used "attach" as the username and "carmen" as the password, as a friend told me to do, and my posterized picture will not load... but it lets me get to the attach page... but yeah it gave me an unhappy face and that is not cool... HELP!!!

are we suspost to leave the writePictureTo Function in when we turn the assigment in or not? Stephen Rudolph

I also can't post my picture.What should I do?

Okay so my program works and I have already turned in. I wrote the picture out, and that was successful. However, I cannot post in the HW1 gallery, there is some lock password they are asking me for (I put in the initial username and password to get to the gallery post page, but on the actual post page they ask for a lock password, and I do not know what that is. I wanted to check if this always happens when you attach things, so I tried to attach on my Whos Who page, and that worked fine (they didn's ask for a passoword), so right now my picture is on my whos who page. Is it necessary for me to post in the gallery? Thank You

I am ready to post my picture to the hw1 posters page - how do I get my name to appear with the picture?

No, your writePictureTo(...) should have actually been done in the command area rather than the program area, but since you wrote it in your program, please take it out. Just think, if everyone leaves theirs in, when the TA is grading, they will end up with 50-somthing new pictures on their computers... Also, y'all, they said last night that someone had locked the picture posting page and we would get it fixed ASAP so you could post yours if you want to, sorry that it happened. Once you see that someone else has posted the exact same question you are going to ask, you really don't need to ask it again, and you especially don't need to be the 6th person to ask it. We will let you know as soon as it gets fixed ok! Summer McWilliams
Second what Summer said! I answered this question after the 2nd person asked it. Then the same question was asked again and again. Please look at what other people have asked because the question was answered! Ashley Coker

Is posting the picture to the hw1 posters page a required part of this lab?
No, posting the picture to the gallery is optional. It's just for fun. Ashley Coker

The picture gallery has been unlocked. You can now post your pictures to the gallery. Ashley Coker

after typing in all the values, do i need to type show picture and repain picture, or do i just stop after my last line of code? thanks... jordan

You function ends without showing or repainting the picture. Just end, just like the posterize example in the book. Mark Guzdial


My program worked on the simple Flower1.jpg file from the JES Media Sources, but it takes a long time on my own pictures and the Barbara.jpg, so I haven't waited for one to finish. Is this simply because my computer is a bit older or could there possibly be something wrong with my code? (Usually after I hit the Stop Button it highlights a different line of code, and gives me this message:
The code has been stopped due to you hitting the stop button.
Please check line 22 of C:\Documents and Settings\Jonathan\My Documents\hw1.py
JES has only done this when I try to run the program from the command area not when I just click "Load." I think JES may just be highlighting the line that the computer reached before I stopped it.

Colin Potts here:
1. Are you showing or repainting the image inside a loop? That will cause the program to take a long time (and may eventually crash JES).
2. If not, try it with flower.jpg and a file intermediate in size and time both to completion. Perhaps you're not being patient enough with your own (bigger) picture.
3. Are you sure it's exactly the same program that worked on flower? Double check the condition(s) in the for loop(s) to make sure that they don't make the program loop forever.
4. Put a print statement at the end of the loop saying what pixel it's currently at (see the slides for Friday for examples). You'll get a lot of lines of output in the command area that should tell you whether the program is making progress.

Thanks, for the help, Prof. Potts. It looks like I just wasn't waiting long enough. I ran the program again- it just took a long time, but when I came back about an hour or so later it had run the program. Pretty cool stuff!–Jonathan Laing
Can someone tell me the command to save the picture once it has been posterized? I think it's something like WritePictureTo but I don't know exactly how it works. Thanks.
writePictureTo(picture,"filename.jpg"). Ways that you can find out more about writePictureTo:
  • Use help in JES – look at Picture functions.
  • Check the book.
  • Check the slides.
Mark Guzdial
Also note: Putting a print statement in your program won't help seeing the program run, because prints don't appear until after the program is done. You can use the function printNow (look it up in the book – use the index, or look through the Movies chapter) will let you print immediately to see how things are going. Mark Guzdial
are we required to post our image?
No, you're not required to post. But we'd love to see how great your pictures turned out on the coweb! Stephanie Weitzel
Thanks, it's all set!
I still can't turn in my hw..I don't knwo what to do. Please help!!!

how do you do "greater than or equal to?" not just between ranges? thanks!
nevermind, i just figured the above comment out, i'm slow in the morning!
I made a mistake the first time i turned the assignment in, so i resubmitted it again. Will i be penalized for turning it in twice?, and we'll the TA be checking my first submission?
It's fine if you turn it in more than once. We will only check the second submission. And you should not have write to in your program. Summer McWilliams
I'm trying to attach my picture to the HW gallery, but it's locked. Can someone unlock it so I can post it before 5.
page removed
It's unlocked. Ashley Coker
I got problems submitting my homework#1 assignment via Jes. Everytime I tried, an error message popped up saying"unable to locate the file hw1.zip, access denied". I don't know what the problem is. Can anybody help me? I couldn't turn my homework in. (Ke Liang)
I have the same problem as Ke Liang and also when I try to attach my picture to the HW gallery it is locked. Can someone get it unlocked or help me before 5?
Thanks, gtg548k

Ke: are you working on you own computer or a lab computer? I've never seen that error message before, but changing the location of your JES folder might help. Also, if hw1 is an attachment to your turnin, you might want to try putting that somewhere else on your computer. Also, the HW gallery is unlocked right now. Adam Wilson
I have successfully turned in my homework at my home!!!!!!!Thank Adam Wilson for the advice. The problem occurred when I tried to turnin my homework in campus, there must be something wrong with the school system. (Ke Liang)
When will the HOMEWORK 2 page be available? I have questions.
Go to the link for "Homeworks" on the home page. Then scroll down to Homework 2. There is a link there for the questions page on HW2. Ashley Coker
take your home work home rpi it up and give it to the teacher what wude you say


lab4.html
Uploaded Image: self potrait.jpg

Link to this Page