Fast projection onto a subspace Given an $n$-dimensional vector $\mathbf{c}\in [0,1]^n$, let $\Delta_{\mathbf{c}}$ be the set of points $\{\mathbf{x}\in [0,1]^n: \langle \mathbf{c},\mathbf{x} \rangle \le 1\}$, where $\langle \mathbf{c},\mathbf{x} \rangle$ is the inner product between $\mathbf{c}$ and $\mathbf{x}$.
Question: Given $\mathbf{c}$ and a vector $\mathbf{z}\in [0,1]^n$, how can we efficiently compute the projection $P(\mathbf{z}, \Delta_{\mathbf{c}})$ of $\mathbf{z}$ onto $\Delta_{\mathbf{c}}$?

By writing $P(\mathbf{z}, \Delta_{\mathbf{c}})$, we mean 
$\arg\min_{\mathbf{z'}\in\Delta_{\mathbf{c}}} \Vert \mathbf{z'}-\mathbf{z} \Vert$, where $\Vert \cdot \Vert$ denotes the regular Euclidean norm.
 A: So you want to project $z$ onto the intersection of two convex sets
$$C = \{x\mid \langle x, c\rangle \leq 1\}$$
and
$$D = \{x\mid 0\leq x_i\leq 1\}.$$
The projection onto each of them is straightforward:
$$
P_C(z) = \begin{cases}
z - \frac{\langle z,c\rangle-1}{\|c\|^2}c, &\text{if $\langle z,c\rangle>1$,}\\
z, & \text{otherwise}
\end{cases}
$$
and
$$
P_D(z)_i = \max(\min(z_i,1),0).
$$
To project onto the intersection you could use quadratic programming, of course, but here is a low-tech variant:
Alternating projections. Initialize with $z^0 = z$ and iterate
$$
z^{k+1} = P_D(P_C(z^k))
$$ 
which converges to the desired projection $P_{C\cap D}(z)$. You could also use Dykstra's projection algorithm, but in my experiments both are about equally fast.
I don't know what value of $n$ you have in mind, but it seems that the number of iterations needed for convergence scales with $n$ not so favorably (at least for the random instances I produced).
A: As noted in the comments, this problem is not really a research level problem. Afaik, versions of it were originally solved in the 50s.
Here is an entire survey that discusses efficient algorithms (including linear-time procedures) for this problem as well as generalizations of it: M. Patriksson, A survey of classic core problems in operations research, 2005, Technical Report, Chalmers University.
If you want a more immediate answer with code (has only $\ge 0$ constraints, but handling upper bounds is easy), have a look at: Condat's L1 projection code
Another useful search time: "Continuous quadratic knapsack"
