Problem:
I have over 30k users that, for the sake of argument, may like Dogs, Cats, Birds, and/or Mice.
The idea is to have users be able to mail each other but if the subject line contains the word "Dog" then anyone who is not a Dog person will not receive it.
Example:
User Likes
---- -----
Amy Dogs, Cats
Bob Dogs, Birds
Carl Cats, Birds, Mice
Dana Mice
Fred Dogs, Mice
If Amy sends an email to everyone and the email has the word "Dog" in the subject line then only Bob and Fred should receive the email.
The actual scenario uses over 20 different "likes" which makes for a very large number of combinations, so I don't think a Distribution List will help here. But there is a web service that I can use which will tell me if a given user belongs to a given group, if I can use that before the email is distributed.
I'm hoping to have an outgoing transport rule reference the web service, but I couldn't find examples of that, so I'm not sure if it can be done or not.
Thoughts?
There is no Transport Rule that will allow you to call a WebService you might want to look at using a Transport Agent https://technet.microsoft.com/en-us/library/bb125012(v=exchg.150).aspx and try to include all your logic within the Transport Agent rather then doing a web service call which can be costly in terms of Transport on a busy server.
Related
I am a new in AWS services and we want to build a simple demo that detect a special word and: [1] trigger an action [2] responses (as speech during the call).
For example, if the user say: "Help" I want to reply "OK" and make an operation (AWS lambda).
We're using Twilio, and Twilio should streaming the audio.
As I understand I have two options, Android Lex and Transcribe, when Lex is for bots and transcribe just translate the speech and can't get involved in conversation.
So the questions are:
What Services should I use to trigger an action when the special word is recognize AND involved in the conversation?
Can I streaming the call directly to AWS service via Twilio?
Edit
To be more clear: The communication will be with two persons in real time, and I want to make interject during their call when someone say "Help" I want to add a bot voice to the conversation and say "OK", for example"
[Person 1]: Hi, how are you
[Person 2]: HELP ...
[BOT]: OK (like a third person in a conference call..).
I am not fully clear on the interaction taking place with the user, before they interject with help. Are they listening to a bot, media file, TTS, or communicating with another person in real time?
For realtime analysis, you would need to use Twilio Media Streams, which streams the voice conversation to a service that could then convert the speech to text in near real time, looking for keywords, and then programmatically perform some action based on those keywords.
An example of using Twilio Media streams with Lex:
Use Amazon Lex as a conversational interface with Twilio Media Streams
I have successfully create a Hyperledger Fabric v1.0 network locally by following the steps Building Your First Network and communicating to this network from my java application using fabric-sdk-java.
Here it created the certificates using cryptogen tools and is able to invoke/query chaincode through each of the peers which participating in the same channel.
My implementations is like:
I have four organisations Org1, Org2, Org3 and Org4 each having one peer.
When Org1 creating an asset A1 with quantity 100 using the chaincode C1, it has to share this asset among the peers like
Org2.peer0 A1: with quantity 40 Org3.peer0 A1: with quantity
30 Org4.peer0 A1: with quatity 20
And remaining 10 only will be
available for Org1.peer0
All these peers joined in the same channel channel1.
My requirement is
If Org1 try to query the data for Org2 : error If Org1 try to query
its own data: return the Asset with the corresponding quantity.
Currently it is allowing to query all the data from all peers in the channel. In order to keep it hide the asset of one organisation from other, what is the best possible way?
I think that the source of your confusion due to the fact that you mixing the application logic with the business contracts logic which is usually implemented in chaincode.
Say you would like to establish Fabric network among 4 different parties and you need to define a rule which defines how you will split/distributed the asset among those participants. Now, let's put aside the peers. In your chaincode you encode notion of the asset and probably the notion of the users to avoid confusion let's call them persons. So you have 4 persons: Alice, Bob, Charlie and John and business rule which says that once Alice submit an asset it has to be distributed according to 40%, 30%, 20% and 10% respectively.
Next, to continue with say Alice works at Org1, Bob at Org2, Charlie at Org3 and John from Org4. Now you can implement a chaincode which will apply business rule based on whoever submits the transaction. Moreover you can implement ACL based on the submitter identity, hence to prevent from Bob query for balance of the let's say John.
The legitimate question will be why do I need 4 peers to implement such simple logic. As you can have only one peer with chaincode deployed, channel which configured for all 4 orgs and all you need is to send transactions proposal to invoke the chaincode.
The caveat in this approach is pretty obvious you need to decide which org will host and run this peer and the chaincode, therefore as all 4 orgs doesn't really trust each other they would like to host they own peer and invoke chaincode against theirs own peers. And in order to prevent each org to trick each other and reduce the influence of adversarial/non-deterministic behavior they will agree on endorsement policies which actually will make sure that peers of other orgs also receives same results as you during the simulation.
Now back to your question, peers are used to simulate transaction against current state and sign on the results, send results back to the client which aggregates endorsements based on policies and submits results to the ordering service which cuts blocks and deliver them to the peers, which will validate correctness of transactions in the block and eventually commit them to the ledger updating state.
Therefore your chaincode should encode notion of clients/users/persons among which you will distribute assets, those users could be mapped back to the client application (real world users), which might be enrolled into different organizations, hence having different certificates signed by appropriate org CA. Finally you will be able to leverage GetCreator API of the chaincode to understand which client invoked the chaincode and apply business logic and access control based on business logic you defined.
Sorry for making my answer too long, but to summarize. Your application/service will be based on two tiers: first one is the application tier - mapped to the user of org, second tier is the peer which holds the ledger and deployed chaincode - to simulate and execute transactions. Hence you will have 4 peers and 4 clients which will submit transaction to the peers and your logic will be based on the client identities rather on the peers.
Hope my explanation will make sense to you ;)
If domain A calls a web service on domain B, can the web service running on domain B read/write cookies? If so, on which domain, A or B? Sorry for the long question but it seems like a straight forward enough question.
I think you don't really understand what cookies are or how they work.
An analogy may help.
If Alice and Bob are having a conversation, and Bob tells Alice "x = 1", Alice will store this and associate it with Bob. If Alice then has a conversation with Bruce, and Bruce tells Alice "x = 2", Alice will also store that, but associated with Bruce.
The next time Alice talks to either of them, she will tell them the value that they last told her.
Bob and Bruce can also talk to each other in this fashion, and the values they store can be completely different, and will be private between them.
Edit: Worth noting, at no point will Alice tell Bob the value she has received from Bruce, nor will she tell Bruce the value she received from Bob. Neither Bob nor Bruce tells Alice "hey, this is from Bob" -- Alice already knows who it's from, it's from the person she's talking to. Neither Bruce nor bob has any say in that.
I want to process incoming forwarded emails received by procmail to grab the subject and recipient of the forwarded (child) email.
For example:
UserA receives an email from UserB
UserA forwards that email to the email server
email server receives the email and extracts UserB's email address
Is there an approach or recipe that performs this task? Or do I have to regex my way through the body of the main email?
EDIT:
By request, I will offer boundary conditions. Email clients of the 'UserA group' are Gmail and Outlook. All users sending in English. The 'UserB' is an automated agent under my control.
One of my servers ('User B') sends automated emails to my users ('UserA') who are supposed to forward the email to a second server for processing (to confirm they received the automated email).
I assume, then, that there are no consistent headers for forwarding and that I am needing to regex my way through the email to extract the data I need.
(This isn't really a proper answer, but I cannot use formatting in comments, so here goes.)
Depends on what you mean by "forwards". If you mean "uses the 'Forward' button in a sane email client" it could come out as an attachment (possibly with a content-transfer-encoding which needs to be decoded in order to access it) or an in-line copy of the original message as a textual body; or if you mean "uses the 'Forward' button in a broken email client, such as anything from Mordor Redmond" there are a number of possible additional complications. Technically, some clients might also "forward" by adding a "Resent-to:" header and otherwise just resending the original message verbatim. Or in some modern clients, you could drag the message over into the composition pane of a new empty message, and make it appear as an attachment to the new message, possibly with user control of the containing message's content-type and encoding, and the attachment's.
Assuming you end up with something like the following ...
From: UserA <usera#such.example.com>
To: server#example.net
Subject: VB: Hi
Hey, here is a message I received.
-- User A
---- Ursprungligt meddelande ----
Från: UserB [mailto:userb#elsewhere.example.org]
Till: UserA
Ämne: Hi
Datum: perjantai 13. lokakuuta 2012 23:45
Here is the original message
-- User B
.... the representation really isn't suitable for automatic processing. You can come up with heuristics such as identifying the "original message" separator and the first (possibly localized and mutilated) "to:" field after the separator, perhaps by requiring all messages to be from a particular version of a particular client with a particular locale setting, but in the general case, this cannot be solved reliably.
(For fun, I constructed an example from a Swedish localization running with Finnish system settings; so the labels from the client are in Swedish, but the system's date is in Finnish.)
If you can edit your question to include an example of a forwarded message and maybe some boundary conditions (it's always from the same user, the version and localization of the client software she uses will not change, etc, perhaps) we can try to take it from there.
I'm creating a web app for handling various surveys. An admin can create his own survey and ask users to fill it up. Users are defined by target groups assigned to the survey (so only user in survey's target group can fill the survey).
One of methods to define a target group is a "Token target group". An admin can decide to generate e.g. 25 tokens. After that, the survey can be accessed by anyone who uses a special link (containing the token of course).
So now to the main question:
Every token might have an e-mail address associated with itself. How can I safely send e-mails containing the access link for the survey? I might need to send a few thousand e-mails (max. 10 000 I believe). This is an extreme example and such huge mailings would be needed only occasionally.
But I also would like to be able to keep track of the e-mail message status (was it send or was there any error?). I would also like to make sure that the SMTP server doesn't block this mailing. It would also be nice if the application remained responsive :) (The task should run in background).
What is the best way to handle that problem?
As far as I'm concerned, the standard Django mailing feature won't be much help here. People report that setting up a connection and looping through messages calling send() on them takes forever. It wouldn't run "in background", so I believe that this could have negative impact on the application responsiveness, right?
I read about django-mailer, but as far as I understood the docs - it doesn't allow to keep track of the message status. Or does it?
What are my other options?
Not sure about the rest, but regardless for backgrounding the task (no matter how you eventually do it) you'll want to look for Celery
The key here is to reuse connection and to not open it again for each email. Here is a documentation on the subject.