Google’s infringement against Oracle: 9 lines of code!
In the copyright portion of the Oracle v. Google case currently going on, the jury found that Google had infringed on 9 lines of code out of millions which are in question. As best as I can determine, these are those 9 lines:
private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
if (fromIndex > toIndex)
throw new IllegalArgumentException("fromIndex(" + fromIndex +
") > toIndex(" + toIndex+")");
if (fromIndex < 0)
throw new ArrayIndexOutOfBoundsException(fromIndex);
if (toIndex > arrayLen)
throw new ArrayIndexOutOfBoundsException(toIndex);
}
The jury couldn’t agree o whether or not the infringement was big enough to justify damages be paid to Oracle.
Time to learn Ruby
What better time is there to learn ruby than on one’s vacation? I’m considering using it to develop a very exciting secret project involving web typography. Like many programmers, I’m going through the ruby koans Exercises to get used to using the language.
about_triangle_project.rb
Sofar, my favorite problems are the about_triangle_project.rb and about_triangle_project2.rb problems. Here’s my solution:
def triangle(a, b, c) # important for efficient triangle testing ar = [a,b,c].sort # test for impossible triangles from sorted array of sides raise TriangleError, "Impossible!" unless ar[0] > 0 and ar[0] + ar[1] > ar[2] # identify triangle type with some stringy magic case [a,b,c].uniq.size when 1 then :equilateral when 2 then :isosceles when 3 then :scalene end end
Isn’t unless a fun operator?
(more…)