##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
| https://mypoi-hack.googlecode.com/svn/trunk/ | |
| Uq7qS2Uy7Ag5 |
##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" |
| def swap (x : Int; y : Int) = { | |
| var a = x; var b =y; | |
| a= a -b; b= b+a; a= b -a; | |
| } | |
| def fibonacci(n : Int) = recursiveFib(n, 1, 0) | |
| def recursiveFib ( n : Int, next : Int, result : Int) : Int = { | |
| n match { |
| object FuncourseWithUncleMartin{ | |
| */ | |
| object Setsss{ | |
| def contains(s: Set, elem: Int): Boolean = s(elem) | |
| def singleton(elem: Int): Set = Set(elem)//(x :Int) => x == elem | |
| def union(s: Set, t: Set): Set = (x : Int) => s(x) || t(x) |
| require 'sinatra' | |
| require 'logger' | |
| log = Logger.new(STDOUT) | |
| log.level = Logger::DEBUG | |
| get '/' do | |
| if params[:q] | |
| log.debug(params[:q]) | |
| sz_q = params[:q].split(": ")[1] |
| class GOL | |
| def initialize | |
| @cells = Array.new(10,Array.new(10)) | |
| for i in 0..9 | |
| for j in 0..9 | |
| @cells[i][j] = 0 | |
| end |
| (*s {\bf Anagrams.} The following program finds all the anagrams of a given | |
| set of characters among a dictionary. Such a dictionary can be built by | |
| the following program given a list of files containing words (one per | |
| line). *) | |
| (*s The dictionary is implemented as a \emph{trie}. It is a multi-branching | |
| tree, where branches are labelled with characters. Each node contains | |
| a boolean which says if the word corresponding to the path from the root | |
| belongs to the dictionary. The branches are implemented as maps from | |
| characters to dictionaries. *) |
| package patmat | |
| import common._ | |
| import scala.collection.immutable._ | |
| /** | |
| * Assignment 4: Huffman coding | |
| * | |
| */ | |
| object Huffman { |
| // Instanciate cluster then connect | |
| Cluster cluster =new Cluster.Builder() | |
| .addContactPoints( addr1, addr2) | |
| .build() | |
| Session session = cluster.connect() | |
| session.execute(query) |