##MixedTweets
We will see how to mix 2 twitter searches and push the results to the browser in real time.
First, checkout this mini project
To try it, you need to install Play 2.0
###Controller
##MixedTweets
We will see how to mix 2 twitter searches and push the results to the browser in real time.
First, checkout this mini project
To try it, you need to install Play 2.0
###Controller
import util.matching.Regex | |
object ExtremeStartup { | |
def answer(q: String): Any = { | |
if (q.contains("what is your name")) | |
return "Mikkel" | |
if (q.contains("which city is the Eiffel tower in")) | |
return "Paris" |
import spark.SparkContext | |
import SparkContext._ | |
/** | |
* A port of [[http://blog.echen.me/2012/02/09/movie-recommendations-and-more-via-mapreduce-and-scalding/]] | |
* to Spark. | |
* Uses movie ratings data from MovieLens 100k dataset found at [[http://www.grouplens.org/node/73]] | |
*/ | |
object MovieSimilarities { |
package com.mansur.scalding | |
import com.twitter.scalding._ | |
import org.apache.lucene.search.spell._ | |
import org.apache.mahout.common.distance.TanimotoDistanceMeasure | |
import org.apache.mahout.math.DenseVector | |
import org.apache.commons.math.util.MathUtils | |
/** |
women | jeans | Levi's 512 | 512 Perfectly Slimming Bootcut, Midnight Star Wash jeans | 54.00 | 39.00 | |
---|---|---|---|---|---|---|
women | jeans | Tommy Hilfiger Jeans | Hope Boot Cut, Caroline Original Wash jeans | 69.50 | 54.00 | |
women | jeans | Lauren Jeans Co. Jeans | Slimming Bootcut, Rinse Wash jeans | 80.00 | 65.00 | |
women | jeans | INC International Concepts Jeans | Curvy-Fit Skinny Ankle-Length jeans | 69.00 | 48.99 | |
women | jeans | MICHAEL Michael Kors Jeans | Skinny Colored Denim jeans | 89.50 | 69.99 | |
women | tops | Karen Scott Top | Short-Sleeve Boat-Neck top | 29.00 | 12.99 | |
women | tops | Cable & Gauge Top | Three-Quarter-Sleeve Solid Twist Front top | 24.98 | 19.99 | |
women | tops | Style&co. Top | Long-Sleeve Striped Button-Down Shirt top | 39.98 | 29.99 | |
women | tops | Style&co. Top | Bell-Sleeve Printed Tunic top | 49.98 | 35.99 | |
women | tops | INC International Concepts Top | Short-Sleeve Ruched Tee top | 29.50 | 24.99 |
public synchronized int read() throws IOException { | |
int result = in.read(); | |
if (result != -1) { | |
pos++; | |
} | |
return result; | |
} |
bash-3.2$ elastic-mapreduce --create --name "Sample Recommender" \ | |
> --jar s3n://temp.cascading.org/sample/recommender.jar \ | |
> --arg s3n://temp.cascading.org/sample/en.stop \ | |
> --arg s3n://temp.cascading.org/sample/tweets/ \ | |
> --arg s3n://temp.cascading.org/sample/out/token \ | |
> --arg s3n://temp.cascading.org/sample/out/similarity | |
Created job flow j-2HA2BVCBJGMVX | |
bash-3.2$ elastic-mapreduce --list | |
j-2HA2BVCBJGMVX STARTING Sample Recommender | |
PENDING Example Jar Step |
// This F# dojo is directly inspired by the Digit Recognizer | |
// competition from Kaggle.com: | |
// http://www.kaggle.com/c/digit-recognizer | |
// The datasets below are simply shorter versions of | |
// the training dataset from Kaggle. | |
// 0. Load data files from the following location: | |
// http://brandewinder.blob.core.windows.net/public/digitssample.csv | |
// http://brandewinder.blob.core.windows.net/public/digitscheck.csv |
This is how we create an inclusive/exclusive range of Ints: | |
val ie = 0 until 500 | |
//1. Fill in the missing item to create a range of Ints from 1 to 100 inclusive | |
val ints = 1 ??? 100 | |
//2. Find the sum of the integers in this range |
object TradingDays extends App { | |
import scalaz._ | |
import Scalaz._ | |
case class Trade(sym: String, trader: String, qty: Int) | |
case class TradingDay(symbols: Map[String, SymDay] = Map.empty) | |
object TradingDay { |