Your code need not be object oriented, but you can write totally fine procedural code in C++ while gaining value from the standard containers and algorithms, such as vector, dequeue, et al. Think of it as a version of C without the need for malloc/realloc/etc.
What about the zeroth law? Would that be something along the lines of "Windows may not harm the profit margins of Microsoft, or by inaction cause profits to drop." So Windows itself can injure members of the board if it's in the best interests of the company:-)
C++'s STL fixes this with for_each, transform, and accumulate. All three are looping constructs over a range, but each one has well-defined termination and meaning. For example if I want to visit each element once, I'd use
You can simulate inheritance in C: just store an instance of the parent struct in the derived struct, and you can access inherited members via self->parent->method( );
Similarily for polymorphism: just cast it to a pointer to the base struct. If you lay your struct out nicely memory-wise this should be a safe operation.
If you can write it in assembly you can write it in C. And all that fancy C++ stuff has to eventually make its way down to ASM at some point.
Value templates can be great. Have a look at std::array. Under the hood it's just a static C-style array (take a look at the generated assembly, on a decent compiler there's zero added overhead), but it remembers it's size as it's baked into the type itself. So it gives us all the speed of a C-style stack-allocated array of N items, plus removes the hassle of having to pass the size around as an extra parameter to functions. Finally, if you really want to be safe, you can use the.at( ) member function for range-checked access. The operator [ ] is overloaded of course for direct access, in case you need that too. This functionality would be impossible without the ability to use std::size_t as a template parameter.
If you have ssh access to the laptops then use clusterssh. It's a simple program that takes your keystrokes and sends them to all of the machines you're connected to. So doing an
I never said I was a bad typer, just a slower typer. I probably would be better off if I were a better (faster) typer, but as I am I'm still more productive than the majority of programmers I've worked with, many of which who type a lot faster than I do.
There is nothing in the GPL License that says they have to make their own improvements available. All that is required is that IF they decide to make their improvements available, they have to provide the source. They can even charge for the improvements, but as long as the source is available then they're in the clear.
Nope, the parent is correct. The only difference between a struct and a class is the default access level of its members. Structs are public, classes are private.
It also has an effect on inheritance as well. A struct will inherit publicly by default,
struct A : B { };
is the same as
struct A : public B { };
Similarly for classes, but replace "public" with "private".
Both structs and classes are contiguous blocks of memory. The only cases where pointers come into play are when your member functions (methods) are declared as virtual.
Actually it's B and !A to disprove A -> B
A -> B is the same as !A or B, !(!A or B) is !!A and !B, or A and !B
(Assuming you meant implication by -> (if A then B))
I think I may have been a bit mistaken then, either that or I was just talking out my ass. I really appreciate the clarification, especially with a good example like that one. So, NP-Complete problems are a subset of NP-Hard which are a subset of NP?
Your definition of NP-Complete isn't quite accurate. Np-Complete isn't made by NP and NP-Hard. NP-Hard IS NP-Complete for yes/no type problems. NP-Hard == NP-Complete, and both are a subset of NP.
Think of any NP-Complete problem, such as the famous Travelling Salesman Problem: given a weighted graph G, find a minimum cost Hamiltonian Cycle on it (visit every vertex exactly once, and do it while minimizing the cost of travel). We can convert this from an optimization problem to a yes/no problem. Given a graph G and a value K, is there a Hamiltonian Cycle in G with cost less than or equal to K?
The first problem is NP-Complete, the second is NP-Hard. Essentially they're the same problem, just one outputs a number, and other outputs yes or no.
If you don't mind me asking: which field do you work in? I.e. do you write mostly "business" apps or do you do any neat stuff?:P
Not meaning to offend, of course. It's just that for me personally, the fun areas of programming have all required a lot more math.
Interesting thing, since you mentioned the P = NP problem. One area of mathematics that is making heavy progress on that problem is (for some reason) Algebraic Geometry. It seems that Mathematicians are as interested in the P = NP problem as we Computer Scientists are. I wonder who will eventually solve it, and whether they'll get a Field Medal or a Turing Award;)
If I had to choose one of the two listed, I would go with the first. As a student currently finishing his CS Undergrad I can tell you that discrete maths like Combinatorics and Graph Theory will help you much more than Continuous maths like analysis and calculus. I'm not saying Calculus isn't important -- it is to an extent when you're working with the design and analysis of algorithms, but Graph Theory is something that you should not miss out on.
Graph Theory is used all over CS: it can be used to model network flow, it can be used in AI to represent search spaces, and don't forget that the majority of cool data structures fall directly from Graph Theory. If you're looking for more practical uses, think of the flow of a computer program. You can use vertices to represent states of your program such as assignments, branches, and so on. Connecting these states with edges determines the flow of your program.
Plus, overall Graph Theory is fun to do! The proofs are rigorous, but everything is very easy to visualize. If you're having trouble with a concept, in most cases it's easy to draw up a graph and see for yourself that some theorem holds. All in all, it's quite an experience, and as a Computer guy you'll definitely get more practical uses out of it.
Not the grammar you're thinking of. In Computer Science grammars are used to represent languages, and the sentences that can be represented by them. For example, the language that generates all sentences of the form a^n b^n, meaning n a's followed by n b's.
Grammars in this sense are a collection of rules, such as:
S -> aSb
We say that S is a terminal, and a and b are non-terminals. Now there are restrictions on the types of rules we can have, which creates a hierarchy of grammars, where regular grammars are on one side of the spectrum (one terminal S creates one non-terminal a), and unrestricted grammars are on the opposite side (no rules).
Unrestricted grammars are obviously much more complicated to deal with, but their power is immense. Hence when the grandparent talked about using an unrestricted grammar, he meant that we don't have the power to deal with it, but if we did, hoooo boy:)
I have been playing around with this very minimalist distro the past few days. I can get it to go from completly shut down to a graphical login in about 35 seconds. This includes grub and everything. Getting it to boot into a text-only login will probably take less time, but I haven't benchmarked it yet.
Your code need not be object oriented, but you can write totally fine procedural code in C++ while gaining value from the standard containers and algorithms, such as vector, dequeue, et al. Think of it as a version of C without the need for malloc/realloc/etc.
What about the zeroth law? Would that be something along the lines of "Windows may not harm the profit margins of Microsoft, or by inaction cause profits to drop." So Windows itself can injure members of the board if it's in the best interests of the company :-)
This is Slashdot... is reading TFA even... allowed?
C++'s STL fixes this with for_each, transform, and accumulate. All three are looping constructs over a range, but each one has well-defined termination and meaning. For example if I want to visit each element once, I'd use
for_each(begin(container), end(container), some_action);
If I want to mutate it,
transform(begin(container), end(container), begin(destination), some_transforming_action);
and if I want to collapse it down into a scalar,
some_type result = accumulate(begin(container), end(container), initial_value, some_operation);
If you squint at it enough it almost looks like a declarative language, and the compiler is usually smart enough to inline those function calls!
You can simulate inheritance in C: just store an instance of the parent struct in the derived struct, and you can access inherited members via self->parent->method( );
Similarily for polymorphism: just cast it to a pointer to the base struct. If you lay your struct out nicely memory-wise this should be a safe operation.
If you can write it in assembly you can write it in C. And all that fancy C++ stuff has to eventually make its way down to ASM at some point.
Value templates can be great. Have a look at std::array. Under the hood it's just a static C-style array (take a look at the generated assembly, on a decent compiler there's zero added overhead), but it remembers it's size as it's baked into the type itself. So it gives us all the speed of a C-style stack-allocated array of N items, plus removes the hassle of having to pass the size around as an extra parameter to functions. Finally, if you really want to be safe, you can use the .at( ) member function for range-checked access. The operator [ ] is overloaded of course for direct access, in case you need that too. This functionality would be impossible without the ability to use std::size_t as a template parameter.
If you have ssh access to the laptops then use clusterssh. It's a simple program that takes your keystrokes and sends them to all of the machines you're connected to. So doing an
# aptitude update
# aptitude safe-upgrade
on 30 machines is no harder than doing it to one.
Easy: by studying real Computer Science.
I never said I was a bad typer, just a slower typer. I probably would be better off if I were a better (faster) typer, but as I am I'm still more productive than the majority of programmers I've worked with, many of which who type a lot faster than I do.
I'm not a very fast typer but I'm a very productive programmer. Maybe it's because I do more thinking than banging my keyboard :-)
There is nothing in the GPL License that says they have to make their own improvements available. All that is required is that IF they decide to make their improvements available, they have to provide the source. They can even charge for the improvements, but as long as the source is available then they're in the clear.
Nope, the parent is correct. The only difference between a struct and a class is the default access level of its members. Structs are public, classes are private.
It also has an effect on inheritance as well. A struct will inherit publicly by default,
struct A : B { };
is the same as
struct A : public B { };
Similarly for classes, but replace "public" with "private".
Both structs and classes are contiguous blocks of memory. The only cases where pointers come into play are when your member functions (methods) are declared as virtual.
Actually it's B and !A to disprove A -> B
A -> B is the same as !A or B, !(!A or B) is !!A and !B, or A and !B
(Assuming you meant implication by -> (if A then B))
Who says upgrades are mandatory? If it keeps working why trash it? With that mindset, every PC has a mandatory upgrade cycle...
You are completely 100% spot on with this comment. If I had mod points I would be spending them here :-)
I think I may have been a bit mistaken then, either that or I was just talking out my ass. I really appreciate the clarification, especially with a good example like that one. So, NP-Complete problems are a subset of NP-Hard which are a subset of NP?
Your definition of NP-Complete isn't quite accurate. Np-Complete isn't made by NP and NP-Hard. NP-Hard IS NP-Complete for yes/no type problems. NP-Hard == NP-Complete, and both are a subset of NP.
Think of any NP-Complete problem, such as the famous Travelling Salesman Problem: given a weighted graph G, find a minimum cost Hamiltonian Cycle on it (visit every vertex exactly once, and do it while minimizing the cost of travel). We can convert this from an optimization problem to a yes/no problem. Given a graph G and a value K, is there a Hamiltonian Cycle in G with cost less than or equal to K?
The first problem is NP-Complete, the second is NP-Hard. Essentially they're the same problem, just one outputs a number, and other outputs yes or no.
If you don't mind me asking: which field do you work in? I.e. do you write mostly "business" apps or do you do any neat stuff? :P
Not meaning to offend, of course. It's just that for me personally, the fun areas of programming have all required a lot more math.
Interesting thing, since you mentioned the P = NP problem. One area of mathematics that is making heavy progress on that problem is (for some reason) Algebraic Geometry. It seems that Mathematicians are as interested in the P = NP problem as we Computer Scientists are. I wonder who will eventually solve it, and whether they'll get a Field Medal or a Turing Award ;)
If I had to choose one of the two listed, I would go with the first. As a student currently finishing his CS Undergrad I can tell you that discrete maths like Combinatorics and Graph Theory will help you much more than Continuous maths like analysis and calculus. I'm not saying Calculus isn't important -- it is to an extent when you're working with the design and analysis of algorithms, but Graph Theory is something that you should not miss out on.
Graph Theory is used all over CS: it can be used to model network flow, it can be used in AI to represent search spaces, and don't forget that the majority of cool data structures fall directly from Graph Theory. If you're looking for more practical uses, think of the flow of a computer program. You can use vertices to represent states of your program such as assignments, branches, and so on. Connecting these states with edges determines the flow of your program.
Plus, overall Graph Theory is fun to do! The proofs are rigorous, but everything is very easy to visualize. If you're having trouble with a concept, in most cases it's easy to draw up a graph and see for yourself that some theorem holds. All in all, it's quite an experience, and as a Computer guy you'll definitely get more practical uses out of it.
Not the grammar you're thinking of. In Computer Science grammars are used to represent languages, and the sentences that can be represented by them. For example, the language that generates all sentences of the form a^n b^n, meaning n a's followed by n b's. Grammars in this sense are a collection of rules, such as: S -> aSb We say that S is a terminal, and a and b are non-terminals. Now there are restrictions on the types of rules we can have, which creates a hierarchy of grammars, where regular grammars are on one side of the spectrum (one terminal S creates one non-terminal a), and unrestricted grammars are on the opposite side (no rules). Unrestricted grammars are obviously much more complicated to deal with, but their power is immense. Hence when the grandparent talked about using an unrestricted grammar, he meant that we don't have the power to deal with it, but if we did, hoooo boy :)
Would this inverted universe by chance be a cowboy universe? If so, that would be awesome.
Sweet zombie Jesus!
I believe you're mixing up Linux with GNU, which stands for Gnu's Not Unix. Linux, as far as I know, doesn't stand for anything.
I have been playing around with this very minimalist distro the past few days. I can get it to go from completly shut down to a graphical login in about 35 seconds. This includes grub and everything. Getting it to boot into a text-only login will probably take less time, but I haven't benchmarked it yet.