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

If you don't know ahead of time what size you need for the arrays, then you need to use a dynamic array type instead of std::array (which is only for static size arrays). The class you can use is std::vector (see docs). This would make your lines look like this:

typedef map<string,set<MatchRecordPointer>> PlayerHistoryMap;
typedef vector<PlayerHistoryMap> ArrayOfPlayerHistoryMap;
typedef vector<ArrayOfPlayerHistoryMap> Array2DPlayerHistoryMap;
Array2DPlayerHistoryMap PlayerMatchHistory;
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

That code looks OK (by beginner's standards, of course). What is the problem you are having with it? What kind of an alternative are you looking for? Why?

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

Vague much?

It seems pretty clear to me. The post says: "I don't want an answer to my question, and so, I will post a few vague scribbles so that nobody knows what my question is."

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

Would it hurt if I used dir over ls?

No. dir is actually identical to ls in Linux. The only difference is the extra character to type. And of course, it carries the shame of having to admit that you still cling to the shackles of MS-DOS, your previous oppressor (it's called the Stockholm syndrome).

I ought to hear that Ubuntu was user-friendly :(.

For one, as user-friendly as Ubuntu can be, the Linux terminal is the Linux terminal, regardless of what distribution you use, and it's only user friendly when you are used to using it (know the commands and all that), it'll get easier as you get better with it, that's all I can say. It's a bit of a learning curve, but not a long one, so don't worry (I would say, a month or two and you'll be proficient with it).

And second, you are talking about installing an unusual distribution of Apache server and related tools ("unusual", as in, it differs from the main-line supported versions on Ubuntu's official repositories), from an installer (the .run file) which is to be run as root in the terminal. You are not exactly being friendly with the system here, which is OK, you need to do what you need to do, just don't expect the OS to be friendly back. ;)

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

The AVL tree is one of these things that I would qualify as a fundamental data structure and balancing algorithms that are good to know and understand, but the data structure itself has very limited practical purpose. The thing is that if you need a self-balancing binary search tree, you would probably select one of a number of better options, like the red-black tree that is used in most standard library implementations of a basic binary search tree.

There is, however, one practical application of AVL tree that I can easily think of (because I wrote such code). If you want a cache-efficient and memory-efficient data structure for storing a binary search tree, you need to use a contiguous layout (e.g., breadth-first layout, cache-oblivious vEB layout, etc.) which means that balancing algorithms, like that of the red-black tree, that are based on tree rotations cannot be used because there is no way to efficiently perform tree rotations, and if used, it would make things worse. In that case, the balancing algorithms of the AVL tree are pretty much the best thing to do. If Hiroshe is right that AVL tree is used in the Linux scheduler, then it's possibly for these reasons.

Another important role of the AVL tree is that more general search trees, like metric search trees or space partitioning trees, also require balancing algorithms that do not involve the tree rotation tricks, because they make no sense when the sorting is multi-dimensional (as opposed to uni-dimensional, as …

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

The de facto standard compilers for Linux are GCC (GNU Compiler Collection), which you can install if it is not pre-installed on your distro. Under Ubuntu, you can simply install "build-essential" package, which pulls in all that you need (compilers, make, auto-conf.. etc..). Other distros will have an equivalent packages. If not, you can install the individual packages for GCC compilers (gcc for C, g++ for C++, gfortran, gcj for Java, etc..) and the "binutils" package as well as other useful tools like "make", "autoconf", "cmake", etc..

The other alternative compile in Linux that some distros have on their package repositories is Clang (clang, clang++, etc..) which a more modern (but less stable) replacement for GCC.

But up to here, this will only get you as far as being able to compile some code in the terminal / command-line.

To actually do some coding, you can install an IDE. There are plenty of decent IDEs for Linux and C++, like CodeBlocks, Geany, KDevelop, NetBeans, Qt Creator, etc.. which are all offered on most distro's package repositories so that you can easily install them from apt-get or yum or your software center application.

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

We don't do people's homework here. If you need help in solving this problem, you have to start by showing us what you have done so far and where exactly you hit a snag. In other words, you need to show that you've made efforts to solve it before anyone will consider helping you.

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

VC6 and VS2010 are not binary compatible (neither are most versions of Microsoft's compilers, they just change it every time, even for revisions on the same version). This means that the binary layout of classes (e.g. how the objects look in memory) can be significantly different between those two versions.

If your third party DLL was compiled for VC6, then you cannot use it with VS2010. You will get exactly the kind of issue you are describing (you get objects back from it that appear to be half correct but all messed up). You need to either get a newer version of that DLL that is compiled for VS2010 (or compile that DLL yourself from the sources, if you have them). And if that is not available, you will have to resort to a much more drastic approach, which is to wrap all the functions of a DLL into a C API (not C++) that you export from your own DLL which you compile with VC6, and then you use that DLL in your VS2010 project (because C APIs are always binary compatible, but it means that you cannot use any C++ features for those exported functions). That latter solution is pretty intense in terms of work and re-writing of code.

Microsoft compilers have never had a stable ABI (binary interface specification), meaning that you must always ensure that your third party libraries are either specifically made for the same compile version that you have, or that they only have …

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

You need to declare the sortbyScore function as a static member of your class.. i.e., like so:

class Game {
  // ...

    static bool sortbyScore(const PlayerScore &ps1, const PlayerScore &ps2);
};

bool Game::sortbyScore(const PlayerScore &ps1, const PlayerScore &ps2)
{
    return ps1.score > ps2.score;
}

// call sort with:
sort(scores.begin(), scores.end(), &Game::sortbyScore);

Otherwise, you could also make the sortbyScore function into a free function, like so:

bool sortbyScore(const PlayerScore &ps1, const PlayerScore &ps2)
{
    return ps1.score > ps2.score;
}

// call sort with:
sort(scores.begin(), scores.end(), &sortbyScore);

Either way, that should work.

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

You can use it with an SSID that is different from the other one, connect them with an Ethernet cable,

I think that you can actually use the same SSID for the two routers, as long as all the other configurations are the same. I have seen this setup before, it might not work with any router. But the point remains that you need a physical ethernet connection between the two routers. I have never seen a setup where the bridge is done via Wifi, it always seems to require an ethernet cable to bridge them. But it might be possible, maybe not with stock firmware though.

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

tell me which ubuntu version shall i go along with virtual machine?

The latest LTS version is probably the best place to start, that is, version 14.04.

can i use an old desktop pc running window xp and install a Linux Distro to get me started

Yes, that's a very common thing to do, and I often recommend that as a way to give a second life to an older PC.

will the hardware components of such pc be good enough to get me going with no hitch

Yes. Linux tends to have much lower requirements on the PC, and as far as drivers are concerned, older hardware is usually well-supported (it's cutting edge hardware that can cause some troubles).

then if am able to download any Linux Distro online using my window vista,will i be able to burn that onto a cd/dvd in windows os,such that i will be able to use the cd to run the distro on that desktop i intend using

Yes, you can certainly do that. There are several installation guides depending on what you want to do.

Then what is the basic hardware spec to run a Linux Distro.

Basic requirement for Linux is generally much lower than for Windows. However, for much older hardware, you might have trouble running the latest versions of the distros, so you might have to consider using an older version (with lower requirements) or using a …

Gribouillis commented: good help +14
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The standard utility in Ubuntu for text-to-speech is called "espeak", which comes pre-installed with it (but I think you have to install the GUI front-end if you want to use it directly, but espeak is integrated already into other applications like text editors or pdf viewers).

I have used Festival before and it works very well, except that it was a bit hard to get it properly setup, at least, as I remember it.

Under KDE (e.g., Kubuntu), the system-wide text-to-speech utility is called Jovie, which I have also tested and works quite well, and it's pre-installed, you just have to flip a few configuration switches to add the toolbar / pop-up menu buttons for it in most KDE applications. I would imagine that espeak is as easy if not easier than Jovie to use, install and/or enable.

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

Putty has little to do with Linux. Putty is a Windows software that allows you to use Unix shell protocols and environments. It is especially useful to connect, remotely, to a Unix-like server through a protocol like SSH (Secure Shell). I don't see how it could be useful for a beginner to learn Linux, because (1) you need access to a Linux server, and (2) you only get command-line (or terminal) access to that server, which is not something beginners should dive into that quickly. Putty is more useful for a person who is well-versed in Linux (or Unix-like systems) and is stuck having to deal with a Windows computer (like, for example, a system administrator who needs to do some things on the company's Linux server from an employee's Windows workstation computer). Putty is not an option for learning Linux.

To get a Linux-like (or Unix-like) terminal or command-line environment installed on Windows, you can use Cygwin (which is one of the first software I install on any new Windows computer).

To get Linux and try it out, there are really only three options: use a virtual machine (like VirtualBox), boot into a bootable USB device (that you can easily create from a distro image), or setup a dual-boot (which is a bit more tricky and permanent).

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

Using VirtualBox is definitely a great option for you, given the needs you have expressed. There are plenty of easy to follow tutorials out there about how to go about creating one of those. For example, this one seems easy enough to follow.

For beginners, the preferred Linux distribution is probably Ubuntu (or maybe Kubuntu). There are many distributions, and most are easy to use, like for example Linux Mint (more like Windows 7) or ElementaryOS (more like Mac OSX). The nice thing with using VirtualBox is that you can pretty easily test out different distributions until you find the one that suits you the best. For most distributions, the install process is about as easy as with Ubuntu, which is about as hard as installing any Windows application (just answer some basic questions and hit next a bunch of times), especially when installing into a VirtualBox. It's only when you set a dual-boot that things can get a little bit tricky (but not too hard either, you just have to be careful, follow instructions, and understand what you're doing).

The only slight issue with VirtualBox is that it can be quite a bit slower than if it was running "natively", which is why you would normally move on to a dual-boot setup if you use Linux more intensively (e.g., like I only use Windows on very rare occasions, for special purposes).

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

You cannot put the definitions (implementations) of function templates (or functions of class templates) in a separate cpp file. The definitions of templates must be visible to the compiler in order for it to compile them for the specific types you are using as template arguments. The point is, you cannot compile them separately and then link them together. You have to put the definitions in the header file. Read more here.

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

It means exactly what it says, that you need to put typename before List<List_entry>::Error_code, as so:

template<class List_entry> 
typename List<List_entry>::Error_code
  List<List_entry>::put(const List_entry &x)
{
  code..
}

The reason for this is that List<List_entry>::Error_code is a dependent type. Simply put, because List_entry is a template argument, when the compiler first passes through that code, it does not know what List_entry is, because it could be anything, and therefore, it cannot assume anything about List<List_entry> because it could be a specialization of general template for some special type of List_entry. Therefore, anything that is drawn from List<List_entry> is dependent on what List<List_entry> actually is or what it actually contains. So, when you simply write List<List_entry>::Error_code, the compiler cannot verify what Error_code is, and especially, it cannot check whether it is a type (like an enum type, or some other nested class or typedef inside List) or whether it is a member function of List (i.e., you could have a member function called Error_code is the List class template, and therefore List<List_entry>::Error_code would have a very different meaning (pointer to member function)). So, you need to add the keyword typename in front of it to tell the compiler that this expression is expected (once List_entry is known) to be a type, because otherwise, the compiler must assume it is a member function. In this particular case, having a member function as a return type does not make any sense, and that's why the compiler can tell you that you forgot to …

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

Are you sure it wasn't ".. and whatnot."? Because that is a very common expression used to mean "and whatever", and, in fact, it is the correct word according to the dictionary. It seems that the more correct expressions are "and whatnot" to end an enumeration (like "etc."), and "or whatever" to end a sequence of choices or possibilities. In other words, you shouldn't say "and whatever" nor "or whatnot", always "or whatever" and "and whatnot".

I have never heard "and have not." used like this. I have only heard the common expression "have-not(s)" to mean the poor or the otherwise disadvantaged, as in, "the haves and the have-nots".

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

If you use Qt, you could use Phonon.

SDL_mixer is definitely a good option too.

You could also use OpenAL.

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

The standard does not require a specialization of the std::function for variable argument functions. There are two reasons for that. First, variable argument functions (or C-style variadic functions) are not recommended to be used, ever, because they are completely unsafe from a type-checking point of view and have only been kept around in C++ for backward compatibility with C (e.g., variadic functions were used to implement standard C functions like printf()). Second, variable argument functions present some difficulties when it comes to implementing type-erasure, which is the technique used in implementing std::function such that it can store whatever is given to it (function pointer, lambda, etc.) and call it with perfect forwarding of the arguments it is called with.

Now, the reason why you can form something like std::function<void(...)> is that this invokes a specialization of std::function that does not exist, and therefore, it becomes what is called an "incomplete type". An incomplete type simply means that the compiler knows that you are invoking a type, but doesn't really know what that type is (e.g., it doesn't exist or hasn't been defined yet). There are certain things you can do with incomplete types, and others that you cannot do with them. Basically, anything that requires any knowledge about the type cannot be done with an incomplete type, such as declaring a variable of that type, calling a member function of it, and things like that. Some things don't actually require any knowledge about the type and can therefore be done …

cambalinho commented: thanks for all +3
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

A good and simple image loading / saving library is FreeImage. For more complex tasks, you can use libraries like ImageMagick, or even OpenCV. There are also some limited amount of built-in support from OS API functions, like Win32 API for BMP images, but that is usually too limited to be useful. And if you are using some GUI library, they usually come with some image loading / saving / drawing capabilities too.

how the files are build like JPEG, PNG, GIF and others :(

Those files are special file formats that are specified in standard documents or other similar documents. Writing code to read or write such file formats is a very tedious process because you have to follow those specifications to the letter and handle every detail of the file, as well as implementing whatever compression or encoding the file format uses, which is not trivial. If looking at one of those specification documents has confused you, it's totally normal, these are documents that are tedious and hard to understand, because every detail has to be precisely defined, byte for byte.

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

ok.. but why that error message?

Because you cannot use auto for non-static data members. That's what the standard says, and that's what your compiler says, and so, that's as good as a fact of life that you have to accept. The rationale behind that rule is too much to explain. The auto keyword does not provide anything more than the convenience of not having to explicitly write out the type, and therefore, it's not necessary for anything, simply convenient where it is allowed to be used, but for non-static data members, it is not allowed, so you have to explicitly write the type instead (which you can always do).

seems that i can't use lambdas with auto

You certainly can use auto with lambdas. In fact, part of the rationale for introducing auto was to make the use of lambdas more convenient.

seems that my best thing still be the pre-compiler way:

Arrgh... What is it with you and archaic features and pre-processor tricks? It seems like you always come back to some MACRO to create odd constructs that I wouldn't even advise to do even outside of a MACRO, let alone in one. I tell you to stay away from MACROs, you run towards them. I tell you to stay away from variadic functions, you present a variadic function solution, and you double down with var-args macro in the mix... please stop hurting me like that.

but i wanted something like …

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

No, you can't do that. auto is a reserved keyword that tells the compiler to infer the type from the expression that initializes the variable. In other words, it's a placeholder for a deduced type, it is not a type by itself.

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

You have to use a template alias. As so:

template <typename... Args>
using Event = std::function<void(Args...)>;

Event<int,int> test = [](int x, int y)
{
  int a=x+y;
  std::string b = std::to_string(a);
  MessageBox(NULL, b.c_str(), "hello", MB_OK);
};

The reason why your initial typedef worked is because it uses void(...) which represents a variadic function, not a variadic template. That makes it a valid declaration (I think), but a rather useless one, as you would technically have to assign to it a variadic function, not "any function", and I'm not sure you can do that with lambdas. And if I try with a more correct syntax to initialize Event test, there is still an error related to Event having an incomplete type, which indicates that having a std::function with a variadic function is not proper (which I can understand). Variadic functions are essentially obsolete and completely avoidable in C++11, so, stay away from that archaic feature.

You could also simply do this:

auto test = [](int x, int y) {
  int a = x+y;
  std::string b = std::to_string(a);
  MessageBox(NULL,b.c_str(),"hello",MB_OK);
};
cambalinho commented: thanks +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I think you need to look at QSizePolicy (accessed from QWidget::sizePolicy()). Basically, the size policy is what allows you to specify how widgets should grow automatically when their parent widget (with a layout) resizes, and things like their minimum / preferred size (e.g., to force to parent widget to adopt sufficient size to display its contents).

I don't know exactly the programmatic steps to do this, because I mostly create my GUIs in Qt Designer, where you can set all those things in the menus and property editors, which is much easier.

For resizing the main window, I would presume you either just use the size property, or you rely on the size policy, as I just mentioned.

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

In many ways, C++ is the mother of all modern languages, in most application domains. So, is it enough by itself? Not really, but it's a really good start or foundation. In any case, I don't think you can really become an expert C++ programmer without being exposed to a lot of other stuff in the meanwhile. I mean, at the very least, you are going to need some decent scripting skills (e.g., Bash). For the rest, as you do things, you are going to need other things, like knowing SQL to interact with some databases, or knowing some PHP or Python or something for some higher-level tasks (even if it only serves the purpose of exposing or using your C++ code at a scripting level). And then there are plenty of other languages and skills you'll need to pick up in other specific domains.

Remember that programming languages are tools of the trade, it's the trade you have to concentrate on learning. If a company is looking for a programmer, they will be looking for one with particular skills in a specific domain (e.g., databases, web servers, numerical analysis, data analytics, etc..) and even if they say that the job is in doing "C++", it is generally implied that you are familiar with a lot of other things that are specific to the domain in question (e.g., for a "numerical analysis" job, it is implied that you are familiar with fortran, Matlab, and many numerical analysis algorithms, and so …

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

Just to clarify, in the listings the version of the MSVC compiler used by Visual Studio 2012 is MSVC 11, and there is also the November update version which added quite a few of the more useful features (variadic templates, init-lists, etc.). Visual Studio 2013 uses version 12.

Overall, the support for C++11 features in Visual Studio 2012 is pretty slim, I would say, almost insignificant. You really have to move to 2013 (Update 3) to get something that could be qualified as "full support", roughly.

In any case, I generally use Boost MACROs (header <boost/config.hpp>) to determine which features of C++11 can or cannot be used in the code. The Boost team works pretty hard to keep this list up-to-date. You could easily make a program that tests the features for different compilers to know which are available or not on a particular compiler (i.e., just print out the list of macros that Boost defines for a given compiler version). They generally determine which compiler supports which features by literally trying them out with a test suite that exercises each feature.

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

Probably the easiest answer is just to get CodeBlocks.

And also, do not use Turbo C++, it is way too outdated to be relevant or worth using. This is a very old IDE that uses a pre-standard C++ compiler. Do not use it. And if it was recommended to you by your teacher, tell him that he should update his 20 year old (or more) course program, because C++ has changed a lot in the past 20 years (including 4 revisions of the standard).

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

The set of options that I usually prefer for rsync is rsync -va --delete (local transfer) or rsync -vaz --delete (over network, "z" compresses the data to minimize the bandwidth needed).

But the thing that might have been the problem is that rsync can be a bit tricky in the way you specify the source and destination folders. You have to make sure they are written the same, down to the final slash character, i.e., like this:

rsync -vrt --delete /some/source/folder/ /some/dest/folder/

because it has happened in the past to me that a simple mistake like this:

rsync -vrt --delete /some/source/folder /some/dest/folder/

would result in ending up with a subfolder called "folder" in the destination folder (i.e. /some/dest/folder/folder). It's just something to watch out for, rsync is just a bit quirky like that. And don't use globing.

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

This whole question of "What do you have to hide?" is a subtle case of the "loaded question" fallacy (like "Do you still beat your wife?"). This fallacy is about loading the question with a premise such that whichever answer is given, the premise is implicitly accepted or acknowledged in the process. In this case, the premise is that you have no right to privacy and the only reason you would seek privacy is for doing criminal or otherwise immoral things. If you say you have things to hide, you acknowledge that this is your reason to seek privacy. And if you say you don't have anything to hide, you acknowledge that you are willing to be an "open book", so to speak, with no privacy.

The reality is, everyone has things that they would prefer to keep private. And the vast majority of those things are not illegal or even immoral, just maybe a bit embarrassing, or personal, or simply "none of your business".

The real purpose of the invasion of privacy is to do thought police. People tend to have this unrealistic idea of what "thoughts" are. People picture "thoughts" as being what you think about when you're at home alone, in bed before you sleep, or on the bus or whatever. In reality, thoughts consist of much more than that, they are the things you are curious about and might look up on the internet, they are the things you read, the things you watch, the things …

Warrens80 commented: your post are long but are filled with so much interesting facts and opinions that I can't stop reading them +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I have nothing against ElementaryOS, but it is just that they made a number of conscious choices that favor a cleaner, purified interface that is tailored more towards the average "check emails and surf the web" type of user. By making those choices they sacrifice other things that make it less of a practical working environment. So, it's not that it's bad, it's just that it is consciously aimed at mass-market users, the same kind of crowd that Apple aims to please. Just like I like KDE for work, I would certainly not say that it is exciting to use or that people looking for a OSX-style experience would like it, different strokes for different folks.

I guess elementary could ship these features out of the box but then the iso would be much larger and heavier.

Exactly. Providing more "work" apps would be a change of aim that would result in a significantly larger OS, which defeats the point of it. It's just like a construction worker needs a pick-up truck to carry all his tools and construction materials as well as getting around a construction site. But a pick-up truck is not appropriate for most urban people who will prefer a smaller economic car that is easy to park in parallel and gets them from A to B. But my point is, it's silly to take a small compact car and try to turn it into a pick-up truck or try to use it as such. …

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

Whiskey and Pepsi.

Why is there a P in pneumonia?

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

Well to be fair at one point Qt borrowed code from KDE for the multimedia framework if I'm not mistaken (perhaps called "phonon").

Yes. Phonon is KDE's sound manager and, more broadly, it's multimedia streaming layer... i.e., it's the middleware between the sound / graphics drivers and the programs that play sounds or videos (e.g., Amarok for playing music). Applications don't have to use it, of course, but the "native KDE" applications usually do. When it became mature (which it wasn't when I was first using KDE, like 5 years ago), Qt developers decided to incorporate it into Qt, which did not have a good facility for multimedia streaming into Qt applications yet. But even though phonon was created by the people doing KDE and created it for KDE, it is not linked or tied directly to KDE and can be used anywhere else, and therefore, using Qt and Phonon does not require KDE.

why as a workstation you would definitely not use elementary and instead opt for a KDE distro, especially if you're not particularly using any specific tools for GUI design just low level stuff?

Well, for one, out of the box, that distro does not have any decent apps for any kind of work, and has a reduced set of apps available in their repositories (not to mention severely lagging in time compared to the more upstream distros). The default terminal application on ElementaryOS sucks really bad, so, that has to go and …

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

What programming language are you using @Mike?

About 99% in C++. The rest is C (low-level) and Python (high-level). And of course, there are always times that call for some work in Matlab.

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

Hopefully it's not a PhD in computer science or any kind of technical field... if so, she should do it herself.

Otherwise, this should be posted to business exchange forum, or to rent-a-coder.

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

Mike probably needs KDE if he is writing QT apps, I don't know what else he uses it for.

I don't need KDE for writing Qt apps.

For one, as Hiroshe said, KDE sits on top of Qt, not the other way around, and Qt is fully portable to pretty much anywhere you can think of (incl. mobile platforms). I would say that even in other flavours of Linux, most of the apps you see are in Qt as well, because it dominates the cross-platform GUI development landscape, across the board. It's just that with something like GNOME, you have GNOME sitting on top of GTK+, and then, if you make a Qt app, it either has to sit on top of GTK+ or it has to by-pass it (it probably by-passes it, but I'm not sure), but the point is, it doesn't blend as nicely (as in, it doesn't look as nice, and some integrated features or styles might not work across two GUI libraries).

Second, I don't really write that many Qt applications, because my work rarely goes up to as high-level as GUI programming. I mostly do algorithms, numerical analysis, dynamics simulation, robot control, and so on, where making a GUI is just a luxury or an afterthought. Most of my coding could be done on a bare platform that has almost nothing on it, and if fact, sometimes I do code on such platforms. So, when I say I like KDE for development, it …

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

If your compiler supports C++11 (the latest language standard), you can also initialize a vector with multiple values (called an initializer-list), like so:

std::vector<int> fu = {1,3,4,5,6};
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I've been using Kubuntu for many years (the KDE spin of Ubuntu). I like it a lot because it's customizable to the teeth, is fast, has a pristine look, is natively in Qt (which is currently preferred by most applications), and is very well tailored for developers (I find it to be the ultimate "by developers, for developers" OS, without being just a developer's Linux that are often just OSes made for tweaking on Linux itself, like Arch or Gentoo). Some people find KDE to be too much like Windows, and by that, they refer to the start menu, the tray icons, and the harmonious look (Qt). The way I see it, these are some of the very few things that Windows did right (and trying to undo with Win8), and in any case, with the customizability of KDE, you can change or remove any of these things if you really want to (e.g., my own desktop has an overall look of a hybrid between Win7 and OSX).

I also use ElementaryOS on an auxiliary (older) laptop that I use only for light stuff when I'm too lazy to go from my living room couch to my office desk. I like ElementaryOS overall for that kind of stuff. I would definitely not recommend it for a work computer though, it's probably better for what people use Mac's for, i.e., looking cool as they check their emails or twitter feeds, nothing more.

I have used Ubuntu quite a bit, as it's …

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

what languages would be used to create something like adobe photoshop?

Photoshop is entirely written in C++, as far as I know. They've released a lot of open-source code in the past, always in C++, and their developers have been active in the C++ community.

Actually it depends on compiler

No, it does not. It depends on the system and external libraries that can be used to facilitate the process of constructing and programming GUI applications. And for any platform, any C++ compiler can be used to compile code that uses one of these system or external libraries.

if you are using a compiler DEV C++ then it does not supports GUI

First, DevC++ is not a compiler, it's an IDE (Integrated Development Environment), which is just the application that assists you when writing / compiling / debugging code. On the one end of the spectrum, you can just write code in Notepad (or some other basic text editor) or some enhanced text editors like emacs, vim, sublime-text, Kate, gedit, etc.. On the other end of the spectrum, you can write code with a comprehensive IDE like Visual Studio or C++Builder XE6. And in the middle of things, there are lightweight IDEs that just assist you in writing code (with highlighting, code-completion, and documentation tooltips on classes and functions) and perhaps debugging it (step-through) without too much heavyweight features (like …

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

If I'm not mistaken, the 48bit limit on the RAM addresses on 64bit platforms has to do with the virtual address spaces. Virtual addressing (for those who don't know) translates the relative logical addresses that processes use for their own memory (program data) into the physical addresses in RAM. This is something that is implemented by the CPU architecture (firmware / hardware) and is specified as part of the instruction set, not the operating system. So, unless you were to implement some complicated workaround scheme (which, as rubberman says, is a real PITA) that is the effective limit. The x86-64 (amd64) instruction set basically makes RAM addresses 48bits long, and thus limiting RAM addressing to 256TB total (and the Linux kernel reserves half of that to kernel-space code, thus leading to 128TB limit). Unless the OS poses further limitations, the supported amount of RAM depends mostly on the instruction set and the size of its virtual address space.

I found this list of limits for kernel 3.0.10:

https://www.suse.com/products/server/technical-information/#Kernel

Apparently the limit is 64TB, but apparently, even the people at SUSE have not been able to put together a system with so much RAM.

There are Linux supercomputers that have lifted that limit considerably - not a task for the noobie kernel hacker... :-)

Aren't supercomputers using very different instruction sets? Like Sparc, System/Z or PowerPC instruction sets. These tend to be much more scalable when it comes to the amount of RAM and CPU cores. I …

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

I see no reason why this wouldn't work. You picked the chipset that is recommended for the given processor and it supports the given mmc clock rate as well as the 64Gb capacity (total). As for Linux, the kernel has supported terabytes of RAM for a decade at least, and currently supports about 128TB of RAM and 4096 cores (and running more than a millions processes at once), if I'm not mistaken (remember, Linux is still primarily as server-grade operating system, and thus, can support really beefed-up systems).

RikTelner commented: Linux-boss is still answering... goal!! +2
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

And why should I stop using goto

Because the kind of mind-twisting troubles like the one you encountered now is the only thing that using goto gives you. The idea of the goto is to allow you to jump around to arbitrary places in the code, which might sound like a powerful mechanism, but the only effect it has is to create weird code that is hard to make any sense of, because it jumps all over the place.

On a few occasions, I have encountered code that was full of goto statements, and I really needed to understand the code. The only way that I know of to understand code that is full of gotos is to remove them all (which you can always do), and then you can begin to try to understand it.

There are only a few specific cases where a well-placed goto is beneficial and clearer than the alternatives, but they are rare. In other words, a goto statement should never be your go-to statement.

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

Je suis divisé
On m'a multiplié
J'ai jamais rien soustrait
Et je laisse la somme aux autres

  • Claude Péloquin (Québécois Poet)

(English)
I'm a man divided
They multiplied me
I never subtracted anything
And I leave the sum of it all to others

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

If Dani already has an answer to each one of these questions, that would really freak me out, and I would have to start picturing her living with an imaginary friend, and fifty stray cats. ;)

<M/> commented: lol +0
Warrens80 commented: that would very creepy +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Be careful with all this freeware / shareware / crapware programs like PowerISO. The Windows landscape is full of such non-sense software that you can get for free, but it usually comes with a bunch of other programs that piggy-back on its installation, such as a browser toolbars, default search-engines, fake anti-virus software that just scans your HD for "interesting" information, and so on...

I would not worry too much at this point, I think you have detected the issue quickly enough and you took the right steps. There is, of course, a chance that your system is still infected by something. But I think that the kind of crap-ware that comes in this sort of unsophisticated manner (through a freeware installation) is generally not malicious (because it's so easy to trace back to whoever put together the installer). That crapware is generally aimed at people who are less savvy about these things and won't even notice the added programs and will use them (e.g., as default search engines, or anti-virus scanner, etc.), which is how the companies behind those programs make their money. In other words, it's not spyware or malware or viruses, because those malicious programs are generally installed by more covert and less traceable methods.

When you are looking for some free software for a particular task (such as burning or mounting a disc image), you should do more research before picking the software you install. Look for open-source software first. Then, you might look for free …

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

I think this definitely makes sense from both the point of view of quality of results and moving the web towards more security. Most "serious" websites out there are already secure using https, so, it is definitely, in part, a valid indicator of quality for a website. And, of course, all sites should be using secure communications because a huge number of cyber-attacks or other malpractice on the internet is based on sniffing the plain-text traffic around the web. Plain-text traffic should not be the norm.

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

I assume that by "including C++ files", you mean something like this:

#include "my_file.cpp"

Then, as Schol-R-LEA said, it is not good practice to do so. In C/C++, you are supposed to do separate compilations of each source file and then link them together. You should get used to this pretty early on. Just imagine for a moment that they would do this in a large project with millions of lines of code... can you imagine how long it would take for a compiler to compile millions of lines of code all at once? And everytime you change anything anywhere you would have to recompile the entire code... not very practical, is it?

You might want to check out my tutorial that explains the whole compilation process for C++.

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

What makes Bill a better name than Fred? His name is Fred. Stop trying to rename him!

Maybe Bill can be his middle name? ... Like "Fred Bill Daniwebber, the first of his name".

<M/> commented: i like it +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The more special a package is, the harder it is to do any kind of upgrade or replacement of parts. A normal desktop PC is easy to upgrade because the parts are standard, easy to reach, assemble and disassemble, and I've done it many times. A laptop is harder because parts are not as standard, they often have special adaptors or form-factors that are made for that particular model or series of laptops. Disassembly and reassembly of a laptop can be tricky because everything is so tightly packed and delicate (like those darn plastic clips that always break when you pull something out), and there isn't much room for too many additional or bigger components. I have never really upgraded a laptop, or even replaced a part in one, except for replacing the keyboard (which is pretty easy). As for an "all-in-one" computer like yours, I would imagine that it is even worse than with a laptop. I think that all-in-one computers usually have a special motherboard just for that model or series, and everything is meant to be the same forever, not really "upgradable".

You really only have two options: install a lightweight OS that this computer can run well (such as Lubuntu, Xubuntu, Peppermint OS, Puppy Linux, etc.); or, you can buy a new computer. You could also do both, I guess, buy a new computer and install a lightweight Linux distro on your old one.

The reality is, an Atom N270 is never going to run Windows …

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

so thought that I would test it out, when I had a chance ... using a C++11 compiler.

Why? My code does not require any C++11 features. It is purely C++98 code.

This is what I came up with that actually did handle both kinds of errors the way expected ... and I thought you might like to see it.

Ah.. yes, this has been a pet peeve of mine with the iostream library, i.e., the lack of commitment to using exceptions. Despite a lot of nice design patterns that are used in the iostream library, there are also some glaring problems. One such problem is that it was largely written at a time when people were still very reluctant to the adoption of exceptions as a primary error-handling mechanism. So, even though they made all the iostream classes into well-designed RAII classes that can be gracefully used alongside exception throwing and handling, they made them use error-codes (or error-states, which is the OOP equivalent of error-codes) as the default error-handling method and made exceptions second-class citizens in the iostream classes. I find that the option to report iostream errors via exceptions is so poor that you can hardly use it. If I have to, I just check the error-states and throw an exception if needed. Like this:

try
{
    std::ifstream fin( FNAME );
    if( !fin.is_open() )
        throw file_not_openable(FNAME);
    std::vector< double > data2;
    std::copy
    (
        std::istream_iterator< double >( fin ),
        std::istream_iterator< double >(),
        std::back_inserter( data2 …
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I agree with rubberman. Don't expect much from that computer. I mean Atom processors are meant for very small netbooks and for embedded systems. I've seen plenty of Atom CPUs used in embedded system (e.g., robotics), because they are top of the line CPUs for that kind of a small package. They perform great, that is, not for running any kind of Windows OS or other desktop operating system, but for running robot control software and stuff.

If you want to get the most out of the computer, you should consider using an operating system that is more appropriate for such a system. Try a Linux distribution instead, that's my recommendation for anyone looking to give a second life to some older / weaker computer.