How lucky was the genetic investigation in the Golden State Killer case?

gcbias

Last week, police arrested Joseph DeAngelo as a suspect in case of the Golden State Killer, an infamous serial murderer and rapist whose case has been open for over forty years. The arrest is huge news in and of itself, but for people interested in the social uses of genetic data, the way in which DeAngelo was identified—using genetic genealogy & genetic data from crime-scene samples—was noteworthy. In this blog post, we discuss some of the genetics and math underlying the way in which he was identified (see also Henn et al). Because there’s been lots of discussion of the ethics of these approaches, we will not focus on that here; see here for a collection of links & news articles.

 The use of genetic data to identify suspects is not new. In the US, law enforcement makes extensive use of their CODIS (Combined DNA Index System) database—genetic…

View original post 2,907 more words

Advertisements

ScalikeJDBC session(transaction&auto session)

1.scalikejdbc transcations(目前只用过autoCommit,withinTX和localTX)O网页链接
2.auto session O网页链接 ​​​​

第一部分的transactions感觉就和spring的事务管理类似,但名称不同。spring是在annotation里写propagation方式,决定事务传播方式,如required等等。而这个名称不同。

第二部分的autosession,我关注的主要是前半部分出现的DBSession,也就是在不用autosession的情况下用的方式。看上去好像是在service调用dao层时,dao层的代码要写为

(implicit session: DBSession)

我的理解是因为一个transaction里套了一个transaction,然后两个用的session不同,里面的session就无法调用外面transaction传进来的未提交的数据。但是还是有点不明白…

Scala: Option, Some, None, Try, breakable

一、Option,Some,None

Option[A]有两种可能的返回Some[A]和None,用get可取出A。

常见用法是和match合用

xxx match{

case Some(A)=>…

case None=>…

}

不过scala官网(https://www.scala-lang.org/api/2.12.x/scala/Option.html)更推荐把Option看作集合类使用。对其使用map,flatMap,filter或foreach方法。

例如

val name: Option[String] = request getParameter "name"
val upper = name map { _.trim } filter { _.length != 0 } map { _.toUpperCase }
println(upper getOrElse "")

二、Try

在处理可能发生的错误时,既可以用传统的try…catch…也可以用Try…getOrElse类似于那种三目计算符

三、breakable

scala中没有java那样的break和continue,但有breakable类。在breakable{}中可以有break,以此可以进行循环跳出之类的控制。

例如

val mybreaks = new Breaks
import mybreaks.{break, breakable}

breakable {
  for (...) {
    if (...) break()
  }
}

附:

1.github上有关Option的scala练习https://www.scala-exercises.org/std_lib/options

2.scala cookbook作者的个人站https://alvinalexander.com/