use downloaded request and display on windows phone - windows-phone-8

So this URLtranslates text: https://inputtools.google.com/request?text=$&itc=$&num=$\
&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test
and returns
a request file which is downloaded when viewed on browser
by using variables
var text = "ca me plait",
itc = "fr-t-i0-und",
num = 10;
Result:
[
"SUCCESS",
[
[
"ca me plait",
[
"ça me plaît"
]
]
]
]
How can I use this and decode and display result on windows phone?

Related

How do I convert labelme json directory to one json file for use in MaskRCNN?

I am attempting to train an object classifier on MaskRCNN and the tutorial I am following uses VGG label software in which converts the labelled data into one JSON file. I have used labelme for my data and need to prepare this for MaskRCNN.
Labelme gives a JSON file for each labelled image in this format:
{ "version": "4.6.0", "flags": {}, "shapes": [
{
"label": "Green",
"points": [
[
1385.6666666666665,
2.121212121212121
],
[
1349.3030303030303,
174.84848484848484
],
[
1400.8181818181818,
296.06060606060606
],
[
1482.6363636363635,
344.5454545454545
],
[
1619.0,
338.48484848484844
],
[
1715.969696969697,
244.54545454545453
],
[
1728.090909090909,
120.30303030303028
],
[
1712.939393939394,
71.81818181818181
],
[
1679.6060606060605,
11.212121212121211
]
],
"group_id": null,
"shape_type": "polygon",
"flags": {}
},
I have a directory of images and corresponding JSON files, any help on what to do to combine. Can't get labelme_json_to_dataset to work and I believe this is the solution ?
you can use lableme2coco.py script in lableme repository under examples\instance_segmentation folder
with this command:
python labelme2coco.py srcfiles destinationfolder --labels labels.txt
it will convert your annotation files in one json file with coco format
srcfiles contains your labels with images in same folder and lables.txt contains your labels

json file into lua table

How is it possible to get the input of an json file:
{ "name": "John",
"work": "chef",
"age": "29",
"messages": [
{
"msg_name": "Hello",
"msg": "how_are_you"
},
{ "second_msg_name": "hi",
"msg": "fine"
}
]
}
into a Lua table? All json.lua scripts I found did not work for JSON with new lines. Does someone know a solution?
So piglets solution works for the string in the same script.
But how does it work with a JSON file?
local json = require("dkjson")
local file = io.open("C:\\Users\\...\\Documents\\Lua_Plugins\\test_file_reader\\test.json", "r")
local myTable = json.decode(file)
print(myTable)
Here then comes the error "bad argument #1 to 'strfind' (string expected, got FILE*)" on. Does someone see my fault?
local json = require("dkjson")
local yourString = [[{ "name": "John",
"work": "chef",
"age": "29",
"messages": [
{
"msg_name": "Hello",
"msg": "how_are_you"
},
{ "second_msg_name": "hi",
"msg": "fine"
}
]
}]]
local myTable = json.decode(yourString)
http://dkolf.de/src/dkjson-lua.fsl/home
I found the solution:
local json = require("dkjson")
local file = io.open("C:\\Users\\...\\Documents\\Lua_Plugins\\test_file_reader\\test.json", "r")
local content = file:read "*a"
file:close()
local myTable = json.decode(content)

Polymer - How to put 2 url to registry -> search

This is the bowerrc file. I want to search in 2 urls for the polymer components. Is it possible to do that? Neither of the url is local.
{
"registry": {
"search": [
"url1",
"url2"
]
},
"strict-ssl" : false,
"resolvers" : [
"bower-art-resolver"
],
}

Accessing str inside JSON

I am trying to solve an issue with the json file that I get from the twitterAPI api.request.
I am trying to extract the links to the media inside of each tweet with this piece of code:
for item in api.request(TWITTER_ENDPOINT, TWITTER_PARAMS):
if 'entities' in item:
if 'media' in item['entities']:
page = item['text']
link = item['entities']['media']['media_url']
elif 'message' in item:
print('ERROR %s: %s\n' % (item['code'], item['message']))
The format of the field in the json file is a str according to the API documentation, and I can print it if I use this:
urls = [user['media_url'] for user in item['entities']['media']]
print(type(urls[0]))
But the problem is that then I have it stored in a list. What would I need to do to create a variable "link" of type string?
The format of the JSON is this:
"entities": {
"hashtags": [],
"symbols": [],
"user_mentions": [],
"urls": [],
"media": [
{
"id": 707667182633619500,
"id_str": "707667182633619456",
"indices": [
23,
46
],
"media_url": "http://pbs.twimg.com/media/CdIjjaAUEAA7-VU.jpg",
I am a beginner in Python, and I would really appreciate a bit of help with this!

PathSegList is deprecated and removed in Chrome 48

In Chrome 48, PathSegList is removed. And as I read in the answers to another question "Alternative for deprecated SVG pathSegList", Chrome is providing a new API, but I guess this new API is not yet available. What is another alternative and how can I use it. I know this is duplicate, but the link I mentioned is not helping me.
You do not need path seg polyfill (pathSeg.js).
With path data polyfill, you can edit path data as a common array object.
Use path data polyfill to work with new API. It's recommended.
var path = document.querySelector('path'); //your <path> element
//Be sure you have added the pathdata polyfill to your page before use getPathData
var pathdata = path.getPathData();
console.log(pathdata);
/*
you will get an Array object contains all path data details
like this:
[
{ "type": "M", "values": [ 50, 50 ] },
{ "type": "L", "values": [ 200, 200 ] }
]
*/
//replacement for createSVGPathSegMovetoRel and appendItem
pathdata.push({type:'m', values:[200,100]});
path.setPathData(pathdata);
//replacement for createSVGPathSegMovetoAbs and appendItem
pathdata.push({type:'M', values:[300,120]});
path.setPathData(pathdata);
//replacement for createSVGPathSegLinetoAbs and appendItem
pathdata.push({type:'L', values:[400,120]});
path.setPathData(pathdata);
console.log(path.getAttribute('d'));
//create a new path data array
var pathdata = [
{ "type": "M", "values": [ 50, 50 ] },
{ "type": "L", "values": [ 200, 200 ] }
];
path.setPathData(pathdata);
console.log(path.getAttribute('d'));