2,898 Posted Topics
Re: You have two equations: C * 10^2 = 1 C * N^2 = 25 You can solve that for your two unknowns C and N. If you cannot figure out how to solve that, go back to high-school. | |
Hi all, I was just playing around with some ideas about optimizing a core piece of my library: the run-time type identification system (RTTI). What does that have to do with compile-time string concatenation? Well, the whole point of the RTTI is to provide information on the type of objects, … | |
Re: > What does the warning integer overflow in expression mean? It means that the operation goes outside of the valid range of the particular type of integer. For example, if you have an integer of type `unsigned char`, then the range is `0..255` which means that doing `2 - 4` … | |
Re: I would say C++ and Python. I guess Java could be an option, and I remember seeing some half-serious Java code in robotics. As for C# in robotics, that must be a joke, right? By far, the most widespread languages for robotics are C, C++ and Python, depending on what … | |
Re: You can use the tellg and seekg functions to re-establish the cursor (get pointer). As so: std::streampos p = filestream.tellg(); stringstrm << filestream.rdbuf(); filestream.seekg(p); | |
Re: The default constructor is ambiguous with this constructor: property(std::function<void(void)> GetFunction=NULL,std::function<T(void)> SetFunction=NULL) because both can be called without any parameters. You should just remove the default constructor because that constructor with default parameters achieves the same result (setting both functions to null) when called without parameters. The `property<int> Age(&getage,&setage);` line gives … | |
Re: The preOrderHelper function should take a TreeNode pointer, not a Tree pointer. It's probably a simple typo (by you or the author). It should be: void preOrderHelper( TreeNode<NODETYPE> *ptr) const Just like it is for the other helper functions. If you read the errors, they give you a pretty clear … | |
Re: > Does this mean that ListNode can access Lists's private members No, it's the other way around. By declaring List as a friend, the ListNode class gives access to its private members to the List class. It's like an invitation, ListNode invites List into its access-space. Just think about it … | |
Re: The .find() function (in string class) is perfectly fine. I've never heard anybody say that there was anything wrong with it. It's a simple function to find a matching character or string within a string, what could go wrong with that? In general, the only standard functions that one could … | |
Re: Are you talking about [Cygwin](https://www.cygwin.com/)? The Unix emulator for windows, which has, like Linux, all the unix commands plus most of the GNU programs (and others) that can be installed via its package manager. Cygwin is one of the first program I install on any Windows machine that I'm gonna … | |
Re: > C++ uses pointers and have memory leaks , where java doesn't have pointers I've been writing C++ code for years, and I don't remember the last time I had a real memory leak problem. The idea that C++ code has memory leak is a complete myth. Beginners might have … | |
Re: > is adding m_y, m_m, m_d, considered as cheating? Nothing is considered "cheating", but there are trade-offs. Keeping the year / month / day values within the class will add to the memory used by the objects (instead of just one number for the days since some fixed date in … | |
Re: I tried the actual code, and there are some "real" errors like in the `!=` operator, where you have `!(this == right)` instead of `!(*this == right)`, because `this` is a pointer, so it needs to be dereferenced to get a reference that can be compared with `right`. In the … | |
Re: MACROs are a kind of find-and-replace feature with some additional useful benefits. First, they can take parameters which will be replaced inside the MACRO's body. But be warned, they should not be used as substitute for functions, i.e., if you can do it with a function, use a function because … | |
Re: Generally, before being a great reverse engineer you have to be a great engineer. So, I would advise that you start by trying to become a good programmer before you even consider going down this road, which is the wrong road, btw. For any experienced programmer, there is no real … | |
Re: I think that most false advertising laws do allow for some level of approximation, even if it favors the advertiser. Also, if I had a dime for every time I bought some tech that didn't live up to specs, I would be a rich man. I have quite a bit … | |
Re: Awww.... sounds painful. I hope it gets better soon, hang in there Dani. Kram. (N.B. "Kram." is swedish for "I wish I could give you a hug." or "I send you a hug.") | |
Re: From what the guys over at Clang and GCC have said, the constexpr feature is actually one of the hardest features to implement from C++11. I think it's because it actually constitutes (another) compile-time Turing complete language on top of C++. | |
Re: Just posting this through my phone and it seems to be working quite alright. I find the mobile interface nice and clean but it can be a bit difficult to navigate. Using chrome on Android phone. | |
![]() | Re: Most game engines that commercial games use are proprietary, meaning that they were developed by a game company who now owns it and licenses it to other companies (or just uses it for its own in-house games). If company A wants to use a game engine developed by company B, … |
![]() | Re: > Learning occurs by adjusting the weight matrix in a neuron Care to explain how? The logic required to update the weights is generally-speaking exponentially higher in computational cost than the actual neuron firing logic / dynamics, which is quite trivial to compute, even on an ordinary PC. One of … |
Re: The problem is that your new user is not a "sudoer", which means a user that can run commands as super-user. To grant that user the right to run such commands, you have to add it to the "sudo" group. To do this, you must login as a sudoer account … | |
Re: The reason for the limited amount of "peeking" is because certain types of streams cannot accomodate more than a single character peeking (and no seeking). But for the streams that can easily support moving back-and-forth (seeking) in the underlying data, there is no reason to use peek() instead of the … | |
Re: A deduced type traditionally means a template argument type. Like this: template <typename T> void foo(T&& t) { /* .. */ }; int i = 0; foo(i); // type T will be deduced from this call, from the type of 'i' However, with the new standard also comes the keyword … | |
Re: Whatever happened to just failing those cheaters? If the prof has found out that one of his student took an answer from here or elsewhere, that's plagarism, that's an automatic zero on the assignment / exam. That's how it is here (if not worse). If the prof does not have … | |
Re: > master.cpp includes advanced.cpp and simplified.cpp. I would not recommend doing that. There is really no reason to create a "master" cpp file that includes a bunch of other cpp files. You should compile them separately and link them together (either as a static or dynamic library). I generally find … | |
Re: For help viewers, you should use Qt Assistant help-files, which are the Qt equivalent of Windows help files / menus. The Qt Assistant framework has all the features you are describing, and the help files are easily generated from html pages. With that, it's just a matter of launching it … | |
Re: This isn't really a problem of templates, it's just the problem that you don't have a function named `maximum` that could take 3 values. Your maximum function template can only take a single value (not to mention that that function is not going to work at anything, because it has … | |
Re: The fact that most Python libraries are written either in C or C++ (or Fortran for NumPy / SciPy / ..) should tell you something about the limitations of Python as a system language. Thinking that Python is appropriate as a system programming language is missing the point of Python … | |
Re: As an online resource, [this site](http://www.cplusplus.com/doc/tutorial/) is pretty much unbeatable. | |
Re: This code looks very odd. I've been trying to figure out what language it is, but I can't. It has the hallmarks of a Pascal-style language, i.e., the `:=` assigments and the `for r:= 1 to p do` syntax, which are both definitely Pascal. However, the use of `{ }` … | |
Re: The safer way to input an integer from cin is to use the following: if(!(cin >> choice)) cin.clear(); cin.ignore(); What it does is this. If the input operation failed (e.g., you did not enter a valid integer value), then it will put the stream in a failed state, which is … | |
Re: Maybe like [Qt Designer](http://qt-project.org/doc/qt-4.8/designer-manual.html)? | |
Re: Just so you know, the proper C++ version of that (mostly C-style) code is this: #include<iostream> using namespace std; int main(void) { int p = 0; cin >> p; cout << p << endl; return 0; } That readInt function just reads an integer for the standard input stream, and … | |
Re: Great job Dani! Staying on top of your game! I remember when I became a moderator. I think it was right in the thick of it, and I remember that the listing of "unresolved reported posts" (for non-mods: this is where "flag as bad post" reports go) was usually full … | |
Re: Well, the `size_type` of any container (or `std::string`) is just the preferred type for indices and sizes related to that container. It is usually fine to use another integer type, such as `int`. There are a few dangers associated with not using `size_type` but they are very unlikely to happen … | |
Re: Why do you need to put it in the header? Ok, let's just assume this example: // my_foo.hpp: #ifndef MY_FOO_HEADER #define MY_FOO_HEADER void foo_impl(); // <-- this is the function you want to "hide" class bar { public: void foo(); // <-- this is the function that uses the foo_impl … | |
![]() | Re: The process is that once you create a tutorial draft, it will be in this anti-chamber where you can edit it, save, edit, save, etc.. until you are happy with it. At that point, you should send a PM to one of the editorial members (happygeek, Dani, ..?) to get … |
Re: I would also add that it really doesn't matter that much. If you have to support older compilers, then you don't have a choice, of course, since `std::array` is only for C++11. Otherwise, you can use whichever you like, but unless you make only trivial use of the array, you … | |
Re: > What is the difference betwen high level languages and low level languages? Here is a bash script to answer your question: #!/bin/bash echo "high level languages" | sed -e 's/\ /\n/g' > hl.txt echo "low level languages" | sed -e 's/\ /\n/g' > ll.txt diff hl.txt ll.txt rm hl.txt … | |
Re: Hi Glen, and welcome to Daniweb! I'm also from Canada (Quebec). And we have the same last name (Persson), I presume you have some Swedish ancestry too? My father is Swedish. | |
Re: Problem solving skills is a combination of many things, and that's why it's difficult to pin down as one particular thing you need to learn. There is definitely an analytical aspect to problem solving, which is sort of what Hiroshe is hinting at. This is the ability to extract, from … | |
Re: These code-completion or introspection tools that most IDEs have are essentially implementing the first half of a complete compiler (which we would call the "front-end" of the compiler). Think about it, a compiler needs to look at all your code and understand every piece of it, i.e., what every identifier … | |
Re: > 1. Is there any advantage using procedural than oo? Advantages of procedural programming mostly boil down to *simplicity*. For one, a typical procedural program is just a straight-forward sequence of function calls and statements, which, if done well, are very clear and with no hidden behaviors like constructors, stateful … | |
Re: 1. When I was about 14, I think. Started in Visual Basic, but quickly moved on to Delphi, and to C++ a few years later. But used many other languages too along the way (C, Fortran, Python, Java, SQL, html/js/php, Matlab, etc.). 2. C++ because of the endless possibilities from … | |
Re: It declares a function called `myFunc` which returns an `int` and takes two `int` parameters. This function has to also be a virtual member function of some class, because the `=0` part at the end is the "pure-specifier" which means that the function does not have a definition (implementation) which … | |
Re: Well, from the world-bank census's, the empirical number today seems to put most "normal" countries (i.e., excluding island states and really large countries like Canada, Russia, etc.) between 0.1 and 0.5 hectares per capita, which is about 0.001 to 0.005 km2 or 1 to 5 thousand square meters. So, that's … | |
Re: If you are talking about internet ports, then you can just refer to the first sentence of the [wiki page](http://en.wikipedia.org/wiki/Port_(computer_networking)): "In computer networking, a port is an application-specific or process-specific **software construct**". The important words are in bold. Internet ports are purely a matter of software, not hardware. Modems, network … | |
Re: Planes are represented in the [general linear form](http://en.wikipedia.org/wiki/Plane_(geometry)#Point-normal_form_and_general_form_of_the_equation_of_a_plane). This form can be understood as a normal vector `n = (a,b,c)` and a distance `d` between the plane and the origin, along the normal vector. So, for any point `(x,y,z)`, you can compute the following: a*x + b*y + c*z + … | |
Re: If you are computing Vs from Vm, and then computing Vm back from Vs, and the two don't match, then it means that your matrix inversions are not correct. Regardless of whether you defined your matrices correctly with regard to getting a correct modelview + projection transformation, the transformation back … |
The End.