|
So I have to write a program to explain bytes and bits and int values in C but I'm having trouble getting exponents to work. Here's an example of what I'm doing. code:
|
# ? Oct 30, 2008 16:22 |
|
|
# ? May 15, 2024 03:45 |
|
Sexxxy Sophitia posted:So I have to write a program to explain bytes and bits and int values in C I assume somewhere you've declared a long w, right? Try sizeof(long) instead. If it's still returning the "wrong" values, post what it is returning and we'll be able to tell you why it's right e: Oh, only the exponent thing is wrong? What is it returning? e2: Why would you tell us it's returning the wrong values without saying what those are in the first place?
|
# ? Oct 30, 2008 16:28 |
|
The return I get is:code:
csammis posted:e2: Why would you tell us it's returning the wrong values without saying what those are in the first place? I don't know
|
# ? Oct 30, 2008 16:34 |
|
Sexxxy Sophitia posted:
%d wants an int parameter. Even if pow returned an int instead of a double, you can't fit the number you want in an int, by definition. Replace %d in this line with %.0f and it should work.
|
# ? Oct 30, 2008 16:35 |
|
ShoulderDaemon posted:%d wants an int parameter. Even if pow returned an int instead of a double, you can't fit the number you want in an int, by definition. Replace %d in this line with %.0f and it should work. That can't be the only problem because it happens with my char too, which will fit in an int. Okay, here's the sections I need help with code:
code:
|
# ? Oct 30, 2008 16:39 |
|
pow() returns a double. Using %d to print a double will give you incorrect output. That is the only problem.
|
# ? Oct 30, 2008 16:57 |
|
csammis, I started moving over to jface. I don't see an explicit listener for doing sorting, so I don't think there's a spot where I can disable table refresh when moving the rows around. Still, with about 500 entries it's taking about two seconds to sort by ~4-letter strings (stock symbols). Doesn't that seem like a long time? I could dismiss it and eat the sort hit, but I plan to have many more entries in that table by the time I'm done, which will put an annoying sort penalty on me.
|
# ? Oct 30, 2008 17:20 |
|
Okay so that worked, now how do i get this to work?code:
p66.c: In function `main': p66.c:10: warning: overflow in implicit constant conversion p66.c:13: warning: overflow in implicit constant conversion Undefined first referenced symbol in file frintf /var/tmp//ccqdI89E.o ld: fatal: Symbol referencing errors. No output written to a.out collect2: ld returned 1 exit status EDIT: So this post is obnoxiously wide is ther a better way to post that? Sexxxy Sophitia fucked around with this message at 17:45 on Oct 30, 2008 |
# ? Oct 30, 2008 17:28 |
|
It's the same problem: pow() returns a double, but none of those variables that you're assigning the results to are doubles.
|
# ? Oct 30, 2008 17:37 |
|
You also now have a typo: frintf instead of printf.
|
# ? Oct 30, 2008 18:03 |
|
Okay I got it, thanks guys. Is there a way to write a program that will finger just my classmates? if I have a users file that has the usernames of the people in my class finger the if any of the usernames I have are in the first field, print the first and second field of that line in the finger, else printf "No one is online"
|
# ? Oct 30, 2008 18:29 |
|
Does anyone have any DNG experience? I have a raw bayer pattern and am trying to wrap it in a very basic DNG file so I can demosaic it later. Using libtiff I have managed to make a TIFF file containing the bayer pattern. What are the bare minimum TIFF tags I need to add to this file to so it can be identified as a DNG?
|
# ? Oct 30, 2008 21:38 |
|
sund posted:Does anyone have any DNG experience? I have a raw bayer pattern and am trying to wrap it in a very basic DNG file so I can demosaic it later. Using libtiff I have managed to make a TIFF file containing the bayer pattern. What are the bare minimum TIFF tags I need to add to this file to so it can be identified as a DNG? I assume you're talking about Digital Negative format here? Maybe the Adobe file specification will tell you what you need to know.
|
# ? Oct 30, 2008 21:48 |
|
sund posted:Does anyone have any DNG experience? I have a raw bayer pattern and am trying to wrap it in a very basic DNG file so I can demosaic it later. Using libtiff I have managed to make a TIFF file containing the bayer pattern. What are the bare minimum TIFF tags I need to add to this file to so it can be identified as a DNG?
|
# ? Oct 30, 2008 22:13 |
|
nvm.
ten_twentyfour fucked around with this message at 23:03 on Oct 30, 2008 |
# ? Oct 30, 2008 22:27 |
|
I'm writing a small plugin for Audacity in Nyquist. Nyquist uses LISP. The plugin should delete regular intervals from audio specified by the user. I'm having awful trouble getting the correct amount of audio to be deleted and the loops just don't seem to work at all. code:
This is as far as I have got over the past few days and it's driving me insane. I think it may be a problem with the extract function, or perhaps it's a very simple error in the logic of my implementation. I don't hold out any hope for anyone to know LISP or even Nyquist, but thanks anyway!
|
# ? Oct 31, 2008 00:54 |
|
My brain is completely melted after working 60 hours on some stupid thread code and I can't write a simple algorithm. Halp. An application represent numbers as two integers. One is the value, the other is the decimal location. Examples: 2.21 : VALUE(221) LOC(2) 504 : VALUE(504) LOC(0) 3.442 : VALUE(3442) LOC (3) I need a good way to take a double and convert it into two a value/loc combo. Originally I just did this: code:
Valid range of double values is from 0000.1 to 99999. I'm assuming just adding an /epsilon value and checking the remainder against it is all I need to fix this, but my brain is so fried I can't formulate it. Any help? Chuu fucked around with this message at 04:49 on Oct 31, 2008 |
# ? Oct 31, 2008 04:09 |
|
I hit a roadblock on my very first Haskell program: http://www.quickfilepost.com/download.do?get=1f573e1d8ff015815ea5022923b120d3 code:
|
# ? Oct 31, 2008 21:27 |
|
Mr. Jive posted:I hit a roadblock on my very first Haskell program: You're missing a quote on line 11, right before FOR.
|
# ? Oct 31, 2008 21:35 |
|
Thanks. This is nerve-wracking.
|
# ? Oct 31, 2008 21:37 |
|
Chuu posted:This code does not work for because of double's native representation that doesn't correspond well to Decimal, which are easier to gut check then explain (3.43 -> 3.43000000000001 -> 3430000000000001 * 10 -> +inf). I would do something like sprintf(buff, "%.8f", float) and parse the resulting string instead of manually converting a float.
|
# ? Oct 31, 2008 23:08 |
|
I've got a problem with Visual Studio 2008. Since it seemed more of a compiler issue than a language issue, I'm trying it here first. It's in C++, and I've got some files from the professor I need to use, but it's throwing a fit at things like this:code:
|
# ? Nov 1, 2008 01:09 |
|
Go to Project >> Whatever Your Project is Called Properties >> Configuration Properties >> C/C++ >> Preprocessor, make sure WIN32 is part of the Preprocessor Definitions.
|
# ? Nov 1, 2008 02:39 |
|
Thanks, that's what I needed. I managed a workaround until this point by getting the library it was looking for, but this works better.
|
# ? Nov 1, 2008 02:56 |
|
Mustach posted:Go to Project >> Whatever Your Project is Called Properties >> Configuration Properties >> C/C++ >> Preprocessor, make sure WIN32 is part of the Preprocessor Definitions. WIN32 is also defined when you include <windows.h>
|
# ? Nov 1, 2008 03:49 |
|
e:
|
# ? Nov 1, 2008 03:50 |
|
Unless I'm missing something, CppUnit doesn't really have a way to directly access the private internals of a class like JUnit does. 1. Am I wrong? If so, what's the syntax? 2. Is there a clean way to work around this, without resorting to hacks like #ifdef x #define private public, making everything virtual and subclass, etc? Can I use 'friend' for this somehow, without really making the tested class aware of the unit test class? Chuu fucked around with this message at 06:43 on Nov 1, 2008 |
# ? Nov 1, 2008 06:38 |
|
edit: Woops, I just found out that there was a specific PHP thread for this kind of question.
microwave casserole fucked around with this message at 20:40 on Nov 1, 2008 |
# ? Nov 1, 2008 20:35 |
|
(Language: C) Is there a simple way to read a char array[x] -> array[last_element], where y > 0? I just want to read a string, starting from a given index. (eg. read "ello" from "hello"). I don't want to make a for loop for this.
|
# ? Nov 4, 2008 21:56 |
|
Nahrix posted:(Language: C) Is there a simple way to read a char array[x] -> array[last_element], where y > 0? Nahrix posted:I just want to read a string, starting from a given index. (eg. read "ello" from "hello"). I don't want to make a for loop for this. Also, there is a C/C++ thread for questions like this.
|
# ? Nov 4, 2008 22:08 |
|
Nahrix posted:(Language: C) Is there a simple way to read a char array[x] -> array[last_element], where y > 0? If you have char buffer[] = "Hello, World!" and you want a char * to just the second word, you can use char *world = &buffer[7] or, more directly, char *world = buffer + 7.
|
# ? Nov 4, 2008 22:37 |
|
ShoulderDaemon posted:If you have char buffer[] = "Hello, World!" and you want a char * to just the second word, you can use char *world = &buffer[7] or, more directly, char *world = buffer + 7. This, and if you need a copy for some reason you can use strcpy (or memcpy and an explicit terminator if it's a non-terminal substring).
|
# ? Nov 4, 2008 22:46 |
|
Anyone have a quick data structure reference? I need to brush up on a few structures and the big O complexity before a technical interview.
|
# ? Nov 6, 2008 03:38 |
|
Does anyone know of a good intro tutorial online to writing programs that modify behavior of other programs? I'm talking about things like the Steam achievement manager or D2 character editors, but it wouldn't have to be that complex or even have anything to do with games. I just want to understand how people write programs that are dependent on or change the behavior of other existing programs.
|
# ? Nov 6, 2008 06:30 |
|
Queef Olbermann posted:Does anyone know of a good intro tutorial online to writing programs that modify behavior of other programs? I'm talking about things like the Steam achievement manager or D2 character editors, but it wouldn't have to be that complex or even have anything to do with games. I just want to understand how people write programs that are dependent on or change the behavior of other existing programs. This is kinda vague, but there are a few different ways, depending upon what you're trying to do. Google "dll injection", "hooks", and the FindWindow function. Dll injection will let you inject code into a program so that it'll run whatever code you want. Hooks allow you to capture the event handlers of other programs. I've never really used them, so I can't help you there. FindWindow is just a function that'll return the handle of a window. Look in that entire section of Microsoft's documentation. You can use find child objects(such as buttons) on the form and use SendMessage to chenge text, press buttons, etc. That's probably the easiest of the three.
|
# ? Nov 6, 2008 08:44 |
|
Anyone know of an open-source cron replacement with a web based GUI suitable for enterprise development? I'm just being lazy and want to extend someone's else's fleshed out framework. PHP, Java, whatever.
|
# ? Nov 6, 2008 11:34 |
|
quadreb posted:Anyone know of an open-source cron replacement with a web based GUI suitable for enterprise development? I'm just being lazy and want to extend someone's else's fleshed out framework. PHP, Java, whatever. Webmin has a cron interface, as I recall. I've used it before to let developers see production logfiles without giving them actual logins on the servers.
|
# ? Nov 6, 2008 15:03 |
|
dagard posted:Webmin has a cron interface, as I recall. I've used it before to let developers see production logfiles without giving them actual logins on the servers. Nifty looking package, but I'm looking for something that is a replacement for, not interacts with. But thank you anyway! Think it's just time to start planning out the structure
|
# ? Nov 6, 2008 15:09 |
|
ante posted:This is kinda vague, but there are a few different ways, depending upon what you're trying to do. Alright I'll give those a look, thanks!
|
# ? Nov 6, 2008 16:41 |
|
|
# ? May 15, 2024 03:45 |
|
I have a question and a half. When you use the STL Standard Map, it is implemented as a "Binary Tree" and therefore runs in O(lg) time. Is there a STL form of a hash table, one that would work in O(k) time and preferably have a subscript operator? Thanks in advance. Also, is there such a thing as a hash map?
|
# ? Nov 6, 2008 19:05 |