(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # Licence : AGPLv3+ | |
| # rule:[Privacy] | |
| if anyof ( | |
| address :is :domain "From" "gmail.com", | |
| address :is :domain "From" "live.com", | |
| address :is :domain "From" "msn.com", | |
| address :is :domain "From" "hotmail.com", | |
| address :is :domain "From" "hotmail.fr", | |
| address :is :domain "From" "yahoo.com", | |
| address :is :domain "From" "yahoo.fr" |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| [alias] | |
| standup = log --all --since yesterday --oneline --author <your_firstname> |
| #!/bin/bash | |
| # bash generate random alphanumeric string | |
| # | |
| # bash generate random 32 character alphanumeric string (upper and lowercase) and | |
| NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| # bash generate random 32 character alphanumeric string (lowercase only) | |
| cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
One of the goals of Play2 architecture is to provide a programming model for what is called Realtime Web Applications.
Realtime Web Applications are applications that make use of Websockets, Server Sent Events, Comet or other protocols offering/simulating an open socket between the browser and the server for continuous communication. Basically, these applications let users work with information as it is published - without having to periodically ping the service.
There are quite a few web frameworks that target the development of this type of application: but usually the solution is to simply provide an API that allows developers to push/receive messages from/to an open channel, something like:
If your csv doesn't contain escaped newlines then it is pretty easy to do a progressive parsing without putting the whole file into memory. The iteratee library comes with a method search inside play.api.libs.iteratee.Parsing :
def search (needle: Array[Byte]): Enumeratee[Array[Byte], MatchInfo[Array[Byte]]]which will partition your stream into Matched[Array[Byte]] and Unmatched[Array[Byte]]
Then you can combine a first iteratee that takes a header and another that will fold into the umatched results. This should look like the following code:
// break at each match and concat unmatches and drop the last received element (the match)| # --- !Ups | |
| CREATE TABLE users( | |
| email VARCHAR(255) NOT NULL PRIMARY KEY, | |
| name VARCHAR(255) | |
| ); | |
| CREATE TABLE subjects( | |
| id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| title LONGTEXT NOT NULL, |
| // © 2012 Viktor Klang | |
| import akka.dispatch.ExecutionContext | |
| import javax.swing.SwingUtilities | |
| import java.util.concurrent.Executor | |
| // | |
| object SwingExecutionContext { | |
| implicit val swingExecutionContext: ExecutionContext = ExecutionContext.fromExecutor(new Executor { | |
| def execute(command: Runnable): Unit = SwingUtilities invokeLater command |
| // ©2012 Viktor Klang | |
| package akka.klang | |
| import akka.dispatch.{ DispatcherPrerequisites, ExecutorServiceFactory, ExecutorServiceConfigurator } | |
| import com.typesafe.config.Config | |
| import java.util.concurrent.{ ExecutorService, AbstractExecutorService, ThreadFactory, TimeUnit } | |
| import java.util.Collections | |
| import javax.swing.SwingUtilities |
| /* | |
| Copyright 2012-2021 Viktor Klang | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |