Updating intelliJ IDEA
I'm using IntelliJ IDEA 9.0 community edition. The Scala plugin I use uses Scala 2.7.6. How do I update the plugin for Scala 2.8? Thanks. ...
I'm using IntelliJ IDEA 9.0 community edition. The Scala plugin I use uses Scala 2.7.6. How do I update the plugin for Scala 2.8? Thanks. ...
Say I have: class A(val foo: String) class B(foo: String) extends A(foo) class C(val foo: String) extends A(foo) class D(override val foo: String) extends A(foo) class E(bar: String) extends A(bar) I'm interested in how much memory instances of each of these classes take up. Instances of class A will have a single member variable: f...
I've been learning Scala with the Odersky/Venners book using Scala 2.7. Now I'd want to jump to 2.8, but people are saying that there are a lot of changes and some of them are not backwards compatible. This sounds like a big headache unless there is a nice book out there covering the new version of the language. So does such book exist? ...
I'd like to test the arguments to my case class constructor and throw an exception if they fail certain tests. The compiler complained when I tried to write my own apply method (Multiple 'apply' methods. I suppose I could make it a non-case class, and do the apply/unapply constructor field stuff myself, but I had hoped not to. Thanks ...
It does not look very good for me to always repeat a line-long tuple definition every time I need it. Can I just name it and use as a type name? Would be nice to name its fields also instead of using ._1, ._2 etc. ...
I've built Squeryl framework with SBT and am trying to use it with Scala 2.8 and NetBeans 6.9. I've defined an entity model as it is desctibed in Squeryl intro, but the IDE and compiler complain that "CustomTypesMode is not a member of package org.squeryl.customtypes". What might the reason be? ...
Hi, I'm rater new to scala, but basically have found my way around... Here, I'm asking for the recommended/best practice/idiomatic way of implementing this: internally, MyClass uses a state type, which is implemented by a sealed hierarchy of case classes but on the API, only some boolean predicate should be exposed, which gets impleme...
I have read that Scala's type system is weakened by Java interoperability and therefore cannot perform some of the same powers as Haskell's type system. Is this true? Is the weakness because of type erasure, or am I wrong in every way? Is this difference the reason that Scala has no typeclasses? ...
In my unit test, I want to express that a computed (result) sequence yielded a predefined sequence of result values. But without assuming anything about the actual implementation type of the sequence container. And I want to spell out my intent rather clear and self-explanatory. If I try to use the "ShouldMatchers" of ScalaTest and writ...
We're developing a server system in Scala + Akka for a game that will serve clients in Android, iPhone, and Second Life. There are parts of this server that need to be highly available, running on multiple machines. If one of those servers dies (of, say, hardware failure), the system needs to keep running. I think I want the clients t...
I have read that with a statically typed language like Scala or Haskell there is no way to create or provide a Lisp apply function: (apply #'+ (list 1 2 3)) => 6 or maybe (apply #'list '(list :foo 1 2 "bar")) => (:FOO 1 2 "bar") (apply #'nth (list 1 '(1 2 3))) => 2 Is this a truth? ...
I am currently trying to program in Scala but I guess this can generally applies to other programming as well? In Swing, we generally organize our code and logic in a single class (perhaps our Frame or Panel). What I have learnt in the pass has always been dealing with a class as well. I am wondering if there is any medium size (not too...
I wrote a function very similar to this: def writeMyEl (x: TypeA, y: TypeB, z : TypeC) { if (myMutableHashMap.contains((x, y))) myMutableHashMap(x, y) = z else myMutableHashMap += (x, y) -> z } In real code Types A and B are enumerations ans C is a case class. myMutableHashMap is defined as a val of type scala.collectio...
I am trying to use a .format method of a string. But if I place %1, %2 etc in the string, java.util.UnknownFormatConversionException is thrown pointing to a confusing Java source code piece: private void checkText(String s) { int idx; // If there are any '%' in the given string, we got a bad format // specifier. if ((idx = s.in...
Hi. Please have a look at the followin code, where Extractor[A,B] is part of a generic framework and everything else should be regarded as "client code" (I boiled it a down quite a bit and renamed everything. So don't mind that Extractor doesn't seem to be too usefull). scala> abstract class Extractor[A,B] { ...
A program of mine (written in Scala 2.8) works fine when launched by means of NetBeans IDE. But when I try to run it from outside, with "java- jar", it says "Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject...". Putting all the libraries, incl. Scala runtime inside the same dir as the jar to be run doesn't hel...
Im looking for an elegant way in Scala to split a given string into substrings of fixed size (the last string in the sequence might be shorter). So split("Thequickbrownfoxjumps", 4) should yield ["Theq","uick","brow","nfox","jump","s"] Of course I could simply use a loop but there has to be a more elegant (functional style) soluti...
I've got acquainted with Scala recently and found it beautiful. I am willing to give up using PHP and use Scala instead for all projects of mine. Now I Use BlueHost for hosting my PHP-based sites. Can you recommend a good alternative that will support Scala? ...
I'm writing a scala application using scala swing. I can listen for MouseClicked to get notified whenever the mouse is clicked, but how do i know which button was pressed. The documentation is pretty bad, so i have looked in the Java documentation for MouseEvent, which says that the key can be retrieved from the modifiers field, so i tri...
I need to plot some 2d (y=f(x)) and 3d (real z=f(x,y), not just 3d-looking) datasets, as well as graphs (directed and not) from my Scala (2.8) application. Currently I am going to output charts data to text files and use external charting applications (like SciDAVis). But maybe there are more convenient and automated solutions available ...