Setting exercises and assignments when everything is on the web
Here's what I do (or at least try to do) in my algorithms classes:


Make homework useful.  The whole point of homework is to help the students master the course material.  Students learn by doing, not by passively reading or listening.  So I try to choose homework problems that exercise the insights and skills that I want the students to master.  (Among other things, this means keeping busywork to a minimum.)  If a student "writes" their homework solutions using Google and a stapler, they've robbed themselves of an opportunity to learn; all else being equal, that student will do worse on the exams.
Give homework relatively little weight in the final course grade, usually 30%, with the other 70% from exams.  I'd make the homework worth 0% if I thought the students would still do it.  See the previous point.
Tell the students that homework is useful.  Many students think of homework primarily as a vehicle for points, not as a tool for learning.  This is not entirely unreasonable—in some classes, homework is primarily a vehicle for points.   Better warn them early!
Include new questions in each homework assignment and exam.  Because I want to sleep occasionally, I regularly recycle homework problems from previous semesters, but if I recycle too much or too quickly, students don't learn the material as well.  (Whether they should learn the material as well is immaterial.)  Coming up with new useful problems is really hard, even if "new" just means "I haven't used it before".  I scour through a lot of textbooks and papers and web pages; if you teach algorithms, I have mined your web page for homework problems.  Still, I don't always succeed.  (On the other hand, failure sometimes suggests interesting research problems.)





Insist on ethical scholarship: proper citation of all sources, and no verbatim copying of anything.  Within those minimal constraints, students can use whatever source they want, and can collaborate with whoever they want, with no penalty.  In particular, students are welcome to use my official solutions from past semesters, if they can find them, as long as they cite them and don't just parrot them back to me.  Breaking this rule has harsher consequences than not doing the homework at all.
Homework presentations.  I used to ask students to present their homework solutions three times a semester, instead of submitting a writeup.  Here's the whiteboard, you have ten minutes per problem.  A single question like "But what about the empty string?" or "Why did you split the cases that way?" usually reveals students who didn't work out the solutions themselves.  Sadly, growing classes and shrinking TA budgets make this impossible now.
Remind the students that the course staff also uses Google.  (Remember, we're already scouring the web for new homework problems!)  And we have all the old textbooks, and their solution manuals.  And we read StackExchange.  And we have all the official homework solutions from past semesters, because, you know, we wrote them.  (I really wish I didn't have to say that last bit, but more than one student has submitted my own homework solutions, typos and all.)