Photo error on foursquare API [duplicate] - foursquare

This question already has answers here:
Foursquare API for venue user image error
(4 answers)
Closed 3 years ago.
2 or 3 weeks ago, I had a app which use the photo of a connected foursquare user. I've tested it again today, and looks like the API has changed. I use the endpoint
https://api.foursquare.com/v2/users/
Now, the photo attribute in json contains to json attribute : prefix and suffix.
Here's my problem : when I try to concatenate these strings, I got a "internal server error".
You can try it here :
https://irs0.4sqi.net/img/user/TLBKJFDZJ504Y5DO.jpg
Is it a bug, or am I do it in the wrong way ?
Thanks !

For quick reference, add size in between:
prefix + SIZE + suffix
Eg. https://irs0.4sqi.net/img/user/100x100/TLBKJFDZJ504Y5DO.jpg
For sizes see https://developer.foursquare.com/docs/responses/photo

Related

Two different return values mongoose.deleteOne?

Good morning.
I'm working on a back-end project, and I use NodeJS with mongoose.
I found two different return values for deleteOne() on the web :
{n, ok, deletedCount}
{acknowledged, deletedCount}
Here are the sources :
https://kb.objectrocket.com/mongo-db/mongoose-deleteone-922
https://www.mongodb.com/docs/manual/reference/method/db.collection.deleteOne/#examples
In my project, I had a return value equal to {acknowledged: true, deletedCount: 1} and I could not find a way to reproduce the {n, ok, deletedCount}.
What is the difference between the two patterns ?
Thanks in advance !
Elias.
I would think this has something to do with the version of the MongoDB. The first example is a forum post from 3 years ago and the second example is the newest docs.

The ampersand (&) character is not allowed [duplicate]

This question already has an answer here:
Parse error near `&' while setting Heroku config vars
(1 answer)
Closed 1 year ago.
I'm trying to add my environment variables for an app through the console and one of those is the database link. It contains an & in it and I don't know how to fix that.
I saw somewhere to try and add "", '' or (slash, I'm new to stack overflow don't mind it)"" but it didn't work. What can I do about it?
If by "database link" you meant some sort of DB URL, for example mysql://... then it got to be urlencoded.
So replace & with %26

How can i get my python program to get answers from google?

so, im programming a python AI and im trying to make it as similar as JARVIS from iron man. its going great, but i want to do the following:
So, if you go now and search for "How did Gorge Harrison die?", google will show "Lung Cancer", followed by other websites. I want the AI, when asked this questions, to go to google and store the answer in a variable.
I want to store it in a variable because i am using the os module and i am using it to make the AI talk(os.system("spd-say 'hello'") or os.system("spd-say '" + variable + "'"))
Use the requests module to construct an http request then parse the json that comes back.

Shell script for searching a string and store it in a file [duplicate]

This question already has answers here:
Parsing JSON with Unix tools
(45 answers)
Closed 7 years ago.
I have a JSON response file of JIRA issues. I need to extract the JIRA issue key from it and store it in a variable. Below is the sample response file in which the JIRA issue key is CIJ-4
{"expand":"schema,names","startAt":0,"maxResults":50,"total":2,"issues":[{"expand":"operations,editmeta,changelog,transitions,renderedFields","id":"10100","self":"http://localhost:7080/rest/api/2/issue/10100","key":"CIJ-4","fields":{"issuetype":{"self":"http://localhost:7080/rest/api/2/issuetype/1","id":"1","description":"A problem which impairs or prevents the functions of the product.","iconUrl":"http://localhost:7080/images/icons/issuetypes/bug.png","name":"Bug","subtask":false},"components":[],"timespent":null,"timeoriginalestimate":null,"description":"Creating an issue via REST API","project":{"self":"http://localhost:7080/rest/api/2/project/10000","id":"10000","key":"CIJ","name":"CIJIRA","avatarUrls":{"48x48":"http://localhost:7080/secure/projectavatar?avatarId=10011","24x24":"http://localhost:7080/secure/projectavatar?size=small&avatarId=10011","16x16":"http://localhost:7080/secure/projectavatar?size=xsmall&avatarId=10011","32x32":"http://localhost:7080/secure/projectavatar?size=medium&avatarId=10011"}},"fixVersions":
In my example the request is CIJ-4, but as new requests gets logged in the numbers will increase CIJ-10,CIJ-100,CIJ-1000. So my challenge is how do I extract the exact JIRA issue key?
After I extract the result and store it in a file lets say result.txt, i need to parse the reuslt.txt and everytime there is a CIJ-#, i need to pass CIJ-# as a variable to another script
Simple grep version could be like following:
grep -oE "\"key\":\"CIJ-[0-9]*\"" data.txt | awk -F':' '{print $2}'

How is it possible for a domain name to exist without a TLD? [duplicate]

This question already has answers here:
Uncommon IP notations
(2 answers)
Closed 7 years ago.
For instance, I found this website while going through my Spam folder:
http://0x505d5a7a/index.php
... how? I mean shouldn't this URL not even work?
EDIT: The decimal and octal representations do not (or cannot) work:
http://1348295290/index.php
http://12027255172/index.php
Bad Request
Your browser sent a request that this server could not understand.
But the dotted hex does:
http://0x50.0x5d.0x5a.0x7a/index.php
And so does the dotted octal:
http://0120.0135.0132.0172/index.php
This is a hexadecimal noted IP address so this is a valid url.
My browser directly shows me the IP 80.93.90.122

Resources