The answer to the first example is "did we realize", written in the simple past tense. The main verb is "to do". There are two main indications that this should be in a past tense: first, the narrative form (you are recounting a story) would imply that you are not still listening (thus, it would be a past tense); second, "...what a great musician he WAS" is also past tense.
In the second question, the verb "lived" is also in the simple past tense, which would imply that the condition of living in Shanghai has changed (meaning: you have left Shanghai). If you were still living in Shanghai, you would need a present tense... using the present perfect tense, the correct form of the sentence would be "I have not heard from him since I HAVE lived in Shanghai" (note: in BK's example, "began" is the main verb in the present tense... it would not apply to your situation here since it is neither simple past not present perfect). By the way, "...have not heard..." is written in the present perfect tense, meaning that you are still not in contact (the condition of not hearing is still in effect).
If you were to use the simple past "...did not hear...", it would mean that the condition has again changed ("I did not hear from him since I lived in Shanghai" would mean: we talked together when I lived in Shanghai; I left Shanghai, and we stopped talking; there has been some change, and we are talking again... the implication with this alternative wording would be that there has been a very recent change, such as "...until he called last night"). The perfect tenses are formed by the addition of a form of the auxiliary "to have" to the main verb (with the same "-ed" ending that would otherwise indicate a simple past construction). The tense of the perfective form is determined by the tense form of the auxiliary.
Thus, if you have the word "have" (present tense auxiliary) attached to any main verb, it will be in the present tense. Careful... "to have" can also be used as a main verb, meaning "to possess". It is only being used as a perfective when it is attached to another verb (although it may be separated from the main verb by a noun or noun phrase).
Now, for some additional grammar correction, since you requested it: "actually" should be followed by a comma, in the first line. Also in the first line- "...but to me..." should either be rewritten "...but, for me,..." or (better) rewrite the entire clause as "...but I still have some problems". In the second and fifth lines- you must always end a paragraph with some kind of punctuation... since you are continuing with examples, the correct punctuation would be a colon.
Thus, "For example: " and "Another question is: ". "What is the meaning..." requires a question mark at the end of the sentence. Another question mark would be required after the following sentence beginning with "Does it mean...".
"it WOULD be better" instead of "it will be better". "...if you COULD tell ME"... use the conditional, otherwise you are talking about simple ability, not the desire that I actually do it. Don't worry though, most Americans ignore this grammatical rule.
Also, note that there should be a direct object specified... otherwise, a better verb would be "list" instead of "tell". Correction: "By the way, I am a beginner in English grammar, so I might have (made) some mistakes in my grammar" (alternatively, "... some grammatical mistakes."). Correction: "If there are some, or many, (mistakes) in my question, please...".
Punctuation can be important for proper understanding.