Pages

Tuesday 17 April 2012

Dot (.) vs Arrow (->) to Access Data Fields in C++



Normally you can access data members and functions by using the dot (.) operator for Cat objects created locally. To access the Cat object on the free store, you must dereference the pointer and call the dot operator on the object pointed to by the pointer. Therefore, to access the GetAge member function, you would write

(*pRags).GetAge();

Parentheses are used to assure that pRags is dereferenced before GetAge() is accessed.
ons
Because this is cumbersome, C++ provides a shorthand operator for indirect access: the points-tooperator (->), which is created by typing the dash (-) immediately followed by the greater-than symbol (>). C++ treats this as a single symbol. Listing 8.6 demonstrates accessing member variables and functions of objects created on the free store.

Accessing member data of objects on the free store.

1:     // 
2:     // Accessing data members of objects on the heap
3:
4:      #include <iostream.h>
5:
6:      class SimpleCat
7:      {
8:      public:
9:             SimpleCat() {itsAge = 2; }
10:             ~SimpleCat() {}
11:             int GetAge() const { return itsAge; }
12:             void SetAge(int age) { itsAge = age; }
13:     private:
14:             int itsAge;
15:        };
16:
17:        int main()
18:        {
19:               SimpleCat * Frisky = new SimpleCat;
20:               cout << "Frisky is " << Frisky->GetAge() << " years old\n";
21:               Frisky->SetAge(5);
22:               cout << "Frisky is " << Frisky->GetAge() << " years old\n";
23:               delete Frisky;
24:       return 0; 
25:    }

Output:
Frisky is 2 years old
Frisky is 5 years old

Analysis: In line 19, a SimpleCat object is instantiated on the free store. The default constructor sets its age to 2, and the GetAge() method is called in line 20. Because this is a pointe
r, the indirection operator (->) is used to access the member data and functions. In line 21, the SetAge() method is called, and GetAge() is accessed again in line 22.

Source: Dot (.) vs Arrow (->) to access data members in C++

Sunday 15 April 2012

Email Sign-off Considerations


The topic of how to sign-off an email is one that has perplexed and concerned many a Netizen. Those who are concerned about being perceived favorably wonder how to sign-off with the appropriate tone, close with the intended meaning getting across as well as how not to look redundant by always including the same closing.
First things first. All sign-offs need to include your name. Whether you include your first name alone or first and last name is dependent on the level of formality in your email. For first time contacts you can include your last name, but in subsequent communications that isn’t necessary. If you have your email program setup properly, your last name is in the From: field.
Not only does how you sign your name set the tone of an email, so does how you choose to sign-off. Some have their own way of signing off that reflects individuality or their personality. For example I am known for signing off my emails with “At your service,” or “Virtually,”. If you see anyone else using these closings, you now know where they got it from!
Then there are the most popular:
Best,
All the best,
Cheers,
Yours,
Cordially,
Regards,
Best regards,
Best wishes,
Sincerely,
Kindest regards,
Warmest regards,
I remain yours truly,
Warmly,
Thanks again,
With thanks,
Many thanks,
My sincere thanks for your time and consideration,
Take care,
Continued success,
As with anything to do with email, use your discretion as to what is best for that particular message. For example, you wouldn’t use “I remain yours truly” in business communications, but you would use that closing with someone you admire, like or would like to have a friendly email relationship with. Whereas “Regards,” is the other end of the scale. Very professional, unemotional and depending on the content of the email could be perceived as a terse closing.
One must take the time to choose a sign-off that is indicative of the overall tone of your email. A sign-off that does not match the essence of the email’s text can be perceived as being sarcastic or down right rude. For example, I doubt if you were sending a professionally stern email that you would sign off with “Warmly!”
And that is the dilemma we all face when writing and closing our emails. Using our discretion to determine the best words to use to relay the exact tone and intent with clarity to avoid misunderstandings. From how you open your email with a salutation to the content and then the sign-off, all parts of your email are a component that contributes to the overall interpretation of your message.
Most onliners are not clear communicators. If you think about it we haven’t had to rely on communicating with the written word in decades. Just a mere century ago people wrote letters daily. This meant choosing their words carefully and thoughtfully to communicate the emotion and intent of their writings. Now, fast forward to this century and many emails appear to be written by someone who didn’t make it out of grade school!
The above examples are not the end-all-be-all either. Your sign-off isn’t exclusively the words above your name separated by a comma. You can also use phrases that reflect the purpose of your email as well. Some examples could be:
Good Job!
All the best of success!
Have a great day!
Happy Holidays!
Keep up the good work!
Thank you!
Thank you for your quick response.
Thank you for taking your time.
Looking forward to your reply.
Have a nice day!
Enjoy your weekend!
HTH! (Hope This Helps!)
Have a good day!
Your closing, while very important, is only the icing on the cake. It needs to be inline with the overall tone and demeanor of your email to ensure that your message is received as intended and leaves no room for misunderstandings or incorrect perceptions.
By taking your time and choosing your words carefully your sign-offs will just be one more indicator of what a pleasure it will be to communicate with you.


Source: EMAIL SIGN-OFF CONSIDERATIONS
Useful Website: NetManners.Com

Saturday 14 April 2012

Thinkings about New Economics


I listened a presentation about global market delivered by an economic sociologist yesterday. The speaker presented his ideas on the research objects of economics, such as the price, market, economy, from an sociological but not standard sociological perspective. From his speech, I realize that more and more people do not believe the framework of viewing the economy established by the standard economist, and the extend of changing the economics can be larger than we imagined - not only the way we research economics but also the way we look at economic phenomena and human behaviours.

In order to collect the ideas and share them with the readers (and hope to discuss with you), I will list my thinkings about the new economics here.

Listening to Lectures Efficiently


What is the purpose of lectures?

At university, lectures are one of the main methods of teaching. Think about some of the lectures you have attended. You will probably find that lecturers aim to achieve different outcomes, but these generally include one or more of the following:
  • to provide a summary of essential knowledge in a subject area
  • to guide your reading and research
  • to demonstrate how to do something, e.g. solve a problem
  • to present a point of view or different points of view
  • to challenge your thinking by presenting an area of controversy
  • to stimulate your interest.


Listening in lectures

Because lectures are such an important method of teaching at university, you need to know what to do to get the most out of the lectures you attend. Some lectures will be more interesting than others and the forms of lectures will vary, but one of your aims should be to identify how lecturers approach their subject.

When a sociologist speaks about sociology or a psychologist discusses theories, what do they emphasise? What specialist language is used? You need to learn how to think and speak using the language of the subject; being present for lectures, and taking notes, is one way of helping you achieve this.

Listening in lectures is often made more difficult by the length of time you need to maintain silent concentration, and the lack of interaction between you and the lecturer. However, you need to see your role as active rather than passive. You may need to work harder at listening, understanding, identifying main points and taking notes than the lecturer does in delivering the lecture!

Tips for effective listening

  • Prepare for the lecture
Prepare yourself for what is going to be discussed by making sure that you at least know the topic of the lecture. Listen carefully during the first five minutes, because most lecturers will outline the purpose of the lecture, and give you an idea of what they hope you might gain.

  • Improve your concentration
Be aware that your thoughts may start wandering 20-25 minutes into the lecture. One way of maintaining focus is to think about what the speaker may say next or the general point they may be making. You could also think about what has already been covered, and try to sum up the content in a few brief phrases. Ask yourself: 'What have I learnt so far?'

  • Ask questions and analyse the message
Consider what else you would like to know about the information being presented, and put these questions to the lecturer, if appropriate. If there is no opportunity for questions, write out your queries for your own research, or for discussion with the lecturer at the end of the lecture.

Think about the evidence for or against what is being said and consider how this fits in with your own reading and your experience.

  • Maintain motivation
You cannot always rely on the lecturer to provide motivation, so you may need to actively seek out some area of interest. Ask yourself:"What is being said here that is useful to me?"

  • Stay alert physically
While you need to be seated comfortably in the lecture theatre, you should adopt a position that will help you to concentrate. Sit upright, respond appropriately to the speaker, and be prepared to take notes. Sitting near the front of the lecture theatre will help you feel more involved and ensure that you can see and hear, as well as avoid possible distractions.

The purpose of lecture notes

After the lecture, even if you have been an active listener, you may very quickly forget much of what has been said. Therefore, lecture notes are very important. The notes you take during a lecture should provide you with a summary of relevant and important points on the topic being presented.

If you develop effective note-taking skills your notes can also serve a whole range of other purposes. Generally, by attempting to think about the main points to include in your notes you are analysing the topic and producing an outline for your revision.

Your lecture notes can also highlight significant references to follow up on, and be a forum for your own thoughts and comments.

How to take notes

It is impossible to take down every word and detail that is presented in the lecture, and if you attempt to do this you will be unable to listen actively. If you have done some pre-reading to prepare for the lecture and listen carefully to the lecturer's introduction, you will be more likely to identify the key ideas being presented.

Think about the type of lecture you are attending, as this should also influence the way you take notes. For example, if much of the material is available in your textbook, your notes should include minimal detail. However, if the information is not available in other forms you will need to take full notes.

Note taking becomes easier as you become more familiar with the style of individual lecturers. Think about the following points in regard to your note-taking:
  • Your position in the lecture theatre
Don't be frightened of the lecturer. Sit close to the front, and look interested. You will hear and see better, and are more likely to find yourself in the company of committed students.
  • The lecturer's use of voice/body language
The lecturer's use of repetition, a change of tone, meaningful pausing or an upraised finger, etc., may indicate important content. Listen and watch for these signals.
  • Lecture language
A lecture is not a dictation exercise. You need to listen and make your own judgements about what you should write down. The following hints however, may help you.
  • Argument structure
Words such as first, second, also, furthermore, moreover, therefore and finally indicate stages in the lecturer's argument. But and however indicate a qualification, because a reason, and on the one hand and on the other hand indicate a contrast.
  • "Signalling" words (used to indicate parts of the lecture)
(1) Introducing the lecture: "I want to start by..."
(2) Introduction of a main point: "The next point is crucial..."
(3) Rephrasing the main point: "The point I am making..."
(4) Introducing an example: "Take the case of..."
(5) Moving on to another main point: "I'd like to move on and look at..."
(6) A digression: "That reminds me of..."
(7) Summing up main points: "To recapitulate..."

Structure and delivery of the lecture

The structure of the lecture and the delivery should influence the way you take notes. Most lecturers will provide some level of support for note taking, through outlines on overhead transparencies or slide presentations .

Some lecturers distribute handouts that give a summary of the main concepts. This means that you can add points to elaborate or record examples, so that you then have a detailed set of notes.

If you download lecture notes with several slides to a page you may need to enlarge each slide so that you have space to write your own notes as well. Alternatively, you can use your own paper for your notes. Number each slide on the downloaded copy and indicate the relevant slide number for the notes you take on your own paper.

Try to listen for verbal cues the lecturer uses to indicate the level of importance of the points being made. These could include repeating key concepts and slowing down or adopting a different tone to indicate the difference between main points and illustrative examples.

Other pointers will be key phrases or words, which give you an idea about the significance of what is being presented and how it relates to the overall topic. For example, phrases such as 'the next important point is','on the other hand' and 'one example of this' are important signals.

After the lecture

Re-reading your notes, preferably on the day of the lecture, will increase the likelihood of you remembering the key concepts. By re-visiting your notes, you can also expand where necessary, tie points together and/or consult references mentioned to develop points or further clarify certain concepts. By grouping your notes together and organising them in folders you will be building up your own set of revision notes, and compiling a valuable reference for the future.

Sources:
Listening to lectures
Listening and note taking in lectures

Wednesday 11 April 2012

Lesson from Bo's Experience


The only lesson I learn from Bo Xilai's downfall is ... being low-key, as a Chinese.