##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 sys | |
import gevent | |
from gevent.monkey import patch_all; patch_all() | |
from gevent import server, event, socket | |
from multiprocessing import Process, current_process, cpu_count | |
""" | |
Simple multiprocess StreamServer that proxies messages between clients. | |
Avoids using a multiprocessing.Event since it blocks on a semaphore. |
var GCM = require('./gcm'); | |
var gcm = new GCM(<YOUR GOOGLE API KEY>); // https://code.google.com/apis/console | |
// create the message | |
var msg = { | |
registration_ids: [token], // this is the device token (phone) | |
collapse_key: "your_collapse_key", // http://developer.android.com/guide/google/gcm/gcm.html#send-msg | |
time_to_live: 180, // just 30 minutes | |
data: { |
from struct import * | |
ofile=open('sz000680.day','rb') | |
buf=ofile.read() | |
ofile.close() | |
ifile=open('sz000680.txt','w') | |
num=len(buf) | |
no=num/32 | |
b=0 | |
e=32 |
import java.lang.Character.{ LETTER_NUMBER => CR,LINE_SEPARATOR => LF } | |
import java.net.InetSocketAddress | |
import java.nio.channels.AsynchronousChannelGroup._ | |
import java.nio.channels.AsynchronousServerSocketChannel._ | |
import java.nio.channels.{ AsynchronousSocketChannel => ASC } | |
import java.nio.channels.CompletionHandler | |
import java.nio.ByteBuffer._ | |
import java.util.concurrent.Executors._ | |
import scala.annotation.implicitNotFound | |
import scala.collection.mutable.ListBuffer |
Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.
Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.
This is the Gossip state representation:
package com.example.mediaplayersurfaceswitch; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.media.MediaPlayer; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.SurfaceHolder; | |
import android.view.SurfaceView; |
This is an example how to perform multi-select faceting in ElasticSearch. | |
Selecting multiple values from the same facet will result in an OR filter between each of the values: | |
(facet1.value1 OR facet1.value2) | |
Faceting on more than one facet will result in an AND filter between each facet: | |
(facet1.value1 OR facet1.value2) AND (facet2.value1) | |
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh). |