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

I'm not sure how to treated a Canadian girls because either you treated them as English or treated them as French?

That's an "interesting" dichotomy. It got me thinking, I don't know how to treat Polish girls, should I treat them as Chinese or as Swahili?... what about just treating them as best you can, and hope for the best. If she curses at you, well, water under the bridge.. next time you'll do better.

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

I agree with the points you make, however, it depends on where you get taught as well, right?

Well, what you should be taught does not depend on where you get taught. But it does depend on the focus or specialization that you are concentrating on. If you are studying general CS, then a cursory look at FFT algorithms might be interesting, but no more. But if you're doing image processing or pattern recognition or something along those lines, then it is probably well worth the effort to get a good grasp on those algorithms, including implementing them and tweaking them.

But if your curriculum is so general that it doesn't require seriously looking into (and implementing) any kind of algorithms or methods, then does that make you a competent programmer? No. It's like studying art without developing any particular artistic craft of your own, and calling yourself an artist when you're done with your studies just because you have a cursory knowledge of trends and techniques used by actual artists. Such an art curriculum might be good to do art appraisal or trading, but no more.

Some people go through a CS curriculum in much the same way (whether it's their fault or their school's fault, usually a bit of both), but then, they apply for programming-intensive jobs, under the self-delusion that they are actually competent at programming. Part of the problem is that there aren't too many jobs for computer scientist who are incompetent at programming, …

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

1500+ lines in a few (2) days...

Either that includes a hell of lot of blank lines, copying and pasting, or there was no testing because that's just daft!

First, it certainly doesn't include blank lines or comment lines, nobody includes those in code-line counts. Second, rubberman did mention that the code only got to production code about 9 months later, after thorough testing / QA / debates. Third, counting only the time for writing the code, starting from nothing to having a fully working (somewhat tested) piece of code of about 1500 LOCs is easily done in a few days if the task is relatively straight-forward.

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

For example, in my undergrads I had develop an algorith that used an FFT (Fast Fourier Transform) and it would be impossible/not pratical for me to write my own because:

Sure. But there's a difference between choosing not to reinvent the wheel for good practical reasons and not being able to reinvent the wheel when required. In some cases, you are required to write an algorithm from scratch, e.g., because you need to add some twist or feature to it, because you need to stream-line it to your application, because you are borrowing ideas from a few different algorithms to make a new one, because you can't find a suitable off-the-shelf implementation that you can use directly, or simply because the algorithm is completely original. In any of these cases, you have to be prepared and able to sit down and competently write a good implementation (including the testing that ensues). And that's the whole purpose of getting CS students to write classic algorithms like sorting algorithms or basic numerical methods (like FFT). But if they sort of skip that under the pretence of "don't reinvent the wheel", well, they never acquire the most basic skills a good programmer needs.

2) I didn't have enough time to test my algorithms (in-depth) because that would require my whole year.

Well, an FFT algorithm can be written and thoroughly tested within at most a few days, by a competent programmer, that is. This also goes to the point …

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

Exactly a year ago, I bought an Acer laptop with an i7 processor, 8Gb ram, and 1Tb HDD. It was a bargain at the time, and it works great, just a little less powerful than my desktop computer at home (from 2.5 years ago). It's slick, has a full full-size keyboard, decent size screen, yet light-weight and portable. Although it mostly sits in my office, it's nice that laptops today can be good enough as primary work-computers because you don't have to suffer of reduced means when travelling or moving around (from office to labs).

If you include non-PC computers, then my latest acquisition (last summer) was a new micro-controller board (Quanser HiQ) for my lab's satellite-emulating unmanned aerial vehicle. It runs a hard-real-time micro-Linux kernel and allows us to control the UAV via wifi (which is not without its challenges in a hard-real-time system). Pretty good overall, although I had to squeeze every clock-cycle out of the code to get it to run the control systems and filters smoothly.

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

The word a$$ either means anus or donkey, so pick whichever you like: "anus-kicking computer" or "donkey-kicking computer". ;)

I would also vote against censorship, if it was a democratic decision.

Nick Evan commented: Ha! +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

@rubberman: I wasn't talking to you. The OP expressed distaste and problems with the Unity interface of the newer versions of Ubuntu, that's why I was talking about alternatives in that regard.

I've just had a fresh install of 12.04 and it is not responsive and lags. Is that a problem that people(if not all) are experiencing?

I've had the same problem, as many people have. Unity does require more resources than advertised. And Canonical has been trying to fix the issue, but the main problem is that the features that Unity provide (which are awesome in principle) are very heavy features that tend to lag a lot in inconvenient times. I've heard 12.10 is a bit better, but I don't know for sure. I have an older laptop that I recently retired from active duty, so I experimented with a few distributions. The hardware is limited (Centrino CPU, 2Gb RAM, 100Gb disk, etc.). When I tried Ubuntu with Unity, it was very sluggish, barely usable, for both 11.10 and 12.04.

I want to disable unity interface on the side and have something like what I had in 10.10. Is that possible?

I believe that it is not really possible (or at least, not easy) to remove Unity to replace it with something else. It won't be worth the trouble, and if you want to replace the interface, then it boils down to the same as just picking another Ubuntu-based distribution (which are all just Ubuntu …

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

My native languages are French (born in Québec, French-speaking part of Canada) and Swedish (from my father, I also spent part of my childhood there). I speak English just as if it was my native language too. I'm functional / conversational in German because I've lived there for about a year (and also had some classes), and knowing Swedish and with a bit of effort, I picked it up pretty quickly. I learned Spanish in high-school, and given its similarity with French, I'm still good enough to function on a basic level if I'm thrown in a hispanic environment (I tested that in Spain a few years back, didn't have any trouble getting around). I learned some Finnish while I was living there, but it's literally one of the most complicated language in the world, so, not much of it stuck with me, besides a few phrases and swear words. Then, I can sort of understand many of the languages (written or spoken) that are similar to those that I already know, e.g., Italian, Dutch, Danish, etc. And then there are the others that are so close to languages that I know that you could say I speak those as well, e.g., Norwegian, Acadien / Cajun or any other forms of French (technically, that's all French, but some are wildly different from French-Canadian), etc..

I would love to step out of the European languages a bit, and I've considered learning some Arabic and/or Mandarin, but I haven't gotten around to …

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

You say that as if being Canadian is somehow distasteful. What does it mean to you to become "Canadian" as opposed to Quebecois? I'm not trying to start an argument. I really would like to know. No one has ever taken the time to explain it to me.

I'm not saying being canadian is distasteful in any way. I was trying to describe the feeling that Québécois feel when it is asked or implied of them that they should be more part of Canada or assimilated or whichever way it is put. And if you think that there isn't such an implication or push, well, you just don't live here (but I am glad you don't seem to be on-board with that). The best comparison I could come up with was the similar push or implication that Canadians get for being more American. Differences between cultures, especially cultures as closely related as ours (QC, CA, US), are difficult to describe or explain in concrete terms, that's why I was trying to identify the feeling.

and occupied

Could you please expand on that? I'm not sure what you mean.

That was a historical reference. QC is, legally and historically, an occupied territory. We were first invaded by the British. Then, "we agreed" to constitute Canada (along with modern day Ontario), and by "we agreed", I mean that the oppressive British governance who ruled QC at the tip of a bayonette and at the end of …

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

I don't like the idea of French-Canadian, Japanese-Canadian, etc. Once you come here then you are Canadian. Period. Celebrate your roots but don't use your roots to insulate your group from the rest of society or to demand special status.

If using "French-Canadian" was just an unfortunate slip, then alright, otherwise, here's a boiling-blood rant:

That's Pierre Elliott Trudeau's "canadian multiculturalism" right there. This might be appropriate for small immigrant minorities, but Canada also has large non-immigrant "minorities", and this doctrine breaks down completely. My main issue with this is that it lumps French-Canadians (Québécois) like me as just another cultural minority to be assimilated, with more or less the status of an immigrant minority culture (is the province of Québec just a big cultural ghetto?). Québécois people didn't "come to Canada", we're home (and occupied), we won't become "Canadian" anymore than you would become American (we have lots of things in common and I love my neighbors (south and west), but that's a long way from assimilation). Trudeau created his big, strong, united, multi-cultural country, while making sure Québec was left out (and first nations too, btw), while at the same time, of course, making it clear that if Québec wasn't happy about it, martial law and the army is all it would get.

It's laughable when canadians whine about Québec "demanding special status", the truth is, we have special status (in language, in constitutional rights, in governance, etc.), it's just that canadians don't like it and …

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

If the main problem is that you don't like the interface (unity), then just use a different flavor of Ubuntu. I recommend Kubuntu (12.04 LTS). Mint or Fedora are also good options.

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

On writing to cout, terminate your lines with << endl;, otherwise you won't get your output displayed on the screen before you are asking for the input.

That's wrong. cin and cout are tied together under-the-hood such that asking for input from cin automatically triggers a flushing of the output stream, exactly for that kind of situation.

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

I guess we also have to specify that the formula is not computed with integer arithmetic. Otherwise, for any integer greater than 1, the division would yield 0, and thus, there would be "billyuns and billyuns" of possibilities too (2^160 for 32bit unsigned integers). ;)

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

Cold in home with a sick bed.

Sorry to hear that. Hope you get well soon!

@otengkwaku: I agree, Dani and Daniweb both rock!

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

When doing cross-platform work, there isn't really a need to constantly use both or move between two platforms all the time for doing the actual coding, only for compiling and resolving issues. You code on one platform (whichever you prefer), and frequently check that it compiles on your other target platforms, and that your unit-tests pass. Virtualization or dual-booting will do just fine, even remote desktoping works well to just make sure things compile and pass the test-suite (there's nothing easier than just SSH'ing to another computer, run the build+test script, and continue coding while you wait for the results).

The main challenges are not in the setup of the computer(s), but rather in the methodology used while coding. First, you need a decent way to easily transport your code-base from place to place, whether it's between a Linux-friendly folder/partition and a Windows-friendly folder/partition, or between two distinct computers, or into a third-party computer, or into the computer of a collaborator / contributor. Second, you should keep track of changes to be able to see what changed between the last successful cross-platform build and the current one (if it failed). You can solve both of these problems by hosting your code-base on a server like sourceforge or github (I highly recommend github), it's very convenient to commit all your daily changes to the server and be able to pull them from any other machine, anywhere (and it even does the Windows new-lines / UTF new-lines conversions …

bguild commented: Detailed and helpful +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Here is a pretty complete tutorial for Linux. For Mac, it is a Unix-like system like Linux, and so, the tutorial is equally valid for Mac.

(I think it's different in you can't create/import .dll's instead it's .lib).

You have wrong, here is how it is:

Windows:
.dll : for "Dynamic-Link Library", the DLL is needed to run the executable (i.e., the library code is in the DLL only, not imported into the executable, and that code is loaded dynamically (when loading the executable)).
.lib : for static library (only used by Microsoft and Borland compilers), the lib is only needed when compiling the executable (i.e., the library code is imported into the final executable, making it a standalone executable).

Unix-like systems (Unix, QNX, Linux, Mac, Windows/Cygwin, and just about every other OS that exists today):
lib***.so : for "Shared Object", this is essentially the same as a Windows DLL (although the linking mechanisms are a bit different, but that's an advanced topic).
lib***.a : for "Archive" or also called a static library, this is the same as a .lib, but for all compilers other than Microsoft or Borland (i.e., GCC / Clang / ICC / ... under Windows also use .a for static libraries). The only difference between a .lib and a .a is the binary format used (the .a files use the ELF (POSIX) standard from Unix).

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

Stop the hate people. English people are fine people. They're very nice, if you can somehow understand what they say... Cockney != English.

The only trouble I ever had with English folks is when a drunken football hooligan puked on my shoes after a Sweden vs. England worldcup game I went to. It was an accident, they were sorry about it, or at least, they threw an empathic "Oh.. deew'itsh'u mate?" (translation: "Oh, I'm sorry, did we hit you, mate?"). I think the two things that the English are fanatical about is football and drinking, and they love to combine the two, with dubious outcomes.

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

So who do you think is going to win?

The team that scores more points than the other by the end of the game. -- Captain Obvious

<M/> commented: you will be rich if that is how you bid lol +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

What AD suggests is the preferred thing, i.e., passing the libraries and include-paths manually to the command-line, or configure you projects to add your library and include-paths to them. However, you shouldn't put them "anywhere you want", either put them in your home folder or somewhere that isn't a system path (not on the root partition).

If you really want to install them on the system, here's what you need to do:

So, normally, in the Linux file system, you have the following directories for installed software and libraries:

/usr/bin : for executables (and scripts)
/usr/lib : for binary libraries (static (.a) and shared libraries (.so))
/usr/include : for header files (all languages)

So, you could "install" your library's headers and binaries in those folders and then you will be able to use them like any other system library (i.e., when you install development packages or any software or library from the repositories (apt-get or yum) that's where things are installed, with the addition of /usr/share for application data (images, system-wide configurations, etc.)).

However, it's not a good idea to put your own hand-rolled libraries and stuff in there because it will be mixed up with official system libraries, and you don't want that until your library has achieved really good maturity. There is an additional set of directories for that specific purpose:

/usr/local/bin
/usr/local/lib
/usr/local/include

which are just add-on folders for the top-level folders of the same name, but it is much easier to manage …

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

More and more I find that I can no longer assume that the developers and IT specialists I work with have any clue how to do their job.

The worst is when the only skill that people develop during a programming course is their skills at finding code on the web and disguising it as their own. At some point, it gets to the point that they even believe that they did it themselves. A while back I delegated a simple coding task to a senior computer science student that was part of my robotics team. It was a simple pattern-matching task, no big deal, maybe a few hundred lines of code or so. It took him about 3 months to get it done and what he delivered was clearly pieced together from 2 different sources, and still had the original authors' names in most of the source files. And of course, the code was completely inappropriate for the task given. And when I confronted him to those facts, he couldn't understand why I would say that he didn't do the work, but said that of course he didn't literally write the actual code himself, as he said "nobody does that anymore", some programmer he is. It never occurred to him that his programming courses were trying teach him to be able to write the actual code himself, he thought the point was to have a vague understanding of it and be able to cobble up code from …

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

sets up a way for users to permenantly close their own threads so they don't have to take in anymore solutions or have a "timer" that closes threads permantly after a few months of being "dead". Wouldn't those be helpful features to prevent spam?

If I'm not mistaken, there is a time out on the email notifications. As in, the OP or other members who contributed to an old thread don't get notified by email that someone has resurrected their thread. If not, that could be a good idea (but then again, I'm sure Dani would say that it's good that resurrected threads poke old members, possibly bringing them back to Daniweb, if they haven't been around for a while).

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

By any chance is Dani developing a way to permenantly close "dead" threads, to prevent spam?

No, or at least, it would be extremely surprising. She has made it abondantly clear (mostly in moderator-only discussions) that people contributing to old threads is not only in agreement with the rules but also welcomed, even if it's annoying for members to see old thread popping up in the listings. And as the queen, her wishes are our commands.

I do agree that it would be nice to have some feature that's more "in your face" about the thread being dead would be a good thing. But then again, the current purple, large-font message and the big fat link to start a new discussion is pretty "in your face" already.

It could be a two-step thing: remove the editor box from threads that are too old and replace it with a message like the current one, with the addition of a link to make the reply-editor appear if the person really feels he has something valuable to add to it. That additional, simple step just makes it impossible for someone to just glare over the thread and the "dead thread" message without noticing and replying to it as if it was a current and active thread.

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

I have a tentalizing scenario for the whole "holding the door" conundrum: double doors. Walk into a restaurant, mall, or building with double doors, whoever gets to walk through the first door held open for them is going to reach the second door before the other. And there comes the "test", (1) will the person return the favor (and establish equality of manners), (2) will the person slow down expecting the gallantry to be repeated, (3) will the second person rush in to hold the second door too, or (4) will the person just open the door and walk through (and probably holding it open for the second person).

To me, the first case is nice and pleasant for all parties involved, even among strangers, it just feels good to care for others and/or be cared for. The second case, which would usually involve a woman as the person waiting for the gesture of gallantry, is a bit backwards and weird, and I don't think anyone (of my generation) likes that, whether on the receiving or giving end. I think few men are still attracted (if ever) to the whole "I'm a princess and you're my knight" thing. And if women are offended to be put in that role, then great! The third case is also bad for the same reason, except that, in that case, the man is trying to put the woman into that princess/knight paradigm. In the last case, clearly the person doesn't care much about the …

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

Ok, completed compilation of Clang 3.3
In other system, you wouldn't need to do this: you would just use the working binaries that you be available at the site of the developper. But, hey this is the linux world: always make it the most complicated possible so we can keep busy all the time.

Take any fairly complex bleeding-edge open-source library or application and try to use it in any system other than Linux, and then you will know what real pain is. You cannot compare something like getting the very latest version of Clang or GCC (a very recent, experimental-version, open-source compiler) with something like installing stable versions of GCC or MSVC distributed in Windows. MSVC works on a 2 to 3 year release cycle (which is really long), is closed-source, and commercially packaged. GCC has a much shorter release cycle on Unix-like systems (a few months), is open-source, and is packaged (as binaries) only after sufficient stability and field-testing, and is packaged for Windows (in MinGW) every so often (and never with the bleeding-edge version either). If you can accept that situation (lagging behind in version, waiting on long release cycles), as the vast majority of people can, then you can install those pre-packaged binaries and have no trouble at all, in Linux, it is as easy as issuing the command $ sudo apt-get install build-essential and that's it. But if you choose to get the bleeding-edge version (of Clang or GCC), you must accept …

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

Ok, now I actually seem to be able to compile Clang 3.3. The computer is running for quite some time now (I am crossing my fingers...). I am curious: about I long will it take on a duo-core laptop ? An hour or a day?

It should take about an hour, at most two. Clang and LLVM are not that big.

But still, why is it not working (the config.log that it refers is many many pages long and totally useless for me)?

I'm pretty sure it is this issue with the crti.o libraries and such (as in my previous post). I had that issue before, and it is seems to be a recent change by Debian (since Ubuntu 11.10) that the GNU people didn't adjust to yet in their configuration scripts.

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

Have you tried clang?

It's funny you say that. I just built clang + llvm + libc++ from source today (for the first time). I had no problem whatsoever. And now, I'm compiling my entire code-base with it (about 130 thousand lines of code) and it's going very well. I also just tried a very nice utility derived from clang, called include-what-you-use to analyse header-file dependencies in the hopes of reducing inter-dependencies and adding forward-declarations wherever possible (getting this tool was the main reason that I compiled clang from source). Clang is a great compiler, it's very fast, standard compliant and uses very little memory.

If I add #include <iostream> in a reckless moment of happy expectation, it can't compile it and I can have real fun trying to decipher:

/tmp/test2-LUg9Sk.o: In function __cxx_global_var_init': test2.cpp:(.text+0x10): undefined reference tostd::ios_base::Init::Init()'
test2.cpp:(.text+0x16): undefined reference to `std::ios_base::Init::~Init()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems that your clang program is not able to find the standard library to link to. Clang can use either libstdc++ (from GCC) or libc++ (from LLVM project). You can specify it as a command-line argument (but it should attempt to look for libstdc++ by default):

$ clang -stdlib=libstdc++ test2.cpp -o test2

or

$ clang -stdlib=libc++ test2.cpp -o test2

You must make sure that either one or both of these are installed. The easiest is just to make sure you have installed the package …

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

And by the way, version 4.7.2 that is now on Ubuntu's repositories is perfectly fine for doing C++11 coding, the difference between 4.7.2 and 4.8.0 is not that great in that regard.

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

So I ask: has anybody ever succeeded in building/loading/using SUCCESSFULLY g++ 4.8 on a Ubuntu computer?

Yes. I keep a rolling version of GCC on my computer at all times, i.e., GCC compiled from source obtained from the latest development branch of GCC's svn repository. And most of my computers have Ubuntu (actually Kubuntu, but it doesn't make a difference for this task). I also have a fedora laptop, and I also have a rolling version of GCC there too. No problem.

Then in what mysterious ways have you been able to achieve this monumental achievement?

I wouldn't call it a "monumental achievement". Except for the time that it takes to compile all the code-base (a couple of hours), I never had too much trouble doing it. I followed the instructions carefully, made sure to install all the dependencies, and that's it. I remember getting a few errors, but I just copied the error message, googled for it, and found a fix within a very short time.

Do you have a specific problem?

Typically I get completely cryptic errors such as:: error 4 or error 2 WITHOUT any sort of error log available nor information to consult (this is very very typical of my experience with gnu).

Most of the time, if there are errors (which might be cryptic to you), they only show up on the terminal at a high-level, the error logs are located within the sub-directories of your build directory, they …

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

even if you take away the guns, people still kill each other... if you get to keep them, you still kill just as many people as you do without a gun.

That's false.

M. Killias, "International correlations between gun ownership and rates of homicide and suicide", Canadian Medical Association Journal, 1993. - Quote:

There was no negative correlation between the rates of ownership and the rates of homicide and suicide committed by other means; this indicated that the other means were not used to "compensate" for the absence of guns in countries with a lower rate of gun ownership.

L. M. Hepburn and D. Hemenway, "Firearm Availability and Homicide: A Review of the Literature", International Journal of Aggression and Violent Behavior, 9(4), 2004. - Quote:

Most studies, cross sectional or time series, international or domestic, are consistent with the hypothesis that higher levels of gun prevalence substantially increase the homicide rate.

The truth is, having a gun at your disposal makes it easier to commit a homicide or a suicide, and thus, more guns equal more homicides and suicides. All studies on the subject, whether international or state-by-state arrived at the same conclusion. The causality is obvious, and the correlation is apparent. That case is closed. The only debate is about how to effectively reduce gun ownership. And if I'm not mistaken that is what AD is trying to argue (by presenting titbits of anecdotal evidence), that the gun control laws being considered now, …

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

You can actually blaim scientists (and China) for our gun violance. (link). They started it all in about 700 AD.

Yeah, and you can blaim the Wright brothers for drone strikes too! (translation: don't blaim the people who do it and promote it today, blaim some dead guys from another era)

Brady Gun Bill == "Feel-Good about ourselves" bill with no real impact.

You keep repeating that gun control laws have no impact and are just to make some people feel good. All countries that have gun control laws have extremely low levels of gun violence, and all countries that don't have such laws have very high levels of gun violence (mostly third-world countries, plus the USA). That's hard to ignore, even within the right-wing echo-chamber (e.g., a majority of republican voters support stricter gun control). You can choose to cover your ears and scream "LA LA LA LA LA, I can't hear you", but you can't keep repeating your point and expect rational people to buy it.

I would agree that gun control is not going to solve the problem completely, not by a long shot, but it's a step in the right direction. But, of course, it is more of a measure to stop the bleeding (literally), not really a solution to the root of the problem, which is widespread desperation and obscurantism. There are a lot of things that distinguish other civilized countries from the US besides gun control, for example, …

Reverend Jim commented: I like the Wright Brothers' reference +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Such a ban will most likely have little or no affect.

Then why is the NRA against it?

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

I'm not an NRA member but I am sympathetic to many of their causes.

The NRA only defends one cause: increase the sales of guns to please their sponsors, the gun manufacturers. You are blind if you think otherwise.

I wish we could rid our country of assult weapons, but that is just not realistically possible.

You can't rid the country of assault weapons, but you can stop or at least slow down the sale of the assault weapons, and that will certainly reduce the amount of guns in circulation. Hardened criminals will still be able to get them, and real gun enthusiasts too. If you have proper background checks and a license obtained after taking a basic firearm safety course, then mentally-stable, responsible and non-criminal people who want to own guns could easily have them, just not the others.

Of course, you can't realistically seize all guns or something crazy like that. You must phase them out by regulating their sales.

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

Do unto others as you would want them to do unto you.

Was that from the Kama Sutra, or from the Bible? I can't recall.

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

In nearly half of the real-life situations when a hand-gun is fired, it's for committing suicide.

Maybe that's a good thing. Remove the stupid gens from humanity.

Wow.. that's a terrible thing to say... Do you really mean that? That suicide "may be a good thing"!?! And that people who commit or try to commit suicide are just stupid and good riddance for humanity!?! Considering that suicides are particularly common among teenagers, leaving parents in terrible grief, how can you throw that comment out there so carelessly? Shame on you. I'm gobsmacked.

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

@diafol And consider how many people do something reckless (eg. drinking & driving, biking without a helmet, dares, using machinery for home repairs without reading the instructions, etc...) and get themselves hurt compared to malicious bad guys going out to beat you up.

Yeah, it's like after watching a mafia movie, you might think "OMG, I wouldn't want to owe money to the mafia and have them cut off one of my fingers". But I know plenty of people with severed fingers, they all lost a finger, or part of it, while carelessly using a saw. But I guess that the hazards of home repairs aren't good material for a thriller movie.

And also, another little factoid on that topic, if you own a hand-gun, you are statistically 22 times more likely to hurt yourself or a member of your family, intentionally or accidentally, than you are of having to use it for protection from a criminal / home-invader. In nearly half of the real-life situations when a hand-gun is fired, it's for committing suicide.

I think that's a great little factoid to support the idea that you are much more dangerous to yourself than the "bad guys" are. Whether it's self-destructive behavior stemming from mental / emotional / social problems that you're not dealing with properly, or whether it's just about being stupid and careless in your daily life. I'm pretty sure that occupational health and safety inspectors save many more lives than cops do.

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

Or, using std::stringstream:

std::string toString(unsigned int i) {
  std::stringstream ss;
  ss << std::setfill('0') << std::setw(6) << i;
  return ss.str();
};
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
if ( atoi( argv[1] ) % atoi( argv[2] ) == .33333 )

You misunderstood what the remainder is. The remainder is an integer value, not a fractional value. In other words, 7 % 3 gives 1 because 3 fits two times into 7 and then there is 1 left, that's the remainder.

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

The mythbusters are awesome!... but what does that have to do with anything (unless they did an expirement with alcohol...)?

Links, which appear in underlined blue letters, can be clicked on and they will lead you to another web-page. I suggest you give it a try:
From Reverend Jim's earlier post:

Alcohol dilates the blood vessels. It may make you feel warmer but the net effect is actually to make your body lose heat faster.

<M/> commented: I should've read it :) +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I don't know anyone from Canada but that is really cold!

I know both you from Canada but how do you keep yourself warm?

It's expensive having the heater turn on 24/7.

There's a thing called insulation. Walls generally have several layers of insulation (for heat and humidity), windows (and sometimes doors too) are always doubled to leave an insulating layer of air trapped in between. Heating is most often electric (which is cheap here), and only about doubles the electric bill (peak of summer vs. peak of winter). Good insulation is also really nice in the summer, it keeps the house / apartment fresh, as long as you control how much sunlight gets in during the day. Here, insulation is a necessity for winter, but you guys down south should also start getting up to speed on that to save you on your air-conditioning bills in the summer. Although, here in Quebec, we are quite alright with americans down south wasting tons of electricity on air-conditioning their paper-thin houses, because you buy that electricity from us! (well, some of it)

As for being outside, well, you wear several layers, a good coat, a tuque, a scarf, gloves, and a good pair of boots. And yeah, you keep moving, whether you're just walking fast to wherever you're going, or you're just having fun in the snow (sport, activity, whatever). If you have to wait around in the cold (for a bus or something), you just relax and try …

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

It was never part of the C or C++ standards, so it can't be deprecated.

Well, not deprecated by the C++ standard, but deprecated by the people providing it, i.e., Microsoft. When you use function from conio.h, with highest warning levels (in VS2012), don't you get a message saying something like "warning use of this is function is deprecated" or something like that? Similar to when you use Win32 API functions dating to before all the post-XP strengthening of security. At least I thought so. In any case, if Microsoft hasn't officially deprecated it. It is certainly informally deprecated, as in, obsolete and no longer recommended.

As for the rest of your comments, he is probably using Turbo C. That was a valid program, if written 30 years ago.

Yeah, I had that hunch too. I don't know how Turbo C managed to stay alive like that and constantly being used in courses that teach C++, even today. I guess just a lot of professors who have been teaching the same course every year for 20 years without ever updating the content, maybe their course-notes still read "Introduction of 'C with Classes'" ;)

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

Do you have a question?

As for the code, there are several problems with it:

  • The header #include <iostream.h> has been deprecated for a long time, it is a pre-standard syntax that some compilers still support today, but it is not standard. The standard libraries do not have a ".h" after them, e.g., #include <iostream>. Also, for C libraries (like stdlib.h or math.h), the ".h" is omitted and they are prefixed with the letter "c" (like #include <cstdlib> or #include <cmath>).
  • The header #include <conio.h> dates back to MS-DOS and is also deprecated. Not many up-to-date compilers still provide that header, and I think that only older versions of Windows can still run it. And, of course, it's not portable.
  • The definition #define size 5 breaks the conventions used in C/C++. Definitions like these (and macros) should be in upper-case letters entirely, and should have a much more unique name than simply "size". Replace with something like #define MY_STACK_SIZE 5.
  • You cannot use just cout. You must use either std::cout or issue the following statement before using cout: using namespace std;. Your code works only because it uses the pre-standard header "iostream.h" which does not define cout inside the std namespace as prescribed by the standard. The same goes for cin, and for absolutely everything else from the standard library (including functions from C headers like <cmath> or <cstdlib>).
  • The main function should not have the signature void main(). There are only two acceptable signatures for the main function (since …
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

It's snowing a bit (probably about 5cm by the end of the day), and it's pretty cold, about -20 C (about -5 F), but it feels much colder with the high winds and high humidity.

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

Why is there no way in C++ to ensure the safety in this case?

Why? Because C++ has an overarching principle of no overhead for what you don't use. In order to be able to do the run-time check that dynamic_cast does, the compiler has to add a hidden virtual function (or set of virtual functions) to perform this dynamically-dispatched cast operation. A virtual function requires a virtual table (per class) and a virtual table pointer (per object), and that's overhead. If the class already has at least one virtual function, that overhead is already present, and so, adding another hidden virtual function to enable the dynamic cast does not represent any overhead (per object). And that's "why" things are like they are. And also because if the compiler must put in place the facilities required to support dynamic casts on non-polymorphic classes, it must put those facilities in place for all classes (including C-style structs, which would break compatibility with C), and that would be unacceptable in terms of overall overhead (unacceptable by C++ standards, not by other people's standards, as in Java/C#).

Does it mean this above use case is flawed and that an inheritance hierarchy always needs an overriding behavior via virtual methods?

It depends what your intent is by "inheritance hierarchy". Inheritance can serve a few different purposes (and a few more purposes at the "expert level"). The main purpose of inheritance is to allow for dynamic polymorphism, and that requires a …

myk45 commented: excellent explanation! +5
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

"My favorite thing about the Internet is that you get to go into the private world of real creeps without having to smell them." -- Penn Jillette

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

Convincing. I shall disregard my earlier follies and follow this fact.

Clearly, no one can deny that Orlando Ferguson was directly inspired by God when he drew that map. Such a perfect map could only have been drawn by dictation from a perfect Being with an overseen point of view on the world. Case closed.

After that, I can't believe people buy all that evil propaganda about the Global Positioning System (GPS) being based on signals from satellites orbiting the Earth. Clearly, a GPS is an Angel-detecting system that figures out your position based on your distance to the four Angels that guard the corners of the Earth! The GPS hoax is just another evil conspiracy by scientists, directly from the pits of Hell, to drive people away from the biblical truth.

God also states that guns are good

Yeah. Guns are the modern day equivalent of stoning, after all, bullets are small stones. And clearly, God loves stoning. Here's a nice way to spend a sunday afternoon: seek out anyone who is working, and "stone" them with your favorite firearm. Fun for the whole family!

He will bestow upon us the warmer climate that we deserve for our endeavours. He marvelled at our industriousness and saw that it was good.

Amen to that! Global warming is a blessing from God to reward us for doing exactly what Jesus taught us: "compete with your fellow man for resources and power", "make consumption and accumulation …

diafol commented: I nearly pissed my pants. Ha ha ha +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

All right-minded folk know that we live on a disc

That's wrong. We live on a Square and Stationary Earth.

diafol commented: I shall have to update my thinking. Square it is! +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Does the word typo kinda like a iffy word.

I don't understand what you're saying. A typo is just when you mis-spell a word or skip over a word or two as you type. It is most unfortunate when the skipped over word in question is the negation (the "not" or "n't"). It has nothing to do with what is called "backpedaling", as politicians do all so often, which is to retract from a previously stated position after a storm of criticism about it (that's when you hear BS talk about "it didn't come out right", "I didn't mean to say that", or "it is unfortunate that people have interpreted my words in this offending way", and so on).

There was no such typo in my statement. Global warming, like global cooling, is a natural phenomena that occurs every so often during the Earth's history. :)

Oh well, I was just trying to save you the embarrassment of leaving people thinking you were disconnected from reality. ;) But now that you've doubled-down, I can't save you anymore... I'm sorry.

Yeah, climate changes are naturally occurring, but they don't happen by magic. Everytime they occurred before there was either a major event (e.g., massive meteor), or some major factor (usually geological or biological) that caused it. This time, that major factor is us, humans. All the evidence points to that. I don't know why I even waste time arguing about this...

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

global warming is caused by humans

Just to correct the typo, the world famous lie is:

"global warming is not caused by humans"

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

I remember, early on when learning C++, to be a bit frustrated at limitations of C-style struct initialization and how awkwardly it mixed with C++ classes. But I also remembered letting go of that quite quickly and never really missing it. Now that the rules have been updated to more or less solve those tiny frustrations, I'm glad about it, but also very indifferent to it. I don't think I'll use that feature much, not because I have a problem with it, but just because I don't really have a problem (anymore) with the way it was before (C++03) and I'm used to that. If anything, it might push me to initialize C-style structs (or POD-types) with the curly-brace syntax a bit more often, now that it has more of a C++ flavor to it.

Saying the feature is "contraversial", I think that goes too far. Is it ugly? Well, that doesn't really have an answer. I think it's ok. Does it have issues about implicit conversions? No more than C++03 single-parameter constructors. And I don't see any other practical concerns you might raise. I think this feature is closer to being one of the least contraversial ones rather than one of the most contraversial. But then again, the C++11 standard is still very conservative overall, you can argue that certain changes are less consequential than others, but most of the contraversial stuff hasn't made it to the C++11 standard.

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

That's exactly the point I made a few posts back.