(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.
| #pragma clang diagnostic ignored "-Wold-style-cast" | |
| { | |
| "schema": { | |
| "type": "struct", | |
| "fields": [{ | |
| "type": "int32", | |
| "optional": true, | |
| "field": "c1" | |
| }, { | |
| "type": "string", | |
| "optional": true, |
(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.
| Producer | |
| Setup | |
| bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1 | |
| bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3 | |
| Single thread, no replication | |
| bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196 |
| import net.liftweb.common._ | |
| import net.liftweb.http.LiftRules._ | |
| import net.liftweb.http.rest.RestHelper | |
| import net.liftweb.http.{S, JsonResponse, LiftResponse, Req} | |
| import net.liftweb.json.JsonDSL._ | |
| import scala.concurrent.duration.Duration | |
| object RateLimit { | |
| public class CorsHeadersFilter implements Filter { | |
| @Override | |
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { | |
| if (response instanceof HttpServletResponse) { | |
| HttpServletResponse httpServletResponse = (HttpServletResponse) response; | |
| HttpServletRequest httpServletRequest = (HttpServletRequest) request; | |
| httpServletResponse.addHeader("Access-Control-Allow-Origin", "http://127.0.0.1:3030"); | |
| httpServletResponse.addHeader("Access-Control-Allow-Credentials", "true"); | |
| httpServletResponse.addHeader("Access-Control-Expose-Headers", "true"); |
| /* | |
| Before running, install express by running | |
| npm install express | |
| and run with: | |
| node absurd_rest_service.js | |
| in this script's directory. |
| import java.util.concurrent.CountDownLatch; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.LinkedBlockingQueue; | |
| import java.util.concurrent.ThreadPoolExecutor; | |
| import java.util.concurrent.TimeUnit; | |
| import java.util.concurrent.atomic.AtomicReference; | |
| public class CallbackB { | |
| /** |
| import java.util.concurrent.Callable; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.Future; | |
| import java.util.concurrent.LinkedBlockingQueue; | |
| import java.util.concurrent.ThreadPoolExecutor; | |
| import java.util.concurrent.TimeUnit; | |
| public class FuturesA { | |
| public static void run() throws Exception { |
| package recfun | |
| import scala.collection.mutable.ListBuffer | |
| import common._ | |
| /** https://class.coursera.org/progfun-2012-001/assignment/view?assignment_id=4 */ | |
| object Main { | |
| def main(args: Array[String]) { | |
| println("Pascal's Triangle") | |
| for (row <- 0 to 10) { |