This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution: | |
| def romanToInt(self, s: str) -> int: | |
| res = 0 | |
| i = 0 | |
| mapping = {'I' : 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} | |
| while i < len(s): | |
| if s[i] == 'I': | |
| if i + 1 < len(s) and s[i+1] == 'V': | |
| res += 4 | |
| i += 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Ch11Phone where | |
| import Data.Char | |
| import Data.List | |
| import Data.Ord | |
| type Digit = Char | |
| type Letters = [Char] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ./bin/run-example SparkPi 10 | |
| ./sbin/start-master.sh | |
| ./bin/spark-class org.apache.spark.deploy.worker.Worker spark://server:port | |
| ./bin/spark-submit --master spark://server:port sparktest.jar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name := "sparkTest" | |
| version := "1.0" | |
| scalaVersion := "2.11.4" | |
| exportJars := true | |
| libraryDependencies ++= Seq ( | |
| "org.apache.spark" % "spark-core_2.11" % "1.4.1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.gmail.spark | |
| import org.apache.spark.{SparkConf, SparkContext} | |
| /** | |
| * Created by rayanral on 08/08/15. | |
| */ | |
| object SparkMain { | |
| def main(args: Array[String]): Unit = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Database extends Schema { | |
| val events: Table[Event] = table[Event]("events") | |
| on(events) { e => | |
| declare { | |
| e.id is autoIncremented | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db.default.driver=org.h2.Driver | |
| db.default.url="jdbc:h2:mem:play" | |
| db.default.user=sa | |
| db.default.password="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # --- !Ups | |
| CREATE TABLE events ( | |
| id long auto_increment, | |
| startDate timestamp, | |
| endDate timestamp, | |
| venue long, | |
| eventType int, | |
| name varchar, | |
| description varchar | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Event(id: Long, startDate: Date, endDate: Date, | |
| venue: Long, eventType: EventType.Value, name: String, description: String) | |
| extends KeyedEntity[Long] | |
| object Event { | |
| import Database._ | |
| def findAll(page: Int) = inTransaction { | |
| val pageLength = 10 |