Hello,
I was wondering how to apply a match and case to my act() method. This is my tempObject class
case class tempObject(typeOfData: Int) {}
And this is my Actor:
object StorageActor extends Actor {
def act(TO: tempObject) = TO match {
case TO(0) => println("True")
case TO(1) => println("False")
}
}
So, what shoul...
Hello,
Currently I use Apache CommonsVFS to fetch images from other sites and it works well.
The website of CommonsVFS says it supports HTTPS protocol, but I found I could not access those URL starts with https:// using CommonVFS, while I could browse it from my Firefox normally.
For example, the following code will yield an exception...
Hi,
I knew this 'How can I convert a Java Iterable to a Scala Iterable?'
But I am working on java 1.4.2 code with a scala API.
How can I get a scala.Iterable from a java.util.List?
Thank you for your suggestion.
...
My query is that, is it possible to write and compile Scala code in netbeans6.9.1?
I am a beginner to Scala programming, and am very much confused about this.
I posted this question here so as to get the reviews of fellow programmers.
...
I asked this on the XNA forums but I guess since most people there would specialize in C# I didn't get much help with this
I have some code for a game written in Scala. I compile everything into Java Bytecode at the moment but the Scala compiler has a .Net version. With that in mind, and because modular design is good practice in gene...
I want a convenient way to generate an Iterable, given a initial object and a function to produce the next object from the current one, that consumes O(1) memory (i.e., it doesn't cache old results; if you want to iterate a second time, the function has to be applied again).
It doesn't seem like there's library support for this. In Scal...
Following Scala mailing lists, different people often say: "compiler rewrites this [scala] code into this [java/scala??] code". For example, from one of the latest threads, if Scala sees
class C(i: Int = 4) { ... }
then the compiler rewrites this as (effectively):
class C(i: Int) { ... }
object C {
def init$default$1: Int = 4
}
H...
Are there any sane analogues to LINQ (.NET) exists for Scala?
...
I have the following Scala code.
import scala.actors.Actor
object Alice extends Actor {
this.start
def act{
loop{
react {
case "Hello" => sender ! "Hi"
case i:Int => sender ! 0
}
}
}
}
object Test {
def test = {
(Alice !? (100, "Hello")) match {
case i:Some[Int] => println ("Int rec...
I don't have much experience with statically typed languages (currently learning Scala and loving it!) but one thing I've noticed is that they don't ever seem to have anything like Ruby's method_missing or ColdFusion's onMissingMethod. Is there some inherent limitation in statically typed languages that prevent or make this difficult?
...
I'm using Scala plugin for IntelliJ IDEA and my project has a few thousands lines of source code.
Unfortunatelly, when I'm typing the code IDE freezes frequently(i.e. on code completion etc.). I tried to switch off inspection, but there was no effect.
Is there a way to turning off all plugin's features for using it just as syntax highl...
Is it possible to do something like this in Scala:
class MyTest {
def foo[A <: String _or_ A <: Int](p:List[A]) = {}
}
That is, the type A could be a String or Int. Is this possible?
(Similar question here)
...
When I programming with the ScalaQuery, how to build a "select count(*) from table" statement?
I used a
Query(TestTable.count)
but the generated select statement is:
select count(*) from (select column1
from TestTable t2) t1
I want the:
select count(*) from TestTable
sorry for my poor english.
import org.scalaque...
This question was previously asked in scala-user mailing-list without a confirmed answer.
scala> val T = new Pair(1, 2){
override def equals(obj:Any) = obj.isInstanceOf[(Int, Int)] && obj.asInstanceOf[(Int, Int)]._1 == this._1}
}
T: (Int, Int) = (1,2)
scala> T match {
case (1, 1) => println("matched")
case ...
My question is that if it is possible to overload constructors in scala?
So I can write code like:
var = new Foo(1)
var = new Foo("bar")
And if it is not possible, are there any equivalent tricks?
...
I wonder if it is possible to inherit auxiliary constructors in Scala?
I tested this code, and it complained
temp.scala:18: error: too many arguments for constructor Child: ()this.Child
val a = new Child(42)
^
abstract class Father {
var value: Int = 0
protected def setValue(v: Int) = {
value = v
}
protected def ...
hi
I've got a little Problem: I want to have Buttons in some of the cells of my Table. As rendering component I return a Button with the following code: (theres application specific and debugging code in this example but you'll get the picture)
class LivingTreeButton(lt:LivingTree[_], client:TableBehaviourClient) extends Button(Action(...
Why do all Scala classes inherit from ScalaObject although that trait is completely empty and has no (visible?) functionality compared to AnyRef, which does define additional methods?
Won't that slow down method calls like equals() or hashCode() because it will need to take another class into consideration (which might override the meth...
Hi.
I'm playing with Remote Actors but I'm facing some difficulties.
Consider this server:
object Server {
def main(args: Array[String]) {
val server = new Server
server.start
}
}
class Server extends Actor {
RemoteActor.alive(12345)
RemoteActor.register('server, this)
def act() {
while(tr...
I've created an IntelliJ Idea SBT Scala project like Heiko Seeberger's article describes.
I'd like to add a Jar library (joda-time) to use in this project. How to do this? Simply putting them into project's /lib does not help. If I right-click "External libraries" in Idea's project tree, "New >" is greyed.
...