GET all patients:
GET https://uvt-hci-lab.herokuapp.com/patients.json
CREATE patient:
POST https://uvt-hci-lab.herokuapp.com/patients.json
{"firstname":"Test", "lastname":"User", "age":44, "phone":"0788122321"}
| object Test extends App { | |
| trait CanAdd[T] { | |
| def plus(a:T, b:T):T | |
| def minus(a:T, b:T):T | |
| def or(a:T, b:T):T | |
| def devide(a:T, b:T):T | |
| } |
GET all patients:
GET https://uvt-hci-lab.herokuapp.com/patients.json
CREATE patient:
POST https://uvt-hci-lab.herokuapp.com/patients.json
{"firstname":"Test", "lastname":"User", "age":44, "phone":"0788122321"}
| object PdfReplace extends App { | |
| val pageNumberToReplace = 22 | |
| val sourcePathStr = "C:\\..." | |
| val destPathStr = "C:\\..." | |
| val pageToReplacePath = "C:\\" | |
| val sourceInput = new FileInputStream(new File(sourcePathStr)) | |
| val pageToReplaceInput = new FileInputStream(new File(pageToReplacePath)) |
| import scala.annotation.tailrec | |
| /** | |
| * Created by CristianPopovici on 9/29/2016. | |
| */ | |
| sealed trait List[+T] { | |
| @tailrec | |
| final def forEach(f:T => Unit): Unit = | |
| this match { |
| def quickSort(l:List[Int]):List[Int] = l match { | |
| case Nil => l | |
| case head :: tail => | |
| val (l,r) = tail.partition(_ < head) | |
| quickSort(l) ::: head :: quickSort(r) | |
| } |
| type BuildingStringMapper = Building => String | |
| val buildingCode = (b: Building) => b.getBuildingCode | |
| // works OK | |
| val buildingHeaders = Map[String, BuildingStringMapper]( | |
| "Building Code" -> buildingCode | |
| ) | |
| // does not work. Can I define function literals as inline map values?? | |
| val buildingHeaders = Map[String, BuildingStringMapper]( |
| import play.api.mvc.{Results, SimpleResult, RequestHeader, Filter} | |
| import scala.concurrent.Future | |
| case class BasicAuthFilter() extends Filter { | |
| private[this] val username = "joe" | |
| private[this] val password = "secret" | |
| override def apply(f: (RequestHeader) => Future[SimpleResult])(rh: RequestHeader): Future[SimpleResult] = { | |
| rh.headers.get("Authorization").map { basicAuth => | |
| val (user, pass) = decodeBasicAuth(basicAuth) |
| var power = function (base, exponent) { | |
| if (exponent === 1) { | |
| return base; | |
| } | |
| return base * power(base, exponent - 1); | |
| }; | |
| var fibb = function (n) { | |
| if (n === 0 || n === 1) { | |
| return 1; |
| OpenTsDb Usefull queries | |
| * show all metrics | |
| GET /suggest?type=metrics | |
| * put datapoint | |
| PUT /api/put | |
| { | |
| "timestamp" : 1391952958, |
| package controllers | |
| import play.api._ | |
| import play.api.mvc._ | |
| import play.api.libs.json._ | |
| // you need this import to have combinators | |
| import play.api.libs.functional.syntax._ | |
| object Application extends Controller { | |