Ask opinion about situations in which researchers/non-researchers get involved in projects (externally) and the best way to avoid strange situations I'm junior researcher so I'll appreciate your understanding on my very short 'experience' for the things I'm going to explain:

I'd appreciate your comments regarding two relatively similar situations I've experienced recently:

Situation 1) 
Recently I was contacted by a professor who asked me to give him a hand with a student who would be working on one of the topics of my expertise. While I'm not affiliated to the University where they work, I'll be collaborating with them in few months (all fixed already), so I agreed thinking that the experience would be useful for me and to build some good relationship with them from now. From the firsts conversations with the student, an idea for a working plan came up, even if they had some previous idea of 'what they wanted to do', I definitely helped them to define the main plan. After the 'draft' of the plan was set, few days of silence went by, later on, I received an email from the student telling that from now on, he would be working with Researcher-A and Researcher-B in this project and he would ’probably' contact me for some questions in the future.  Since this is a multidisciplinary project, I knew that Researchers A and B would eventually have to join, but, I also had a bitter taste since I was 'kindly' kicked out of the whole thing.  I guess the best I can do now is to track the progress of this study and eventually request to be part of any publication that they plan to do.

Situation 2) 
I had to contact a group of 'computer scientists' (a group 'devoted' to innovation, who offer their services to researchers independently -not belonging to any university-), to help me to build up a part of a project in which I'm not really expert (basically setting some experiment using computer devices and programming).  They said they knew somebody doing similar things and asked me to send them my working plan to get a better idea of the whole thing. Of course I just sent them a short &amp; very basic description of the plan, with mostly the things that I'd need from them and some general explanation to help them understand the project. After that, I had no news from them for weeks, I tried to contact them several times and there was always something getting on the way (unexpected meetings and trips, incoming second calls…I never got a call back).  Later on, I saw in their website that they were recruiting students to help them to do something very similar to what I requested but with few variations. I don’t think that this was an advance of my work since they never reached to me to work on the details, I never received news from them about when were we going to start, what was the plan or anything! I’m confident that eventually I'll get them to help me if I push some buttons with the main bosses there, but again bitter taste here. 

Regarding both situations: Is this common? What can one do to avoid these problems? How can a researcher (especially those not-yet affiliated) protect his/her ideas/work from people who would be somehow involved. I try not to judge, not in all cases there is bad intention, but in some way, they seem to bump into random situations and behave in tricky ways. I don’t know how both stories will end up, I trust that there will be someone in the head of both offices that will show some common sense, but I want to learn something from these experiences, what to do to prevent these kind of ‘bad moments’.

Thank you in advance.
Situation A is more or less common specially it comes to publications. 

Generally in such situation, 


Both the parties should have clear cut understanding of role of each other before starting working on the project. 
Ethically, that researcher SHOULD knowledge you for your contribution in the project if she/he want's to get it published or submit to any grant agency. 
If you have contributed sufficiently and you think you should be part of their publication, you can just express your opinion to professor and make it clear. 
Do not 'assume' that they have kicked you out. There might be changes in their project direction and they might need some other set of skills.
Inform regarding this to your adviser. It is important to keep him/her in loop.


However also remember, sometimes whatever you have decided may not work out because experiments/analysis might need to get more help or reduce existing resources etc. Best thing to do in this case is talk to professor and see what is your role in this project. To avoid further such situations, always be clear about your role in project. Sometimes your role might change depending on direction or project or results you got. You should be flexible enough to handle such cases. 

In the case of situation B, try to contact their organization/institute regarding this. See what is the purpose of that advertisement. As you had not provided them any details, they could have come up with similar thing by their own. See their website /publications if they had working on similar thing before. Be patient and contact them again regarding this.