- Strength to Increase Rep
- +3
- Strength to Decrease Rep
- -0
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 4
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I have a project that uses DirectSound to play streaming sound. I use SetThreadpoolWait to get a threadpool callback every time the notification (AutoReset) events are signalled. (To fill the streaming buffer with more audio). The new Win7 threadpool API requires you to use SetThreadpoolWait to schedule a new wait … | |
Re: You can't rely on Sleep to reliably sleep for one second. If you read the documentation for sleep, it will specifically say that it might (and in reality, often will) sleep for more than the specified time period. If the cpu is under load (like if there are processing intensive … | |
Re: Sounds an awful lot like he wants us to do his homework assignment for him. Sometimes I feel tempted to post a really sophisticated answer with templates and policy classes and inheritance so it is perfectly clear to the teacher that there's no way he wrote it. | |
Re: Study operator precedence. I know it's boring as hell, think of it as the same kind of thing as learning your times tables -> boring as hell but great to know once you know. It helps a lot to be able to look at an expression and know what order … | |
Re: Mike is talking about industrial strength optimal ways to handle it. A while ago I developed a very simple way of doing it that is not even close to optimal but isn't too bad: For triangle A B C calculate the vector N = crossproduct(normalize(B - A), normalize(C - A)) … | |
Re: This is a bug that has been reported to Microsoft since visual C++ 4, and has not been fixed yet. Microsoft says it is fixed in VS 2011. We'll see. | |
Re: It's the other way around, right? Don't you have requirements that it run on a given operating system, or a requirement that it be portable across a lot of operating systems? The sockets API is my suggestion. It allows you to have code that is reasonably similar between unix and … | |
Re: Real encryption algorithms (symmetric ones anyway) are mostly based on an extrememly strong random number generator that can be "seeded", which means made to generate the same sequence of random numbers, given a seed, often called the key. You take those extremely random numbers and xor them with the data, … | |
| |
Re: Never heard of "on the fly paging". The closest thing I can think of is "demand paging". It means that things like executable files and dlls are mapped to a range of memory, but it only goes and reads from disk if the program touches those areas of memory that … | |
Re: I think what you are asking is how to reverse engineer the protocol. Yes, reverse engineering is usually difficult. One approach is to make the program do known things and watch the data. Repeat the operation and see what changes and what doesn't. Then do something slightly different and see … | |
Re: What windows is doing when that thing comes up is switching to another desktop. The "other" desktop is heavily secured so that it is very very difficult* for a program to be able to press the button for you (by moving the mouse pointer and clicking it from a malicious … | |
Re: 1) Do you need to put new objects at the end? Since you're using a singly linked list, the simplest/fastest way to add an object to the list is to put it at the beginning: [code] this->next = first; // The next of my new node points to the one … | |
Re: It might be logical, it might be physical. Depends on the hardware and how it is configured. If the processor has no memory remapping capability (i.e. no MMU) then you ONLY have physical addresses. Ancient home computers (before 80286) had no MMU (memory management unit). The first commonly used desktop … | |
Re: The 'if' statement on line 16 only affects the cout << q. If you look carefully, you'll see that the 'break' is always executed and it will never loop. However, it's still wrong if you fix that. From what I can tell by running the code in my head, you … | |
Re: There is a [B]lot [/B]more to it than blindly copying a block of code and expecting it to work. It depends very much on the processor and the instructions being used. For example, a switch statement might have a lookup table somewhere else. It might be using jump vectors for … | |
Re: If you know the name of the *member* of the structure and you know the type of the structure, you can use offsetof(type,member) and do some pointer arithmetic. It is impossible to get the base of the structure in C (or C++) without knowing what member it is and what … | |
Re: There's nothing wrong with typedef double T. What is wrong with it? Does it HAVE to be a template argument? No! I am siding with the professor on this one. If you are typedef'ing inside a class scope, then doing typedef double T is perfectly fine - it enables you … | |
Re: At the start of the fight, C would open up with a flurry of super high speed punches. After a while though, the C program would start to bog down, because the developer used simplistic algorithms - lots of linear searches and the like. C++ would maintain higher damage later … | |
Re: How do YOU think you would do it. Are you looking for someone to outright do your homework for you? I see absolutely no effort on your part. Did you even try to do it? Did you write any code? If you post code and perhaps show that you even … | |
Re: I have a suggestion to get better randomness from rand(). The high bits are the most random, the low bits are a lot less random. If you use modulus, you are effectively using the low bits - your random numbers won't be very random. To get optimal randomness from rand(), … | |
Re: For these kinds of problems, keep a toolbox of ways of thinking of the numbers in your mind. The trick that applies here is remembering that dividing by a lower number will give a higher result. 5/1 = 5, 5/0.5 = 10, 5/0.25 = 20, etc... So if you have … | |
Re: Not sure how you plan to write a program to prove that, since you already know it's false. | |
Re: I did some quick web searches for "allegro page flipping" and found a page that shows how to do page flipping. For smooth animation of this sort, you can't just draw and hope for the best. You need two copies of the screen. The 'front' buffer is the one the … |