App-engine and Scala
Hello, all. I have a 2-part question: Could you use Scala with Google's App Engine instead of Java? (Assuming 1 is answered yes) Would it be advised? Thanks ...
Hello, all. I have a 2-part question: Could you use Scala with Google's App Engine instead of Java? (Assuming 1 is answered yes) Would it be advised? Thanks ...
Is there a way to produce javadoc so that all methods accessible from the class are listed with their full description? Usually only the methods defined in that class are listed and the rest are only linked to in "methods inherited from" section. (Obviously it is tricky to show javadoc of super classes if they're thirdparty and there's...
I have 4 elements:List[List[Object]] (Objects are different in each element) that I want to zip so that I can have a List[List[obj1],List[obj2],List[obj3],List[obj4]] I tried to zip them and I obtained a nested list that I can't apply flatten to because it says: no implicit argument matching parameter type. How can I solve this? should...
The usual way of defining main in Scala (as shown below) can be used to run classes with 'scala', but not 'java' (since the created method is not static). How do I write a Scala class/object that can be executed with 'java'? object HelloWorld { def main(args: Array[String]) { println("Hello, world!") } } ...
I'm trying to build a simple search application as an learning experiment with Comet and the Lift Framework. The plan is to have a page with a text entry and space for search results. When a search term is entered, it should be transmitted as an ajax request and the results should be pushed back by the server and rendered on the same pag...
I need to return values, and when someone asks for a value, tell them one of three things: Here is the value There is no value We have no information on this value (unknown) case 2 is subtly different than case 3. Example: val radio = car.radioType we know the value: return the radio type, say "pioneer" b. there is no value: re...
I've got a number of classes with fields that are meant to be case insensitive, and I'd like to put the instances of these classes into HashMaps and look them up by string case insensitive. Instead of using toLowerCase every time I want to index an instance by its string, or look up an instance by its string, I've instead tried encapsul...
Is this an opportunity to make things a bit more efficient (for the prorammer): I find it gets a bit tiresome having to wrap things in Some, e.g. Some(5). What about something like this: implicit def T2OptionT( x : T) : Option[T] = if ( x == null ) None else Some(x) ...
I'm wanting to do something like this: class A (var updateCount: Int) { } class B (val name: String, var updateCount: Int) extends A(updateCount) { def inc(): Unit = { updateCount = updateCount + 1 } } var b = new B("a", 10) println(b.name) println(b.updateCount) b.updateCount = 9999 b.inc println(b.updateCount) but the com...
I'm trying to test some actors using scala specs. I run the test in IDEA or Maven (as junit) and it does not exit. Looking at the code, my test finished, but some internal threads (scheduler) are hanging around. How can I make the test finish? ...
I'm developing Scala code using Eclipse, often when I run tests I get this error: No tests found with test runner 'JUnit 3'. Environment: Eclipse for Java Developers, 3.5.1 Scala 2.7.7 JUnit 4.7 I'm currently writing my tests as JUnit3 tests, and invoking them by right clicking on a package in the project explorer, choosing Run As ...
I'm trying out XStream as a way to quickly serialize objects to Xml or JSON to send over the wire, and deserialize. I do want the XML/JSON to be simple/clean. It seems to work well, I've added a few aliases, but now I've hit a problem, this code: println(new XStream.toXML(List(1,2,3))) produces this XML: <scala.coloncolon serializa...
I have an iteration vals: Iterable[T] and a long-running function without any relevant side effects: f: (T => Unit). Right now this is applied to vals in the obvious way: vals.foreach(f) I would like the calls to f to be done concurrently (within reasonable limits). Is there an obvious function somewhere in the Scala base library? Some...
Say I'd like to implement something like this: def serialize( list: List[_] ) : Node = { <list> { for ( item <- list ) yield serializeItem(item) } </list> } def deserialize( node : Node ) : List[_] = { // ? } How do I get the type of the List, e.g. T in List[T] so I can write that out? Or do I need it? How can I instantiate ...
This code: println(new XStream.toXML(List(1,2,3))) produces this XML: <scala.coloncolon serialization="custom"> <unserializable-parents/> <scala.coloncolon> <int>1</int> <int>2</int> <int>3</int> <scala.ListSerializeEnd/> </scala.coloncolon> </scala.coloncolon> Instead I'd like this: <list> <int>1</int> <...
What I mean by the title is, whether there's a free framework/tool that allows me to write .scala files and have them reloaded & compiled automatically by the (web) server without the need to compile, package and deploy. Probably javarebel can be used here, but it is not free. ...
Greetings, I'm just going over some scala tutorials on the net and have noticed in some examples an object is declared at the start of the example. Can anyone explain to me what the difference between class and object are as far as scala is concerned? ...
I'm using Scala 2.8.0 and trying to read pipe delimited file like in code snipped below: object Main { def main(args: Array[String]) :Unit = { if (args.length > 0) { val lines = scala.io.Source.fromPath("QUICK!LRU-2009-11-15.psv") for (line <-lines) print(line) } } } Here's the error: Exception in thread...
I'm making an application that will parse commands in Scala. An example of a command would be: todo get milk for friday So the plan is to have a pretty smart parser break the line apart and recognize the command part and the fact that there is a reference to time in the string. In general I need to make a tokenizer in Scala. So I'm w...
I'm using Scala Source.fromFile however I can't seem to find a nice way of getting it to close the underlying InputStream once the file has been read. Here's my code that will fail with an AssertionError because the file cannot be deleted. def main(args : Array[String]) : Unit = { val myFile = new File("c:/tmp/doodah.txt") v...