Skip to content

Instantly share code, notes, and snippets.

@mrvisser
mrvisser / a.js
Last active February 11, 2024 23:53
Module circular dependency weirdness
var events = require('events');
var b = require('./b');
var emitter = module.exports = new events.EventEmitter();
module.exports.init = function(callback) {
b.init(function() {
emitter.emit('done');
});
};
+sealed trait MyList[+A]
+case class Cons[A](head: A, tail: MyList[A]) extends MyList[A]
+case object Nil extends MyList[Nothing]
// Import the required classes
import org.apache.poi.xssf.usermodel.XSSFWorkbook
import java.io.FileOutputStream
object XSSFMain extends App {
// Automatically convert Java collections to Scala equivalents
import scala.collection.JavaConversions._
root@db0:~# nodetool ring oae
Datacenter: Cassandra
==========
Replicas: 3
Address Rack Status State Load Owns Token
0
10.224.16.92 rack1 Up Normal 27.24 MB 75.00% 85070591730234615865843651857942052864
10.224.16.71 rack1 Up Normal 25.03 MB 75.00% 42535295865117307932921825928971026432
Loading Batch 0
Wed, 08 Jan 2014 15:28:52 GMT: Finished Loading User 0 of 100
An unexpected error occurred.
This principal has no large picture associated with it.
An unexpected error occurred.
This principal has no large picture associated with it.
An unexpected error occurred.
This principal has no large picture associated with it.
An unexpected error occurred.
This principal has no large picture associated with it.
[2014-01-06T17:04:16.874Z] ERROR: oae/12827 on app0: An uncaught exception was raised to the application.
TypeError: Cannot read property 'objectType' of null
at /opt/oae/node_modules/oae-activity/lib/internal/transformer.js:152:48
at Array.forEach (native)
at _getActivityEntitiesByObjectType (/opt/oae/node_modules/oae-activity/lib/internal/transformer.js:151:61)
at /opt/oae/node_modules/oae-activity/lib/internal/transformer.js:36:9
at Array.forEach (native)
at Object.module.exports.transformActivities (/opt/oae/node_modules/oae-activity/lib/internal/transformer.js:34:16)
at /opt/oae/node_modules/oae-activity/lib/api.js:577:29
at /opt/oae/node_modules/oae-activity/lib/internal/dao.js:60:16

Rather than:

callback(new TFramedTransport(frame));

This could be done:

(function(frame) {
var doStuff = function(callback) {
var returnArgs = ['these', 'are', 'my', 'return', 'args'];
// Now I want to invoke `callback` with the `returnArgs`
// callback.apply(XXX, returnArgs) <== What do I replace XXX with to not change the "this" object of the callback?
}
[2013-12-20 09:47:06,782][DEBUG][action.index ] [Awesome Android] [oaetest][0], node[7mS6-4-aT4Wrgv6kB0hSRg], [P], s[STARTED]: Failed to execute [index {[oaetest][resource][_explain], source[
{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"multi_match": {
"fields": [
Application root: /usr/share/puppet/rack/puppetmasterd
Backtrace:
# File Line Location
0 /usr/lib/ruby/vendor_ruby/puppet/util.rb 518 in `exit'
1 /usr/lib/ruby/vendor_ruby/puppet/util.rb 518 in `exit_on_fail'
2 /usr/lib/ruby/vendor_ruby/puppet/application.rb 362 in `run'
3 /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb 132 in `run'
4 /usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb 86 in `execute'
5 config.ru 35