Why is my geo coordinate always false? - geolocation

I'm sending a tweet to #JoeMaxiTaxis from my Android phone. The trouble is, the coordinates simply do not show up.
I double checked that GPS is enabled and that location is enabled on the Twitter app.
Here is the response I get on the server:
{ in_reply_to_status_id_str: null,
contributors: null,
place: null,
in_reply_to_screen_name: 'JoeMaxiTaxis',
text: '#joemaxitaxis lll',
favorited: false,
in_reply_to_user_id_str: '634579476',
coordinates: null,
geo: null,
retweet_count: 0,
created_at: 'Fri Jul 13 22:13:01 +0000 2012',
source: 'Twitter for Android',
in_reply_to_user_id: 634579476,
in_reply_to_status_id: null,
retweeted: false,
id_str: '223902880527167488',
truncated: false,
user:
{ favourites_count: 0,
friends_count: 0,
profile_background_color: 'C0DEED',
following: null,
profile_background_tile: false,
profile_background_image_url_https: 'https://si0.twimg.com/images/themes/theme1/bg.png',
followers_count: 0,
profile_image_url: 'http://a0.twimg.com/sticky/default_profile_images/default_profile_0_normal.png',
contributors_enabled: false,
geo_enabled: true,
created_at: 'Wed Jul 07 16:19:53 +0000 2010',
profile_sidebar_fill_color: 'DDEEF6',
description: '',
listed_count: 0,
follow_request_sent: null,
time_zone: 'Dublin',
url: null,
verified: false,
profile_sidebar_border_color: 'C0DEED',
default_profile: true,
show_all_inline_media: false,
is_translator: false,
notifications: null,
profile_use_background_image: true,
protected: false,
profile_image_url_https: 'https://si0.twimg.com/sticky/default_profile_images/default_profile_0_normal.png',
location: 'Dublin, Ireland',
id_str: '163924257',
profile_text_color: '333333',
name: 'Eamonn Hynes',
statuses_count: 6,
profile_background_image_url: 'http://a0.twimg.com/images/themes/theme1/bg.png',
id: 163924257,
default_profile_image: true,
lang: 'en',
utc_offset: 0,
profile_link_color: '0084B4',
screen_name: 'rainbowcabs' },
id: 223902880527167500,
entities: { user_mentions: [ [Object] ], urls: [], hashtags: [] } }
Can anyone offer any insight?

Does your HTTP request get the long and the lat parameters that contains your GPS coordinates (longitude and latitude) ? Whatever your app does with the GPS, if Twitter does not got both long and lat parameters and if you are not "geo enabled", Twitter will not be able to return you the location with the rest of the written tweet.

Related

Can't attach a message for transaction in Waves bitcoin by package #waves/waves-transactions

I try to create transaction on Testnet Waves blockchain with short message, I use attachment as a string according to documentation, but I receive a error, that attachment is Object. I see in result of "transfer" function that attachment is not a string it is object: { type: 'string', value: '2XTb5rrCf5d1zJkj2jZGjQaA4NPV' }, but I can't do anything with that, and in the end i have the same error.
P.s.: without attachment this part of code is work fine.
const { transfer, broadcast } = require("#waves/waves-transactions");
const nodeUrl = "https://nodes-testnet.wavesnodes.com";
const privateKey = "...realPrivateKey...";
const signedTranserTx = transfer(
{
amount: 1,
recipient: "3MqfoN68Gj3Eqc9C7pHLqbYvd5k2hovSkgi",
attachment: "2XTb5rrCf5d1zJkj2jZGjQaA4NPV"
}
, {privateKey: privateKey}
);
broadcast( signedTranserTx, nodeUrl)
.then(resp => console.log(resp))
.catch(err => console.error(err));
Output of signedTranserTx =
{
type: 4,
version: 3,
senderPublicKey: 'He58mC5hQHjQtx6sKcq7MVaeTc6Je9wJthp2P8m7fUXU',
assetId: null,
recipient: '3MqfoN68Gj3Eqc9C7pHLqbYvd5k2hovSkgi',
amount: 1,
**attachment: { type: 'string', value: '2XTb5rrCf5d1zJkj2jZGjQaA4NPV' },**
fee: 100000,
feeAssetId: null,
timestamp: 1602355529316,
proofs: [
'fLmLYr2D1YMLogLtne4NW4YUiB6GufqsfmEjWGqeGS7R56DrB9mXGYDsfQngMGV3EPDwgsh5zNgiv971KezF5AG'
],
chainId: 84,
id: 'Hw55x7FTuYsPUtuczrdRaJ2kqDCVUgxPuoxndajmeC3C'
}
Error request:
{
error: 1,
message: 'failed to parse json message',
cause: null,
validationErrors: { 'obj.attachment': [ [Object] ] }
}
i add type and version attribute to transaction, but change version of transaction from 3 to 2 and now its work. But i didn`t find any information about in documentation.
const signedTranserTx = transfer(
{
type: 4,
version: 2,
amount: 10000,
recipient: "3MqfoN68Gj3Eqc9C7pHLqbYvd5k2hovSkgi",
attachment: codedAttachment
}
, {privateKey: privateKey}
);

Fetch twin from Azure device sdk

I need to just get the twin of a device using the Azure device sdk for node.js.
I did used the Client clode as below:-
import { Client } from 'azure-iot-device';
import { Mqtt } from 'azure-iot-device-mqtt';
await client.setOptions(options);
await client.open();
const twin = await client.getTwin();
The issue is the twin returned doesn't have the device twin fields but other fields like below:-
{
_events: [Object: null prototype] { newListener: [Function: bound ] },
_eventsCount: 1,
_maxListeners: undefined,
_transport: Mqtt {
_events: [Object: null prototype] {
error: [Function],
connected: [Function],
disconnect: [Array],
message: [Function],
twinDesiredPropertiesUpdate: [Function: bound ]
},
_eventsCount: 5,
_maxListeners: undefined,
_mid: '',
_firstConnection: false,
_authenticationProvider: X509AuthenticationProvider { type: 0, _credentials: [Object] },
_mqtt: MqttBase {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
mqttProvider: [Object],
_onTheWirePublishes: [OnTheWireMessageContainer],
_fsm: [constructor],
_options: [Object],
_config: [Object],
_mqttClient: [MqttClient],
[Symbol(kCapture)]: false
},
_twinClient: MqttTwinClient {
_events: [Object: null prototype],
_eventsCount: 1,
_maxListeners: undefined,
_pendingTwinRequests: {},
_mqtt: [MqttBase],
_topicFsm: [BehavioralFsm],
_responseTopic: [Object],
_desiredPropertiesUpdatesTopic: [Object],
[Symbol(kCapture)]: false
},
_fsm: constructor {
initialState: 'disconnected',
states: [Object],
eventListeners: [Object],
namespace: 'fsm.2',
useSafeEmit: false,
hierarchy: {},
pendingDelegations: {},
_stamped: true,
inputQueue: [],
targetReplayState: 'connected',
state: 'connected',
priorState: 'connecting',
priorAction: 'connected.getTwin',
currentAction: '',
currentActionArgs: undefined,
inExitHandler: false
},
_topicTelemetryPublish: 'devices/amidha/messages/events/',
_topics: { method: [Object], message: [Object] },
_userAgentString: 'azure-iot-device/1.17.1 (node v12.18.0; Ubuntu 18.04; x64)',
[Symbol(kCapture)]: false
},
_retryPolicy: ExponentialBackOffWithJitter {
_errorFilter: DefaultErrorFilter {
ArgumentError: false,
ArgumentOutOfRangeError: false,
DeviceMaximumQueueDepthExceededError: false,
DeviceNotFoundError: false,
FormatError: false,
UnauthorizedError: false,
NotImplementedError: false,
NotConnectedError: true,
IotHubQuotaExceededError: false,
MessageTooLargeError: false,
InternalServerError: true,
ServiceUnavailableError: true,
IotHubNotFoundError: false,
IoTHubSuspendedError: false,
JobNotFoundError: false,
TooManyDevicesError: false,
ThrottlingError: true,
DeviceAlreadyExistsError: false,
DeviceMessageLockLostError: false,
InvalidEtagError: false,
InvalidOperationError: false,
PreconditionFailedError: false,
TimeoutError: true,
BadDeviceResponseError: false,
GatewayTimeoutError: false,
DeviceTimeoutError: false,
TwinRequestError: false
},
immediateFirstRetry: true,
normalParameters: ExponentialBackoffWithJitterParameters {
c: 100,
cMin: 100,
cMax: 10000,
ju: 0.25,
jd: 0.5
},
throttledParameters: ExponentialBackoffWithJitterParameters {
c: 5000,
cMin: 10000,
cMax: 60000,
ju: 0.25,
jd: 0.5
}
},
_maxOperationTimeout: 240000,
desiredPropertiesUpdatesEnabled: false,
properties: {
reported: { update: [Function: update], '$version': 1 },
desired: { '$version': 1 }
},
[Symbol(kCapture)]: false
}
I don't want to listen the twin change events that I can do easily by using above object using twin.on. I need to just get the current twin of the device. Is it possible?
After reading your comments it seems you are expecting some values to be there that just aren't available to the device (when you use the device SDK). The device can read and receive updates on desired properties and read/write to reported properties, the rest is unavailable.
In a comment, you mentioned you want to find the deviceScope in the twin, but that isn't available to the device SDK. You would need the service SDK for that.
When you print the result of const twin = await client.getTwin();, what you see is an object with helper methods to subscribe to desired property changes and patching new reported properties. Like Mark stated in his question, the properties of your twin are included in this object as well.
The current twin is in the JSON you posted. See the section properties:
properties: {
reported: { update: [Function: update], '$version': 1 },
desired: { '$version': 1 }
},
The twin you posted is empty.
Above is not feasible to get the whole twin not just the desired and reported properties from device IoT sdk and that has been confirmed by Azure too. Check here.
The link also has a solution to assign parent child relationship between the leaf and the edge device.

Fetching caller location (city/country) from historical Twilio call logs

I currently receive data from each call to a Twilio number that contains info like this:
{
"Called": "+xxxxxxxx",
"ToState": "CA",
"CallerCountry": "US",
"Direction": "inbound",
"Timestamp": "Sat, 25 Aug 2018 00:01:46 +0000",
"CallbackSource": "call-progress-events",
"CallerState": "CA",
"ToZip": "92111",
"SequenceNumber": "0",
"To": "+1xxxxxx",
"CallSid": "xxxxxxxxxxxxx",
"ToCountry": "US",
"CallerZip": "92117",
"CalledZip": "92111",
"ApiVersion": "2010-04-01",
"CallStatus": "completed",
"CalledCity": "SAN DIEGO",
"Duration": "1",
"From": "+1xxxxxxxxxx",
"CallDuration": "10",
"AccountSid": "xxxxxxxxxxxxx",
"CalledCountry": "US",
"CallerCity": "POWAY",
"ToCity": "SAN DIEGO",
"FromCountry": "US",
"Caller": "+1xxxxxxxxxxx",
"FromCity": "POWAY",
"CalledState": "CA",
"FromZip": "92117",
"FromState": "CA",
}
This is provided at the end of each call to my server. However I need to fetch historical data to reconcile some missing info so I attempted to use the call log api as:
const calls = await twilio.calls.list()
This returns a different type of structure:
CallInstance {
accountSid: 'xxxxxxxxxx',
annotation: null,
answeredBy: null,
apiVersion: '2010-04-01',
callerName: null,
dateCreated: 2018-08-29T17:20:51.000Z,
dateUpdated: 2018-08-29T17:21:52.000Z,
direction: 'inbound',
duration: '61',
endTime: 2018-08-29T17:21:52.000Z,
forwardedFrom: '+xxxxxxxxxx',
from: '+xxxxxxxxxx',
fromFormatted: 'xxxxxxxxxx,
groupSid: null,
parentCallSid: null,
phoneNumberSid: 'xxxxxxxxxx',
price: -0.017,
priceUnit: 'USD',
sid: 'xxxxxxxxxx',
startTime: 2018-08-29T17:20:51.000Z,
status: 'completed',
subresourceUris:
{ notifications:
'/2010-04-01/Accounts/xxxxxxxxxx/Calls/xxxxxxxxxx/Notifications.json',
recordings:
'/2010-04-01/Accounts/xxxxxxxxxx/Calls/xxxxxxxxxx/Recordings.json' },
to: '+17603137608',
toFormatted: '(760) 313-7608',
uri:
'/2010-04-01/Accounts/xxxxxxxxxx/Calls/xxxxxxxxxx.json'
}
However this has no caller location data such as the city/country. Is there another API call to get the location data or am I left to my own devices by analyzing the phone number?
So after diving into it it doesn't appear to be possible. I ended up using something like the Google phone lib to analyze the number and return country.

FullCalendar not displaying in wanted timezone

Using fullCalendar I am not able to get it to display in a different timezone. I am in pacific timezone, but I want to see the events as if I was on New York. I have also tried to pass the dates in with the offset (2014-11-20T13:33:00-0800). No matter what, they display as pacific time zone. What am I doing wrong?
$(document).ready(function () {
var dt = "2014-11-20";
var tz = "America/New_York";
//Call the fullCallendar method. You can replace the '#calendar' with the ID of the dom element where you want the calendar to go.
$('#calendar').fullCalendar({
header: {
//left: 'prev,next today',
left: '',
center: 'title',
right: ''
//right: 'month,agendaWeek,agendaDay'
},
editable: false,
defaultDate: dt,
timezone: tz,
defaultView: 'agendaDay',
allDaySlot: false,
events: [
//At run time, this APEX Repeat will reneder the array elements for the events array
{
title: "New Photo Shoot",
start: '2014-11-20T13:27:00',
end: '2014-11-20T14:27:00',
url: '',
allDay: false,
className: 'event-personal'
}, {
title: "GMB/Calendar Test 4 - Initial Photo Shoot",
start: '2014-11-20T11:00:00',
end: '2014-11-20T13:00:00',
url: '/00UJ00000081xpZMAQ',
allDay: false,
className: 'event-birthday'
}, {
title: "GMB/Calendar Test 4 - Initial Photo Shoot",
start: '2014-11-20T10:36:00',
end: '2014-11-20T12:36:00',
url: '/00UJ00000081xptMAA',
allDay: false,
className: 'event-birthday'
}, ]
});
});

Getting image from google api

{
geometry:
{
location:
{
lat: 20.012256,
lng: 73.761541
}
},
icon: "http://maps.gstatic.com/mapfiles/place_api/icons/fitness-71.png",
id: "3e59d6a764e44c969e632c659e0d4284e7bd2561",
name: "AYURVEDIC PANCHKARMA & GARBHASANSKAR",
photos: [
{
height: 1024,
html_attributions: ["From a Google User"],
photo_reference: "CpQBjQAAAIn74syEAB4wtDfRxQqHrEuETcQYYJ2PgAy-uCtQ5UjSsfmWhGLvij6zL4rdHCEUSHOvKOyyhcOO7N-i-mcYpAjZKMNgbfNEaBNWPPRl6MTRf3BHb8DZ8i8bO-F3-IVF5kEvo4-8GQwDGsvNiIXdmkyTi0ugzo0Tj3K9Zicy-cakr25sgy8Mp-UeBqyPABv_AhIQIJzI11nBcIQWVHPBnSVMihoU69ou9PsrnIrvldruNVJma9EGnRU",
width: 768
}
],
place_id: "ChIJmx2FRZDr3TsRgNITjVbXAyU",
reference: "CpQBhQAAAH6wIR1m39e0NaDGqSvFAb6LHjcY3YzZbHJV33RRScqspe4s6NPNpMQZbufkMHhDv7-zhbYriOct-s1jX1Uy_tP4a6cgPboaBITMpgLR_uQO7j-k8ngDgvYuIeU70So0m-RygRMwK5Wsxj-j-dW6UswEIGiyctBvWD_eIW7j1dHh9GfS1YhBGAjDcEZuAOjNARIQOgtBWeqaHi6rPsZgc7g9TBoUBuz5fgZnaIwkGgZP8MiZG97fRl0",
scope: "GOOGLE",
types: [
"gym",
"health",
"establishment"
],
vicinity: "'Anand -Leela', 37, Kamal Society, Near Kusumagraj Pratishtan, Gangapur Road, Na, Nashik"
}
I am using following web service through which i want to access the photo_reference to get the image, API is in JSON format.How can i retrieve the image from photo_reference
Thanks in advance.

Resources