Friday, March 7, 2008, 10:24 AM - Programming
The combination of these four conditions was causing VS.Net 2003 to give me that unexplicable linker error.
1. Class has virtual DTOR.
2. Class is inside another class.
3. Class is built into a static library.
4. PCH is on.
Removing any one of those conditions would solve the problem. I chose #2, by moving my class to namespace level.
[ add comment ] | permalink |




( 2.6 / 288 )Wednesday, May 9, 2007, 02:15 PM - Linux, Programming
When debugging a Java program, breakpoints would cause the program to stop, but instead of showing my source code, it was showing a "source not found" in red. This was working fine before upgrading to feisty.
I tried editing the source lookup path to no avail.
The issue was Eclipse running under the java-gcj VM. I edited my /etc/eclipse/java_home file and placed /usr/lib/jvm/java-1.5.0-sun at the very top and restarted Eclipse. This time it ran under Sun's VM and the problem went away!
[ add comment ] | permalink |




( 2.3 / 193 )Thursday, February 23, 2006, 12:00 AM - Programming
Theorem
Given: Integers a, b, c, such that:
- a >= 0
- b > 0
- c > 0
Given: % represents modulo operator
Theorem: (a % b) × c == (a×c) % (b×c)
Proof Part A:
First I will define a new formula for modulo that uses subtraction, multiplication, and the floor() function.
Given: floor(x/y) represents the integer part of the division of x and y.
| 1. | (x % y) | Given: x Modulo y |
| 2. | [x/y - floor(x/y)] × y | Divide x and y, subtract the integer part, then multiply by the divisor to get the remainder |
| 3. | x - y × floor(x/y) | Distribute multiplication over subtraction |
I didn't really prove how to go from step 1 to step 2, but it is pretty easy to reason about.
In any case, here is another page that comes up with the same formula.
Proof Part B:
Here comes the fun proof. I will prove the theorem by simplifying the equation one step at a time.
| 1. | (a % b) × c | =?= | (a×c) % (b×c) | Given: The theorem we are trying to prove |
| 2. | (a % b) × c | =?= | ca % cb | Simplify right side and reverse order of multiplication |
| 3. | [a - b × floor(a/b)] × c | =?= | ca - cb × floor[(ca)/(cb)] | Replace modulo operator with formula in step 3 of Proof Part A |
| 4. | ca - cb × floor(a/b) | =?= | ca - cb × floor[(ca)/(cb)] | Distribute multiplication over subtraction |
| 5. | -cb × floor(a/b) | =?= | -cb × floor[(ca)/(cb)] | Subtract c×a from both sides |
| 6. | floor(a/b) | =?= | floor[(ca)/(cb)] | Divide both sides with -c×b |
| 7. | floor(a/b) | == | floor(a/b) | The c's divide out. |
[ add comment ] ( 547 views ) | permalink |




( 2.8 / 179 )Friday, October 28, 2005, 12:00 AM - Programming
Problem 1:
Visual C++ .Net 2003 Standard Edition comes with a non-optimizing compiler!
How annoying!!!
Fix to Problem 1:
See this page for instructions on how to get an optimized compiler, and integrate it with the IDE. Microsoft makes the optimizing compiler available to download for free. Now, why would they let you download a free optimizing compiler, but when you pay $100 and actually buy the product, you get a non-optimizing compiler? In the words of a friend of mine, "That's some shrewd marketing. Or something."
Problem 2:
So, everything is hunky-dory now, right? Not exactly, the optimizing options are still grayed out in the GUI, just as the xona.com article mentions. Well, that's not too annoying, since you can just specify /O2 or whatever in the "Additional Options" section.
However, it actually was still very annoying for me because I use cmake (Cross Platform Make) for small projects and it conveniently changes a /O2 into an 'Optimization="2"' in your project file (which is the correct thing to do, if you have a normal IDE that doesn't gray out optimization options and then filter them out before launching cl.exe). Try as I might, I could not get cmake to just put the "/O2" in the additional options. I could put it in there myself manually, but the next time I reload the project, cmake conveniently rebuilds my project file.
I'm not angry with cmake. It's doing exactly the right thing. It's MS fault for giving me a crippled compiler! If they are giving out a free optimizing compiler, why not actually let me use it from the IDE that I paid for!
Fix to Problem 2:
Well, I wouldn't be writing this nice blog if I didn't have a solution, now would I?
There is a function in VCProjectEngine.dll that filters the command-line. Just replace 0x74 with an 0xEB at offset 0x63D7 in the DLL and you're set! (This only applies to VCProjectEngine.dll version 7.10.3077.0. With version 7.10.3274.0 the offset you want is 0x6AB3.)
Best of luck.
[ 1 comment ] ( 2571 views ) | permalink |




( 2.9 / 145 )Thursday, October 27, 2005, 12:00 AM - Programming
Problem:
NoStepInto does not work with VS.Net 2003 on Windows 2000. Sure it is an undocumented feature, but hey, it's quite handy, and would be nice to have.
Longer description:
When you hit F11 in VS.Net to step into a function, sometimes you don't want it to step into certain things, like basic_string constructor, etc.
Visual Studio 6.0 had a way of disabling stepping into certain functions via the autoexp.dat file, but with VS 7.0 and later, you accomplish it by setting certain values in the registry.
Refer to this page to see more about NoStepInto and how it works.
Refer to this page to see the problem with Win2k and the solution Jan Bares came up with.
Cause:
So, after reading that, you can see that because of bug in MS code, a certain variable goes uninitialized, and therefore the GetRegistryRoot function fails, and therefore NoStepInto functionality doesn't work. Now, was this done intentionally, to "encourage" people to upgrade to Windows XP? I don't know.
Fix:
Well, Jan Bares already came up with the solution, which is a hack/patch to the NatDbgDE.dll file, but unless you have access to a disassembler and can figure out how to download the symbol information, it's probably not going to be that easy for you to figure out where the patch goes.
Just nop out the eight bytes starting at offset 0x15103. (Oh, and don't forget to make a backup of your DLL first.)
Hope it works for you too!
[ add comment ] | permalink |




( 2.9 / 126 )Next





