|
4VAlien posted:Check all your array boundaries to make sure you are not referencing outside of arrays (most likely cause). Debug mode gives different machine code so the stack does not look the same and you're not breaking it then. Also, what is the meaning of the non zero return code, it might actually mean something. Thanks for your help. Unfortunately that's what's making it so tricky - I can't figure out a way of checking the return code. In Debug it works fine, return code is always 0. In release it's returning non-zero, BUT, if I modify the code to capture and display the error code (for example print to console or a messagebox), that code alone seems to be doing enough to modify that stack that my error code is always 0. The only way I can think of to find it out would be to do say: code:
Also, I'm new to C++ so apologies if this question sounds stupid, but if I referencing outside an array, wouldn't that cause a segmentation fault and cause Windows to terminate the app? I'm not getting any sort of crash per se, I'm simply getting a non-zero response to that registry lookup.
|
# ? Aug 12, 2009 11:06 |
|
|
# ? May 18, 2024 06:59 |
|
referencing outside the array will not give a crash as long as you're still poking in valid memory (as opposed to a segmentation fault where you try some random address where you don't have access to). I had this in a 3D app once, in Release mode i had a strange artifact on the screen that wasn't there in Debug. I turned out that i was off by one on the array with vector coordinates and that i draw 1 extra triangle that started on my figurine and ended on a corner that was decided by random stack variables.
|
# ? Aug 12, 2009 11:19 |
|
Thanks! I figured out how to use the Visual Studio disassembly tool to look at the registers on the "jne", and it turns it it's returning error code 234 which is "ERROR_MORE_DATA". From the docs. quote:If the buffer specified by lpData parameter is not large enough to hold the data, the function returns the value ERROR_MORE_DATA, and stores the required buffer size, in bytes, into the variable pointed to by lpcbData. In this case, the contents of the lpValue buffer are undefined. So, I guess if I increase my buffer size that should fix it. But I don't really understand why I would get this error in Windows 7 (and only in Release, not Debug), but not on any other Windows version.
|
# ? Aug 12, 2009 11:41 |
|
What i think : We learned that Windows 7 is not like other windows and returns different data than the previous versions. Therefore the source of the problem only occurs in windows 7 (or is this problem just not showing on different windows versions?). Debug and Release build can have different ASM (debug won't be optimized etc) therefore an overflow might affect different parts of the stack in different modes and mess with your program in a random different way.
|
# ? Aug 12, 2009 11:56 |
|
Whats the best way to do this. Say I have an equation, simplicity sake like f(x,y,z) = x*y*z. I want to have a slide bar for each variable. So I can slide x between [0,100], y between [30,50], z between [20,40] and then see how output variable changes. Also have the option of fixing two, and sliding the 3rd and graphing that output. Is this doable in excel or will I have to use matlab?
|
# ? Aug 13, 2009 04:45 |
|
implementing slider bars seems simple enough, you shouldn't have any problems there. Make three option buttons from the same menu you got the slider bar, and link them to a cell. Put the option buttons next to each of the X, Y, and Z cells. Whichever cell is adjacent to the activated option button, consider that one to be the "unfixed" one. let's define some functions: g(N) = f(N ,fixed_y,fixed_z) h(N) = f(fixed_x, N,fixed_z) i(N) = f(fixed_x,fixed_y, N) j(N) = g(N) if option button = 1, h(N) if option button = 2, i(N) if option button = 3 ...Where fixed_x, fixed_y, and fixed_z are the addresses of your slider-controlled cells. I guess this is the hard part, because this is just pseudocode so you'll have to figure out an implementation yourself. I'm sure it's possible, although it might be kind of ugly. Now if you plot j(N) against N, and graph it, you'll get the curve you want. Not sure how you might change the range of N on-the-fly, though.
|
# ? Aug 13, 2009 05:39 |
|
You know where that option is in Office 2007? Can't find it anywhere or in the search. nm: I found it. It is in the most retarded spot. 5436 fucked around with this message at 06:55 on Aug 13, 2009 |
# ? Aug 13, 2009 06:13 |
|
5436 posted:Whats the best way to do this. FWIW I wouldn't define separate functions like above. Unless your mesh size is tiny, just compute the whole cube over the entire 3D domain, then use array slicing operations to get out the single value or 1D or 2D cross sections you want. You can certainly do that in matlab, or I'd probably use numpy/scipy with matplotlib or chaco.
|
# ? Aug 13, 2009 12:03 |
|
Wasn't sure if this was a C++ problem or a general problem, so sorry if I got it wrong. I've got a C++ program on a Solaris box that up to now has been compiled as a 32 bit application. I've been instructed to try to get it to compile as 64 bit instead, since we're moving the app to a We're trying to get hold of the source code again, but in the meantime, is there anything I can do to make a 64 bit compile of my application work? Some sort of wrapper or trick I can do so I can at least test things until we get a 64 bit library? Sorry if this is a stupid question, my knowledge of this phase of assembling an application is weak at best. (edit) Whoops, sorry. This is mostly a "why not, may as well see if it helps performance at all if it's not gonna be an ordeal" sort of thing--I'm not familiar enough with the application in quesiton to answer that. Ciaphas fucked around with this message at 21:26 on Aug 13, 2009 |
# ? Aug 13, 2009 21:11 |
|
Ledneh posted:I've been instructed to try to get it to compile as 64 bit instead, since we're moving the app to a faster box. I really hope you have a better reason than this.
|
# ? Aug 13, 2009 21:14 |
|
Ledneh posted:We're trying to get hold of the source code again, but in the meantime, is there anything I can do to make a 64 bit compile of my application work? Some sort of wrapper or trick I can do so I can at least test things until we get a 64 bit library? There is no need at all unless you are moving to IA64.
|
# ? Aug 14, 2009 03:50 |
|
Ledneh posted:64-bit programs tend to slightly outperform 32-bit programs by about 10% when they do lots of number crunching with large integers or doubles. Otherwise, there's not much benefit to having it 64-bit other than RAM.
|
# ? Aug 14, 2009 07:00 |
|
64-bit will actually be slower than 32-bit all other things being equal, because 64-bit pointers take up twice the memory and more importantly twice the cache space. Of course all other things aren't equal because x86-64 has a bunch of extra registers compared to x86-32, but unless you have specific requirements like lots of calculations on numbers > 2^32-1 or working sets > 3GB mentioned above you're probably wasting your time porting to 64-bit. Just run it in 32-bit mode on your 64-bit box.
|
# ? Aug 14, 2009 10:23 |
|
Standish posted:unless you have specific requirements like lots of calculations on numbers > 2^32-1 or working sets > 3GB mentioned above you're probably wasting your time porting to 64-bit. Just run it in 32-bit mode on your 64-bit box. Some operating systems will limit a process to less than the total amount of memory available (often 2gb on recent 32-bit systems), such limits may be higher or nonexistant on 64-bit versions of the same OS
|
# ? Aug 14, 2009 13:09 |
|
MrMoo posted:There is no need at all unless you are moving to IA64. OP is on Solaris. Most scrap Solaris hardware is 64-bit capable.
|
# ? Aug 14, 2009 20:25 |
|
I'm writing a binary tree traversal function (language is VB6, which is the only language compatible with the accounting software we're using). The treeNode class has a Left and Right field, along with a Siblings field (siblings = multiplicity - 1) and visited field. rootNode is the root of the tree, stackNode is used for going back up the tree since treeNode doesn't have a parent pointer. When I pop the stack I set Node.Left.visited and Node.Right.visited = 0, but I'm failing to reset the fields properly - on the 164-element test dataset my total visited count is 20 after completing the traversal. (FWIW, without the reset code my total visited count is 164.) I'm evidently popping the stack somewhere without first resetting the Left and Right nodes, but I can't figure out where. code:
|
# ? Aug 18, 2009 16:18 |
|
Your function is spaghetti and I'm not going to bother finding the bug in it.code:
|
# ? Aug 18, 2009 18:44 |
|
'if-else' statements are spaghetti now?
|
# ? Aug 18, 2009 18:50 |
|
loinburger posted:'if-else' statements are spaghetti now? Spaghetti or not, it's pretty gross.
|
# ? Aug 18, 2009 18:58 |
|
loinburger posted:'if-else' statements are spaghetti now? You managed to turn a really simple idea (an in-order traversal of a binary tree) into a horrible mess of stateful programming and unnecessary recursion. Basic data structures should not require thought to decipher.
|
# ? Aug 18, 2009 19:06 |
|
I would like for a batch file to run an executable and output the text that appears in the prompt to a text file. A typical line I have right now looks like this:code:
|
# ? Aug 20, 2009 14:50 |
|
is there a tee equivilent in the shell you are using?
|
# ? Aug 20, 2009 15:02 |
|
tef posted:is there a tee equivilent in the shell you are using? I don't think so, I'm using regular cmd.exe. Plus this isn't just to run on my own machine, and I would rather not have to install new shells on the many computers that might need to use the script.
|
# ? Aug 20, 2009 15:11 |
|
edit: ugh I'm an illiterate idiot
|
# ? Aug 20, 2009 15:45 |
|
BizarroAzrael posted:I would like for a batch file to run an executable and output the text that appears in the prompt to a text file. A typical line I have right now looks like this: Not the cleanest, and not tested, but.. CALL runthis.exe > tmpoutput.txt ECHO tmpoutput.txt ECHO tmpoutput.txt >> output.txt DEL tmpoutput.txt
|
# ? Aug 20, 2009 18:27 |
|
tef posted:is there a tee equivilent in the shell you are using? FWIW a native tee.exe is included in http://unxutils.sourceforge.net/. Not sure it's applicable to cmd.exe, but watch out for changing the exit code of your pipeline with tee.
|
# ? Aug 20, 2009 19:32 |
|
chocojosh posted:Not the cleanest, and not tested, but..
|
# ? Aug 21, 2009 01:25 |
|
I got bored today and switched the font on Notepad++ to Inconsolata and now everything looks lovely: HTML: CSS: Does anyone know how to improve the way it appears? Or am I alone in thinking it looks like total poo poo? I can't even remember the settings I had before so I hope I'm not completely hosed.
|
# ? Aug 22, 2009 00:44 |
|
Chinaski posted:Does anyone know how to improve the way it appears? You're supposed to use the "Consolas" font.
|
# ? Aug 22, 2009 18:08 |
|
Blurry rear end-text is the worst kind of text.
|
# ? Aug 22, 2009 21:47 |
|
terminatusx posted:You're supposed to use the "Consolas" font. Thanks - I just tried it and it's actually legible.
|
# ? Aug 22, 2009 22:14 |
|
What did you take those screencaps with?
|
# ? Aug 23, 2009 01:56 |
|
Another batch script question. I would like to be able to date stamp the name of a folder the script creates, but telling it:code:
Is there another readily-accessible variable that lists the date purely numberically as 240809 or similar?
|
# ? Aug 24, 2009 10:52 |
|
You could extract the numbers from %date% like this:code:
|
# ? Aug 24, 2009 20:45 |
|
Mustach posted:What did you take those screencaps with? If you're asking me, FastStone Capture. It's a great program - can do scrolling screenshots, has a drawing mode, editing tools, a color sampling eyedropper (super helpful), and even more amazing poo poo. It used to be free and it looks like it still might be. Either way it's worth it.
|
# ? Aug 25, 2009 00:34 |
|
magicalblender posted:You could extract the numbers from %date% like this: I found a shorter solution: code:
I'm also trying to find a way to check if the current time falls in between two points (specifically 7am and 6pm), and then have it ECHO a warning and PAUSE when it is. So I just need to read the first 2 digits of %time% and see if it is seven or more and 18 or less. Do I still need to use a FOR statement. I'm also not sure of the way to get it to compare integers, or how to do an AND statement (basic stuff I know, but I can't seem to google much of it)
|
# ? Aug 25, 2009 12:54 |
|
code:
|
# ? Aug 25, 2009 16:58 |
|
For something I'm writing in Fortran I want one possible option to be to break out of the program & spawn a command to the operating system. This seems to be simple enough, it should just be a call to the intrinsic system(). But when I compile my code I'm getting;code:
code:
|
# ? Aug 25, 2009 17:54 |
|
Hmm, it works for me, but I don't have the same version.code:
|
# ? Aug 25, 2009 18:57 |
|
|
# ? May 18, 2024 06:59 |
|
Have any of you done any UltraEdit macro writing? I'm having some trouble with one I'm working on, and I'm not sure what the problem is.
|
# ? Aug 27, 2009 07:04 |