typesafe-stack

Typesafe config: Load additional config from path external to packaged scala application

南楼画角 提交于 2021-02-05 12:59:08
问题 My scala application will be packaged into a jar. When I run my app, it needs to read an additional config file stored externally to my app jar. I am looking for functionality similar to the Typesafe Config library but other solutions are welcome too ! Is there a way to do something like below: val hdfsConfig = ConfigFactory.load("my_path/hdfs.conf") 回答1: I think what you want is: val myCfg = ConfigFactory.parseFile(new File("my_path/hdfs.conf")) 回答2: If your external configuration is to add

Scala slick query where in list

丶灬走出姿态 提交于 2019-12-20 10:36:21
问题 I am attempting to learn to use Slick to query MySQL. I have the following type of query working to get a single Visit object: Q.query[(Int,Int), Visit](""" select * from visit where vistor = ? and location_code = ? """).firstOption(visitorId,locationCode) What I would like to know is how can I change the above to query to get a List[Visit] for a collection of Locations...something like this: val locationCodes = List("loc1","loc2","loc3"...) Q.query[(Int,Int,List[String]), Visit](""" select *

playframework - IOException unable to allocate memory

不打扰是莪最后的温柔 提交于 2019-12-18 15:43:09
问题 My system is Mint 12 64bit. I've installed the typesafe stack and created a new play application. Without modifying the code I've tried to run it. This is the output: http://pastebin.com/6XwmsbAE Play complains with this error message: IOException: Cannot run program "javac": java.io.IOException: error=12, Cannot allocate memory How can I fix this ? UPDATE: @Mef Ok you were definitely right. I've increased the initial RAM from 1 GB to 2 GB (running this on virtualbox). Compiling worked

Typesafe stack and Scala 2.10 [closed]

假装没事ソ 提交于 2019-12-08 20:53:32
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . On scala's 2.10 download page ( http://www.scala-lang.org/downloads) is written: The Scala distribution is also available in a simple, pre-integrated

Run a sbt-created app without sbt

爷,独闯天下 提交于 2019-12-08 06:40:11
问题 This is somehow a follow-up of this question. When I'm creating a Scala package with sbt, I am able to run it using one of these ways: simply by typing run in the sbt console or by creating a jar file (using either one-jar or assembly ), and the running this jar in the system console by typing java -jar myjar.jar But I don't know how to run my package from the scala program ? (not the sbt scala console, in which everything works fine by typing import mypackage._ ) use my Scala package in

How to force Typesafe Activator to listen 0.0.0.0:8888

久未见 提交于 2019-12-03 16:14:33
问题 I recently installed Typesafe Activator to a VM. Applications created by activator can be accessed after port forwarding, but Activator seems to listen localhost. How to change this to WAN? 回答1: It looks like setting system properties http.address and http.port will now do this job, e.g. ./activator -Dhttp.address=0.0.0.0 -Dhttp.port=80 Would launch Activator on a WAN on port 80 (assuming matching permissions, etc). 回答2: It is hardcoded right now and there's no way to change short of

How can I configure system properties or logback configuration variables from typesafe config?

穿精又带淫゛_ 提交于 2019-12-03 08:00:06
问题 I have variables with defaults in my logback.xml configuration file, and I would like to be able to optionally set these variables from my typesafe config application.conf file. I am deploying the application using one-jar, and the application.conf file packaged up in the deployable jar contains defaults. I pass -Dconfig.file=foo.conf on execution to provide the path to a server-specific config file. Right now I can also pass -Dlog.level and other variables to override my defaults in logback

How can I configure system properties or logback configuration variables from typesafe config?

自古美人都是妖i 提交于 2019-12-02 21:50:16
I have variables with defaults in my logback.xml configuration file, and I would like to be able to optionally set these variables from my typesafe config application.conf file. I am deploying the application using one-jar, and the application.conf file packaged up in the deployable jar contains defaults. I pass -Dconfig.file=foo.conf on execution to provide the path to a server-specific config file. Right now I can also pass -Dlog.level and other variables to override my defaults in logback.xml , and I also have to pass -Dfile.encoding=UTF-8 on the command line. I'm looking for a way to be

Failing to include com.typesafe in build.sbt (for Scala and spray on Heroku)

自作多情 提交于 2019-11-30 18:04:36
问题 Trying to bootstrap my boilerplate Scala Spray project on Heroku, I am trying to add the necessary tweaks to my local project as per the Heroku documentation. The spray boilerplate project has been derived from the excellent template at github that simply works and has elegant code and tests included. After the last mentioned template project worked great, when adding the line import com.typesafe.startscript.StartScriptPlugin to my build.sbt , any sbt command now fails with: /build.sbt:1:

Using Auto Incrementing fields with PostgreSQL and Slick

蹲街弑〆低调 提交于 2019-11-29 06:42:04
问题 How does one insert records into PostgreSQL using AutoInc keys with Slick mapped tables? If I use and Option for the id in my case class and set it to None, then PostgreSQL will complain on insert that the field cannot be null. This works for H2, but not for PostgreSQL: //import scala.slick.driver.H2Driver.simple._ //import scala.slick.driver.BasicProfile.SimpleQL.Table import scala.slick.driver.PostgresDriver.simple._ import Database.threadLocalSession object TestMappedTable extends App{