Exception from Tracker recompute function: Error: Bad index in range.getMember: - meteor

After Meteor Update (not sure from which probably old version), but following re-subscribe with a different livehistory triggers the described error.
Meteor.subscribe("amon", livehistory, type)
Exception from Tracker recompute function: Error: Bad index in range.getMember: 80
at DOMRange.getMember (http://clochette.cow.lu:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:586:11)
at http://clochette.cow.lu:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2572:43
at Object.Tracker.nonreactive (http://clochette.cow.lu:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:513:12)
at Object.eachView.stopHandle.ObserveSequence.observe.changedAt (http://clochette.cow.lu:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2567:17)
at http://clochette.cow.lu:3000/packages/observe-sequence.js?2fd807ea171ead273b9e6458607cb226012d9240:284:21
at Function._.each._.forEach (http://clochette.cow.lu:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:22)
at diffArray (http://clochette.cow.lu:3000/packages/observe-sequence.js?2fd807ea171ead273b9e6458607cb226012d9240:270:5)
at http://clochette.cow.lu:3000/packages/observe-sequence.js?2fd807ea171ead273b9e6458607cb226012d9240:147:9
at Object.Tracker.nonreactive (http://clochette.cow.lu:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:513:12)
at http://clochette.cow.lu:3000/packages/observe-sequence.js?2fd807ea171ead273b9e6458607cb226012d9240:121:15

I do not have the solution, but I too encountered the same error, and was able to solve for my case, so posting it, hoping it helps someone. The cause was use of .length. I had a large array (name of array: data), and to make it short (decrease length of arrray), I was assigning data.length = 5, which was somehow causing the error, and meteor helper did not work as expected. Removing that line worked for me, and I accomplished shortening of array by a for loop, and storing first five elements in a different variable.

For me creating an empty array with fixed size (in a helper) was the culprit:
x = new Array(n).
Replacing it with:
x = Array.apply(null, Array(n)).map(function () {})
solved the issue.
Magic...

When I had this error I was using a "hard-coded" array. The error was caused by an empty array member (two commas to separate objects instead of a single comma). Fixing this resolved the issue. So - check your data.

This may also happen if you remove some element in the middle of an array with delete and later use this array reactively. The problem is related with incremental cycles over the array's elements that may address this recently deleted element. Use splice instead of delete.

Related

difference between 2 syntaxes of the 'reactive' instruction

warning: I'm pretty new to R, sniny and co ==> I don't realize whether this question is interesting.
update : It turns out that it is a shiny question and it seems to be a frequent problem, that is not obvious. Please read all answers, they don't address the same cases.
I have a Data base in DB. Is there a difference between DBtoto <- reactive({DB()}) and DBtoto <- reactive({DB}) ? If so, what is it ?
In fact I don't see what BD() (with parentheses) means.
Yes, there's a difference. DB() is a call to the function named DB. DB is the function itself. If it's not a function, then DB() doesn't make sense, and will trigger a run-time error (unless there's another object somewhere which is a function).
reactive() is a Shiny function, that says the value of its argument may change over time. Usually it would make more sense to think the value of the function call would change, but it's (remotely) possible that the function itself could change.
I also found the first answer of What is “object of type ‘closure’ is not subsettable” error in Shiny? addresses this question. To summary, everything created with 'reactive()' in shiny must be referred as a function.
In my example, if DB was reactive (for instance DB <- reactive(read_DataBase())), then DB() must be referred with parenthesis. For instance, to get the attribute 'x', you must write BD()$x. In my 'DBtoto' example above the first expression holds in the case DB is itself reactive.

LLVM converting a Constant to a Value

I am using custom LLVM pass where if I encounter a store to
where the compiler converts the value to a Constant; e.g. there is an explicit store:
X[gidx] = 10;
Then LLVM will generate this error:
aoc: ../../../Instructions.cpp:1056: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
The inheritance order goes as: Value<-User<-Constant, so this shouldn't be an issue, but it is. Using an a cast on the ConstantInt or ConstantFP has no effect on this error.
So I've tried this bloated solution:
Value *new_value;
if(isa<ConstantInt>(old_value) || isa<ConstantFP>(old_value)){
Instruction *allocInst = builder.CreateAlloca(old_value->getType());
builder.CreateStore(old_value, allocInst);
new_value = builder.CreateLoad(allocResultInst);
}
However this solution creates its own register errors when different type are involved, so I'd like to avoid it.
Does anyone know how to convert a Constant to a Value? It must be a simple issue that I'm not seeing. I'm developing on Ubuntu 12.04, LLVM 3, AMD gpu, OpenCL kernels.
Thanks ahead of time.
EDIT:
The original code that produces the first error listed is simply:
builder.CreateStore(old_value, store_addr);
EDIT2:
This old_value is declared as
Value *old_value = current_instruction->getOperand(0);
So I'm grabbing the value to be stored, in this case "10" from the first code line.
You didn't provide the code that caused this first assertion, but its wording is pretty clear: you are trying to create a store where the value operand and the pointer operand do not agree on their types. It would be useful for the question if you'd provide the code that generated that error.
Your second, so-called "bloated" solution, is the correct way to store old_value into the stack and then load it again. You write:
However this solution creates its own register errors when different type are involved
These "register errors" are the real issue you should be addressing.
In any case, the whole premise of "converting a constant to a value" is flawed - as you have correctly observed, all constants are values. There's no point storing a value into the stack with the sole purpose of loading it again, and indeed the standard LLVM pass "mem2reg" will completely remove such a sequence, replacing all uses of the load with the original value.

Game Maker code error

Now I'm making an endless runner where objects are spawned in front on me randomly.
I was told to make a spawnController and globalController object, so I did. Then this code should be put in the controller under step event
if(tick = 32)
{
tick = 0;
instance_create(room_width,room_height,random(spike,groundBlock));
instance_create(room_width,irandom_range(0,room_height-32));
}
tick += 1;
Is there anything wrong with it because i get an error, which is:
In object spawnController, event Step, action 1 at line 4: Wrong number of arguments to function or script.
instance_create(room_width,irandom_range(0,room_height-32));
The error messages in GM can sometimes be a bit unclear.. But in this case it was pretty clear. It goes about this line. And one of the scripts has too few arguments. Either irandom_range or instance_create you forgot an argument.
irandom_range takes two arguments to make a random number, so that is correct.
instance_create however takes 3 arguments: x,y position and the object from which you wish to create an instance. You're simply missing that argument (and the error tells you that). I think that is a typo as you do it correctly in the creation above.
Manual about instance_create
You have a syntax error here:
instance_create(room_width,irandom_range(0,room_height-32);
There's no closing parentheses or a 3rd argument.
One thing that stood out to me is that you used random instead of choose. Im not sure there is a difference in this situation, but choose allows you to list as many arguments you want.
But the other thing as was pointed out, was that your missing the object you want the 4th life to create. You need to specify what object you want it to make.
instance_create(room_width, irandom_range(0,room_height-32), OBJECT);

what is needed in order to use db.scan ()

I'm trying to get the scan function to work, but it seems i'm missing something: According to the documention this should work:
var iter = new ydn.db.KeyIterator('contact');
db.scan([iter], function(keys, values)
But every time i call the function i get the following error:
Uncaught ydn.error.ArgumentException: Iterator argument must be an array.
A contact sore with the name 'contact' exists and i tried different libraries ydb-db but none of them worked.
Documentation is outdated. It should be:
db.scan(function(keys, values), [iter]
See unit test for it use case.

print out xquery sequence and exit

Is there a way to "die" in execution flow in an xquery file and output a nicely formatted printout of a sequence variable?
I'm trying something like:
return { fn:error(xs:QName("ERROR"), $xml) }
but that doesn't quite seem to work.
Thanks!
Based on your comment (you need it for debugging) I guess you are looking for the fn:trace function, described here http://www.xqueryfunctions.com/xq/fn_trace.html
If you want to abort the execution flow and output an error in your application you should in fact use the XQuery exception handling.
Try something like this, omitting the return if this isn't part of a FLWOR expression.
...
return fn:error((), "DEBUG", $xml)
There's no need for curly braces unless you're enclosing an expression, for example <x>{ current-time() }</x>. The return expression is not enclosed.
With MarkLogic it's best to leave the first parameter of fn:error empty. That way you don't have to worry about a QName, and anyway some folks believe that it's reserved for predefined errors. MarkLogic uses the second parameter to fill in error:code, and the third parameter for data.
For more on fn:error, see http://docs.marklogic.com/fn:error and https://github.com/robwhitby/xray/pull/11

Resources