scala

lift with enterprise java beans

Hi, I have troubles with deploying lift application with uses enterprise java beans. There's a simple example: @Stateless class TestEJB { def a = "hello" } object TestApi extends XMLApiHelper{ @EJB private var bean:TestEJB = _ def createTag(a:NodeSeq) = def dispatch: LiftRules.DispatchPF = { case Req("test" :: Nil, "", GetReque...

Background task in Liftweb environment

I must write daemon and I want to use Models for connecting to the database and some useful Lift classes. Is it possible to run analog of Rails's rake tasks? ...

How to install Scala plugin manually ?

http://www.scala-ide.org/ gives http://download.scala-ide.org/update-current-35 There are features and plugins directory. Which should I use or both ? Should I just unzip them all in eclipse features and/or plugins directory ? By the way what diff between features and plugins ? ...

Scala dbc update statement

Where can I see example of scala.dbc update statement? I have found select statement example only... select fields ( ("url" of characterVarying(32)) and ("name" of characterVarying(32)) and ("last_update" of integer)) from ("feeds") ...

Building jar with maven-scala-plugin

I created scala application and now I want to build jar. I run mvn package than I try to run jar by command java -jar target/burner-1.0-SNAPSHOT.jar and I see error: Failed to load Main-Class manifest attribute from How can I define Main-Class property? Do I need to create Manifest.mf? where? Or I need to have mainclass property some...

scala & lift: advanced url rewriting

Hello, I'm looking for a solution for rewriting urls in lift using list declared outside the scope of LiftRules.statelessRewrite.append LiftRules.statelessRewrite.append { case RewriteRequest(ParsePath("abc" :: Nil, _ , _ , _ ), _ , _ ) => RewriteResponse("index" :: Nil) } I'd like to have the following code working the ...

Better type checking on match in Scala

scala> class A defined class A scala> class B defined class B scala> val a: A = new A a: A = A@551510e8 scala> a match { | case _: B => println("unlikely") | case _ => println("no match") | } no match In the example above shouldn't the compiler tell me that one of the cases can never match? A slightly more complicated...

Lift with db4o User model

Hi, suppose you have a Lift + db4o project... How do you define User model? Should I extend MetaMegaProtoUser? Thanks in advance, Etam. ...

Error with scala-2.8 and scalacheck: Prop has wrong version

scala Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_20). Type in expressions to have them evaluated. Type :help for more information. scala> import org.scalacheck.Prop.forAll error: error while loading Prop, Scala signature Prop has wrong version expected: 5.0 found:...

A problem of implicit conversions in scala 2.8

I want to write a implicit conversion of Tuple2[A,B] to Seq[C] where C is super type of both A and B. My first try as following: implicit def t2seq[A,B,C](t: (A,B))(implicit env: (A,B) <:< (C,C)): Seq[C] = { val (a,b) = env(t) Seq(a,b) } But it doesn't work: scala> (1,2): Seq[Int] <console>:7: error: type mismatch; found :...

Possible for IDE's to resolve Scala classes in Java using Maven?

I have a project with mixed Java and Scala sources, following the instructions on this page, which works when running Maven from the command line. However, people using IDEs like IDEA and Netbeans have problems resolving Scala classes in Java code (but not the other way around, thanks to the nice plugins available). Is there a way to r...

Scala, Maven, and preprocessors

I know all of the philosophical arguments against preprocessors and macros in Java. I don't agree that just because some may abuse a language feature, it should be excluded for all. I would like to include __FILE__ and __LINE__ macros in my Java and Scala code for efficient logging. Any use of Exception is unacceptable because of runtim...

Why lift triggers method?

Hi, there's a simple form in Lift framework and a Class with render method that handles the form: def render(xhtml:NodeSeq) = { var name = "" var role = "" var human = "" def register = { val person = new Person person.name = name person.role = role person....

Scala actor to non-actor interaction (or synchronizing messages from an actor to a servlet)

I have the following scala code: package dummy import javax.servlet.http.{HttpServlet, HttpServletRequest => HSReq, HttpServletResponse => HSResp} import scala.actors.Actor class DummyServlet extends HttpServlet { RNG.start override def doGet(req: HSReq, resp: HSResp) = { def message = <HTML><HEAD><TITLE>Rando...

When to use " " ( space ) and when to use . ( dot ) when invoking methods in Scala?

I've seen Scala using both interchangeably, but I don't know when to use one or the other. Is there a convention? For instance these are equivalent "hello" toString and "hello".toString() And they can even be mixed "hello".toString() length What's the convention? ...

Package objects

Could someone please explain package objects, not so much the concept but their usage. I've tried to get an example working and the only form I got to work was as follows: package object investigations { val PackageObjectVal = "A package object val" } package investigations { object PackageObjectTest { def main(args: Array[...

Purely functional soft heap

Are there any implementations of a purely functional soft heap data structure in any language? ...

Scala protocol buffers compiler

Hello, I was thinking about writing a code generator to generate scala from google protobuf definitions file. The reason I see it valuable is the java bindings are too Java-ish and one could do much better in scala. For example for the following definition message Foo { required int F1 = 1; repeated string F2 = 2; message Inner ( ...

Scala programming environment

Possible Duplicate: Which IDE for Scala 2.8? I'm learning Scala by reading 'Programming in Scala' book by Odersky et al. What programming environment people use for scala? I've used TextMate and emacs, and trying to use eclipse for Java. ...

Comparing String and Enumeration

Hi, I have an enumeration in scala mapped to strings in JPA. For more comfortable coding, I defined implicit conversions between them. So I now can define value val person.role = "User", - person.role is the enumeration type "User" a String so there's the conversion. But when I try to compare these two, I always get false, because the de...