Decoding Stack Trace error - windows-phone-8

I am looking at the crash history and the following appears. Is there a way to identify what is the error or how to resolve? Is there any place where it identifies the error codes?
Exception Type: system.exception
Frame Image Function Offset
0 windows_ni Windows.Phone.Speech.Recognition.SpeechRecognizer..ctor 0x00000001
1 carparkcommon_ni GetMeALot.Helpers.Speech.Initialize 0x00000040
2 getmealot_ni GetMeALot.MainPage+_PhoneApplicationPage_Loaded_d__b.MoveNext 0x0000007e
3 mscorlib_ni System.Runtime.CompilerServices.AsyncMethodBuilderCore._ThrowAsync_b__0 0x00000036
Exception Type: system.argumentoutofrangeexception
Frame Image Function Offset
0 system_core_ni System.Linq.Enumerable.ElementAt[[System.__Canon,_mscorlib]] 0x00000122
1 carparkcommon_ni GetMeALot.Helpers.Speech.Initialize 0x00000128
2 getmealot_ni GetMeALot.MainPage+_PhoneApplicationPage_Loaded_d__b.MoveNext 0x0000007e
3 mscorlib_ni Runtime.CompilerServices.AsyncMethodBuilderCore._ThrowAsync_b__0 0x00000036

It looks to be related to your creation of a new SpeechRecognizer in the Loaded event of the MainPage.

Related

Function - Compilation error. Line 9: no viable alternative at character '{'

I am trying to write a trading strategy in Pine Script, but I am getting a compilation error on line 9. The error message states that there is "no viable alternative at character '{'". I have tried adding the keyword "function" before the function name, but the error still persists. The goal is to have the code look at the volatility of the market with MACD, 200 EMA and overall volume with in an hour to determine a safe amount to invest during that period. Can someone please help me fix this error and make my code compile successfully?
function calcTradeAmount(v) => {
tradeAmount = money * (v / 100)
return tradeAmount
}
If the function works properly my if(long) and if(shorts) should be able to pull a different number each time. I don't want to have 1 trade be the entire portfolio each time.
Sample:
if (long)
tradeAmount = calcTradeAmount(volatility)
entryPrice = low
calcTradeAmount(v) =>
tradeAmount = money * (v / 100)
tradeAmount

Does flatMapMerge cache flows?

I wonder how flatMapMerge works in this code:
fun requestFlow(i: Int): Flow<String> = flow {
emit("$i: First")
delay(500) // wait 500 ms
emit("$i: Second")
}
fun main() = runBlocking<Unit> {
val startTime = System.currentTimeMillis() // remember the start time
(1..3).asFlow().onEach { delay(100) } // a number every 100 ms
.flatMapMerge { requestFlow(it) }
.collect { value -> // collect and print
println("$value at ${System.currentTimeMillis() - startTime} ms from start")
}
}
1: First at 136 ms from start
2: First at 231 ms from start
3: First at 333 ms from start
1: Second at 639 ms from start
2: Second at 732 ms from start
3: Second at 833 ms from start
After requestFlow sleeps for 500 ms, it continues with emit("$i: **Second**"). Looking at the output, I am confused. My questions are
Has flatMapMerge invoked asFlow on (1..3) again. Or
Does it cache the flow of 1..3 somewhere for later use because requestFlow has told it, ' I'm not done yet'
The entire sequence is like this:
1 is emitted from original flow and passed to requestFlow which creates a new flow builder which prints "1: First at..." and then suspends for 500ms.
2 is emitted from original flow and passed to requestFlow which creates a new flow builder which prints "2: First at..." and then suspends for 500ms. (here we have two suspended functions in memory).
3 is emitted from original flow and passed to requestFlow which creates a new flow builder which prints "3: First at..." and then suspends for 500ms. (here we have three suspended functions in memory).
After 500ms from 1st emission, the first suspended function resumes and prints "1: Second at ..."
After 100ms, the second function resumes and prints "2: Second at ..."
After another 100ms, the last suspended function resumes and prints "3: Second at ..."
flatternMapMerge just applies the transformation you provide and returns a Flow<String>. Note that this is not a suspend function and so returns immediately.
Answering your two questions,
No, the asFlow function is not invoked again.
It's not caching the flow, just suspending the functions for 500ms, doing other stuff till then, and resuming from where it left off after the delay is over.

Aurelia repeat.for calling function multiple times

In an attempt to discover some performance issues we are running into with Aurelia on IE 11, I tried to just log a timer in order to track progress made. While doing so, I noticed odd behavior during a repeat.for iteration.
<div repeat.for="i of 100">
<div if.bind="lastElement(item, $last)">${$index}</div>
</div>
with the function and scope
var count = 0;
lastElement(item, last){
count++;
if(last === true){
console.log('Last Item: ' + JSON.stringify(item));
console.log(count);
};
return true;
};
...and with the following result:
Last Item: 99
100
Last Item: 99
169
To me the result should have been:
Last Item: 99
100
For some reason there is multiple iterations or checking on this function. Can somebody explain to me what is going on here?
UPDATE: I was able to find a external file by jdanyho and create a Gist to demonstrate. However, now I'm getting 150 instead of 169. Hmmmm...
The function lastElement its call more times that the number of itens, because you do a bind with function, and in this case aurelia binding system do a dirty checking (has a timer to call the function to see if the value has changed).
To avoid dirty checking you can using the decorator #computedFrom.
In this case for using decorator i think that you cannot performing your function logic based in parameter last, must be doing based in properties.
There are many blog about this topic, but you can read the official post:
http://blog.aurelia.io/2015/04/03/aurelia-adaptive-binding/

Error #2109 half the time

I'm making a platform game in AS3.
Everything is running fine except sometimes (not each time I run the game), I've got this error :
ArgumentError: Error #2109: Frame label null not found in scene null.
at flash.display::MovieClip/gotoAndStop()
at PlatformGame/moveCharacter()[C:\...\PlatformGame.as:581]
at PlatformGame/moveEnemies()[C:\...\PlatformGame.as:360]
at PlatformGame/gameLoop()[C:\...\PlatformGame.as:348]
I don't understand AT ALL why it happens randomly..
Do you know what could be the problem ?
Here's the lines in the error :
line 581 :
char.mc.gotoAndStop(char.walkAnimation[Math.floor(char.animstep)]);
line 360 :
moveCharacter(enemies[i],timeDiff);
line 348 :
moveEnemies(timeDiff);
Thank you for your help,
You ask to 'mc' (contained in 'char') to go to the frame which number
is contained in the array 'walkAnimation' at the index: Math.floor(char.animstep).
The error you have got means that, for some reason, 'Math.floor(char.animstep)' index doesn't exist in the array 'walkAnimation'.
Exactly as if you wrote :
var frame:Array = [1, 2, 3];
gotoAndStop(frame[10]);
frame[0] is 1, frame[1] is 2, frame[2] is 3, but frame[10] is undefined.

Finding out loading time of webelements in a webpage using selenium webdriver

I have a webpage(HTML 5) in which there are 4 charts, each of which taking different time to load once the static content in the page comes up. The Loading is shown in the webpage using a 'rendering' circle image for all the 4 charts. I want to find out how much time each of the charts were showing the 'rendering' circle. Please help me in getting a solution using selenium webdriver.
It is the crude way but it must work.
Create a infinite loop with 1 second wait and in each iteration check if the chart is loaded or not. Once all four charts are loaded or if you have timeout value come out of loop.
In this case there is possibility of error of 1 sec. If your chart is loading fast or want to reduce the margin of error reduce the wait from 1 sec to 100msec.
Pseudo code :[May use this to write better code]
boolean[] chartLoaded = {false,false,false,false};
int[] chartLoadTime = {0,0,0,0};
int counter = 0;
while(counter < 100)
{
counter++;
if(isLoaded(chart1))
{
chartLoaded[0] = true;
chartLoadTime[0]++;
}
//Do this for other three charts also
if(chartLoaded[0] && chartLoaded[1] && chartLoaded[2] && chartLoaded[3])
break;
}