mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

1) there's no evidence chemical weapons were used in combat, let alone by government forces, let alone under orders from the president.
2) there's actually strong indication that the victims are the victims of the rebels (al qaeda that is...)

I should have made it clear initially that my statement was under the assumption of "if we get definitive evidence that Assad did it". As I stated in later post:

"As far I know, there hasn't been any proof at all. The media doesn't really seem to care either way. From what I have gathered, it seems the only definitive fact is that a lot of people died suddenly. Cause unknown. The rest is speculation."

3) even if the Syrian government were responsible, Syria is no signatory of any treaty barring the use of chemical weapons, therefore can't be held responsible for violating such a treaty.

Yes they are. They signed the Geneva Protocol on December 17th, 1968, prohibiting the use of "Asphyxiating, Poisonous or other Gases, and of Bacteriological Methods of Warfare".

4) it's an internal affair in an independent nation. Why are we so upset about this when there's a rumour that someone used weapons against civilians that quickly killed a few hundred but when there was a massacre in Rwanda where millions were slaughtered with machettes and other crude weapons the world stood idly by and let it happen.

Technically, violating an international law is an affair of international law, …

<M/> commented: How do you write so much!! +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

over the next 3 years?!

That's the punch-line!! From your description, it's more like in the next 30 years (at which point, most of it will be obsolete anyways, I guess). I haven't even done half of that, and I've been at it pretty hard for about 15 years. So, I speak from experience.

If you actually manage to touch (and I say "touch") upon all these within 3 years, I doubt you will be able to call yourself "competent" at any of these things.

I am personally quite a multi-talented guy, and mostly self-taught (at least, when it comes to programming, computers and electronics), and I do cherish those competences and consider them to be a strong asset because they can be very handy at times. But it's important to understand the difference between having enough skills in other domains that you can do some things without being too lost, and having enough skills to declare yourself "competent" in that domain (implying that someone would pay you specifically for that "competence"). You cannot be an expert at everything, there simply is not enough time in a life-time to be able to acquire that kind of skill in so many domains. The best you can hope for is to be an expert in a few core and strongly related areas, and have a decent set of skills in many of the peripheral areas. For example, I am not by any means an expert in electronics, but being able …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

There are a lot of people who somehow think that backing currency with gold is a good idea - but it isn't for a couple reasons; there isn't enough gold in the world to back the world's economy and the cost of shipping gold around the world would suck all the value out of the gold.

Or mostly the fact that the value of gold is mostly speculative. In terms of real supply (the amount of gold we have) and demand (how much of it we actually need), there is a huge gap. Gold can be considered a very plentiful metal, and it's extremely overvalued (in terms of "real" value, whatever that means). But that doesn't matter in the world of commodities' trading, it's all speculation, as long as it remains within acceptable bounds for those who actually need it (e.g., there are limits to how much you can speculate on oil, because a lot of people need it and won't accept paying too much for it). We are almost hard-wired to believe that high price means scarcity, but more often than not, it has little to do with it (i.e. scarcity will cause high prices, but high prices are rarely due to scarcity). The bottom line is that gold has a high value because everyone agrees that someone who has a lot of gold is a rich person.

If you were to tie gold to a real and dynamic economy, things would change quickly. The reason for …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

You want to know the reasons behind currencies going up or down in general?

To answer that, you have to understand what money is. Fiat currencies (which are most currencies today) are records of debts that the treasury (government or a major bank) has incurred with the central bank (the bank that issues the currency). In other words, it is what we commonly call an "I-O-U", meaning that a 10 dollars bill means that someone borrowed 10 dollars from the central bank at some point. Meaning, someone has a debt to repay, and can only repay that debt in the same currency it was incurred (i.e., if I borrow something from someone, I must give back that same thing, not something else). This means, someone "wants" that currency, and if someone wants it, someone is willing to trade something for it (work, goods, etc.), and that is what gives the currency its value (i.e. just basic supply and demand). And the entity most interested in a currency is the state(s) to which the currency is tied, because they are the biggest original borrower(s) of the currency.

Once you understand this, you can easily figure out how and why the value of currencies go up or down.

As any record of debt, its value is measured by the trustworthiness of the borrower(s). If a borrower defaults on his loan (i.e., bankrupts), he is no longer looking to repay the debt, which lowers the demand for the currency and thus, its value. …

GrimJack commented: Very well said! +0
<M/> commented: How do you type the much in every question! +0
nitin1 commented: same question as from <m/>, do you have any software to do that ;) well said!! +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Microsoft Visual Studio - Don't try to run it in Linux, and there is no point in doing so. If you want to program in Linux, you need to use tools that are native to Linux, there are no ways around that. Visual Studio is for Windows development only, there is no point in using it for any other purpose or on any other platform. Popular IDEs in Linux include KDevelop, CodeBlocks, Eclipse, Geany, Sublime-text, NetBeans, etc..

Adobe Products - This is the most typical thing people try to run in Linux because Adobe does have some very good products (Dreamweaver, Photoshop, etc.) and the competition from the open-source world is not quite up to it, yet. Generally, I think Adobe software can be run in Wine without too much trouble, but it could lead to a few quirks or glitches when using it. But you might want to explore the alternatives first. Here is a list of open-source alternatives to Dreamweaver, many of which will be sufficient for most ordinary tasks. As for Photoshop, the alternative is GIMP, which is a long-standing open-source image editor / manipulator project and is now a very rich piece of software (with probably far more features than Photoshop), and the only criticism about it is that it isn't as user-friendly as Photoshop, but still, give it a try. Most of these alternatives can be found directly from your "Software Center" (or apt-get commands).

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Isn't the standard tool "ffmpeg" available for Windows too? At least, it appears to be. That's the swiss army knife tool I use for all my video conversion needs.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I didn't know dogs can get cancer!

Of course they do. All animals, including humans, can get cancer. There are only a few rare exceptions in the animal kingdom (naked mole (no cellular division), sharks (special cartilagenous tissue, exceptionally resistant to cancer), etc.). Many small animals have very high cancer rates (40-60%).

When dogs are diagnosed with a cancer or any similar lethal or debilitating medical problem, they are usually put down quickly.

I thought rottweilers are good dogs, but not as good as labs because of their intelligence and behavior... a lot of people say rotts are horrible dogs because they are considered "dumb" by many and labs are considered better in all aspects.

They have quite different behaviors, actually. They are both high-energy and playful. But the Labs are much more independent and, as retriever dogs, they constantly wonder off and explore places. The Rotts are much more of a master's dog, they want to be by your side and do what pleases you, and protect you (which is where some of the danger is, they can be less welcoming with strangers, even aggressive if a threat is perceived).

This is the quintessential difference between "retrievers" (Lab, Golden Ret., Poodle, etc.) vs. "shepherds" (German Shepherd, Rott, Collie, etc.). Labs are smart (as far as dogs go in general), as are most larger dogs, but they slip away more easily, i.e., forget the training, lose interest in pleasing you, or are just distracted by curiosities. …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

How many use it on Linux

I've never used it. I keep Windows around on a dual-boot. And the only things that I cannot get in Linux are things I wouldn't try to run in Wine, or not worth the effort. Mostly, I use Windows for either computer games (for which I don't mind rebooting), or advanced engineering software that I definitely wouldn't even try to run under Wine. I have not found anything that I so desperately needed and didn't have a good-enough version or equivalent in Linux.

So, that's my two cents.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Around the time I was born, my parents had a Rottweiler, but she died young due to cancer. Rottweilers are awesome dogs too, they are super smart, gentle, don't shed much (short hair), but they have lots of energy, so you have to be ready for that (i.e., it's not a living-room potato). It's like a Labrador (lots of energy and short hair), but better, because Labs are complete idiots in comparison.

After that, I grew up with a Golden Retriever. Those are also great dogs, again, very smart, gentle, but they have long thin hair (and shed a lot) and have much less energy (which is either good or bad, depending on your preference). They're well known for being cowardly and welcoming dogs, so, don't get it as a guard dog, a home invador is more likely to drown in dog saliva than be bitten. My dog broke its leash (chain collar) twice: one time to go mate with a neighboring dog in heat; and, to run away from a cat that was showing its claws.

why not get a Newfoundland?

I love Newfie dogs. When I move to a place that can support a large dog, a Newfie will be on top of my list.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

How to evaluate that the timetable is the most effective. Any idea?

Well, you described your problem as a "smart scheduler". So, you must have some idea of the difference between a schedule produced by a stupid scheduler and one produced by a smart one. But, to create a working genetic algorithm, you need to transform that vague concept into an actual function that produces one number that describes that "fitness".

There are two things to consider here: validity and value. There is, of course, a possibility that a schedule in invalid, like having the same lecturer teaching two classes at the same time, or a student having to attend two classes on overlapping times. This is not easy to deal with in the case of genetic algorithms (or any other optimization algorithm for that matter). Ideally, what you should do is create a representation for your genes (DNA) that makes it impossible to produce invalid schedules, but that might be difficult. As much as possible, try to parametrize your system such that a "random" schedule is most likely a valid one. If random schedules are far more likely to be invalid, applying a genetic algorithm will be very difficult (i.e., it's like simulating evolution of a species with an extremely high mortality rate).

Now, for value, you have to figure out what are the things that are preferable for students and lecturers. Things like fullfilling all the credits, i.e., in a given candidate schedule, how many students …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Qt is definitely the best, IMHO. It is not true that you need another IDE for using Qt. But it is true that it is easier with certain IDEs that have a tighter integration with Qt. This will be true for any GUI library out there.

As far as I know, the best IDEs for working with Qt are Qt Creator, Visual Studio, and KDevelop. Qt Creator is the IDE provided by Qt, and it is a pretty good IDE. Visual Studio requires that you install a Qt plugin for it, and I think it also works for the free versions of Visual Studio (the "Express" versions). KDevelop was developed in Qt and largely for Qt development (for the Linux KDE environment), so, it is well integrated with Qt out-of-the-box.

Otherwise, it is possible to use any other IDE and do Qt stuff. However, you will need not be able to use much of the traditional things you use an IDE for, because you will have to setup the build script in qmake, build your projects through the command-line (or by setting up the custom commands in DevC++), and so on. At this point, the IDE will be little more than a text editor. This is pretty much true of any other GUI library because they are generally too big and complex and require a number of extra build-scripts and things like that.

Another option that is similar to Qt is wxWidget. And the other options are mostly tied to …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

If you need to implement different behavior for different types, you can use a separate function with overloading. This is what I mean:

template <typename T>
void read_from_stream(std::istream& is, T& value) {
  is >> value;
};

void read_from_stream(std::istream& is, std::string& value) {
  std::getline(is, value);
};

And then, in your property's stream function, you just do this:

  friend istream &operator>>( istream  &input, property &d )
  {
     ValueType v;
     read_from_stream(input, v);
     d = v;
     return input;
  }

The compiler will select the correct version of read_from_stream depending on the value-type. This is the standard way to do this.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

like you see i'm trying see if the 'v' is 'string'. but i get several errors in 'input >> (string) v;', why?

There are two reasons why this fails.

1) All code in the function body of a template must compile for each type it is instantiated with. In other words, if the value type is int, then the code which says (string)v still needs to compile correctly, where v is an integer. Obviously, only an insane compile would let that slide without errors (or warnings, if you tell it to be C-style permissive).

2) Even just for the case that the value type is string, it won't work (even if the first issue didn't apply). When you cast it to a string, it actually creates a temporary object of type string from the value v. And a temporary object (also called an "rvalue") cannot be used in an expression like input >> because it needs to assign a value to that temporary, but a temporary cannot be assigned to. That's the rule (and there are good reasons for that).

these function works, but not with strings ando know why;)

Why not? It's a perfectly fine function, and should work for strings. What is it that is not working with strings? What happens? And why do you want it to do?

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The C++ wikibook has a pretty complete overview of operator overloading.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The paragraph is very poorly written. I understand what it is referring to, but the wording of the text is horrible and imprecise.

What it is referring to is the fact that template instantiations have internal linkage. This is to guarantee link-time satisfaction of the ODR (One-Definition Rule).

Normally, if you have a function declared in a header and defined (implemented) in a cpp file, then you must compile the cpp file once (as an object file) and link it to the rest of the object files to create your final executable (or dynamic library). If you were to link that object file twice, or have multiple definitions of the function in different source files, the linker would give you an error stating that you have multiple definitions for a given symbol (function-name).

With templates (function or class), the definitions usually appear in the header files, and the template is instantiated for each context in which it is used (i.e., as "needed"). This means that the same template instantiation could appear in multiple object files (from different source files that happen to contain the same template instantiations), which would seem to contradict the one-definition rule. To solve this issue, the compilers treat template instantiations as having internal linkage, meaning they are not "exported" from the object file, and thus, do not clash between each other when you link them together.

Note that many compilers do not exactly obey that rule, as often they do export the template instantiation symbols, but …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

i would request the mods to delete this thread.

I would have deleted it in a split second if people hadn't replied on the thread so quickly. By the time I noticed this thread, which is an obvious vessel for signature spamming, several people had already replied. Generally, we don't delete threads that have more than one post, because we don't want to delete the valid posts other people have made when only the OP is a spammer.

And we do not delete threads on request like that (i.e., because you don't like the content of it). We apply the forum rules, and the rest is in the domain of free-speech.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Incontinence? How gauche.

Would you have preferred "Impotence"? ;)

Serious and
Consciencious
Investigator of
Evidence against the
Nihilistic
Tactics of
Irrational
Supersitious
Twits

Plumber

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Why do you want to install a windows program onto Linux? Chances are, there is a Linux version of the software or an equivalent application for Linux. What is the software itself? Maybe we can suggest a Linux equivalent.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Is it me, or doesn't the C++11 version just change the language that expresses the rules (which is definitely clearer)? Except for the addition of rules for the initializer lists, it doesn't seem like there is anything different (which I guess is required for C++98 compatibility). Only the language changed.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The point is that you could evaluate the operands in any order. Lets add some parentheses:

( 
  ( 
    ( cout ) 
    << 
    ( a++ ) 
  ) 
  << 
  ( " " ) 
) 
<< 
( ++a );

For any of the << in the above expression, the stuff above it or the stuff below it (i.e., its operands), could be evaluated first, and you cannot know which (i.e., it is "undefined"). It will be whichever the compiler chooses (arbitrarily or not). So, clearly, there is no telling which of the increment operators will be evaluated first. And thus, it is "undefined behavior".

A sequence point is just a point at which you can tell that all the stuff that appears before it has been evaluated (or at least, the code behaves as if it has all been evaluated) and none of the stuff that appears after it has been evaluated (again, this is about observable behavior, of course). Because the order of operand / function-parameter evaluation is undefined, there cannot be such a point in the midst of an expression such as the one in this example. So, for the most part, sequence points coincide with where you'd find semi-colons (;) in the code (with the exception of short-circuit operators like && and ||). Also note that sequence points only refer to observable behavior on a single thread of execution, it does not imply anything about actual underlying operations (instructions), which could shuffled around or optimized away, as long …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Retreat from
Employment to
Tackle
Incontinence,
Reflections,
Epicurean
Moments, and
Exasperation at
New
Technologies.

Homeopathy

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

One learns to play a piano well only by years of practice -- same with progamming languages.

Good analogy. I'd add to it: One doesn't learn to play a piano well by only playing the same tune over and over again.

You have to find new challenges all the time to progress.

ddanbe commented: Well said! +14
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

That's odd.

I can explain the "posts voted down" section showing only 3 posts. This is because this section only shows the posts that are currently negative overall. This means that all those down-votes were counter-balanced by the up-votes on the same post.

But the overnight down-votes is very weird. And being that you only have a total of 2 down-voters, it would seem like someone has a grudge against you. Knowing who is beyond my "powers" as a moderator.

In any case, this is not the end of the world, but if it keeps on going, we'll have to look into it.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

A function cannot return an object from its stack

In c++, yes it can.

In that example, the object "f" is copied into the return value of the function. The return value of a function is a variable residing in the caller's stack frame, not the function's stack frame. So, technically, it is not returning an object from its stack, it is copying an object into the caller's stack. That's an important difference in this particular situation, because if the function is part of a library and the caller is the user of that library, then the operation of copying an object into the caller's stack frame is undefined if the type of the object does not have a guaranteed memory layout (which is generally not guaranteed in C++ because the standard does not specify it (ABI)).

Memory allocated in a DLL is not in the same heap as memory allocated in the application program, therefore all memory allocated in the DLL must be destroyed in the same DLL.

Thanks for pointing that out, it's a very important point that I forgot to mention. And yes, that is one of the main reasons why DLLs must pretty much always use the "Option 1" (although "Option 2" is also possible, but very tricky).

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

There are a few common options (and it's best to stick to what is common, and thus, most likely familiar to users of the library).

The first important question to ask is: are you targetting an ABI-stable platform? In other words, do you plan to support Windows, or only unix-like systems. If you want to support Windows (i.e., a platform that has no stable C++ ABI), then your library's API will have to be in C (unless you have a header-only library). Otherwise, C++ is also an option.

In any case, the key is responsibility. That is, don't give any to the user. If your library creates an object, it is your library's responsibility to destroy it (the right way) and ensure it will get destroyed. That's the basic principle.

It is not really a matter of heap vs. stack, because the stack is not an option. A function cannot return an object from its stack, because its stack is destroyed upon return from the function. If you return an object from a function, it will be either in the form of a (smart-)pointer to an object that was allocated dynamically (on the heap), or in the form of a value (return-by-value) which is actually on the caller's stack. And if you need to stick to a C API, the caller's stack is an unknown (no stable ABI) so you can only put primitive objects there (int, char, double, pointers, etc.), and if you want to return a C++ object, …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The survey is a bit weirdly formulated. The questions seem to refer to the "last sketch/diagram" that I made. That could happen to be anything from the most involved sketch that I ever drew to the most trivial doodle on a random piece of paper. I went by the assumption that the questions refer to the sketches / diagrams I usually draw on average.

To be honest, as a general remark about the use of diagrams and especially UML, I think academia focuses way too much attention on that. Although visual representation of code is important and useful, it is not critical. The average practitioner probably spends far more time worrying about quality assurance (QA) for his software than he worries about design methodologies and those diagram rules that academics dream up. I know that for me, I draw diagrams occasionnally to either make a plan for a future piece of architecture or to make a visual summary of existing code, but mostly, I rely on generated documentation (e.g., doxygen, call-graphs, etc.) and reading source code. But overall, that representes a very tiny chunk of my time. Worrying about how to prove or test the correctness and robustness of the software is the thing I preoccupies me every waking moment. If academics have decent methodologies and insights on quality assurance, I'm all ears, but I've been tuned out of any discussions about UML diagrams and stuff for years, because it's really not that important, all things considered.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Just to add to that, a full binary tree is usually stored in an array as follows:

[Root] [Child-1] [Child-2] [Leaf-1] [Leaf-2] [Leaf-3] [Leaf-4]

That's called a breadth-first layout. In other words, it is just an array of 7 elements, and you interpret the first element as being the root and so on for subsequent elements. If you permute the elements around that array 7! times you get all the possible binary trees.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Any standard permutation algorithm will do. You have seven slots to fill, and you can permute the elements just like you would permute the elements of any array. C++ has a standard implementation for it.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Each digit stands for a power of 2, just like decimal digits stand for a power of 10. For example, if you have a decimal number:

5498
5          4          9          8
5 * 10^3 + 4 * 10^2 + 9 * 10^1 + 8 * 10^0
5 * 1000 + 4 * 100  + 9 * 10   + 8 * 1
5000     + 400      + 90       + 8
5498

For binary numbers, it is the same thing (except you only have two digits (0,1) and the base is 2 instead of 10):

1101
1         1         0         1
1 * 2^3 + 1 * 2^2 + 0 * 2^1 + 1 * 2^0
1 * 8   + 1 * 4   + 0 * 2   + 1 * 1
8       + 4       + 0       + 1
13

As far as doing the conversion between binary and decimal numbers, there are a number of "mental" tricks to do it, or you can just do it on the calculator (Windows calculator or whatever). For example, with the number 13, that is easy to convert mentally, you just start with the highest power of 2 that fits within the number. For 13, the highest power of 2 that fits in it is 8. Then you subtract them, giving you 13 - 8 = 5. And you repeat the process, noting down a 1 for each power of two that can fit, and 0 for each that does not, until you reach …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Another hint that might help you is this. The first even number higher than x can be calculated as 2 * ((x + 2) / 2) (and the parenthesis matter, because this relies on integer division).

You can use Schol-R-LEA's loop to do the rest.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

We don't have a forum section dedicated to matlab, but you can post under "Software Development" directly and be sure to add tags to your question, specifically "matlab".

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

If I have a number like 13, its binary representation is 1101 (i.e., 13 = 8 + 4 + 1 = 1 * 2^3 + 1 * 2^2 + 0 * 2^1 + 1 * 2^0). If I do a bitshift of the number to the left by one bit, i.e., 13 << 1, it simply means that I shift all the bits by one position to the left (filling the new bits with zero), giving me 11010 which is 16 + 8 + 2 = 26. And as you can see, this has the effect of multiplying the number by 2. If I do a bitshift of the number to the right by one bit, i.e., 13 >> 1, it simply means that I shift all the bits by one position to the right (discarding any bits that fall off), giving me 110 which is 4 + 2 = 6. And again, the effect is the same as an integer division by 2 (which discards the remainder). Shifting by more bits just means a higher power of 2 (multiplication or division). In other words, this is just a quick and efficient way to multiply / divide a number by powers of 2. Or, it can be used to do other bit-wise manipulations (usually for low-level purposes).

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

None of the codes that I posted are standalone. They are for demonstration purposes, i.e., I'm demonstrated how to accomplish what I talked about in the post, it wasn't meant to be used as is. For example, the different versions of "property" class template that I showed can come and replace your original version, within your original code (with its includes and the PropTest class, etc..).

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Welcome!

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The reality is that there are limits to what you can achieve using the combination of implicit conversion operator and the assignment operator. You will not be able to make the "property" look like the actual value (i.e., make a property variable look like a normal variable but have hidden calls to get/set functions).

The main problem is that you can't overload everything, and you can't rely on the implicit conversion to apply everywhere. For example, if you were to have property<PropTest,std::string,READ_WRITE> Name;, then you'd have the following issues:

void Foo(std::string s);

void Bar(std::string& s);

template <typename Something>
void Bla(Something s);

void Bla(std::string s);


int main() {
  PropTest a;

  Foo(a.Name);  // OK, uses implicit conversion.

  Bar(a.Name);  // ERROR, implicit conversion returns a temporary string, which cannot be bound to a non-const reference.

  Bla(a.Name);  // UGH... this will call the template version, not the string version.

  std::cout << a.Name;  // ERROR, will look for a << operator for the property class.

  getline(std::cin, a.Name);  // ERROR, same as Bar().

  a.Name.length();  // ERROR, property does not have a member function named "length".

  // ....

};

The point is, the implicit conversion operator can only really work in a few "easy" situations. You will still need a "get()" function of some kind, very often.

Another important matter is the matter of references. Currently, your property class causes a lot of copying (much of which might be elided, but not all), and if the value-types of your properties are expensive to copy, this …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

That is an absolutely terrible example, it should never appear in a book, or at least, not one worth reading (unless it is presented as an example of what not to do).

In any case, what this MACRO is trying to do is automatically generate a list of objects of a particular type. For example, if you have some class called Foo and you use that MACRO as Listof(Foo), it will expand to this:

class FooList 
   { 
   public: 
   FooList(){} 
   private: 
   int itsLength; 
   };

Or, I imagine there was more to it than that, but you get the point, it generates a complete declaration of a class FooList to represent a list of Foo objects.

In reality, C++ has a native feature for this kind of thing, it is called templates. You would normally write this instead:

template <typename T>
class List { 
  public: 
    List(){} 
  private: 
    int itsLength; 
};

and then use it as List<Foo>. This is how standard containers like std::vector and std::list are made.

Any book that recommends or shows this MACRO technique is either extremely old and written by a grossly incompetent programmer.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Dogma

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

A programmer having 5+ years experience in C++ programming, in the system and also game department... more or less what will they make?

Of course, this depends on many factors, with respect to your qualifications, position, and your company's size. Generally speaking, it's around the mid 5 digits (USD), that is, around 50 k$ per year, plus or minus 10-20 k$. A friend of mine's entry salary as a C++ game developer in a small company (about 50 employees) was about 42k$, and grew steadily from there. I would expect similar conditions or better elsewhere.

Can I do both and be successfull in both?

It depends. Certainly, some areas of game development are very similar to system programming, others not so much. The same is true the other way around. But I don't know that you could really do both, unless you do one as a job and the other as a hobby (which would be a lot of coding altogether). But I can certainly see a game developer migrating to system programming (new job, new position), and vice versa, if you realize after some time that you'd prefer the other area.

And as far as I know, when people talk about "system programming" (or also called "infrastructure programming"), game development is included in that category (at least, game engine kernel development). System programming is pretty much any complex software architecture with strict requirements about performance and reliability, which applies to OS kernels, game engines, server …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Kick a$$

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Your decoding can be fixed by flipping the subtraction at line 50, getting this:

input[count] = 'z' - ('a' - input[count]) + 1;

As for capital letters, that's not any different than for small letters. You just have to check before whether the letter is a capital letter or not. The "isalpha" function already checks if it is a letter (small or big), you can just replace that with a test for small letter and a test for big letter:

        if((input[count] >= 'a') && (input[count] <= 'z'))
        {
            input[count]+= 4;
            if (input[count] > 'z')
            {
                input[count] = 'a' + ( input[count] - 'z') -1;
            }
        } 
        else if((input[count] >= 'A') && (input[count] <= 'Z'))
        {
          // same strategy as above, but with 'A' and 'Z'.
        };
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

There are a number of bugs in your code. Much of which you could easily figure out by simply adding a print out in the midst of the encoding/decoding loops and examine what happens when you try it.

First, at line 51, you have input[count] == 'z'; where it should obviously be input[count] = 'z';, notice the single equal sign.

Then, you seem to have used + instead of - everywhere, and vice versa. That is, at line 52, you should have input[count]--;. Then, at line 26, you should have input[count] += 4;. And finally, at line 29, you should have input[count] = 'a' + (input[count] - 'z') - 1;.

It seems quite obvious to me that the encoding method (lines 12 to 33) is much nicer than the decoding method.

And if you have further issues, just test it and observe the result, that's the best way to wield out a bug or a problem. So, to recap, the encoding method should probably look like this:

if (choice == 2)
{
    cin.ignore(10000,'\n');
    cout << "enter the phrase to be encoded: \n";
    getline(cin, input);
    for(int count = 0; count < input.length(); count++)
    {
        if (isalpha(input[count]))
        {
            input[count] += 4;
            if (input[count] > 'z')
            {
                input[count] = 'a' + (input[count] - 'z') - 1;
            }
        }

        // For debugging purposes:
        cout << "After encoding letter " << count << ", got this: " << input << endl;

    }
}

and similarly for the decoding, by flipping everything around (plus …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The most "powerful" top to bottom combination of languages for desktop / server applications seems to be C / C++ / Python. That's my two cents.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

First, let me introduce you to two extremely useful standard floating-point functions: frexp and ldexp. The first allows you to do a base-2 logarithm (integer result, rounded above). And the second allows you to multiply a floating-point number with 2 to some integer power (positive or negative), and it does so in exact arithmetic, meaning, absolutely no loss of precision whatsoever. That's where all the magic happens.

There are many algorithms that rely on scaling the input numbers such that they fall within some desirable range (for numerical precision) where the algorithm works better. In matrix numerical methods, this is crucial, and it is called "matrix balancing", and similarly, the so-called scale-and-square methods which apply to a number of exponential-based functions. In any case, the implication is always that you do the scaling using exact arithmetic functions (i.e., frexp and ldexp).

That said, your problem does not really fall under that category per se. Your situation is a classic problem of smearing. Once your input number reaches a high enough magnitude (compared to PI), you've lost the precision, and there's nothing you can do to retrieve it. Sorry.

What you need to do in this situation is ensuring that the number never reaches a high magnitude, which it shouldn't anyways, because angles are periodic, so they can just wrap around. So, this is a problem that you can only fix at the source (where the "x" comes from) and ensure it never reaches large magnitudes. This …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The security council and the UN should come up with a peaceful resolution without getting involved.

Two of the five veto-power countries in the UN's security council are open supporters of Assad's regime, that is, Russia and China. The UN is completely paralyzed in this matter. And as AD notes, it's pretty much paralyzed in all important matters.

The only reason the US wants to take Military action is to nuke the hell out of Syria, thus killing innocent people and all to show Iran and the rest of the world what such a powerful country the US is.

You're way off on that, it's a lot more calculated than that. There are certainly a number of reasons for the US high-commanders wanting to intervene, and of course, none of them are humanitarian. These reasons include defying the competing super-powers, i.e., Russia and China. Also, to send a message to Iran (i.e., that the US is still as "trigger-happy" as ever before). And, of course, Syria is an oil country not controlled by a western country, and has strategic and economic importance. Then, there are internal politics like the Democratic president not showing the "weakness" that democrats are often accused of by brain-dead pundits from the right. There's the stupid idea that a man should "walk the walk when he talked the talk". And so on, so forth.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Any well-rounded programmer should know several languages (at least 4-5). And C++ and Java will both figure on most "lists" of recommended languages to know. The others might be languages like Python, and some more esoteric languages.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

It sounds like some sort of phishing scam. When I google for those numbers, I get hits of all kinds, mostly saying that each of these numbers are tech-support numbers for microsoft / MSN / hotmail, facebook, norton, and just about any other prominent IT company.

My guess is that you call there, for tech-support, and they get you to give them your credentials (username / password). And the rest is obvious.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The point about learning Java well before moving on to C++ is a fair point from the perspective that Java might be an easier language to learn the basics. But that's the important point "the basics". Java and C++ are very different, and Java is far more narrow in scope and in coding practices / techniques. Don't be fooled into thinking that simply taking good Java skills and transposing them into C++ is sufficient to be considered as being as good in C++ as in Java. Java-style (even very good Java style) programming in C++ is generally considered, at best, as mediocre, by the C++ community. A good C++ programmer is expected to master a wide amount of techniques and styles that are not common or even possible in Java.

So, I guess my advise is not to wait too long before initiating yourself to C++, if that's your ultimate goal. And when you do, treat it as a completely different language. The worst thing Java programmers do is assume they should program in C++ like they are used to doing in Java, that results in horrible C++ code and a lot of pain and suffering, and often leads Java programmers to give up on C++. As evidenced by animatinator's description of C++:

but there are so many fiddly details (pointers/references, memory management, general low-levelness) that it's easy to get bogged down and lose motivation.

which are, for the most part, only problems related to trying to do …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

If you eat the cake you have the cake ;)

Yeah, it's a stupid "fixed" expression, but you know what I meant.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

US wouldn't be wormongeres if all the little piss-ant sized nations like Syria would cut all that crap out. Actually, seems to me I recall this all being started by Syrian people themselves.

As Rep. Alan Grayson would put it:

"I don't know where we got this odd notion that every time we see something bad happen in the world, we should bomb it."

If you think Syria is a piss-ant sized nation, then why should we even bother to do anything. You cannot imply, in the same sentence, that every small country in the world should behave according to your wishes, and at the same time imply that it's their fault that you have to police them. You can't have the cake and eat it too.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Has there been any definitive proof that shows which side was responsible for the use of the chemical weapons?

As far I know, there hasn't been any proof at all. The media doesn't really seem to care either way. From what I have gathered, it seems the only definitive fact is that a lot of people died suddenly. Cause unknown. The rest is speculation. I think it's reasonable to assume it was a (bio-)chemical attack of some kind, but the instigator could anywhere between Assad personally ordering it, and rebels having somehow gotten their hands on some chemical weapons and used them. Or, of course, anything in between, like a faction of the regime acting on its own, or some conspiracy by american neo-cons to create a pre-text for war.

EDIT: Apparently, there is a US report that concludes that it was indeed a government strike, most likely commanded by Assad / high-command. Link. I remain a bit skeptical, knowing the shameful track record of US intelligence agencies' failures to get a clue on anything in recent times, and their prominent role as war-mongerers. So, to take with a grain of salt.