Q:

Including code in open source projects

I have an open source project under Apache License 2.0. Normally, I would just include the License Terms and Conditions comment at the top of each code file.
What about code that I copied from someone's blog, or website? Is putting a link referring to the site enough? And I still leave the License Terms and Conditions there even though the code was written by someone else?
What's the proper way of doing this?

A:

You can't relicense code that isn't yours as you don't own the copyright. If the code is already under a license you must use that, and provide that license as part of your package. 
If the code isn't under a license then personally I'd look for an alternative piece of code which is licensed under the Apache license, obviously retaining the copyright statement in the code, and note the source and copyright it in the documentation for your project. 
If you can't do that why not email the code author asking if they'd state a license for it? If they choose a license different to yours then you should make it clear that piece of code is under a different license in both the code itself and your documentation.
(Of course I am not a lawyer, nor do I play one on TV, and as licensing is a legal agreement you should consult one rather than take advice from random strangers on the internet)

A:

Don't copy a code from a blog unless it is explicitely Public Domain or under a compatible license.
If it is under compatible license you just mention it at the license header at the top of the relevant file. (and also include a clause into your about dialog) This last bit might not be required by certain licenses, but is still a good way to say thanks.

A:

What about code that I copied from
  someone's blog, or website? Is putting
  a link referring to the site enough?

IANAL, but you can not go about altering peoples license without getting permission from them. If the code you copied from the blog is under a conflicting license to Apache you can not include it in your project. There is a fair use argument, but its pretty slippery (Eg. I just copied something so small that it really needs no attribution). 
So, I would recommend you read all the fine print on the blog you copied the sample from, and if you have any doubts shoot off an email to the author explaining what you are doing. In general people are fine with a hyperlink to their blog post in the source, but every person is allowed to license their IP under whatever license they choose. 

