How to use Environment Variables in build.sbt?

You can get env variables with the commands mentioned other responses like: sys.env.get(“USERNAME”) sys.env.get(“PASSWORD”) but they return an option of type Option[String] To turn this into string you need to either do a match or simply use sys.env.get(“USERNAME”).get sys.env.get(“USERNAME”).getOrElse(“some default value”) if you need to set some default value. Warning! calling .get of an option … Read more

Using scala.util.control.Exception

Indeed – I also find it pretty confusing! Here’s a problem where I have some property which may be a parseable date: def parse(s: String) : Date = new SimpleDateFormat(“yyyy-MM-dd”).parse(s) def parseDate = parse(System.getProperty(“foo.bar”)) type PE = ParseException import scala.util.control.Exception._ val d1 = try { parseDate } catch { case e: PE => new Date … Read more

Scala’s .type and Java’s .class literal

Here is my rationalization: classOf[T] classOf is defined in Predef as a function with this signature: def classOf[T]: Class[T] Although it’s implemented by the compiler, using the function syntax is possible without having to create any special treatment in terms of syntax. So that’s one reason here to consider this option. The alternative like String.class … Read more

Reified generics in Scala 2.10

Your argument is flawed. Kotlin has not been released yet*, and Ceylon just had its first version released, and I’ll quote one of the things it is missing from their announcement: reified generics So, excuse me, but what implementation proves it is possible? In fact, I haven’t looked much at what Kotlin is promising, but … Read more

Closest equivalent to SQLAlchemy for Java/Scala [closed]

One of the notable things about SQLAlchemy is that it makes tables first class objects. Thus the core API is really written around table objects, and the API therefore is essentially relational in nature. Thus at this level even if the API is OO, it is essentially reflecting RDBMS objects or functions such as Tables, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)