How to say lived vs. have been living somewhere? I want to say 


  1) "I lived in Beijing for six months."


As in, I was there last year for six months but I am not living there anymore.

Furthermore, how can I distinguish it from 


  2) "I have been living in Beijing for six months."?


I am sure the secret lies in 了.

My answers (which I hope you can correct/confirm):


  
  我在北京住了六个月 
  我住在北京六个月
  


I'd appreciate any help!
I would say, as a Chinese, that Chinese language doesn't express tenses as explicitly and clearly as English does in most cases. Your translation of the first sentence(我在北京住了六个月) can be taken in both ways, in which case we figure out the tense by context. Past tense would be a better guess, though.

To remove uncertainties, you can say:

我在北京住过六个月。I lived in Beijing for six months.

我在北京住了六个月了。I have been living in Beijing for six months.

Or for added clarity:

我曾在北京住过六个月。I once lived in Beijing for six months.

我已经在北京住了六个月了。I have been living in Beijing for six months already.