1) HALACHAH: "YICHUD" WHEN THE WOMAN'S HUSBAND IS IN TOWN
OPINIONS: Rabah rules that when a woman's husband is present in the city "we are not concerned for Yichud." The Gemara earlier teaches that when a man and a woman seclude themselves, they transgress not only the Isur of Yichud but they are also liable for lashes mid'Rabanan (Makas Mardus). When Rabah says that "we are not concerned for Yichud" when the woman's husband is in town, does he mean that there is no Isur whatsoever, or does he mean that there is an Isur but there is no punishment of lashes?
(a) RASHI (DH Ba'alah ba'Ir) writes that no lashes are administered, implying that there is an Isur of Yichud. He understands that the husband's presence in the city does not entirely eliminate the Isur of Yichud, but rather it merely mitigates the severity of the Isur.
(b) TOSFOS (DH Ba'alah ba'Ir) argues with Rashi and explains that when the woman's husband is in town, there is no Isur of Yichud whatsoever.
HALACHAH: The SHULCHAN ARUCH (EH 22:8) rules in accordance with Tosfos that there is no prohibition of Yichud with a woman when her husband is in town.
The PISCHEI TESHUVAH mentions several cases in which the Heter of "Ba'alah ba'Ir" does not apply. When the husband does not know his wife's whereabouts (for example, she is not at home and she did not tell her husband where she was going), the Isur of Yichud still applies. Only when the Yichud occurs in the husband's home (or in a place where the husband knows that his wife is located) does the Isur of Yichud not apply. The fear that the husband might enter at any moment prevents the man and woman from doing anything inappropriate, as Rashi explains. This deterrent does not exist when the husband does not know where his wife is, and thus Yichud is prohibited even though the husband is in the city.
Another case in which "Ba'alah ba'Ir" does not permit Yichud is where the woman is in the home of another man. Although the husband knows her whereabouts, he will not walk into someone else's private home unexpectedly, and thus the Isur of Yichud applies.
2) "YICHUD" WHEN A DOOR IS OPEN TO "RESHUS HA'RABIM"
OPINIONS: Rav Yosef rules that when a door is open to Reshus ha'Rabim ("Pesach Pasu'ach"), the Isur of Yichud does not apply.
How open must the "Pesach Pasu'ach" be in order to permit a man and woman to be secluded in the house?
(a) REBBI AKIVA EIGER understands the words of the Gemara literally and explains that "Pesach Pasu'ach" means that the door of the house must be entirely open. If the door is closed but unlocked, the Isur of Yichud still applies.
(b) The EZER MI'KODESH (the Butchatcher Rav) argues and says that the door does not need to be fully open. He explains that the reason why "Pesach Pasu'ach" permits Yichud is not that it creates a deterrent by enabling everyone outside the house to see inside the house. Such a deterrent would not be effective, because even when the door is fully open the man might act inappropriately by looking outside to ensure that no one is nearby. Rather, the reason why "Pesach Pasu'ach" permits Yichud is that it creates a chance that the man and woman will be caught if they do something wrong. That chance is enough of a deterrent to permit the Yichud. Since the fear that one will be caught exists when the door is closed but unlocked, an unlocked door also suffices to permit Yichud.
With regard to how one should act in practice, a competent rabbinical authority should be consulted.
3) THE POWER OF TORAH
QUESTION: The Gemara relates two incidents in which the Yetzer ha'Ra did not bother Rebbi Meir and Rebbi Akiva because it was declared in Heaven, "Be careful with [the honor of] Rebbi Meir and his Torah... be careful with [the honor of] Rebbi Akiva and his Torah."
The Gemara in Sukah (52a) teaches that "he who is greater than his friend, his Yetzer [ha'Ra] is greater than his [friend's]." Accordingly, the declaration in Heaven that Rebbi Meir and Rebbi Akiva were great Torah sages should have been cause for the Yetzer ha'Ra to increase his battle with those sages and not a cause to leave them alone!
ANSWER: The MAHARSHA explains that the purpose of the declaration in Heaven was not to publicize the greatness of these two Torah sages. Rather, the purpose of the declaration was to declare the greatness of the Torah itself. The Torah has the special ability to protect those who study it (21a).

OTHER D.A.F. RESOURCES
ON THIS DAF