Queue city location in database language independent - database

I'm currently facing the following issue:
My database has a table of restaurants with locations (composed of Country, City, Street).
Now, any user can add a restaurant.
Now, let's say that a user clicks on Add and enters the following:
'Restaurant de Mar' in Gustastreet 7, Nueva York, Estados Unidos.
The next user clicks on the filter and selects "New York".
It should, of course, display the entry from the Spanish user as well.
I've thought about the following solutions to allow filtering on a city level:
Store everything in English. If a user submits or requests a location, use e.g. google's geocoder to get the English name.
Disadvantage:
No way to show the user in his own language in which country there are entries at all.
Store Lat/Long for every address (also needs API call for that). If a user requests entries of a city, also use an API to get the bounds of that city and search the Lat/Long points in the database for this specific boundary.
Advantage:
No need for any localization.
Is there any documented approach for this?

Related

How to structure a database with Firebase

I'm in the process where I need to store data under a specific users account with Firebase. I'm fairly new working with the backend and I'm primarily looking for a second option before I start typing away.
This is how I currently have it structured:
Providers
City
Cincinnati
Company 1
Jobs
History
Company 2
Jobs
History
Columbus
Company 1
Company 2
My thought is it would be better to have each company listed within a specific city node when a user is requesting from that city. However, if the city was at the first level then we'd have to go through the city first. But instead of having the city at the higher level we can store the cities their in under the companies node essentially in an array.
So here's the user flow:
The user makes a request based on their location (city). The provider accepts that specific job which moves into the 'jobs' node. Once the job is complete it then moves into their 'history' node.
My question:
Should I keep the structure as is or place the city within the companies node?
Your structure is right, as city is your primary key in this case, since a company has a city, you will need to specify first the city where you want to pull companies from. I assume that this structure is the right way to go to solve your problem.
If your parent node is not City and just the name of the cities you will end up with a lot of children in your main tree, and that is what you don't want, you want to structure your database in order to do it readable when data is big enough.
PS: Think in scalability, if you think this way you end up with a good organized database, now, as you are doing it it's OK, but if you have another doubt, think in this way to improve your structure.

Is there any way to get first name , last name ( or phone number ) from twitter handle?

Problem Statement: Lets consider that you have huge customer data which has demographic information as firstname, lastname, phone and email. Now lets say that we have a twitter handle, then is there any way to tie that twitter handle to the proper contact/customer data present.
So basically I want to get phone number, email or firsname and last name so that match could be done in internal database to identify the existing customer.
Any pointers would be helpful here.
As i understand it, you want to proper view of customer information instead corrupt or lack information on your customers.
I don't think is that possible. Because twitter hiding telephone number or mail adress for securty and privacy.

Cakephp - Choose your preferred country for ecommerce

I'm developing an ecommerce website. Now, at the homepage, i want to put the preferred country. When the customer choose their preferred country, the list of product shown to them was from that prefered country only.
My database (products table has id, name, description, color, SKU and country_id)
Anyone has idea about this. I already check for global variable. But its like declaring in core.php or bootstrap.php. I want it to declare at my homepage when customer choose the country.
Please somebody help me. Thanks in advance ;p
I think "Magic Find Types" is a good place to start. You get this functionality automatically from your product Model class.
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#magic-find-types
Inside your controller, all you probably need to do is type something like this. It also has optional arguments for sorting and result set limiting. Of course, how you retrieve the preferred country is dependent on your application (browser cookie, logged in user profile etc).
$this->Product->findAllByCountryId($countryId)
If your user selects a country, store it in a session or cookie. If you want to be really efficient, you could have users select their preferred country on sign-up and store that in their profile record in the database, and set a configuration variable when they log in.

Implement a form in Salesforce

I am currently the Salesforce administrator of a company Enterprise account. Our accounts are made up of universities. I was asked to implement a form for trips.
The trips basic information is: Trip name, University, Region, Country, Project manager and Project manager met. I created the object trip and added the custom fields using lookup relationships with contacts and accounts. This was very easy to do so.
The first problem is as we move through the form. The next section is about the university info which has these fields: Number of students, Number of faculty, Language. They are asking me that these fields override the information that was previously stored in the account. Like if you pick X university and it had 200 students originally, then if I write 205 in the field , it will overwrite the previously set number.
My second problem is, in the next section of the form they have an objectives section.
For example, there is a text field with the label :
"Objective 1 ___________" +
if you want to add a new objective there is a "+" sign that will create a new field
"Objective 1 ___________" +
"Objective 2 ___________"
How can I achieve this? Is there a way with basic creating system? Do I need to create a Visualforce page? Thank you for your help.
This is what I understand of your 1st problem: On the trip object you have a lookup to account (university) and there are number of students etc field on the trip object and whenever a user updates it here it should be update back in the Account Object?
Instead of doing this, as you're already capturing all this data in the account object, use formula fields in the trip object to populate the data. This i think would be a better data model. But if you still wish to do it the way you intend to then you will have to write a trigger on trip object and update the account with that information. The problem with the second option would be: lets say you create a trip 1 record and update the #of students to 210, and this would be updated in the account as 210. And then you create a trip2 record for the same account and here you input the value of the #of Students field to 230, so the account(university) record with the value 230. But the problem is the value in trip 1 record will still remain 210. I hope you understand what I am trying to explain.
Coming to the 2nd Problem:
Here too the data model will be slightly different:
Create another object called Objective which has a master detail relationship with the trip object. So the Objective will be a related list in the trip object. For every trip there will be a number of objective which you can add in the related list. This is quite simple and there would be no need of any coding. But if you want to add the + sign which would display another field when the user clicked on it: In this case too the data model is the same, but you would need to create a VF page(which could either in-line VF page or a entirely an independent VF page) and then whenever a user clicks the + sign a new field is shown.

How to handle mobile number recycling by telephone companies?

I need to implement one user ID for one user. After looking around, closest I can see is using mobile phone numbers to text. Assuming this is best available method How to handle mobile number recycling by telephone companies? Any ideas?
Following is best one that attempted to answer on how to implement one ID for one person-http://stackoverflow.com/questions/5964664/account-verification-only-1-account-per-person
Thank you.
Back when I worked for a marketing client, our business was based on determining whether two people were the same - "our records show Bob Smith. Is the Robert Smith who responded the same as Bob Smith?"
Our data could be segmented into name, method of contact (address, phone, email) and relationship (Alonzo works for Square Tires Inc). Once the data had been scrubbed/standardized, we would then compare that entity to possible matches in the system. Matching on a single segment was insufficient to categorize as a match. We required two different segment matches for an entity to be matched to another. This was important as matching phone and address might yield different members of the same household. Depending on your criteria, that might be sufficient but generally it is not.
With all that said, I don't think you have enough information to make a semi-authoritative guess as to whether phone number 1234567 is the original user or a person who has had their phone number reassigned. I would attempt to capture more personally identifiable information about the entity registering the phone number. The registration of an existing phone number with different PII would not cause the original holder of the number to become invalidated, it merely signifies that a new user has come onboard. Until you get enough information back about the original holder of that number having a new method of contact, you should probably retain the association to the phone number. It could be the case the second registrant supplied a bogus number or either applicant fat-fingered their number and you wouldn't know which was accurate.
You can still run into issues with say corporate issued mobile phones. A company has a pool of phones they distribute to folks. People quit and get hired and those phone numbers remain the domain of the company but are assigned to people that then register for your service.
Hope this helps give you some starting points for solving the problem.

Resources