As I type this question, I am skeptical there may be no answer?
I am building a flutter app using firebase as the backend. There is a feature in my app that allows a user to add friends to the app from their contact list.
Now I am struggling because firebase phone numbers must be stored in this format -- +17653371230.
However, when a user stores a phone number in their phone, they don't always add the country code.
Essentially, a user can have phone numbers in their contact book in these formats:
9142240145,
510-725-1331,
(404) 988-3125
If I want to check if any of these phone numbers exist in my database, I will get a result saying they don't, even if they could but in a different format.
The first step to solving this problem is pretty simple: trim all parentheses and spaces in the phone number string.
However it gets difficult and it brings me to my real question:
Give a phone number like so: 9143646532, how can I determine that it is a US number so that I may add the +1?
Or given a number like 08027323457, how can I determine that it is a Nigerian number so that I may remove the leading 0 and add a +234?
I want to be able to do this for all countries. Is there a flutter package that handles this? Or is there a publicly known algorithm that sorts this out? Because I doubt I am the first person trying to build this capability using firebase as a backend.
The first step is to normalize these numbers into a format of your choice.
The second step involves finding out the country of residence of the current user. Then determine the country's prefix and add said prefix to the numbers provided by the current user. But check if these numbers already have an international prefix beforehand.
Do you have the complete phone number of the current user with country prefix? Then use that. You could also force the current user to provide or confirm this prefix, if missing.
If not, use a geo-location-service to determine the country of residence of the current user and then select the phone prefix accordingly.
What types of geo-location-service are available to you depends on the framework you use. Some are depending on IPs, some on GPS.
There are also external services:
https://medium.com/mop-developers/free-ip-based-geolocation-with-google-cloud-functions-f92e20d47651
How phone numbers are constructed:
https://www.tipard.com/mobile/international-phone-number-format.html
Related
I am running Wordpress 6.1.1 with WPForms 1.8.0
I have found a lot of solutions for checking and preventing duplicate email address entries on WPForms, including a WPAddon called Form Locker. However, I need to prevent duplicate home / mailing address entries on my sign up / entry form.
Several solutions that I found online that did not work is using the "Validation" section of WPForms, which isn't there. I was also told to use the "WPForms Dynamic Fields" plugin. But I don't see that one available either.
The type of thing I am doing, we only want one entry per household. So I want to check for duplicate address entries. If there is already an address entered, it will reject it and tell the user that this address has already entered in the program, and that we only allow one entry per household.
Also, as far as making sure people who live in the same apartment complex with different apartment numbers don't get wrongly filtered, I would like the duplicate checker to check for just the numbers in the address line 2. Don't strip the actual letters in the form submission (so if someone puts Apt 202, keep Apt 202 in the submission). But, just strip the letters so we can make sure there's no duplicate number entries. That way the user cannot just format their line 2 address to type something (alphabet wise) in front of their apartment number to throw it off.
I'd like for this code to be put in an example where I can have it to where it will check the address after Address Line 1, Address Line 2, City, State, and Zip are filled out and the user clicks down to go to the next form section. The form cannot be submitted until the address is verified as unique. As you can see, it's a one page form. But the user goes down and interacts with the form each section.
Here's the URL to my current form: https://easygetpaid.com/getting-started/
I am not sure how in wordpress what I GET or POST to do a query for an address entry in WPForms. I know I can search through entries on WPForms based on certain conditions but only through the admin panel. I'd like to be able to do this without the admin panel. But I only want it to search for duplicates due to privacy issues.
I am also not sure if there's an addon that can do what I need it to do. If anyone could please point me in the right direction, I'd greatly appreciate it. So far, there's no addons that can do it with the latest version of WPForms. I've tried searching all over. Anyone who can point me in the right direction would be very very much appreciated.
I'm running an A/B Test targeting 100% of iOS users with specific versions using a regex to match versions 2.1.27 and up, here's the regex in case it's relevant:
2\.1\.([3-9].|2[7-9])
I did not set any activation event for the experiment; meaning I left that field blank.
Now my question is: Who becomes part of the experiment? Anyone who opens the app with a matching version? Anyone who starts a session with a matching version? Anyone who engages with a matching session?
So far, it says the total number of users that have been exposed to the experiment is 9,6K. I'm trying to set up a funnel that only includes these users but I can't figure out one that shows me anything close to that number in the date range of the experiment.
Firebase Support says:
Firebase will determine if a user will be part of the experiment when your app do the activatedFetch method.
That's the answer I was looking for.
I want to create a smart contract and launch it for ICO. I also create a website where people can buy my token. I want know how to check how many token been sold (live)? so i can create a live bar counter to show how many percentages of the token already been sold.
Or is there a way i can monitor the token sale process in the smart contract?
A token contract is no different than any other smart contract. There are no special built in Solidity features or logic associated with them. They are just regular smart contracts that follow a specification.
So, if you want access to the number of tokens sold, you code that into your contract. While tokens sold is not part of the standard ERC20/ERC721 interface, nothing prevents you from adding a constant function to retrieve this information. In fact, if you're using the basic Zeppelin Crowdsale contract, you can just calculate it using the public state variables weiRaised / rate (Chances are you should be creating your own Crowdsale subcontract, so it's better to add the functionality you want there).
We can use the Etherscan Developer API to review transactions against a given contract address and find out the total supply or number of items available for sale.
There is a lot you can do with the Etherscan Developer API. For example, here's one URL that pulls data from Ethereum Mainnet -> Etherscan -> JSON parser -> Shields.io and renders it as an image to calculate the number of Su Squares remaining for sale:
Source: https://img.shields.io/badge/dynamic/json.svg?label=Su+Squares+available&url=https%3A%2F%2Fapi.etherscan.io%2Fapi%3Fmodule%3Daccount%26action%3Dtokenbalance%26contractaddress%3D0xE9e3F9cfc1A64DFca53614a0182CFAD56c10624F%26address%3D0xE9e3F9cfc1A64DFca53614a0182CFAD56c10624F%26tag%3Dlatest%26apikey%3DYourApiKeyToken&query=%24.result
^ I don't know if SO is going to cache the image here. But that URL is a live URL which pulls the number of Su Squares available hot off the blockchain.
Background of my specific environment: I am trying to set up GA to track the user journeys around an iOS native app written in React Native. The app is in-house only and all users consent to being tracked in this way.
As I understand it, the measurement protocol allows either Client ID (cid) or User ID (uid). In the docs, both are optional, but at least one is required. Makes sense so far. Client ID is an anonymous UUIDv4 that tracks a browser or device, but not necessarily a user. User ID on the other hand is some uniquely-identifying value for a user, but may cross devices/browsers.
Initially I wrote my application using cid (as I hadn't yet read the docs on uid). Every time a user logged in the user's uuid would be stored and sent as the cid parameter. I also used session control sc. This worked - I saw sessions coming in, the User Explorer showed me the individual user uuids and sessions, etc. But upon rereading the docs, this seemed like an incorrect use of cid. It seems like cid is meant to be consistent and not something that changes as you log in and out.
As people on my app can log in and out (and possibly will - staff members may well share devices), using a long-lasting cid that is specific to the device won't allow me to track the habits of individual users and changing it per login-session, as mentioned above, feels wrong.
So I switched out cid for uid. The docs say both are optional and one is only required if the other is not used, so I figured I could just use uid and use the user's uuid in that field and it's otherwise act the same.
However, when doing it this way no hits seems to be registered at all - in "real time data" as well as the User Explorer.
Am I doing something wrong or is this by design? (If by design, are the docs wrong to say cid and uid are both optional or am I reading it incorrectly?)
Either way, best-practices-wise, do I:
Just go back to using an ephemeral cid that only changes when people log in and out. Individual sessions in the app don't change the cid but I do use sc to explicitly start and end sessions by navigation inference (click 'home' = sc=end, navigate from 'home', sc=start).
Use uid as I am trying to (i.e. switching out the current cid for uid), but also include a random cid that never changes (regardless of session lifetime, logging in and out, etc.).
Something else?
I have seen this question and its answer but it does not really answer my actual question regarding how cid and uid should actually be used, and if my issue is me or the way that GA works.
Oki so client-id is randomly generated value and must be sent with all hits.
In a non-User-ID-enabled view, Client-ID is used to calculate unique users. In a User-ID-enabled view, User-ID is used to calculate unique users
In reference to your app, you can send the unique Device id value in place of random value for client-id. This will resolve all your problems and ensure that the client id is sent with all the hits, otherwise it wont get registered in GA
I would like to know how I would go about finding out the 'current' MNC from a UK mobile phone number?
I have given out a collection of numbers to companies, and they returned the "original MCC/MNC" & the "current MCC/MNC" codes, all checked out fine.
I would like to know how this was done in the first place? Its easy to find the original MCC/MNC codes, but I'm having trouble with the current MCC/MNC.
To obtain the current MCC / MNC (or NWC - Mobile Network Code) for a mobile number you can take a number of approaches. Based on your comment I'm going to combine a little background information also.
Getting the original MCC / MNC
This is relatively easy as long as you have a reliable source of data. The MCC is relatively simple to deal with as MCC's don't change all that often. MCC being the Mobile Country Code designated by ITU-T. MNC's are a little more tricky because they can change over time. The ITU-T also distributes these allocations and regularly publishes updates or should I say the GSMA does.
Getting current MCC / MNC
Here you have a number of factors to consider. One of them you have already mentioned. Here are some more possibilities:
Mobile porting - Transfer of a mobile phone number from one operator to another
Roaming - The mobile phone number is currently registered on a "foreign" mobile network
Both of these factors mean that just using the mobile phone number is not an option for finding out the current MCC / MNC. It is really a question of how accurate you need the information to be. And of course how much money you want to spend finding it out.
So finally to the original question. The short answer is no you do not have to be a member of ITU to have access to this information. The long answer is that you need access either to the ITU publications. As I recall the following are ways of obtaining the information you need:
GSMA (GSM Association) regularly publishes updates to NWC's (Mobile Network Codes) in document form. This together with numbering schemes for every country using GSM networks.
Neustar (http://www.neustar.biz) provides an API which you can query for the currently registered (non-roaming) mobile phone numbers. They also provide portability information which is updated at various rates depending on country and operator. Effectively they are the root of all portability information for the GSMA.
Some mobile operators for example Deutsche Telekom in Germany provide an API to obtain daily updated portability information for the whole of Germany.
Companies with SS7 connectivity (basically the GSM cloud where mobile operators interoperate) can query realtime the mobile phone numbers current network registration. This also includes whether the mobile phone number is roaming or not.
This information is priceless for many companies and GSMA rightly so ensures that only companies and people who can responsibly manage this information are allowed to obtain it.
You can use this nuget package.
Sample code:
var IsViablePhoneNumber = PhoneNumberUtil.IsViablePhoneNumber("989123456789");
var MCC_MNC = PhoneNumberUtil.GetMCCMNC("989123456789");
var Operator = PhoneNumberUtil.GetOperator("989123456789");
var Brand = PhoneNumberUtil.GetBrand("989123456789");
var OperatorStatus = PhoneNumberUtil.GetOperatorStatus(232 ,10);
var OperatorType = PhoneNumberUtil.GetOperatorType(232 ,10);