This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//download the lib from http://faye.jcoglan.com/download.html | |
var http = require('http'), | |
faye = require('./faye/faye-node.js'); | |
var bayeux = new faye.NodeAdapter({ | |
mount: '/faye', | |
timeout: 45 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def notify(message) | |
msg = JSON.dump('channel' => "/notifications/channel", 'data' => {'text' => message}) | |
uri = URI.parse('http://127.0.0.1:3333/faye') | |
Net::HTTP.post_form(uri, :message => msg) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//have to include http://127.0.0.1:3333/faye.js in the html file | |
var client = new Faye.Client('http://127.0.0.1:3333/faye', { timeout: 120 }); | |
var subscription = client.subscribe('/notifications/channel', function(message) { | |
alert(message.text); | |
}); | |
//or with user_id as a channel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On a back-end side | |
Comet.trigger("some_event", user, {:text => 'hello'}) | |
#on a front-end side | |
Badgeville.bind('some_event', function(data) { | |
console.log("Event handler here"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Badgeville.ready(function(){ | |
Badgeville.Comet.bind( function( event, message ) { | |
console.log('site notification'); | |
console.log( message ); | |
event_handler(message); | |
}); | |
Badgeville.bind( 'siteMessage', function( event, message ) { | |
console.log( message ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Badgeville.ready(function(){ | |
Badgeville.Comet.bind( function( event, message ) { | |
console.log('site notification'); | |
console.log( message ); | |
event_handler(message); | |
}); | |
Badgeville.bind( 'siteMessage', function( event, message ) { | |
console.log( message ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'contents': [ | |
{'content_id' : 1, 'content_url' : 'url'}, | |
{'content_id' : 2, 'content_url' : 'url2'}, | |
], | |
'result' : [existing_array] //something that we return right now | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
-{ | |
-data: { | |
-result: { | |
points: 1 | |
} | |
+activity: { … } | |
rewards: [ ] | |
+user: { … } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
-{ | |
-data: | |
{ | |
+result: { … } | |
+activity: { … } | |
rewards: [ ] | |
+user: { … } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11/10/18 23:28:46 INFO mapred.JobClient: map 0% reduce 0% | |
11/10/18 23:29:10 INFO mapred.JobClient: Task Id : attempt_201110180937_0045_m_000000_0, Status : FAILED | |
Error: java.lang.InstantiationError: org.bson.BSONDecoder | |
at com.mongodb.hadoop.io.BSONWritable.readFields(BSONWritable.java:167) | |
at org.apache.hadoop.io.WritableComparator.compare(WritableComparator.java:97) | |
at com.mongodb.hadoop.io.BSONComparator.compare(BSONComparator.java:41) | |
at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.compare(MapTask.java:1110) | |
at org.apache.hadoop.util.QuickSort.fix(QuickSort.java:30) | |
at org.apache.hadoop.util.QuickSort.sortInternal(QuickSort.java:83) | |
at org.apache.hadoop.util.QuickSort.sort(QuickSort.java:59) |
OlderNewer