Skip to content

Instantly share code, notes, and snippets.

2026 MLS Roster Composition
A Major League Soccer club's active roster is comprised of up to 30 players. All 30 players are eligible for selection to the game-day squad during the regular season and playoffs.
In addition to the Salary Budget, each MLS club may spend additional funds on player compensation including money from a League-wide allocation pool (General Allocation Money), discretionary amounts of Targeted Allocation Money, the cost of Designated Players outside the Salary Budget, the cost of U22 Initiative Slots outside the Salary Budget, and money spent on the Supplemental Roster (roster slots 21-31).
Senior Roster
Up to 20 players, occupying roster slots 1-20, count against the club's 2026 Salary Budget of $6,425,000 and are referred to collectively as the club's Senior Roster.
Clubs are not required to fill roster slots 19 and 20, and clubs may spread their entire Salary Budget across 18 Senior Roster Players. A minimum Salary Budget Charge will be imputed against a club's Salary Budget
@longcao
longcao / SparkCopyPostgres.scala
Last active September 11, 2024 18:55
COPY Spark DataFrame rows to PostgreSQL (via JDBC)
import java.io.InputStream
import org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils
import org.apache.spark.sql.{ DataFrame, Row }
import org.postgresql.copy.CopyManager
import org.postgresql.core.BaseConnection
val jdbcUrl = s"jdbc:postgresql://..." // db credentials elided
val connectionProperties = {
@longcao
longcao / words.scala
Created May 9, 2016 03:27
i did a bad
/**
* Intersperses words with spaces and trims ends, accounts for basic smilies.
*/
def wordsToSentence(words: Vector[String]): String = {
val punctuation = Set(":", ";", ".", ",", "!", "?")
val smilies = Set(":)", ":(", ":<", ":}", ":|", ":o")
// @TODO really bad implementation probably, clean this up later
words.zipWithIndex.foldLeft("") { case (acc, (word, i)) =>
val isLastWordPairSmilie = if (words.isDefinedAt(i - 1)) {
@longcao
longcao / problems.md
Created December 20, 2015 23:29
sample scala problems to cover in cats docs?
  1. Handling stacked monads and the like e.g. List[Option[T]], `Future[Option[T]``
  2. Referentially transparent error handling
  3. Error accumulation/'parallel' validation
  4. Adding together Option[T]s (a la http://stackoverflow.com/a/16319667, not sure how to word this well)
  5. More explicitly typesafe collections (e.g. non-empty, guarantee that list.head never throws, etc)
@longcao
longcao / Server.scala
Created December 20, 2013 07:24
Server source code.
import akka.actor._
object Server extends App {
val system = ActorSystem("serverSystem")
val serverActor = system.actorOf(Props(new ServerActor), name = "ServerActor")
}
class ServerActor extends Actor {
def receive = {
case message: String =>
@longcao
longcao / Client.scala
Last active December 31, 2015 22:09
Client source code.
import akka.actor._
object Client extends App {
val system = ActorSystem("clientSystem")
val clientActor = system.actorOf(Props(new ClientActor), name = "ClientActor")
clientActor ! SayHello
}
class ClientActor extends Actor {
@longcao
longcao / client.conf
Last active December 31, 2015 22:08
client and server conf
# 'client' conf
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 2553
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.2.3",
"com.typesafe.akka" %% "akka-remote" % "2.2.3"
)