On the example http://gmap3.net/issues/contains-failed.html
map.getBounds().contains(marker.getPosition()) failed while the marker is visible,
if i change the map width from 1200px to 800px, it succeed
is it a known issue ?
Regards,
Jean-Baptiste.
With '800px' width, you have these bounds:
(-57.31109738854086, -173.32397500000002), //south west GPS -> sw
(84.67616358203445, 178.23852499999998) //north east GPS -> ne
In '1200px' case:
(-57.31109738854086, 151.51977499999998), //south west GPS -> sw
(84.67616358203445, -146.60522500000002) //north east GPS -> ne
Your marker have (49.00408, 2.562279999999987) coordinates.So for 1st case:
-57.31109738854086 < 49.00408 < 84.67616358203445 //true
-173.32397500000002 < 2.562279999999987 < 178.23852499999998 //true
and for 2nd one:
-57.31109738854086 < 49.00408 < 84.67616358203445 //true
151.51977499999998 < 2.562279999999987 < -146.60522500000002 //false
That is why, you get "No" as an alert in 2nd case, and "Yes" in 1st case.
Related
Am using a Kusto query to create a timechart within Azure AppInsights, to visualize when our webservice is within its SLO (and when it isn't) using one of Google's examples of measuring if a webservice is within its error budget:
SLI = The proportion of sufficiently fast requests, as measured from the load balancer metrics. “Sufficiently fast” is defined as < 400 ms.
SLO = 90% of requests < 400 ms
Measured as:
count of http_requests with a duration less than or equal to "0.4" seconds
divided by count of all http_requests
Assuming 10-minute inspection intervals over a 7-day window, here is my code:
let fastResponseTimeMaxMs = 400.0;
let errorBudgetThresholdForFastResponseTime = 90.0;
//
let startTime = ago(7days);
let endTime = now();
let timeStep = 10m;
//
let timeRange = range InspectionTime from startTime to endTime step timeStep;
timeRange
| extend RespTimeMax_ms = fastResponseTimeMaxMs
| extend ActualCount = toscalar
(
requests
| where timestamp > InspectionTime - timeStep
| where timestamp <= InspectionTime
| where success == "True"
| where duration <= fastResponseTimeMaxMs
| count
)
| extend TotalCount = toscalar
(
requests
| where timestamp > InspectionTime - timeStep
| where timestamp <= InspectionTime
| where success == "True"
| count
)
| extend Percentage = round(todecimal(ActualCount * 100) / todecimal(TotalCount), 2)
| extend ErrorBudgetMinPercent = errorBudgetThresholdForFastResponseTime
| extend InBudget = case(Percentage >= ErrorBudgetMinPercent, 1, 0)
Sample query output of what I wish to achieve:
InspectionTime [UTC] RespTimeMax_ms ActualCount TotalCount Percentage ErrorBudgetMinPercent InBudget
2019-05-23T21:53:17.894 400 8,098 8,138 99.51 90 1
2019-05-23T22:03:17.894 400 8,197 9,184 89.14 90 0
2019-05-23T22:13:17.894 400 8,002 8,555 93.54 90 1
The error I'm getting is:
'where' operator: Failed to resolve scalar expression named 'InspectionTime'
I've tried todatetime(InspectionTime), fails with same error.
Replacing InspectionTime with other objects of type datetime gets this code to execute OK, but not with the datetime values that I want. By example, using this snippet executes OK, when used within my code sample above:
| extend ActualCount = toscalar
(
requests
| where timestamp > startTime // instead of 'InspectionTime - timeStep'
| where timestamp <= endTime // instead of 'InspectionTime'
| where duration <= fastResponseTimeMaxMs
| count
)
To me it seems that using InspectionTime within toscalar(...) is the crux of this problem, since I'm able to use InspectionTime within similar queries using range(...) that don't nest it within toscalar(...).
Note: I don't want a timechart chart of request.duration, since that doesn't tell me if the count of requests above my threshold (400ms) exceed our error budget according to the formula defined above.
your query is invalid as you can't reference the InspectionTime column in the subquery that you're running in toscalar().
if I understand your desired logic correctly, the following query might work or give you a different direction (if not - you may want to share a sample input dataset using the datatable operator, and specify the desired result that matches it)
let fastResponseTimeMaxMs = 400.0;
let errorBudgetThresholdForFastResponseTime = 90.0;
//
let startTime = ago(7days);
let endTime = now();
let timeStep = 10m;
//
requests
| where timestamp > startTime and timestamp < endTime
| where success == 'True'
| summarize TotalCount = count(), ActualCount = countif(duration <= fastResponseTimeMaxMs) by bin(timestamp, timeStep)
| extend Percentage = round(todecimal(ActualCount * 100) / todecimal(TotalCount), 2)
| extend ErrorBudgetMinPercent = errorBudgetThresholdForFastResponseTime
| extend InBudget = case(Percentage >= ErrorBudgetMinPercent, 1, 0)
I need to print a test with 3 parts to a Word document. Part 1-question 1 to question 56. Part2-question 57 to question 66; Part3-question 67-question 100. Part 1 and Part 2 questions are required to be on two columns on paper. For example, questions appear on the first page are following.
1. 7.
2. 8.
3. 9.
4. 10.
5. 11.
6. 12.
I have created code behind and the report PT.rdlc. All questions are showed up nicely on the Word doc except some of the question numbers are dropped off. I can't figure out why. Here are some my codes:
int TRow = Dt.Rows.Count; //TRow = number of rows in Part1 or Part2
for (int RowCount = 0; RowCount < TRow; RowCount++)
{
TDt.Rows.Add(1);
if (RowCount < TRow)
TDt.Rows[TDt.Rows.Count - 1]["ID"] = Dt.Rows[RowCount]["qnum"]; //q1
if RowCount + 6 < TRow
TDt.Rows[TDt.Rows.Count - 1]["TID"] = Dt.Rows[RowCount + 6]["qnum"]; //q7
....
}
I do the same way above for all questions in Part 1 and 2. In the report, I use expressions as following for question numbers.
=iif(Fields!question.Value<>"",Fields!ID.Value & ". ","") and
=iif(Fields!Tquestion.Value<>"",Fields!TID.Value & ". ","")
Can you please help me to identify what is wrong with some question numbers are dropped off? Thank you in advance.
I need help transforming a selected point in the Rotated View back to it's corresponding point in the original Image. So for example if I clicked in the upper left ( 0,0 ) in the rotated view, it should correspond to (0,1280) in the original image.
Extra points for a solution that works regardless of the rotation.
Original Image ( 1920 x 1280 ) Rotated View ( for display on phone )
+----------------------------+ +-----------------+
|(0,0) | |(0,0) | ( 1280 x 1920 )
| | | |
| | | x |
| x | | ( click ) |
| ( what is this point ) | | |
| | | |
| | | |
+----------------------------+ | |
(1920,1280) | |
| |
| |
| |
| |
| |
| |
| |
+-----------------+
(1280,1920)
UPDATED
/*
This is how I build the matrix used to perform the initial rotation from the original to the rotated image. This matrix also includes scaling
Code base: Android/Java
bitmap ( bitmap i'm scaling/rotating )
canvas ( the canvas being drawn to )
Note: bitmap is in landscape mode / canvas is in portrait
*/
Matrix matrix = new Matrix();
float centerX = canvas.getWidth() >> 1;
float centerY = canvas.getHeight() >> 1;
rAngle = 90;
scaleH = ((float) canvas.getHeight()) / bitmap.getWidth();
scaleW = ((float) canvas.getWidth()) / bitmap.getHeight();
scaler.preScale(scaleH, scaleW);
scaler.postRotate(rAngle, centerY, centerX);
float nx = (canvas.getHeight() - canvas.getWidth()) / 2;
scaler.postTranslate(-nx, nx);
canvas.drawBitmap(bitmap,scaler,null);
I'm hardly a math guy, so any hand holding will be appreciated. :)
Subscript O indicates coordinates in the original frame and subscript R in the rotated frame:
XO = YR
YO = maxXR - XR
The four corners of the frame give us:
For top-left in the rotated frame (0,0)
XO = 0
YO = 1279 - 0 = 1279
(0, 1279)
For top-right, (1279, 0):
XO = 0
YO = 1279 - 1279 = 0
(0, 0)
For bottom-left, (0, 1919):
XO = 1919
YO = 1279 - 0 = 1279
(1919, 1279)
For bottom-right, (1279, 1919):
XO = 1919
YO = 1279 - 1279 = 0
(1919, 0)
I want to validate the text within a textbox using a regular expression.
The text should be a number greater than 0 and less than and equal to 1000.
"^[1-9][0-9]*{1,2}$" is the regex you are looking for.
if(Regex.IsMatch(YourTextBox.Text,"^[1-9][0-9]*{1,2}$"))
{
//Write your logic here
}
Try this regex:
//for 0 < x < 1000
^((?<=[1-9])0|[1-9]){1,3}$
explain:
(?<=[1-9])0 //look behind to see if there is digits (1-9)
test:
0 -> invalid
000 -> invalid
45 -> valid
5 -> valid 'Ashwin Singh' solution can not capture this
101 -> valid
999 -> valid
1000 -> invalid
12345 -> invalid
10000 -> invalid
2558 -> invalid
205 -> valid
1001 -> invalid
2000 -> invalid
And better way convert to Decimal (if you dont use regular expression validator):
Decimal dc = Decimal.TryParse(textBox.Text);
if( dc > 0 && dc < 1000)
// do some thing
I found it:
^([1-9]|[1-9][0-9]|[1-9][0-9][0-9])$|^(1000)
I test it in range 0~1000
I am running the AT command AT+KCELL to get cell information and it returns, amongst other things, a PLMN (Public Land and Mobile Network) - the description of this from the documentation is:
PLMN identifiers (3 bytes), made of MCC (Mobile Country Code), and MNC
(Mobile Network Code).
OK, that matches what Wikipedia says - in there is the MCC and MNC. Now what I don't understand is how do I extract the aforementioned MCC and MNC values?
Here is an example. I get back:
32f210
and I am told (though I am sceptical) that that should result in:
MNC: 1
MCC: 232
but I can't for the life of me work out how to get that result from the PLMN so how do I parse this?
Well, I have found this out and figured I would add an answer here in case there is some other unlucky soul who has to do this - the PDF called GSM Technical Specification (section 10.2.4) contains the answer, the relevant bit is:
PLMN Contents: Mobile Country Code (MCC) followed by the Mobile Network Code (MNC). Coding: according to TS GSM 04.08 [14].
If storage
for fewer than the maximum possible number n is required, the excess
bytes shall be set to 'FF'. For instance, using 246 for the MCC and 81
for the MNC and if this is the first and only PLMN, the contents reads
as follows: Bytes 1-3: '42' 'F6' '18' Bytes 4-6: 'FF' 'FF' 'FF' etc.
So I was wrong to be sceptical!
I need to read from the left swapping the digits around so the first two bytes would be the MCC so that would be 232f and the MNC would be 01 then I just discard the f and I have 232 and 1! Glad that one is sorted.
For example, in c# you can do it like this:
string plmn = "whatever the plmn is";
string mcc = new string(plmn.Substring(0, 2).Reverse().ToArray())
+ new string(plmn.Substring(2, 2).Reverse().ToArray())
.Replace('f', ' ')
.Trim();
string mnc = new string(plmn.Substring(4, 2).Reverse().ToArray())
.Replace('f', ' ')
.Trim();
Here is a java answer with bitwise operations:
public static String mcc(byte[] plmnId) {
if (plmnId == null || plmnId.length != 3)
throw new IllegalArgumentException(String.format("Wrong plmnid %s", Arrays.toString(plmnId)));
int a1 = plmnId[0] & 0x0F;
int a2 = (plmnId[0] & 0xF0) >> 4;
int a3 = plmnId[1] & 0x0F;
return "" + a1 + a2 + a3;
}
public static String mnc(byte[] plmnId) {
if (plmnId == null || plmnId.length != 3)
throw new IllegalArgumentException(String.format("Wrong plmnid %s", Arrays.toString(plmnId)));
int a1 = plmnId[2] & 0x0F;
int a2 = (plmnId[2] & 0xF0) >> 4;
int a3 = (plmnId[1] & 0xF0) >> 4;
if (a3 == 15)
return "" + a1 + a2;
else
return "" + a1 + a2 + a3;
}