Recent content by rgrig

  1. rgrig

    C/C++ Guide to C++ Programming For Beginners

    LogiX: your recommandations are better than mine! From the same area: The Pragmatic Programmer, a book full of practical advices presented thru analogies that helps you remember. One example: The Broken Window Theory. The advice: Never leave something broken (if you know it is broken)...
  2. rgrig

    C/C++ Guide to C++ Programming For Beginners

    Then have a look at: http://lab.msdn.microsoft.com/express/ and http://java.sun.com/ Both come with pretty comprehensive documentation (both tutorials and reference material).
  3. rgrig

    C/C++ Guide to C++ Programming For Beginners

    "Design patterns" is, as I said, for designing applications -- in any OO language. For structured programming you are better of with Dijkstra's "Structured programming" book. His writing style is excelent. Why exactly do you want to learn about MFC? It is old and a very good example of BAD...
  4. rgrig

    Programming and Computer Science Resources

    programming links Technology will come and go. Complexity itself, algorithms, programming languages will stay with us. There is no substitute for practice. These are my favourite programming sites: http://www.topcoder.com/ http://scpd.stanford.edu/knuth/ http://www.cs.utexas.edu/users/EWD/...
  5. rgrig

    Java Welcome to Java Class: Learn Java One Bit at a Time

    prime factorizations Now, that is a nice problem.. So, you are given a number N and you want to produce all tuples (p_1, \ldots, p_k) such that forall i the number p_i is prime and p_1 \ldots p_k = N. Well, take all prime numbers p_1 such that N' = N / p_1 is an integer and complete the...
  6. rgrig

    C/C++ Guide to C++ Programming For Beginners

    Hungarian notation is an historical one. Everybody agrees these days that it is obsolate (see Java or .NET coding standards for example. As for the book, just look at: http://www.accu.org/cgi-bin/accu/rvout.cgi?from=0au_d&file=cp003204a The conclusion: "Do not buy this book, and if...
  7. rgrig

    Java Welcome to Java Class: Learn Java One Bit at a Time

    That's what I had in mind :) Here is an article "on sentinels": http://www.topcoder.com/?&t=features&c=feat_090104 A nice discussion about implementing lists can be found here: http://tinyurl.com/53tpe Look especially at lecture notes 4, 5, and 6. If I remember correctly it includes the...
  8. rgrig

    Java Welcome to Java Class: Learn Java One Bit at a Time

    For a first stab it looks pretty good! No,you don't need to concern yourself with deallocating memory. This is a job for the garbage collector. A few things: 1. Trying to dequeue an element from an empty queue should throw an exception. This is the usual practice in Java and it is good...
  9. rgrig

    Selecting Types for infile Variables

    What type problems?
  10. rgrig

    Solving Neutron Star Physics Problems: Speed, Acceleration, Height

    for 4: use v_2^2 - v_1^2 = 2 a \Delta x
  11. rgrig

    Proving f^-1(Y ∩ Z) = f^-1(Y) ∩ f^-1(Z)

    When you need to prove that two sets are equal, A = B, as in your problem the simplest trick you can use is to show that any a \in A is also an element of B and viceversa.
  12. rgrig

    Selecting Types for infile Variables

    kronecker, i don't understand what you want to do. What exactly is it that you want to "switch"? With your example above you could do something like: // modify this at compile time, e.g. thru preprocessing based on platform const bool a = true; template <typename T> void f() {cout <<...
  13. rgrig

    Troubleshooting an 0x80 Mask for Char Bit Display

    Ah, I know why it doesn't work! if you declared "mask" as "char" then 0x80 is actually a negative value and the sign bit is preserved. you should have written those declarations in the first piece of code :) I've barely nticed you mantioned it latter.
  14. rgrig

    Troubleshooting an 0x80 Mask for Char Bit Display

    You might find this code interesting (this is how I'd probably write it, I'd just add some more checks in real code). #include <iostream> #include <cassert> using namespace std; template <typename T> void print_bits(const T& value, int to_go = sizeof(T) * 8) { if (to_go ==...
  15. rgrig

    Troubleshooting an 0x80 Mask for Char Bit Display

    Please be more specific: what exactly doesn't work? As chroot said, the code looks OK.
Back
Top