How I Met Your Mother Season 2 Episode 4: "Ted Mosby: Architect"
After Ted and Robin's big fight, Barney tries to convince Ted that being an architecht is a great pick up line. Lily and Robin try to follow Ted's trail and discovered Ted Mosby: Architech left with a girl named Anna.
Barney [on a note left to girl]: Dear Resident, The time we spent together, however long it was, meant the world to me. I would love to see you again but unfortunately I cannot. You see, I am a ghost. I can only materialize once every decade, on the anniversary of my death. I chose to spend my one day among the living with you, sweet resident. Perhaps we will meet again, in another decade--provided you keep your figure. Until then, all my love from the beyond, Barney. Resident: Barney... Who the hell is Barney?