Hi Jason,
It's been some time since I've enjoyed the nightlife in Osaka. I spend way more time in Kyoto.
As for Tokyo, Roppongi is known outside of Japan as the place to party. However this is swamped with non Japanese and it's hard to meet locals. Going to Shibuya/Shinjuku/Ikeburero may be a better option if you wish to experience Japanese Night life.
I'd advise asking your question over at Gaijin Pot, that's a great community that can help you with all kinds of things related to staying in Japan.
Generally dress code is not very important, just don't look like slob. I would avoid trainers though.
If you have the chance, walk the streets of Osaka at night as well. This is the moment that the city really lives.
Hope this helps!
Daniel