A General Solution to Least Squares Problems with Box Constraints and Its Applications. (19th June 2016)