I have a list of users in Firebase that looks like this...
How would I retrieve only the email (for example) values?
THE answer.
Two things.
1) Please copy and paste your structure instead of a picture so we don't have to retype it. Please take a minute to format it so it looks cool.
2) This is a very basic query in Firebase and fully explained in the Most Excellent Guide to Retrieving Data In Firebase
Scroll down the query section and there are a couple of examples that are very similar to what you are asking for.
And a tad more info. Doing a query will retrieve each child node that matches the query (including the other stuff within the node). It's up to your code to grab each email (pretty simple task as it's key:value pairs)
If you don't want the other stuff, you would need to change the structure of the data
asdf
firstName
lastName
etc
emails
asdf
email: email address
asdf1
email: email address
or, use events: value for example and a structure like this
emails
asdf: email address
asdf1: email address
Related
I would like to send several dems to an e-mail address with different customizations based on the information present in a Custom Object.
Es.
Email Address = xxx#x.com
Custom Object:
3 records with different information to be printed in the email to be sent.
Is there a way to ensure that multiple emails can be sent to an email address simultaneously with different customizations?
Is there a workaround for last created field merge etc?
Yes.
Create a dynamic for each demo, create decision steps on the canvas which check to see if the field in the cdo has the correct value, if not pass it to the next decision step.. if yes, pass it to the email which passes to the next decision step, like this:
Multi step campaign canvas example
Im trying to check the emails of my users in my firebase database, if their email already exists. My json looks like that:
I dont know how to get the full path to email, because every User starts with the Unique Identifier and I dont have that information. Is it possible to use a wildcard /users/*/email or something like that?
this.afdb.database.ref('users/*/email').orderByChild('email').on('value', (snapshot)=>{
console.log(snapshot);
});
When a Firebase Database query runs against a location, it considers each child node under that location. And for each child node you can test the value of properties at a known path under that child.
There is no support for wildcards, nor does one seem needed for your case here:
this.afdb.database.ref('users').orderByChild('email').equalTo("pqoo#poam.com").on('value', (snapshot)=>{
snapshot.forEach((child) => {
console.log(child.val());
});
});
So the two changes are:
We query location users order by email and only return nodes with value pqoo#poam.com.
There will potentially be multiple results. So the snapshot contains a list of those results. Even if there is only a single result, the snapshot will contain a list of one result. So we use snapshot.forEach(...) to loop over the results.
I'm really spent a lot of time searching about, but no luck.
My issue is not directly related to Mailkit working or not, it is doing right but perhaps someone here have a clue.
I have to look for mails unseen mails from specific mail address on a Exchange 2010 using IMAP. All work fine (until now) for any server except this one.
When "from" mail address in format like John Doe <johndoe#pluto.com> a search for johndoe#pluto.com does not return any UIDs;
John Doe return UID collection;
On the other hand if "from" mail is in plain format all works fine.
Does anybody have any idea or know if is it an issue on Exch2010?
As a work around I'm thinking to make a simple search unseen to get UIDs then Fetch and look at Envelope
By the way here I have on log when message from = John Doe <johndoe#pluto.com>;
C: A00000006 UID SEARCH CHARSET US-ASCII FROM johndoe#pluto.com
S: * SEARCH
S: A00000006 OK SEARCH completed.
Almost 1 year later, seems I found why I canĀ“t get any result when searching From when mail address have Display Name.
Here Dmitry explain Exchange behaviour
https://blogs.technet.microsoft.com/dkhrebin/2013/10/04/how-exchange-imap-search-in-message-header/
A short quote say:
If you use SEARCH FROM (for CC, BCC, TO idea the same) Exchange will search in message's Property: PR_SENT_REPRESENTING_NAME, PR_SENT_REPRESENTING_NAME_A,
ptagSentRepresentingName
The PR_SENT_REPRESENTING_NAME property contains the display name for the messaging user represented by the sender.
So in addition to:SearchQuery.FromContains ("johndoe#pluto.com").Or (SearchQuery.FromContains ("John Doe"));
I can use SearchQuery.HeaderContains ("from", "johndoe#pluto.com");
Since Display Name can be anything and can be changed anytime, and mail address is always same. I can deal with both commands command lines above.
But I can't determine which has the best performance.
I've noticed that each IMAP server seems to behave differently with respect to searching for email addresses and/or Message-Id tokens.
What you may need to do is either do an OR search query:
SearchQuery.FromContains ("johndoe#pluto.com").Or (SearchQuery.FromContains ("John Doe"));
Perhaps that will work around the problem so it works with all IMAP servers?
I am learning iOS development. Currently, I started my hobby project which is a weather foracast app. I have found a open REST API, I can send request to get weather data for a city.
The REST API needs me to send request with city id instead of city name & it provides me a 20MB json file which contains city objects with fields city_id, city_name, longitude, latitude. I know I should create a City class to have those fields.
My app is supposed to allow user to input the city name, then, my app make request with the corresponding city id. My question is a about the best practice for this:
Since I need all city ids, should I download the 20MB json file & embed it to my app? Does that mean my app size would be larger than 20MB ? Any better practice to handle this?
If I have to put the 20MB json file in my project, what is the best way to parse the content to a list of City programmatically?
If user input one city name, I feel if I scan all the cities in the json file, it is inefficient, what could be the efficient way to find the city id for the city name (without scanning all the 20MB json)?
==== THE OPEN REST API ===
You do not need to include the JSON in your app. In fact, I highly recommend against doing so. This is according to the documentation:
Description:
You can call by city name or city name and country code. API responds with a list of results that match a searching word.
API call:
api.openweathermap.org/data/2.5/weather?q={city name}
api.openweathermap.org/data/2.5/weather?q={city name},{country code}
Parameters:
q city name and country code divided by comma, use ISO 3166 country codes
Examples of API calls:
api.openweathermap.org/data/2.5/weather?q=London
api.openweathermap.org/data/2.5/weather?q=London,uk
Given this information, you can send a request to the API like the example given: api.openweathermap.org/data/2.5/weather?q=London
The response should include the necessary data to make a subsequent call for the weather forecast.
No need to include 20MB of noise in your app bundle.
I'd create an array of City objects and parse the data into each City object (assuming you need all of them. If not, you'll have to find a way to parse out the ones youd on't want.) As long as you're not writing these to storage it shouldn't increase your app size, it may take a bit to download and parse depending on the methods you use, but that's all part of the fun of optimizing.
There are many JSON parsing iOS libraries, I have the most experience using RestKit to make network requests, and that includes a JSON to Objective-C Object parser built right in, it's super easy. Basically, do some research on JSON parser libraries and pick the one that best suits your needs. You shouldn't need to parse it yourself.
I'd create an NSDictionary with the city_name as your keys, and the city_id as your values. Then to retrieve the city_id simply call [dictionary objectForKey:enteredCity] (replacing with your actual variable names, of course)
I believe that they are asking you to bundle and not burden their server with requests for the 20mb file that doesn't seem to change much.
I would make a script that you run on your dev machine that turns this into a sqlite db (or some other serialized format). Don't bundle the JSON and parse at runtime --- turn it into something queryable at runtime.
I'm developing an app that has to retrieve all the contacts from the Address Book and display them according to the source (Gmail, iCloud, Outlook, Facebook ecc). I've already looked up all similar previous answer on this topic: has anybody found an answer?
Is it possible to discriminate between these sources (for example using mail addresses)?
Using kABSourceTypeProperty and kABSourceNameProperty seems not effective because two Gmail accounts will have same name and same type.
Furthermore is there a way to have a more significant name?
For now I have only names like this:
- name = "" (empty string) for Facebook contacts
- name = "Card" for iCloud contacts
- name = "Address Book" for Gmail contacts
- name = nil for Local Address Book, etc
If someone else is still stuck with this problem i found a trick solution for the sources of type kABSourceTypeCardDAV (such as Gmail and Yahoo accounts).
The trick is to access the kABPersonLastNameProperty of the ABRecordRef of the source even if it should be a ABPerson-only property. The result is a path (I think where the contacts are stored in the phone) that contains also the mail/name of the account.
Still no idea how to get the name of the account in the kABSourceTypeExchange case!