I'm building a website for a client in the transport industry and I'm using the Google Places API to acquire pickup location and destination. One requirement is to display a "Flight Number" field, if the pickup is an airport.
To work out whether an airport is coming back from the Google Maps API, we
look at the location's "type" attribute.
This works for most cases, such as "Brisbane International Airport, Brisbane Airport, Queensland, Australia", but not for some other cases, such as "Brisbane Airport, Queensland, Australia".
Object {address_components: Array[3], adr_address: "<span class="locality">Brisbane Airport</span> <sp…pan>, <span class="country-name">Australia</span>", formatted_address: "Brisbane Airport QLD, Australia", geometry: Object, icon: "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png"…}
address_components: Array[3]
adr_address: "<span class="locality">Brisbane Airport</span> <span class="region">QLD</span>, <span class="country-name">Australia</span>"
formatted_address: "Brisbane Airport QLD, Australia"
geometry: Object
html_attributions: Array[0]
icon: "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png"
id: "80dd327e4dbee8d2ca0dcf65ebfb3c46cb3790ae"
name: "Brisbane Airport"
place_id: "ChIJo9DK_AHik2sR4IHe81qjAgU"
reference: "CpQBggAAACdy4sxtQDDCxp500sBAWHFCjZMLrRvG4X1Qc91zQdupccCLhTDteb5tTtxpPvQM9xVlXlF-mqmr27blvXYxx14w7fZFpi69pq63rk4OKCtnKMzpHXxPeT1j5xmqLEanQi4q09hhJZlwr6sk34PAphv4gxsOWQHB6RE_Zyoipxf43185HF3Sv3t4sw3K2p_9chIQMTmNyjRSLoL02xwqxx_YfRoUzAuVlz_nBa7LHYz1dflI1OZclcM"
scope: "GOOGLE"
types: Array[2]
0: "locality"
1: "political"
length: 2
__proto__: Array[0]
url: "https://maps.google.com/maps/place?q=Brisbane+Airport+QLD,+Australia&ftid=0x6b93e201fccad0a3:0x502a35af3de81e0"
vicinity: "Brisbane Airport"
__proto__: Object
My expectation would be for "airport" to appear in the "types" array for both "Brisbane International Airport, Brisbane Airport, Queensland, Australia" and "Brisbane Airport, Queensland, Australia".
Can anyone tell me why this isn't the case? Is this something to report to Google and get them to fix? If yes, how do I do that, considering the Google Places API (https://groups.google.com/forum/?hl=en#!forum/google-places-api) says I need to ask technical questions here?
ps: its kind of related to this post, but I haven't been able to find the answer in this one.
It's because you're finding a suburb named "Brisbane Airport", not the Brisbane airport.
https://en.wikipedia.org/wiki/Brisbane_Airport_%28suburb%29
If you filter for airport, you can be 99% certain you'll only get airports.
Related
I can't understand why this piece of code suddenly returns internal error.
It was working like a charm, after a while it started to throw the error in header and there is nothing to do.
var courseWork = {
'title': 'Reglamento',
'description': 'Por favor, leer los documentos adjuntos.',
'materials': [
{'link': { 'url': linkDocumento }},
{'link': { 'url': "https://drive.google.com/file/d/1eESDk5HA3vR2IEbV0UglaR0F6UysuEmd/view?usp=sharing" }}
],
'workType': 'ASSIGNMENT',
// 'state': 'DRAFT',
'state': 'PUBLISHED',
'topicId': idTema
};
Classroom.Courses.CourseWork.create(courseWork, passa.idClasse);
Answer from the comments on the question:
Actually the problem was the document I was sharing. As I mentioned before, each month I generate 120 classrooms and in each one I put a document "Course Rules". This document is shared from my Drive account (Sharing rules is "Everyone that has the link can see"). Doing this the system charges to the document the link of each classroom that shares it and, I suppose, there is a limit in the number of links that a document can receive.
With a new copy of the document no more error. The workaround will be to copy the document in the classroom drive folder and share it from there.
I've scoured all four corners of interweb trying to find documentation on how to do this. But my journey has been unsuccessful so far. Part way through the search, I was able to find out how to mention a User (not a bot), and that was even a pain to find. I found that you have to post a field named msteams at the top level of the "any" object parameter which is an object consisting of an entities array. That array is an array of objects. The following use of adaptiveCard works when mentioning a user with the proper values replacing username and userID:
CardFactory.adaptiveCard({
$schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
type: 'AdaptiveCard',
msteams: {
entites: [
{
type: 'mention',
text: '<at>(username)</at>',
mentioned: {
id: <userID>,
name: <username>,
role: 'user'
}
}
]
}
body: [
{
type: 'TextBlock',
text: '<at>(userName)</at>',
}
]
});
The documentation of CardFactory.adaptiveCard just lists the parameter as an any Object and gives a small example not displaying an exhaustive list of fields of this parameter. It also posts a link to the Adaptive Card documentation, but that's what it's abstracting and the fields are not 1:1 (point and case this msteams object that is never referenced in the Adaptive Card documentation from what I can tell). I want to mention the bot itself that is posting this Adaptive Card. I've attempted to replace the mentioned object with the following
{
"id": "a3216960-131c-11eb-xxxx-xxxxxxxxx",
"name": "Bot",
"role": "bot"
}
This is equivalent to the object that I'm using to mention the "from" user in the adaptive card. But this is the recipient. The from user which is successfully mentioned is formatted like the following:
{
"id": "c3370a7c-95f2-4a60-xxxx-xxxxxxxxx",
"name": "User",
"role": "user"
}
Any help/guidance, tips, references would be greatly appreciated!
Currently #mention a bot in Adaptive card is not supported. You can #mention user in Adaptive card.
I'm struggling with linked documents when creating a view.
A salesperson has multiple clients, each client has multiple
purchases.
I need to get a view containing:
salesperson ids for each client purchase.
In a relational database I would join:
purchase.clientid -> client._id
client.salesperson -> salesperson._id
Given:
{ _id: "1", type: "purchase", clientid: "2", items: [] }
{ _id: "2", type: "client", salespersonid: "3", name: "Chris the client" }
{ _id: "3", type: "salesperson", name: "Simon the salesperson" }
I've tried reading a lot of stuff, but nothing has clicked. How would I do this in a view?
{
_id: 'purchase-client-2-<unique-purchase-id>',
salespersonId: 'sales-3'
}
{
_id: 'sales-3',
name: 'Simon the salesperson'
}
{
_id: 'client-2',
name: 'Chris the client'
}
With the above documents you could query for all documents starting with 'purchase-client2' to get an array of purchase document. Each purchase document then tells you who the sales person was. Depending on the number of sales staff you may already have everything you need right there, assuming your map of sales id to name is already in memory.
If not, you could do a further lookup (and potentially cache that result). If that in-memory lookup or extra lookup doesn't work for you you could also duplicating the sales person's name in the purchase document. After all, NoSQL DB's don't follow the same rules as relational DB's and it's ok to duplicate now and again. You just have to think about how you keep the dups sync'ed up later.
If you can use and abuse the ID field and getaway without views then you may be better off. Views bring their own set of problems. Good luck!
I would like to create a click stream application using HBase, in sql this would be a pretty simple task but in Hbase I have not got the first clue. Can someone advise me on a schema design and keys to use in HBase.
I have provided a rough data model and several questions that I would like to interrogate the data for.
Questions I would like to ask for accessing data
What events led to a conversion?
What was the last page / How many paged viewed?
What pages a customer drops off?
What products does a male customer between 20 and 30 like to buy?
A customer has bought product x also likely to buy product y?
Conversion amount from first page ?
{
PageViews: [
{
date: "19700101 00:00",
domain: "http://foobar.com",
path: "pageOne.html",
timeOnPage: "10",
pageViewNumber: 1,
events: [
{ name: "slideClicked", value: 0, time: "00:00"},
{ name: "conversion", value: 100, time: "00:05"}
],
pageData: {
category: "home",
pageTitle: "Home Page"
}
},
{
date: "19700101 00:01",
domain: "http://foobar.com",
path: "pageTwo.html",
timeOnPage: "20",
pageViewNumber: 2,
events: [
{ name: "addToCart", value: 50.00, time: "00:02"}
],
pageData: {
category: "product",
pageTitle: "Mans Shirt",
itemValue: 50.00
}
},
{
date: "19700101 00:03",
domain: "http://foobar.com",
path: "pageThree.html",
timeOnPage: "30",
pageViewNumber: 3,
events: [],
pageData: {
category: "basket",
pageTitle: "Checkout"
}
}
],
Customer: {
IPAddress: 127.0.0.1,
Browser: "Chrome",
FirstName: "John",
LastName: "Doe",
Email: "john.doe#email.com",
isMobile: 1,
returning: 1,
age: 25,
sex: "Male"
}
}
Well, you data is mainly in one-to-many relationship. One customer and an array of page view entities. And since all your queries are customer centric, it makes sense to store each customer as a row in Hbase and have customerid(may be email in your case) as part of row key.
If you decide to store one row for one customer, each page view details would be stored as nested. The video link regarding hbase design will help you understand that. So for you above example, you get one row, and three nested entities
Another approach would be, denormalized form, for hbase to perform good lookup. Here each row would be page view, and customer data gets appended for every row.So for your above example, you end up with three rows. Data would be duplicated. Again the video gives info regarding that too(compression things).
You have more nested levels inside each page view - live events and pagedata. So it will only get worse, with respect to denormalization. As everything in Hbase is a key value pair, it is difficult to query and match these nested levels. Hope this helps you to kick off
Good video link here
How do I retrieve individual email addresses that are members of a Google Contact Group?
Using the API, I seem to be able to only see which contacts are members of a group - contacts that might have multiple email addresses. However, the Gmail UI lets me create a group with individual email addresses.
To repro:
1) Open https://mail.google.com/mail/u/0/#contacts
2) Create a new contact called John Smith with two email addresses: jsmith#gmail.com and jsmith#work.com
3) Create a new contact group call "my group". Add (only) jsmith#work.com to that group.
4) Now use the Google Contacts v3 API to fetch John Smith's record. It will look like this:
'gd$name': { 'gd$fullName': { '$t': 'John Smith' }, ... },
'gd$email':
[ { address: 'jsmith#gmail.com',
primary: 'true',
rel: 'http://schemas.google.com/g/2005#other' },
{ address: 'jsmith#work.com',
rel: 'http://schemas.google.com/g/2005#work' } ],
'gContact$groupMembershipInfo':
[ { deleted: 'false',
href: 'http://www.google.com/m8/feeds/groups/engtestuser%40mixmax.com/base/6' },
{ deleted: 'false',
href: 'http://www.google.com/m8/feeds/groups/engtestuser%40mixmax.com/base/2a44002d89eb51e3' } ] }
How do I know that only jsmith#work.com was added to "my group" (with id 2a44002d89eb51e3)? Where is the association between email addresses and groups stored?
Entire contacts are added to groups, not just individual emails. You are finding the contact using one of their two email addresses, but the entire contact with both email addresses is added to the group. For this reason it's not possible to make that distinction.