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

what is the use of :: in them ??

A simple trick, just think of Foo::Bar as meaning "Bar from Foo". This meaning works everywhere you see those ::. Like std::cout is "cout from std namespace". Or MyClass::SomeFunction() means "call SomeFunction() from MyClass". In fancy C++ terminology, the :: is called the "scope resolution operator", because in an expression like Foo::Bar, the operator :: tells you to what scope Bar belongs to (i.e., it "resolves" the scope of Bar).

what are member function??

Functions that belong to a class. And when something belongs to a class, it is referred to by something like MyClass::SomeFunction(), as in, "SomeFunction from MyClass", meaning SomeFunction belongs to MyClass, it is a member function.

what are static and non static member function??

Both types of functions belong to the class (i.e., member functions), but non-static member functions (not declared with the static keyword) must be called on an object of the class they belong to. Calling it as MyObj.SomeFunction() means "call SomeFunction on the object 'MyObj'". Calling it as MyObjPtr->SomeFunction() means "call SomeFunction on the object that 'MyObjPtr' points to". As for static member functions, they are just called by being resolved from the class scope, i.e., as MyClass::SomeFunction().

If you are already within the class scope (in the body of a member function, for example), then you don't need to resolve the scope of the static member functions, i.e., no need for the MyClass:: part. If you are …

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

What consumes most RAM (besides the browser) is the desktop environment as a whole. Ubuntu's latest versions that have Unity and all the latest bells and whistles that come with it is on the heavier side when it comes to Linux desktop environments. This definitely does not sound like something you would want to have on a VPS, especially if you are mostly using it for browsing. Things like media / file indexing, flashy desktop effects, nice software suite, and lots of software running in the background for various little features are all things you don't need. Ubuntu is more in the category of "Windows replacement", as in, a complete user-friendly, nice-looking, feature-rich OS that you can use as your primary OS for day-to-day work and leisure.

Unfortunately, Ubuntu is a pretty bad place to start. I imagine it will be a bit hard to strip it down to the "lean and mean". When it comes to lightweight desktop environments, the main candidates are LXDE and Xfce. There are Ubuntu fork-distributions for these environments, Lubuntu and Xubuntu, respectively. Installing either of those instead of Ubuntu would have been a lot better. But to have a truly lightweight Linux installation (that still has a graphical interface), it is probably preferrable to start with a minimal distribution like Debian, and then install the individual things that you need. It seem many people do exactly that for their VPS systems. See instructions here for Debian + LXDE …

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

I have to agree with jwenting (that's a first!), cloud-based services of the likes of Google Docs are pretty much the biggest hole in internet security right now, and everyone is pushing to make it bigger. If you use them, limit your use to uploading files into a public dropbox folder. When hackers talk about cloud-based services, they drool helplessly.

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

Yeah I know. I'm just saying, if you plan to do anything more in terms of connection with social media, places like google+, twitter, and facebook might not be the best places to direct efforts.

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

I'm not a big user of the main social media outlets either, and also, I think it would be wrong to put too much focus on those "muggle-facing" outlets. If I find an interesting thread here, it will most likely be technical, and thus, not likely to be something I would share with my family and friends. On more professional networking sites (e.g., LinkedIn), the chances of that happening grow quite a bit.

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

I do not internet at the shop. So has to be offline for now.

You treat the internet as if it was some big mystical thing. It's nothing more than a very large network. Writing this as an web application is certainly possible, you just have to run a web server in your network (which is cheap and fairly easy to setup). No connection to the internet is required. The computer on which you run the database server can also be used to run a web-page server, and you'll be able to write code in almost any web-language you like (ASP, PHP, javascript, etc.). This is not an issue. Get a decent server computer, install RHEL or SUSE on it (or Fedora or OpenSUSE, for the smaller wallets), and run a MySQL database server and an Apache web server on it. That's it.

Also, on the server will have all customers info, all design files for projects, and do a payroll off of what work people complete.

All this and no access to the internet? So, no off-site backups? No security updates? You like playing with fire do you?

I think your system administration needs a bit more work (and possibly, hired "expertise").

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

What would following a member do, exactly?

From time to time, I've had a few people PM me and say things like "whenever I see that you have posted a reply somewhere, I always check it out because I know it will be interesting to read..". To follow a member might just mean that there is a new tab within the "watched articles" or somewhere like that that would display all the threads on which the members that you follow have recently posted. I know that you can just go to the member's profile and check out the "contributions", but it would be nicer to have it aggregated for all the members you might wish to do so on a regular basis.

I also think a chat feature might be useful, I wouldn't know what exact shape it would take though.

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

I could set up a mysql that is offline and uses it through a wan connection?

Yes, of course. MySQL is a server application, it receives queries from the network. Whether the network is just the loopback (localhost (IP: 127.0.0.1)), or a local network (via a router, LAN and/or WAN), or the internet at large, it doesn't matter.

What language are you most comfortable with?

I'm guessing from where this was posted, that it would be C++. Of course, as far as doing GUI programming or interfacing with a database, any language works just as well, as long as the tools are well-established, so, as long as you stick with main-stream languages (C++, Java, Python, PHP), it's all the same, really.

Of course, there could be a choice between the client application as a standalone application or as a web-page, that depends more on what kind of GUI experience is desired. And there is of course a performance / portability trade-off.

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

Alright, for the sake of do-it-yourself experience, we can discuss how you could do it.

The central issue here is something called "type erasure". This is something you encounter for time to time in C++. It's not always possible but often useful. The Boost.Function library (and the standard std::function template) do type erasure on function objects (or function pointers).

BTW, your solution, using the void*, is what people would call a "poor man's type erasure technique". It is very often used in C (or C-style C++), because that's pretty much the only technique available there. The fluff you have with the to and from functions is just eye-candy.

In your case, what you want is for the caller of the callback function not to have to care about the type of the function it is calling, nor about the type of the parameters it is giving it, if any. So, these are the types you want to "erase".

In your problem, the caller doesn't know anything except that it must call the callback function. Even though, in your code, you provide a void* to the function call, in reality, the caller contributes nothing of its own to the function and does not expect anything back either. So, for the sake of not complicating things more than they need to be, your caller should look something like this:

void call_function(some_callable_type f)
{
    f();  // provides no parameter, recieves nothing in return.
}

The some_callable_type should not be a template …

rubberman commented: Nice explanation mike! Worth reading. +12
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

It seems a bit too convoluted. There is a standard (now) method for doing this. See this example using Boost.Bind and Boost.Function. Both of these libraries are now part of the standard (C++11) in the <functional> header.

You can basically implement your example like this:

#include <iostream>
#include <functional>
#include <string>

void foo(const std::string& data)
{
    std::cout << data << std::endl;
}

void call_function(std::function< void() > f)
{
    f();
}

int main()
{
    std::string test = "Hello";
    call_function( std::bind(foo, std::cref(test)) );

    std::cin.get();
    return 0;
}

Simple, hey?

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

how do these rows work exactly?

The first line refers to a classic issue: how do you signal an error from a constructor?
There is essentially no other choice to report an error from a constructor but to throw an exception.

The second line tells the IO-stream object to throw an exception upon failure instead of simply going into a "bad-state" as they usually do. See the reference documentation.

The third line comes from the fact that if you don't define a destructor for a class, the compiler will generate one for you, and that destructor will just destroy each of the data members of the class. In this case, the only data member is the file-stream object, which will automatically close the file if it is still open by the time it reaches the destructor of that file-stream object. This is a bit harder to find explicitly said in the reference documentation (you have to look into the standard document), but I assure you, it is guaranteed.

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

What do you mean by "file type"? If you mean different file formats, then there is no way that you can avoid having to write a special load/save function for each format. But if you mean files with different types of content but saved with the same overall format (an "extensible" format), then what you are describing is indeed what we call a serialization library.

When serializing data, there are fundamentally two things that need to be coded: what do you want to put in the file; and, how are you going to put it there. The first is "content" and the second is "format". A good serialization library would generally separate those two tasks. This is because the type of object that you want to save / load determines the content of the file, which is generally independent of the format. And because every type of object (class) that you might want to save to a file will have different content, there is generally no way to avoid having to manually specify the content to be saved/loaded for each class. However, what you can avoid is the dependency to the format of the destination file.

That's where I have issues with your solution. You are relying on a line like file << ab; to save your object (ab) to the file, this means that your class will have to implement a << operator for IO-streams (and a corresponding >> operator for loading) which means that this function defines both …

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

The database part is almost definitely better handled with a database engine. A reasonably good and cross-platform, and free one is MySQL. All database engines are setup in a server-client arrangement over a network (or loopback). And most GUI toolkits (I recommend Qt) have a number of pre-existing widgets to deal with databases (query data, display, insert entries, etc.), and for the rest, you just some database-client library (like libmysql). In other words, you could solve your problem simply with this arrangement:

Server: 
  - Run a MySQL database server (or some other database server)
Client:
  - Use a mix of pre-existing database widgets and of custom code to communicate with the server
  - Create the rest of the eye-candy GUI

This means you only really need to code one application, and you don't need to worry about complicated server-client coding. It's going to be a walk in the park.

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

The 1980s weren't that great.

Except for the invention of the Internet, the adoption of seatbelts, Michael Jackson, Knight Rider, and, of course, the invention of miniskirts. And the greatest miracle of them all, my birth ;)

Can it be possible to give the header file windows.h in turbo c ?

Short answer: No.
Long answer: Maybe, but not worth the effort.

Change to a more recent compiler. There are plenty of free compilers available out there, like CodeBlocks and Visual Studio ("Express" editions are free).

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

You're correct. The standard sort function will provide const objects to the comparison function. When calling a function with a const object as parameter, the function must take the object either by const-reference or by value. This is why changing the signature of the comparion function to non-const references does not work. And because you need non-const objects inside that function, the only remaining solution is to take those parameters by value. This is, of course, wasteful (useless copy), but that's one of the consequence of not caring to const-qualify things properly (i.e., making the "name" function non-const is stupid, leading to more stupid / wasteful code).

9-2. If we define the name function as a plain, nonconst member
function, what other functions in our system must change and why?

My answer to this question would be that every piece of code that depends on this function will have to change and code that relies on conventional constness rules will be broken, because making the "name" function non-const is a major breach of the integrity and consistency of the class' interface. I guess that's the lesson that this exercise is supposed to teach you.

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

Yeah, you do have a pretty thick Lawn Guyland accent.

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

There is some online documentation you can refer to. Use the C functions (not FreeImagePlus). You just need to include the header "FreeImage.h" and link with the library. There are functions like FreeImage_Load to load an image, and FreeImage_Save to save an image, and so on. The PDF has the full references for all the functions.

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

That's a good idea RevJim. There could be a button under the "Tutorial" tab that says something like "Propose a Tutorial Topic" or something like that. In other words, it would be nice to have an "official" place for people to manifest their desire for a particular topic to be covered in a tutorial, maybe even a voting system to prioritize the current proposed topics according to popular demand. And as moderators, we could do the "dispatching", i.e., finding a member who can and is willing to write that tutorial, or that comes forward wanting to do it.

I know that I would be totally willing to write some more tutorials. And a lot of simple topics don't require much time or research to write. But the problem is having the motivation (from the community) and topic ideas, having a kind of official "to-do" list with votes would solve both problems. The votes on the topic idea could also be transfered to the member who wrote the tutorial, as a little extra incentive.

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

For simple image manipulations like that, I find that the FreeImage library is pretty nice and easy. And it works well in Windows too.

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

the feature has existed for a few days already and no one has noticed :(

I had noticed it (couple of days ago or something like that), but I wasn't sure if it was there before that and I just hadn't noticed it, or if it was something new. I also couldn't quite figure out what it was for (no tooltip, and I'm kinda slow ;) ), and I was scared to click on it (well, I didn't think it would trigger WW III or something, but you know what I mean). I think it would be nice to have the word "Preview" next to the check mark, like all the other buttons (like # List and * List).

And, Hurray for the spellchecking!!! I would still prefer the system / browser's spellchecker, but I can live with this one.

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

I really enjoyed the interview. It was quite endearing how Dani was giggling the whole time. One thing I got out of this interview is that Dani, you really got your shit together! (pardon the language) I mean, you clearly understand this business well, from the technical and marketing side, and that's impressive. I've grown to respect you a lot over my years on Daniweb. You're a force to be reckoned with.

One of my biggest regrets today is that I never got my MBA.

Pfff.. You could be a guest lecturer in an MBA course. The purpose of an MBA is to pad a resume, you don't need that, you've got more than a million Daniweb members padding yours.

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

Simulation is a far too general term. What kind of simulation? What kind of system do you want to simulate? If you're talking about a dynamic system (i.e., differential equation of motion), then at the base all you need is some good numerical integrators library, then probably some linear algebra library, and then you just implement the functions that compute the time-derivative of the state vector and feed it to an integrator, that's it. If it's a more complex system, you might need quite a bit of code to model the dynamics of that system (instead of manually writing out the complete differential equations).

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

For one, you cannot overload operators for basic types like int or double or whatever, there must be at least one non-primitive type in the operator's signature. In this case, it is OK on that aspect because ostream& os is a non-primitive type. However, there already exists an operator<< for the type int (or const int). It might be that your implementation (compiler) accepts it, depending on how it implemented the operator<< for built-in types, but you shouldn't do this, especially not if you are going to do something "weird" inside the operator (like print the value times 2).

One way to solve this problem would be to introduce a different type that just wraps the integer value. It's really just a placeholder to differentiate the types when the compiler does overload resolution. Here's what I mean:

#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>

using namespace std;

// create a type to hold a "doubled integer":
struct doubled_int {
  int value;

  // make it implicitly convertible (int -> doubled_int)
  doubled_int(int aValue) : value(aValue * 2) { };

  // make it implicitly convertible (doubled_int -> int)
  operator int() const { return value / 2; };
};

// overload the << operator for that wrapper type:
ostream& operator<<(ostream& os, doubled_int p_val) {
    return os << p_val.value;  // <-- print the doubled value.
}

int main()
{
    std::vector<int> myVector = {34,54,43,2,7,87};

    std::copy(myVector.begin(), myVector.end(), 
              ostream_iterator<doubled_int>(std::cout, " ")); // <-- notice '<doubled_int>'

    cin.get();
    return 0;
}

Of course, the above is pretty …

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

First of all, if you don't need the AbstractClass beyond the scope of the constructor, then all you need to do is make the constructor templated:

class FileWriter {
    ofstream file;
  public:

    template <class AbstractClass>
    FileWriter(const string& fileName, const AbstractClass& ab) {
        // must turn on io-exceptions, as the only way to signal error from the constructor.
        file.exceptions( ofstream::failbit | ofstream::badbit );
        file.open( fileName.c_str() );
        file << ab;
    }

    ~FileWriter() {
        file.close();
    }
};

Second thing is, I don't understand why you want to have a constructor that does the serialization of an object. It doesn't make sense. The only way to use this class is to create a temporary FileWriter to serialize one object, and then immediately destroy that temporary writer object. In other words, it will always boil down to this function:

template <class AbstractClass>
void writeToFile(const string& fileName, const AbstractClass& ab) {
  ofstream file;
  file.exceptions( ofstream::failbit | ofstream::badbit );
  file.open( fileName.c_str() );
  file << ab;
}; // file will be destroyed here, which closes the file.

Why do you need a class to do this? At the very least, your FileWriter class should have the constructor and object serialization split into two functions to make it more usable:

class FileWriter {
    ofstream file;
  public:

    FileWriter(const string& fileName) : file(fileName.c_str()) { };

    template <class AbstractClass>
    void write(const AbstractClass& ab) {
        file << ab;
    }

    // convert to bool to know if the writer is in a good state.
    operator bool() const { return …
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I don't know about file sizes specifically, but have you tried Qt? It fits all your other criteria: easy to use, good RAD tool, and LGPL (or commercial) licensing.

As for tnFox, I have never heard of it.

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

I just tried it out. I have Kubuntu 12.10, with python installed (default) and with the mxDateTime and Mako installed as instructed by JasonHippy. I extracted the Haizea sources as instructed, I launched the setup.py as instructed, and received a message similar to yours (ending in "Writing ... haizea-1.0.egg-info"). All seems to have worked correctly. I also ran the test to verify the installation and it works just fine. Did you try the verification? If it tells you something like:

IOError: [Errno 2] No such file or directory: '/usr/share/haizea/traces/sample.lwf'

then you just have to go into the sample_trace.conf file and look for the path to this file and change it to wherever the file was actually installed (might be /usr/share/haizea/traces/sample.lwf, or /usr/local/share/haizea/traces/sample.lwf, or ~/share/haizea/traces/sample.lwf, depending on where you installed haizea, you seemed to have installed it in /usr/local, which is good).

As for your troubles compiling Python, well... as JasonHippy said, you DO NOT NEED TO DO THAT. Compiling Python from sources is likely to be quite a task in itself (probably has a gizillion dependencies), and there is no reason to do it. (btw, if libffi is missing, just install it: sudo apt-get install libffi-dev).

JasonHippy commented: Been away for a few days. Cheers for picking up my slack on this! And a really good, accurate response as ever too! :) Thanks Mike! +8
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

According to the problem statement and according to the function declaration, what you should do is take the three numbers as input (cin) before calling the function, and then pass those three numbers to the function to get the result. As so:

#include <iostream>
#include <cmath>      // <-- notice, the standard math header is "cmath" not "math.h".

using namespace std;

int addTwoMultiplyOne(int, int, int);

int main()
{

    cout << "Enter x y z: " << endl;   //
    int x,y,z;                         // take input first.
    cin >> x >> y >> z;                //

    cout << addTwoMultiplyOne(x, y, z) << endl;  // then, call the function.

    char c;       //
    cin.ignore(); // use this instead of the non-standard "getch()" (remove "conio.h") 
    cin >> c;     //
    return 0;
}

int addTwoMultiplyOne(int x, int y, int z)
{
    return ((x+y)*z);
}

Also, I hope you notice how much nicer it looks when the code is properly indented and spaced-out.

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

The solution is simple your programs won't work on anything but turbo c so your only choice is to carry on using it.

Well, another solution is to make all the necessary changes to the code so that it works on a modern compiler. If the project is not too big, this can be a very good way to unlearn all the non-standard stuff you might have learned over time while using this ancient compiler.

Fstream.h, iomanip.h and graphics.h are not not working in this. Help me.

fstream.h and iomanip.h are not called just fstream and iomanip, i.e., you write #include <fstream> and #include <iomanip>. The standard C libraries (math.h, stdlib.h, etc..) have a different name in C++, they are now cmath, cstdlib, etc.. without the .h. Also, all standard classes and functions are now in the std namespace, meaning that cout is now std::cout, ifstream is now std::ifstream and so on, and if you want to avoid having to write std:: everywhere, you write using namespace std; either at global scope (outside any function) or within the function where you want to avoid writing std::.

As for graphics.h, this is not a standard library, only a Windows-specific library. This library has been long since deprecated and is no longer bundled with any compiler, as far as I know.

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

The answers given by the OP are correct, that is, 1: B & D and 2: B. The explanation is as follows:

1) The Linux naming convention for hard-drives has the first two letters to identify the kind of hard-drive it is, usually "hd" for normal hard-drive and "sd" for a SATA-connected hard-drive (as opposed to the old IDE connections). The letter after that is just an alphabetic order letters to identify the drives (a: first, b: second, etc..). And then, the number is the number of the partition. Thus, hdb2 is in a "hard-drive", it is in the second physical hard-drive, and it is the second partition of that hard-drive. Thus, the answers are B and D.

2) Both a DLL and an EXE contain executable code, so, (a) is false. Both a DLL and an EXE contain mapped addresses of executable code (i.e., exported symbols, as they are usually called), so, (c) is false. And a DLL does not necessarily, and almost always not, contain all the executable code for a program, so, (d) is false. By process of elimination, (b) must be the correct answer because it is quite true that there is very little difference between a DLL and an EXE, in fact, the differences are quite trivial, just a flag that is different (to tell the OS whether it is a EXE or a DLL), and the fact that an EXE is expected to have a main() function while a DLL is expected to optionally …

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

So how can I distinquish the difference? In other words, how can I figure out which kind of T** they are passing?

You can't. There is no difference between T** (pointing to an array of arrays) and T** (pointing to a pointer to a T variable) from a type perspective. You can file it under "another reason not to use C-style arrays".

When using a "strongly typed" language, if you wish to benefit from static type checking, it is your responsibility to correctly and strictly encode the requirements of the passed parameters into their type. A type like T** does not enforce any requirement other than "it must point to a pointer to T". The requirement that the first parameter should actually refer to an array of arrays is not well represented by the type that you used for that parameter. The compiler can only enforce the requirements that you laid out.

The solution here is that you should have some other type that would be more strict. This could simply take the form of std::vector< std::vector< T > >, or some other more general type. Maybe a custom type like Matrix<T> or something like that. Otherwise, you'll have to accept that this function is just weakly typed, and cannot ensure, statically, that the passed parameter is truly of the correct type.

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

Normally, I would direct people either to the C++11 threading library or to its precursor, the Boost.Thread library, as the best, most portable and easiest multi-threading library to use. However, these will certainly not work with Turbo C++ 3.0.

Your best chance is with the Win32 API functions. To create a thread, you can use the function CreateThread.

The issue you will face is probably the fact that Turbo C++ 3.0 is most likely packaged with an ancient version of the Windows APIs, and I can't say for sure whether it can even work with more recent versions. The version of the Win32 API that Turbo C++ 3.0 comes with probably dates to some time when people would be using Windows 3.0 / 3.1, if they were using Windows at all (probably MS-DOS). In either case, multi-threading was not supported in those days (i.e., it just didn't really exist yet). If you have a post-Windows95 version of Turbo C++ 3.0, then there is a chance that it comes with the earliest version of Win32 API, the one used for making applications for Windows 95 or NT. If that's the case, I would assume that CreateThread (and its related functions) probably do exist. But one thing's for sure, you'll have a very hard time finding documentation on this (people would, quite expectingly, rely heavily on MSDN for documentation on Microsoft stuff, but MSDN is not known for its "archiving" qualities, I don't think there is much useful …

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

Start by reading some reviews and picking a distribution that might be a good fit for you. For example, these latest reviews, or these, or these. Also, you should know that often what matters most to a casual user is the eye-candy, i.e., the look and feel of the interface, which is not so much dependent on the distribution as much as it depends on the "desktop environment" (most distributions give you a choice of alternatives). So, check out some reviews of that too.

Then, go to the distributions webpage, and download the ISO image to install it.

Then, decide how you want to setup your system. You have roughly 3 choices (with links for Ubuntu, but you can easily find instructions for other distros):

  • Run Linux within Windows (or Mac) in a virtual machine, i.e., it's like having the OS running inside a Windows application. This can be a good option at first, especially if you want to try out different distros. See here.
  • Dual-boot between Windows and Linux. This is the most typical thing. You have to be a bit careful when re-partitioning and especially about the Boot Manager (I recommend using EasyBCD). See here (notice the remarks on Boot Managers).
  • Replace existing OS. This is by far the easiest installation process, but, of course, it means that afterwards, you will have Linux only on your system (and it will wipe out all your data). This …
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I think LibreOffice works OK for most practical purposes. I'm not sure how good their database program (LibreOffice Base) is though. I've used it a little bit, it seems fairly basic, but I have never used MS Access, so I have no basis for comparison. How do you find it to be?

I don't tend to use (MS/Libre)Office products too much. I do document writing in LaTeX, including presentations and posters (LaTeX/beamer). I do most math-/plotting-related things in Matlab, but sometimes in LibreOffice Calc (Excel clone). Vector drawings (diagrams) in Inkscape (or some UML application). PDFs in Okular.

I'm not a fan of Google Docs or other cloud-oriented applications. For one, they are currently one of the biggest security vulnerability out there, these applications are currently ridiculously easy to hack into, so that rules them out for any serious work (serious, as in, a company relying on them). And they still don't really deliver good enough performance and feature-sets, in my opinion.

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

Well, for one, you must always turn on all the warnings (-Wall) when compiling your code, and most compilers will warn you when you are using uninitialized variables, or that a variable might be uninitialized at some point.

If the type is not a trivial type (int, double, etc.., and some trivial classes), then it will always be default-initialized or zero-initialized. Only trivial variables can be truly uninitialized (i.e., have some garbage value).

Some compilers (e.g., Visual Studio, Borland, etc.), under debugging-mode, will fill all uninitialized memory with some weird bit-pattern to informally mark them as being uninitialized. When you are debugging and reading a stack dump or memory dump in hexadecimal form, you will see patterns like 0xBAADF00D or 0xDEADBEEF in the memory, those correspond to uninitialized memory. The reason why this is only done in debugging-mode is because it is an expensive operation, and any correct program cannot be relying on any kind of uninitialized memory, so, it is useless in any final product / application.

Uninitialized variables have an undefined value. This means that a correct program cannot use that value under any circumstance. And for that reason, there is no such thing as a function to "check if it is initialized" because that would imply the possibility of reading the value of an uninitialized variable, which is undefined behavior, and thus, an incorrect program. In other words, such a function would be, by definition, a guaranteed bug in your program.

The solution, of course, is to …

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

NOTE: I added the curly braces (to write code, you just write it, then select it, and hit the "Code" button on the editor or the tab-key on your keyboard).

But u said I have to tell the compiler to use recent architecture, but how can I do that??

The command-line option is -2. That means, when you write out the MS-DOS command to compile the code, you must add the -2 somewhere (anywhere) on the same line as the command.

If you are using the Windows version of Turbo C++ 3.0 (does one exist?? can it still run on any computer that is recent enough to be connected to the internet?), then look through the "build options" or "compilation configuration" or whatever it's called, and try to find either somewhere where there is an edit box that says something along the lines of "custom command-line compiler options" and enter -2 (dash and two), or you might be able to find a check-box somewhere that says "80286" or "286/287" or "286-protected mode".

I cannot give you detailed explanations (I doubt anyone could), this compiler dates back to when I was 6 years old. It is an old and forgotten compiler (and development environment).

Inline assembly is, as far as I know, not very portable between compilers, so I doubt that you could get the code to compile on another compiler. But, at least, try something more modern from the same family of compilers (Borland), like Turbo C++ 4.5, …

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

What would your solver do with a quadratic equation where a != 0 but there is still only one root (e.g., f(x) = x^2)?

That's called a repeated root, there are still two roots, they just have the same value. A proper quadratic equation solver should output two roots with the same value. Otherwise, it would be very weird.

So I am considering using quiet_NaN. Is this acceptable practice?

Acceptable? Yes.
Typical? Yeah..
People often use NaN or infinity as a cheap way to mark a double/float as "invalid". After all, that's what NaN is (Not-a-Number), although it technically should only result from specific operations like log(-1.0) or 0.0/0.0, you can use it for other reasonable cases (which usually derives, one way or another, from the basic cases that generate NaN or infinite values).

In this case, actually, the second root is infinity because it is a division by zero, from the following:

x = (-b +- sqrt(b^2 - 4ac)) / 2a

(assume b is positive, without loss of generality)

x1 = (-b + sqrt(b^2 - 4ac)) / 2a
x1 = 0 / 0
x1 = lim(a->0) (-b + sqrt(b^2 - 4ac)) / 2a
(use L'Hôpital's Rule)
x1 = lim(a->0) (-2 c / sqrt(b^2 - 4ac) / 2)  =  -c / b   (1st root)

x2 = (-b - sqrt(b^2 - 4ac)) / 2a
x2 = -b / a  =  -b / 0  =  -infinity   (2nd root)

So, technically-speaking, the value of the …

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

The problem is that Turbo C++ 3.0 is an ancient 16bit compiler from 1991, and it will, by default, compile the code for the 8086 architecture (which dates back to 1978). The inline assembly in that code you are trying to compile probably uses more "recent" instructions from the 80286/80287 architectures (from 1982). You need to tell the compiler that you want the code to be compiled for that architecture, i.e., the command-line option for that is -2 (see here). If the assembly code actually uses any instructions that are more recent than 286/287, you're in trouble, because your compiler will never be able to compile it (it doesn't understand anything more recent than that).

The other option would be to upgrade to a more recent version if possible (does that code require the use of Turbo C++ 3.0?).

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

I agree that you cannot do something like saying to children "we won't teach you how to use a computer until we taught you enough English to be able to navigate English menus and website" or something similar in other modern / technical topics. But at the same time, I feel that people go a bit crazy sometimes with coming up with "native" official terms when the English one works just fine and has already been adopted. For example, when the internet was quite new and people started to use emails, the French language office came up with the term "courriel" (fusion of "courrier" (which means "mail") and "el" for "électronique"), I thought it was kind of stupid. Most people here just use the word "email" when speaking French, although in formal speech (e.g., on TV), people make an effort to remember to say / write "courriel" instead. I don't see much benefit in that kind of thing, seems more like a contrived attempt to reject the English term just for the sake of "purity". If the English term is really difficult to pronounce or doesn't blend in very well as an adopted word, then fine, let's come up with a more suitable translation. There's been an onsloth of "official" French terms for all these new internet-related things, most of them are not used at all except by people who make an effort to speak well on TV and in official documents, most normal people just integrated the English vocabulary …

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

stating that 10K is the maximum number of words an average human may retain, we are firmly planting the nail in the coffin of polyglotism.

Well, obviously, that's merely a ball-park figure. And it's the "active" vocabulary, which is very different from the more general term "retain", which is probably only limited by the total amount of memory you have. I used to live in Germany, and I learned the language mostly in the "street" (i.e., not in a classroom). Today, my german is very "rusty" (i.e., it's "passive"), I used to be able to get around in day-to-day affairs in German only, and could even sustain a conversation with minimal English borrowings. Now, I can still understand it pretty well (e.g., watch a movie in German without subtitles), but talking is certainly a lot harder. In early childhood, I was perfectly bilingual (French (mother) and Swedish (father)) but I progressively lost a lot of my Swedish while growing up in a French environment. When going back to Sweden (family vacations), it usually took about 2-3 weeks before I could start to feel a bit more comfortable with using the language, i.e., progressively re-activating my passive vocabulary, but I could always understand it pretty well (understanding can draw more on passive vocabulary than speech). If I were to try and maintain a decent active vocabulary in all four languages (French, English, Swedish, German), it would require a lot of daily efforts (i.e., time), and I can't really afford …

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

It's a zero-sum game merely because it's a matter of time investment and finite resources. At least, I think so. Developing a comfort for using a language and a domain-specific vocabulary takes some time, not just initially but also as a sustained day-to-day "training". For example, I think I heard somewhere that the average person can retain around 10,000 words in his/her active vocabulary (these are the words that immediately come out when you speak, you don't have to look for them), and that's for all languages combined. So, this is literally a zero-sum game: if you have two equally active languages that you use, you'll have about half the active vocabulary that an average person would have in each language alone. That has a noticeable effect, I know it, I live it. And the active vocabulary is something that is fluid (i.e., like volatile memory), which means you can re-gain it over some time and you can also lose it quickly without day-to-day "training". In my personal experience, the re-training period is about 3-5 weeks for an almost full reload of the active vocabulary.

Culturally, things are also a zero-sum game. You have to choose which TV show you watch, which magazin or online articles you read, what artists you listen to, and what things you do in general. Your time is limited (finite), and your choices affect how "connected" you are to one culture or another (e.g., your local area, your country, the (US-centric) global culture, the domain-specific …

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

Who said they have to give up their native language?

diafol was referring to a kind of inevitable loss of some of your native language and culture when you get into the habit of using English day in day out. I feel this very much, I've used English predominantly at work, at university, and with most acquaintances. When I speak French with family and friends from back home, I realize I'm no longer entirely fluent (English words or expressions pop to mind faster than French words, hindering the fluency of my speech, and things like that). If I get into more work-related or science and technology topics, I'm virtually incompetent at saying anything meaningful without borrowing every other word from English (and technical words are obscure enough for the laymen already, it's even worse when they're in a foreign language). The point is that for many of the modern (tech-)topics or for scientific technical topics for which all research and "current events" are communicated in English, the domain-specific vocabulary is being created entirely in English, meaning that all other languages have "stopped evolving" in the sense of no longer generating new words to describe the new things.

So, "who said they have to give up their native language?", well: (1) no one said they had to, (2) they are often not consciously "giving up" their native language (only consciously acquiring / using another language), and (3) it's a natural consequence of having an international language. If you want …

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

Not as far as I know. There might be some compiler extension that does this, but nothing standard.

This kind of thing is generally handled by the build system and/or compilation flags. Technically speaking, there could be a way to obtain information from the compiler whether a header file exists or not, but that would be crude at best and not very useful. Generally, you use a build system (such as cmake, autoconf, Boost.Build, etc.) to do things like checking if a header file exists, finding the path to a header file that you're not sure where it could be, finding alternative paths / libraries to use, and doing things like disabling the compilations of some source files under some conditions, and so on.. This is what a build system (or build configuration system) is useful for, so, that's where you should be doing that kind of thing. Once you determine what optional headers exist, you would typically set certain defines (#define) that you can test in your code, for example:

#if defined(HAVE_FOUND_OPENCV_HDR)

#include <cv.h>
#include <cvaux.h>

#elif defined(HAVE_FOUND_FREEIMAGE_HDR)

#include <FreeImage.h>

#else

#error "No appropriate image library installed on the system! Options are OpenCV or FreeImage."

#endif

Another mechanism for this kind of thing is to assess the nature of the platform you are compiling for by using pre-processor definitions that are defined by the compiler. These defines generally can be used to infer which compiler is being used, what OS it is compiling for, and on what …

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

we even get some very minimal traffic from North Korea. Just because people from North Korea may visit DaniWeb can't possibly mean that we have to uphold North Korean internet and privacy laws!!

But it does mean that the site should be usable from a Windows 95 computer. ;)

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

Another vote for OpenMP. It's very easy, and supported by virtually all modern compilers on all platforms. It is turned on by a compiler option, and if not turned on (or not supported), the code just compiles the same but single-threaded, which is a great feature for portability.

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

The spelling went away when the old system (vBulletin) was replaced. It has been a constant irritant ever since. People (including me) have asked for it many times. I think there is some technical reason why it is kind of hard to do, but I don't buy it. I think it is long overdue now.

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

@rubberman: using just extern in front of a function declaration in C/C++ has absolutely no effect. Function declarations declare functions with external linkage by default, adding the extern keyword doesn't change anything.

@Suzie999:
You need to provide some sort of explicit example of what you are trying to do. Could you just write up a small example (similar to the example code Moschops presented) that demonstrate the problem you are facing? It will be a lot easier to understand that way. I'm really confused as to what you are trying to do or what your problem is, it will be easier with some simple bits of code to show it.

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

should i start learning about hardware or software?

You take on a project and you learn what you have to. In robotics, it's pretty much inevitable to have to have a well-rounded set of skills. Each piece of hardware (sensors, motors, servos, controllers, batteries, etc.) have their quirks, which you learn about as you gain experience with them. And you can't get anything done without having to write software. One of the most critical parts to understand is what is between hardware and software, that is, the "ports" and their associated electronics. If there is something that you need to do some research on before buying hardware or preparing to write software, it is getting to know all the different protocols / connectors / ports that are used by different peripherals (hardware) and provided by different micro-controller chips. Things that you should know like your back pocket are things like TTL, RS-232, JTAG, I2C, PWM, servo-PWM, CAN / OpenCAN, SMB, etc... Otherwise you might buy the wrong things and have lots of trouble making it work, or worse, end up burning things up. Good knowledge of basic electronics and circuits is also essential. Basic things like why you cannot power a servo-motor from a USB connection, or why you cannot put a magnetic sensor near a DC-motor, or why you need separate circuits for analog and digital sensors (and how to isolate the circuits).

would i have to buy hardware parts? or a kit?

Buy it? …

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

0

I win!

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

@ddanbe Thanks for that, I had never heard the word "transportation" used in French, but apparently it's a synonym of "deportation" (or expatriation), it's a super arcane word. I know that the Belge have a nick for using arcane words (like septante / octante / nonante), have you ever heard that word being used?

In fact half, if not more of the English words are derived form French

Yeah, and the other half is mostly a mix of Old Norse and later Scandinavian languages. Being a native French and Swedish speaker, there are very few words in English that I cannot easily tie to one or the other language roots. I think only about 5-10% of English words are native to the British Isles. The last I checked, I think the ethymologic distribution of English is about 10% native (celtic, gaelic, etc.), 20% Old Norse, 25% Old Scandinavian (or Old Danish / Swedish), and the rest (45%) is French. And there is also a surprising amount of Old German in the French language, so the lines get blurry at some point. But the English grammatical structures are almost exclusively Scandinavian... thank goodness they didn't adopt too much grammar from French!

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

I've heard of public transportation and I've heard of public transit. I've never heard of public transport

It's the same here, at least in my experience. I've also heard "public transport system" or some other similar term (transport as qualifier for a word like "system" or "administration", etc.).

Nonetheless-- people who live in NYC are just weird :)

I guess Canadians speak weird too ;) Well, that doesn't surprise anyone, does it?

And I guess by "people who live in NYC" you mean the entire north-east quarter... and the eastern half of Canada. That's probably what wikipedia calls "North American English". If I recall correctly, the technical term for all the other kinds of English in North America is "speech impediment"... Just kidding.. ;)

Transport is a verb, as in to transport something.

Well, "transit" is also a verb, as in to transit from one place to another. But, both transit and transport are both verbs and nouns, depending on the context. For example, consider a phrase like "the transport of goods is a lucrative business", clearly, "transport" is a noun.

All this confusion (transportation / transport / transit) is from the fact that these are words borrowed from French. And we all know how to solve that problem: stop using this frankenstein language we call English, and start using a proper language, i.e., French. ;)

BTW, in French, "transport" (noun) is the same ("transport"), "to transport" (verb) is "transporter", "transportation" does not exist, …