Find Country, City through IP in my code - database

I have created an Analytics Reporting page with Drupal, and want to find a service, module or anything that gives me City and Country based on the API I have.
Just plain conversion. When I pass IP through (say, a function), it gives me City and Country.
If it's a Drupal Module, great, otherwise a function, or a database which I can put in my site's database and put a search query to find a city, Country through the IP.

You can try the RouteViews database which has a downloadable mapping between IP, AS, and Country. Unfortunately, it does not have the city information last I checked.
If you have the cash, try: Maxmind It's not that expensive.

Related

How to set different access levels for dashboard data in Google Data Studio

Lets assume I am creating a google DataStudio dashboard for a sales data which is having sales records for countries.
For each country has a country manager and they are assign to single supervisor in Head Office.
My question is:
Can we develop a Google DataStudio DashBoard which is capable to restrict data only relevant to a particular country if it is viewing by a country manager and to show whole data relevant to all countries if it is viewing by the supervisor of country managers?
There is no easy solution to have a page-level permission, but there are three options.
Break up the report in to separate ones (this is the most simple solution, although it creates multiple reports)
Use Viewer's credentials instead of Owners’ credential (You must grand viewers access to your gbq data source, which is not ideal in most cases)
Filter by email (This works for small number of users, but quite cumbersome for multiple users)
For the option one, you can break up one "master report" that has all pages, and creating multiple sub-reports by using URL embedding by page
In your Data Source, create a column called "e-mail" and populate it with the e-mail address of the manager that you want to be able to see that particular line.
After you do this, use the "Filter by email" option in the Data Source:
And select the field you just created:
And there you are. Your data will only be searchable by the person you selected, based on the email they are using to access the dashboard.
If you want more than one person to be able to see a particular data, you'll need to duplicate the respective lines in the Data Source.

How to fetch data from a database through a web service URL in VS 2017

I am new to this, I have a web service someone set for me in a distant server where a database resides, I have:
web service URL
username
password
universe
1 parameter which is person's ID.
Query is all set, all I need to input is the person's ID for it to return the phone, so basically I need to retrieve persons phone number based on his/her ID and save that returned string as an string variable to be further put in a text box.
Would be ideal to have this executed when a form is loaded, don't know if that is possible.
Searched many sites and none explained how to proceed with plain Visual Basic/.net forms, only ASP and C#.
Hope my description is good, I am using VS 2017.
Please help.
Thanks a million
Probably by adding Service Reference of that WebService URL and then you could call the methods after creating instance of the same to fetch the result.

Google Places API: store Places in DB

I am building a web app where all the users belong to some type of places, lets say "bank". Each user belongs to only 1 bank but 1 bank can have more then one user.
I need to display their bank name and location in user profile and to be able to search by bank names inside specific city. So I need to connect users and banks somehow.
Is it safe to use the Place ID for that for each bank in terms of app scalability and life-cycle?
The manual says:
Place IDs are exempt from the caching restrictions stated in Section
10.5.d of the Google Maps APIs Terms of Service. You can therefore store place ID values indefinitely.
So Google says I can but is it the best practise? Do I need to store a full address additionally to be safe in case Google will deprecate these IDs in future?
Let's say I can get the bank Place ID with the help of Place Autocomplete during the user registration. Then I need to save it to DB to be able to display it later and search by bank.
The DB Structure could be:
Or Just
But I think the 1st way it better with unique place_id column?
As Google says, you may store PlaceID, but they also tell you that it is a good practice to "refresh" these stored PlaceIDs each 100 days, they do not assure you that your stored PlaceID will be for the same place that you stored.
https://developers.google.com/places/place-id

Displaying civicrm contact's fields in drupal 7 registration and profile edit

I am using Drupal 7 with civicrm 4.5. I want to display the civi contact fields in drupal registration and profile forms. I used the civicrm profile to display the first name and last name fields. But i don't know how to integrate the address, phone and email fields same as civi in drupal(For ex for address with [b]Another address[/b] and [b]Location type[/b] selection boxes street address,Add link,Delete etc). Using civicrm profile i could be able to configure Home street address etc as a individual ones. But i want as a grouped one how civi is displaying. Is there any module available for this? Any help is highly appreciated. Thanks in advance
For better or worse, CiviCRM profiles don't have those features for picking location type or adding indefinite numbers of addresses, etc. They respect location type, so you could have home street address, city, state, zip, etc. fields and work street address, city, state, zip, etc., and those will hang together as two addresses.
In front-facing forms, there is a way to do this using the Webform CiviCRM Integration module. You can set up several sets of address fields and let people pick the location type for each. You might link to a Webform page from the user form to invite people to fill out more details.
An alternative approach, using native CiviCRM profiles, would be to create a CiviCRM profile for each location, including the address fields for each location, and expose all them to the Drupal registration and/or account view/edit screens. For example you could have one profile on the registration screen, and have all the others only on the account view/edit screens, thereby enabling your users, once signed up and logged in, to develop their profile.
A tad clunky perhapsjust , but it would work.

Unique customer identifier in Amazon Marketplace Web Services

I am importing customers from Amazon to do an integration with our ordering system and want to avoid having duplicate customers as we do a high volume of sales on Amazon.
Is there any report, or API that will allow me to get a unique customer identifier that will never change for that customer no matter how many orders are placed?
I have thought of the anonymous email that Amazon makes available, however I am unsure if this changes, or if it is a static value as it is not referenced within the API documentation.
Has anyone else found a solution for this, or have any suggestion?
the key is buyer-email and is available from order reports or from amazon fulfilled shipments data report.
The amazon fulfilled shipments data report will not contain buyer email information in certain circumstances, however the order reports will always contain the buyer email.
Amazon's FAQ documentation states:
Are there separate e-mail addresses per thread? No. The anonymised e-mail alias remains the same for all contacts that you have with each individual buyer. Use the buyer's anonymised e-mail address as a unique identifier to follow conversations across multiple orders.

Resources