Java Virtal Machine.net

[ News ] rss

February 01, 2011

Mark Wielaard: New GPG key. Finally created a new GPG key using gnupg. The old one was a DSA/1024 bits one and 8 years old. The new one is a RSA/2048 bits one. I will use the new one in the future to sign any release tarballs I might create. pub 2048R/57816A6A 2011-01-29 Key f...

More »

February 01, 2011

Andrew Hughes: [SECURITY] IcedTea6 1.7.8, 1.8.5, 1.9.5 Released!. We are pleased to announce a new set of security releases, IcedTea6 1.7.8, IcedTea6 1.8.5 and IcedTea6 1.9.5. This update contains the following security updates: The IcedTea project provides a harness to build the source code from OpenJDK6 u...

More »

December/2024
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22 232425262728
293031    

[ Archives News
for 'Java Technology' ]

home > news > java technology > more scala scripting

More Scala Scripting

This semester, I am teaching a very bright and motivated group of students at the Ho Chi Minh Technology of University. (It's the standard undergraduate programming langugages course, and I use Scala as the primary language. But that's for another blog.) While I have every reason to believe that the students are not only bright but also honest, I figured it's best not to leave anything to chance for the midterm exam. Their classroom is very crowded, after all, and I don't want anyone to gain useful information from an accidental glance at their neighbor's monitor. I decided to make lots of slightly different versions of the same exam. But I am lazy too, so here is how I used a bit of Scala scripting to turn two versions of the exam into 64 different ones. I wrote the exam, then made a copy and introduced small changes in each of the six questions—changes that would require you to look closely at the question text, such as changing names or the order of parameters. At first, I was going to cut each file into pieces and concatenate them with some shell commands, but then I worried—what if there was a bug, and I had to repeat the operation? I had to automate. I used Scala, mostly because that's what I always do these days, so I'll get better at it. It's easy enough to read all lines of a file into an array: val lines = scala.io.Source.fromFile("exam1.html").getLines.toArray It'...


Date: October, 24 2010
Url: http://www.java.net/blog/cayhorstmann/archive/2010/10/24/more-scala-scripting


Others News

©2002-2019Java-Virtual-Machine.net best web design software | free website generator | top website builder | easyhtml5video.com | css menu