我的分支是:
o---o support.2013.16
\
o---o---o---o---o master
\
o---o---o hotfix/A
Run Code Online (Sandbox Code Playgroud)
我需要复制hotfix/A来支持.2013.16.我知道采摘樱桃,但有可能做类似的事情
git rebase --onto support.2013.16 master hotfix/A
Run Code Online (Sandbox Code Playgroud)
但是没有移动分支而是复制它?
无法弄清楚StrangeIntQueue扩展Queue有什么问题,为什么会出现错误"构造函数Queue没有足够的参数:( leading:Int)list.Lister.Queue [Int].未指定的值参数前导".我怎么指定它?
class Queue[+T](
private val leading: T
) {
def enqueue[U >: T](x: U) =
new Queue[U](leading: U) // ...
}
class StrangeIntQueue(private val leading: Int) extends Queue[Int] {
override def enqueue(x: Int) = {
println(math.sqrt(x))
super.enqueue(x)
}
}
Run Code Online (Sandbox Code Playgroud) 为什么此代码会导致编译错误
类型不匹配; 发现:(Int,Char)必需:scala.collection.GenTraversableOnce [?]
?
val n = Map(1 -> 'a', 4 -> 'a')
def f(i: Int, c: Char) = (i -> c)
n.flatMap (e => f(e._1, e._2))
Run Code Online (Sandbox Code Playgroud) 我正在使用playframework 2.1-RC2.首先,我已经看到了所有 类似的 问题,所以我按照每个环境分离application.conf文件的通用指令.所以我有application.test.conf并且我以这种方式运行测试:
play -Dconfig.file=./conf/application.test.conf "test"
Run Code Online (Sandbox Code Playgroud)
我试过不同的组合,比如
play -Dconfig.file=./conf/application.test.conf ~test
Run Code Online (Sandbox Code Playgroud)
要么
play -Dconfig.file=conf/application.test.conf ~test
Run Code Online (Sandbox Code Playgroud)
仍然没有运气,它只是没有被选中,默认的一个(application.conf).
从另一方面来说,如果我这样做
play -Dconfig.file=./conf/application.dev.conf "run"
Run Code Online (Sandbox Code Playgroud)
然后应用程序选择正确的配置.
那么如何指定测试配置文件呢?
我有一个表,其中一列具有ltree类型,以下代码从中获取数据:
SQL("""select * from "queue"""")()
.map(
row =>
{
val queue =
Queue(
row[String]("path"),
row[String]("email_recipients"),
new DateTime(row[java.util.Date]("created_at")),
row[Boolean]("template_required")
)
queue
}
).toList
Run Code Online (Sandbox Code Playgroud)
这会导致以下错误:
RuntimeException: TypeDoesNotMatch(Cannot convert notification.en.incident_happened:class org.postgresql.util.PGobject to String for column ColumnName(queue.path,Some(path)))
队列表模式如下:
CREATE TABLE queue
(
id serial NOT NULL,
template_id integer,
template_version integer,
path ltree NOT NULL,
json_params text,
email_recipients character varying(1024) NOT NULL,
email_from character varying(128),
email_subject character varying(512),
created_at timestamp with time zone NOT NULL,
sent_at timestamp with time zone,
failed_recipients character varying(1024),
template_required boolean …Run Code Online (Sandbox Code Playgroud) 有时我被问到一些采访:InnoDB对MyISAM有什么好处,MyISAM比InnoDB好?关于问题的第一部分,一切都很清楚:InnoDB是交易兼容的,行级阻塞而不是表级阻塞,外键支持和其他一些,这些点只是浮现在脑海中.
但是当MyISAM真的比InnoDB好吗?
我是如何实例化一个抽象类的?
abstract class A {
val a: Int
}
val a = new A {val a = 3}
Run Code Online (Sandbox Code Playgroud)
或者是隐式创建的一些具体类?那些支撑后的new A意思是什么?
标题实际上并没有完全描述问题,即:我有一个日期表 -
1. 2011-07-01 13:01:48
2. 2011-07-01 13:09:36
3. 2011-07-01 13:21:24
4. 2011-07-01 13:35:12
5. 2011-07-01 13:49:23
6. 2011-07-01 13:57:47
7. 2011-07-01 14:05:12
8. 2011-07-01 14:12:45
9. 2011-07-01 14:31:48
10. 2011-07-01 14:47:31
Run Code Online (Sandbox Code Playgroud)
等等.我需要的是每小时获得三个随机日期,例如:
1. 2011-07-01 13:01:48
2. 2011-07-01 13:21:24
3. 2011-07-01 13:49:23
4. 2011-07-01 14:05:12
5. 2011-07-01 14:12:45
6. 2011-07-01 14:47:31
Run Code Online (Sandbox Code Playgroud)
我怎么能在mysql中做到这一点?
从Odersky的书中写一个简单的例子导致了以下问题:
// AbstractElement.scala
abstract class AbstractElement {
val contents: Array[String]
val height: Int = contents.length // line 3
}
class UnifiedElement(ch: Char, _width: Int, _height: Int) extends AbstractElement { // line 6
val contents = Array.fill(_height)(ch.toString() * _width)
}
object AbstractElement {
def create(ch: Char): AbstractElement = {
new UnifiedElement(ch, 1, 1) // line 12
}
}
Run Code Online (Sandbox Code Playgroud)
,
// ElementApp.scala
import AbstractElement.create
object ElementApp {
def main(args: Array[String]): Unit = {
val e1 = create(' ') // line 6
println(e1.height) …Run Code Online (Sandbox Code Playgroud)