add sound card to vmware server virtual machine
If your virtual machine does not have a virtual sound adapter in the virtual machine configuration file (.vmx)
With the virtual machine powered off, try adding the following lines to the end of the .vmx file
sound.present = "TRUE"
sound.virtualDev = "es1371"
sound.fileName = "-1"
sound.autodetect = "TRUE"
Then you can use wmware server virtual machine configuration to point the sound card to your host machine physical sound card.
--
Pop (Pu Liu)
UML learning stuff
Java modeling: Summary |
Level: Introductory Granville Miller (rmiller@togethersoft.com), Mentor, TogetherSoft 01 Jun 2002 Welcome to Java modeling, a monthly column for Java developers that examines best practices in the UML, a standard notation for modeling object-oriented systems. The column begins with some introductory articles to build a foundation, but will quickly move to more advanced applications. All of the articles are presented here for your convenience. A UML workbook, Part 4 Holonic software development, Part 2 Holonic software development, Part 1 A UML workbook, Part 3 A UML workbook, Part 2 A UML workbook, Part 1 |
--
Pop (Pu Liu)
two articles about C++ assignment operator
http://icu.sourceforge.net/docs/papers/cpp_report/the_anatomy_of_the_assignment_operator.html
class TFoo : public TSuperFoo {
TBar* fBar1; //TBar is monomorphic (1)
TBar* fBar2;
// various method definitions go here...
}
//Do not need to be a virtual function(1) If TBar is polymorphic, we need a virtual function like clone() to accomplish the creation.
TFoo& const //considering: a=b=c and (a=b)=c
TFoo::operator=(const TFoo& that)
{
//step 1
if (this == &that) //compare address of this and that
retur *this;
//step 2
TBar* bar1 = 0; //make memory allocation a transaction
TBar* bar2 = 0;
try {
bar1 = new TBar(*that.fBar1);//make a copy, see (1)
bar2 = new TBar(*that.fBar2);
TSuperFoo::operator=(that); //copy super's members
}
catch (...) {
delete bar1;
delete bar2;
throw;
}
//step 3
delete fBar1; //free fBar1
fBar1 = bar1; //call TBar.=()
delete fBar2;
fBar2 = bar2;
//step 4
return *this;
}
(2) Owning pointer: like fBar1, fBar2, whose lifecycle are the same as the host object of TFoo
--
Pop (Pu Liu)
Using copy construction and assign operator
statement:
Using initializer in copy constructor to avoid double initialization for class type members
Do not reuse the same for copy constructor and assign operator even they are doing the same thing!
In C++, assignment and copy construction are different because the copy constructor initializes uninitialized memory, whereas assignment starts with an existing initialized object.
If your class contains instances of other classes as data members, the copy constructor must first construct these data members before it calls operator=.
The result is that these members get initialized twice, as cctest shows. Got it? It's the same thing that happens with the default constructor when you initialize members using assignment instead of initializers.
For example:
CFoo::CFoo()As opposed to:
{
m_obj = DEFAULT; // cause double initialization of m_obj, one for m_obj, another for "="
}
CFoo::CFoo() : m_obj(DEFAULT)
{
}
--
Pop (Pu Liu)
C++ virtual destructor
5.3.5.3: "If the static type of the operand is different from its dynamic type, the static type shall be a base class of the operand's dynamic type and the static type shall have a virtual destructor or the behavior is undefined."
1. If C++ had a "sealed" keyword, then the rule would be simpler: If you do a "
delete p
" where p
is a pointer to an unsealed class, then that class needs have a virtual destructor. (The imaginary "sealed" keyword makes it explicit when a class can act as the base class for another class.)2. If the sizeof or layout of your class is a concern for some reason, making the destructor virtual "costs nothing" if your base class already has a virtual method. You're already carrying a vptr at that point.
3. Classes having virtual functions should always have a virtual destructor. This is necessary since it is likely that you will hold an object of a class with a pointer of a less derived type. Making the destructor virtual ensures that the right code will be run if you delete
the object via the pointer
--
Pop (Pu Liu)