How to implement contacts/email address picker like in Apple's mail application? - cocoa-touch

when sending a mail on the iPhone/iPad you start typing the name of the recipient and list of proposals shows up. Either pick one from those, or continue typing an email address. Adding a new address turns the first one entered into a blue button like thing.
I would like to use this to allow users to select a couple of email addresses. Does anybody know if it is a standard component?
René

I dont really know if it is a standar UI control but i guess you could figure out something with the help of this video, this one uses the UI Person picker to display the persons name
http://www.alexyork.net/blog/post/Selecting-a-contact-from-the-Address-Book-with-MonoTouch.aspx
and with some modifications you could search on contact list and display a modal view with suggestions of the emails in the list
with this example you can get all the emails in the contact list
ABAddressBook ab = new ABAddressBook();
ABMutableMultiValue<string> emails = new ABMutableStringMultiValue();
foreach (ABPerson person in ab) {
ABMultiValue<string> personemails = person.GetEmails();
foreach (ABMultiValueEntry<string> item in personemails) {
emails.Add(item.Value, item.Label);
}
}
With this code you will get all the emails on the contact list in the variable "emails" now you just need to access the "emails" variable and look for the email the user is typing.
Hope this helps.
Alex

Related

How do I associate a file with a key on google drive?

I'm trying to automate a process at my company where I have to send files to my customers every month.
These files are unique and each customer must receive their own. In addition, I wanted the client to be required to answer an NPS assessment form in order to have access to his file.
Honestly, I don't understand much about programming and I'm just trying to find a solution to do this automatically.
The solution I have in mind today is to use a google forms form and after filling out the form a link would be made available to access a google drive folder (that way the customer would be obliged to answer the form to have access to his file).
In the google drive, each file would be associated with a unique access key (for example, an identification number of that customer, in which he already knows what it is).
Then these customers should insert this key in the google drive folder in order to be able to access their file. That way I would be able to: get all the answers of the evaluation in a single form, make a standard message (or tutorial) available to all customers informing them how to access their file, and give access to the files automatically because the access key would be the same every month.
Sorry for the long text but I tried to describe my problem in the best way. I am accepting any kind of help or guidance. Even where I could get help about it. This automation would be very important to me because in addition to automating a process that costs a lot of time it would give me a very powerful tool to evaluate my services. Thanks in advance to everyone who took the time to read this question.
The best approach in this situation is to start by using Apps Script.
Apps Script is a powerful development platform which can be used to build web apps and specifically for your situation, automate tasks. What makes it special is the fact that it is easy to use and to create applications that integrate with G Suite.
Since you mention that the files are unique for each customer, what you can do is to store these values in a key - value list. However, depending on the number of the customers, you can store these value in a spreadsheet, something similar to this:
Making the files available only after submitting the Google Form mentioned can be done by taking advantage of Apps Script's triggers.
So essentially, you can use an onFormSubmit trigger which will execute every time the above mentioned form is submitted.
Code
You can also add another column in your spreadsheet to mark if the email was sent or not; taking this into account, this is how your spreadsheet will look like:
As for the code, this is just a short snippet which does the following:
opens the spreadsheet and retrieves the values for the File ID, Customer Email and Sent columns as the following arrays ids, emails and sent respectively;
retrieves the needed form and loops through the responses and checks if the last email of the form matches any of the ones from the spreadsheet;
if the conditions check, the file permissions are edited, an email is being sent, and the corresponding row on column C is being set to TRUE;
function editPermissions() {
let form = FormApp.openById('FORM_ID');
let sheet = SpreadsheetApp.openById('SPREADSHEET_ID').getSheetByName('SHEET_NAME');
let responses = form.getResponses();
let emails = sheet.getRange('EMAILS_RANGE').getValues();
let ids = sheet.getRange('IDS_RANGE').getValues();
let sent = sheet.getRange('SENT_RANGE').getValues();
for (let i = responses.length; i > 0; i--) {
let email = responses[i].getRespondentEmail();
for (let j = 0; j < emails.length; j++) {
if (emails[j][0] == email && sent[j][0] == false) {
// edit file permissions
// send email
// mark the associated row on the Sent col with TRUE
}
}
}
}
Trigger
As for making the function above run every time there's a new form submission, you will have to create an onFormSubmit trigger which will trigger the execution of the function.
Reference
Apps Script;
Apps Script Spreadsheet Service;
Apps Script Forms Service;
Apps Script Installable Triggers.

Create letters, contract templates with rich text, save then in SQL Server table

I need to dev a web app that permits users create or write their own templates for letters, contracts, or mails.
This templates must be written with Rich Text Formatted on a user interface like stack overflow use.
The user can use some names columns of a SQL Server table or view, to insert then in the text, similar what MS Word do.
Documents must be saved in a SQL table and then that text must be use to create the final view this the data of the related field.
Example:
Columns of table clients:
clientId Name ProductName
-----------------------------
1 Cris Tablet
Letter created by user:
Hello dear *Name*
We've send you your *ProductName*
Sincerly
My Company
Final view in html:
Hello dear Cris
We've send you your Tablet
Sincerly
My Company
I've work with asp.net and SQL Server... What do you recommend to achieve this?
This can be achieved using C#, i doubt if SQL alone can do it, which language are you using in asp.net?If it is C#, I can explain.
First
On the User login page
After Each user as logged on
On the Button Onclick event
Session["user"] = username.Text;
Response.Redirect("nameofthepagetocreateletter");
Second(To create the letter template)
On the nameofthepagetocreateletter
page_load event
loginname.Text = Session["user"].ToString();
also you will have a text control named "loginname", as well as 5 text field to write the letter
First text field-this will have its default value set to "Hello dear"
Second text field-this is the loginname
Third text field-this will have its default value set to "We've send you your"
Fourth text field-this is the product name field
Label field- this can be set as "sincerely"
Fifth text field-this is company name
I hope this helps.

Extract single messages from gmail thread (Objective-c)

I am trying to fetch gmail emails with IMAP (in objective-c), and I want to separate, for every thread, every single message that has been sent in the conversation. To make myself more clear, imagine a conversation like this one:
John says : Hi Mike, that's the first email
Mike replies : Hey John, how are you ?
John replies : Great Mike, thanks.
If I get John's emails through IMAP, I will fetch only one email, that will be :
Hey John, how are you ?
On Wed, 21 May,
Hi Mike, that's the first email
And I would like to get two different messages out of this one email I fetched.
First message would be "Hi Mike, that's the first email"
Second message would be "Hey John, how are you ?"
I looked at the message-id field in the header, but I can't figure out how to link that back to actual messages.
Any ideas?
Thanks !
[EDIT] : So far I can parse the email in John's inbox and extract the associated string containing the message. But what I want is the actual message (with the header and all), not just the string containing the message.
Gmail has a very nice IMAP extension to do this. I've never tried to use the objective-c libraries, though.
If you want to do this for one conversation, you need a message to start with. Any message in the conversation will do. First, you retrieve the X-GM-THRID of that message: a uid fetch 23451345 x-gm-thrid, which gives you a 64-bit number, perhaps 9876543876543444423. Next, you look for the other messages in the same conversation: b uid search x-gm-thrid 9876543876543444423, which gives you the UIDs of all messages in that conversation, and you're done.
If you want to do it for all the conversations in the inbox, you issue c uid fetch 1:* x-gm-thrid, which gives you a set of message-conversation tuples: "message 123 belongs to conversation 9876543876543".
If you want to order the messages within each conversation, the easiest way is probably to retrieve the internaldate item and sort by that. Gmail also has an x-gm-msgid but I haven't looked to see whether it's useful for sorting.

Apex - passing a variable from one page to another

I have a form on one page which prompts a user to enter their email address. When they click "next" I want Apex to redirect the user to a different page which shows them a report which selects the records from the users table where the email address matches the one that they entered.
E.g.
SELECT *
FROM USERS
WHERE EMAIL_ADDRESS = (the email address that they entered on the previous page);
Can someone please explain the easiest way to do this?
I have only in the last 5 seconds heard about 'Apex' Lol ... But I think I found what you need to do.
You need to define a 'Branch' which will allow you to POST to whichever page you need to.
Here's some documentation on 'Branches': http://docs.oracle.com/cd/B32472_01/doc/appdev.300/b32469/pdf_report.htm#BABICIJG
Also this snipet may help:
It's [The 'branch'] in the middle (page processing section) of the
development page at the bottom. The branch will be executed whenever a
post submission occurs but you can put conditions on the branch.
Which I found at: http://dbaforums.org/oracle/index.php?showtopic=8139
The "Next" button should not redirect but should submit. The value of the page item has to be pushed to the session state for it to be available in the (apex) session. On submit you can then define a branch which will take you to the page with your report. Your report can then reference the page item by using bind variable notation in the region source:
SELECT * FROM USERS WHERE EMAIL_ADDRESS = :Px_EMAIL_ADDRESS

What are the Aweber API Variables $account_id and $list_id?

You can check here:
https://labs.aweber.com/docs/code_samples/subs/create
The script to add a new subscriber to the list via api requires those two pieces info...only I cannot figure out for the life of me what those two variables are!! I've beaten through every little aspect of my Aweber Subscriber Account, AND my Aweber Labs account...and I can't find any reference to either of those variables anywhere. I've submitted some tickets to them, and haven't gotten any response yet.
Does anyone have any ideas here? I've tried my account names, my list names, to no avail!
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Okay, I've got it! You can get the values of both of these variables by dumping some other variables in the aweber api after making certain api calls.
get the account id first:
$account = $aweber->getAccount($accessKey, $accessSecret);
then vardump or print_r $account.
next we get the list id:
$account = $aweber->getAccount($accessKey, $accessSecret);
$list_url = 'https://api.aweber.com/1.0/accounts/<id>/lists';
$lists = $account->loadFromUrl($list_url);
then vardump or print_r $lists.
And you are all set! I'm so happy I figured this out, it freakin took long enough. Hopefully this saves some one a bit of time.
I too have agonized over finding the $list_ID, so went to deactivate the list, and create a new one, and "discovered" that if you hover over the Deactivate button, you get a url you can copy, and this gives both %account and %list Ids
https://www.aweber.com/users/lists/deactivate/$accountID/$lisID
like this....
https://www.aweber.com/users/lists/deactivate/123456/123456
Hopefully this will help make someone as it is a super easy solution
The proper answer is Anne Allen's one, but...
Check the return of the /accounts endpoint. It should return the same account id as you detected in the link, but I had cases they were different (strange, isn't it?). Use the account id returned by the /accounts endpoint and other endpoints to retrieve lists, subscribers, etc. will start to work. It's like if some accounts have two ids, one partially works and the other fully works.
Let me tell you how to get $list_id value... login into your AWeber account and then create a new list copy only integer value from list's name.
At first, login.
1) click Reports>Settings. Your account ID will be displayed in the box,example: ?id=XXXXX
2) click List Options>List Settings. There you will see the list ID under the name.
p.s. To add subscriber, you can use this - Automatically add into aweber list