HTTP Archive (HAR) TOTAL response size of zero - har

According to HAR 1.2 specification, the response size is calculated as:
var totalSize = entry.response.headersSize + entry.response.bodySize;
But how could the response size be zero (=1273+(-1273)), for example in the following HAR:
"response": {
"status": 200,
"statusText": "OK",
"content": {
"size": 4916,
"mimeType": "application/x-javascript",
"compression": 6189
},
"headersSize": 1273,
"bodySize": -1273
In the specification, there is no negetive value for bodySize other than -1:
bodySize [number] - Size of the received response body in bytes. Set to zero in case of responses coming from the cache (304). Set to -1 if the info is not available.

This is probably a bug on Chromium. There were similar one, in timings section, in the past: https://code.google.com/p/chromium/issues/detail?id=152201
You may open a issue about this one.

Related

Return value of hereAPI router in metres?

We're currently investigating in the HERE Routing API v8 but can't really determine what the actual result consists of when units is set to metric.
Example result:
"summary": {
"duration": 1670,
"length": 12865,
"baseDuration": 1506
},
"transport": {
"mode": "truck"
}
Would the length be in metres perhaps? And what about the duration? Is that in seconds?
Please find the following parameters along with their units of measurement
duration:
required
integer (Duration)
Duration in seconds.
length :
required
integer (Distance) >= 0
Distance in meters. For more information please refer to the following API Reference

Telegram bot api : issue with GIF upload/download size

Faced with issue, when i am trying to send GIF to my bot, but bot can't access to original size of image. Seems like telegram servers converting it to mp4 (it is a good idea, looks fine) and when i trying to download it - it always looks like a thumbnail with maximum 320px of bigger side.
Looks, like it is an api bug, because for example here :
It describes as 600x473px, but real downloaded mp4 size is :
So, trying to understand - where i'm wrong here, as original gif size require for my project needs... Maybe any workaround exists here?
ps. in case of converting gif to mp4 manually with saving quality and size and then submitting to bot - it works awesome, without any additional compression and etc, but it is unacceptable to ask use do it before using bot.
update :
To reproduce (you need you bot/bot_token and also, be able to receive webhook with json) :
1) sending this gif (https://c2n.me/47Y3H37.gif) to the bot via windows 10 telegram client (v2.1.10). Using "send without compression".
Gif size : 600x473, 3.35MB
2) Bot received and Telegram sending webhook :
{
"update_id": 290360893,
"message": {
"message_id": 21,
"from": {
"id": 101483786,
"is_bot": false,
"first_name": "edited",
"last_name": "edited",
"username": "edited",
"language_code": "en"
},
"chat": {
"id": edited,
"first_name": "edited",
"last_name": "edited",
"username": "edited",
"type": "private"
},
"date": 1591962500,
"animation": {
"file_name": "9Ywn9p.gif.mp4",
"mime_type": "video/mp4",
"duration": 4,
"width": 600,
"height": 473,
"thumb": {
"file_id": "AAMCAgADGQEAAxVe42t2MTQQrFMyXbskwWiNkHjm3wACKwgAAtZ-GEtFrAh9bgzTOnpJm5QuAAMBAAdtAAMIgQACGgQ",
"file_unique_id": "AQADekmblC4AAwiBAAI",
"file_size": 15304,
"width": 320,
"height": 252
},
"file_id": "CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA",
"file_unique_id": "AgADKwgAAtZ-GEs",
"file_size": 68253
},
"document": {
"file_name": "9Ywn9p.gif.mp4",
"mime_type": "video/mp4",
"thumb": {
"file_id": "AAMCAgADGQEAAxVe42t2MTQQrFMyXbskwWiNkHjm3wACKwgAAtZ-GEtFrAh9bgzTOnpJm5QuAAMBAAdtAAMIgQACGgQ",
"file_unique_id": "AQADekmblC4AAwiBAAI",
"file_size": 15304,
"width": 320,
"height": 252
},
"file_id": "CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA",
"file_unique_id": "AgADKwgAAtZ-GEs",
"file_size": 68253
}
}
}
, so you can see there, that size is correct, but weight - no, it is only 68253 bytes = 66.65kb, instead of ~3.35MB (some less, because of converting)
3) Get File_id : CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA from this webhook and trying to use it in api by calling GET "https://api.telegram.org/bot{your_bot_token}/getFile?file_id=CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA" and you will receive :
{
"ok": true,
"result": {
"file_id": "CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA",
"file_unique_id": "AgADKwgAAtZ-GEs",
"file_size": 68253,
"file_path": "animations/file_12.mp4"
}
}
4) Downloading file using this file_path :
GET "https://api.telegram.org/file/bot{your_bot_token}/animations/file_12.mp4" and... getting this mp4 file : https://c2n.me/47Y4oAv.mp4 , with loss quality, weight and size (320x252)
But when you are trying to download it from Telegram client - by clicking "save as" - works fine, mp4 with appropriate size/weight. So seems like an api bug...
update#2 : tried to submit it via tfs telegram support, but also, can't login using my phone number... (https://c2n.me/47Yqswl.png). #pavel_durov, could you please fix it all :))
It seems like the only workaround atm is to convert gif to mp4 (yeah, such a frustrating experience) until the issue is fixed.

Adding parameters to the POST Analyze method

https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api/operations/AnalyzeWithCustomModel
In the above documentation there is the following URL which implies you ought to be able to analyze a form for a specific Key value
https://{endpoint}/formrecognizer/v1.0-preview/custom/models/{id}/analyze[?keys]
I have trained a model of my own and when I use the Get Keys method this is what gets returned...
{"clusters":{"0":["House Name","Mobile Number","Name","Phone Number","Postcode","Street","Sumame","Town Name","e-Mail Address (required)"]}}
It seems to me that I ought to be able to execute that post against any one of those key values. So....
https://{endpoint}/formrecognizer/v1.0-preview/custom/models/{id}/analyze?keys=Name
Should pull back whatever the value is associated with the Name key (and there is a value) but instead I get a 200 success and no workable information.
"status": "success",
"pages": [
{
"number": 1,
"height": 756,
"width": 471,
"clusterId": null,
"keyValuePairs": [],
"tables": []
}
],
"errors": []
}
I think I am misunderstanding how to do this properly
Are you able to see the key and an associated value when you try the /analyze call without the query param "keys"?

I am getting error while hitting payUmoney api https://secure.payu.in/_payment'

Iam getting error invalid amount . my request parameters are as follows
var data={
key: 'mHnY4ZVe',
salt: ' OseOWqkht7',
service_provider: 'payu_paisa',
hash: hash,
amount:1,
firstName:'ayushi',
lastName:'gupta',
phone:"989601451",
email:"ayushigupta0294#gmail.com",
productInfo:'car',
surl: 'www.google.com',
furl: 'www.facebook.com',
txnid:txnid
};
check whether they accept amount as '1' or '100' for one rupee or they may have a minimum amount limit, try with Rs 10 or above
In PayU documentation the clearly mentioned below line :
Note: specify prices using the lowest currency unit e.g. in lowest currency unit for PLN, so 1000 is equal to 10 PLN. HUF is the exception – multiply this by 100.
Read this
Below is sample request :
{
"notifyUrl": "https://your.eshop.com/notify",
"customerIp": "127.0.0.1",
"merchantPosId": "145227",
"description": "RTV market",
"currencyCode": "PLN",
"totalAmount": "21000",
"products": [
{
"name": "Wireless mouse",
"unitPrice": "15000",
"quantity": "1"
},
{
"name": "HDMI cable",
"unitPrice": "6000",
"quantity": "1"
}
]
}
you have not passed any currency code etc. They have complete documentation. Just read once. Change your request accordingly

Azure Computer Vision APIs Returns default values

I'm currently using the Computer Vision API to get image dimensions and also to detect color & adult content.
The API returns back the correct metadata containing the width, height, and format, but all the values for Color or Adult Content come back as default values (zeros/null/false/"None").
If it makes any difference, I'm calling the service in US West which is listed as having these features enabled. Also, I specify that I want these features in the request, which is why I receive the objects for these two features.
How do I get this information to be populated accordingly?
Example request I just used with today's Bing image. I'm using the Microsoft.Azure.CognitiveServices.Vision.ComputerVision package from nuget which contains the AnalyzeImageAsync method.
POST https://westus.api.cognitive.microsoft.com/vision/v1.0/analyze?
visualFeatures=Adult%2CColor HTTP/1.1
Ocp-Apim-Subscription-Key: <REMOVED>
User-Agent: FxVersion/4.6.26515.07 Microsoft.Azure.CognitiveServices.Vision.ComputerVision.ComputerVisionAPI/1.1.0.0
x-ms-request-root-id: 5e7823bb-4cac1f594af57fcf
x-ms-request-id: |5e7823bb-4cac1f594af57fcf.2.
Request-Id: |5e7823bb-4cac1f594af57fcf.2.
Content-Type: application/json; charset=utf-8
Content-Length: 129
Host: westus.api.cognitive.microsoft.com
{
"url": "https://outerpulsemedia.blob.core.windows.net/uploads/images/0be893af-9edc-416a-a779-929d2e2d1428-1529100079.jpg"
}
Response:
{
"adult": {
"isAdultContent": false,
"adultScore": 0.0,
"isRacyContent": false,
"racyScore": 0.0
},
"color": {
"dominantColorForeground": "None",
"dominantColorBackground": "None",
"dominantColors": [],
"accentColor": "000000",
"isBwImg": false
},
"requestId": "5b57186d-9976-4af7-97fd-e06b33fb0ecb",
"metadata": {
"height": 1200,
"width": 1920,
"format": "Jpeg"
}
}
The JPEG image is not, strictly speaking, correctly encoded. Specifically the EOI (end of image) marker is missing. The image should end with FF D9, whereas your image is ending simply in FF. This is why the image classifier is returning default values instead of true values.
While a case could be made that either the (a) return response is deceptive, or (b) the API should have returned a 400 Bad Request, it is probably more beneficial for you to try and understand how the image got truncated by a byte.

Resources