|
Mister Biff posted:Really stupid question about Visual Studio 2008: I don't really know Visual C++, but can you tell it to statically rather than dynamically link itself to its dependencies? Maybe windows isn't wired that way, so I might be off track, but look into it. That was the thing I always liked about delphi. It usually (and optionally) statically linked itself to the VCL libs (or at least earlier versions did), so you just had to distribute a big fat binary, rather than a whole messy link of dlls and poo poo.
|
# ? Mar 12, 2008 02:34 |
|
|
# ? May 28, 2024 15:46 |
|
FigBug posted:I don't think you can add a single button, you'll need to make a toolbar with only one button. Turns out that's a wrapper to an MFC object, but at least now I know what the MFC object is (and can do this in C++)!
|
# ? Mar 12, 2008 03:12 |
|
What about something like Dominoes and we each have to create a client that has to beat the rest.
|
# ? Mar 12, 2008 08:02 |
|
MEAT TREAT posted:What about something like Dominoes and we each have to create a client that has to beat the rest. Wrong thread
|
# ? Mar 12, 2008 15:33 |
|
Does anyone know of a good perl module that can convert images, or more specifically, de-animate .gif files? Image::Magick works quite nice, but its pretty overboard for just doing what I'd like to do. But if I can't find anything else, I'll just end up using that. Edit: Nevermind, Imager was already installed and works quite nice rawk cawk fucked around with this message at 16:14 on Mar 13, 2008 |
# ? Mar 13, 2008 01:59 |
|
C Question: I am trying to send and receive a string of data using blocking sockets and send and recv functions.. buffer is 512 bytes and contains 9 doubles when I trace, the send function shows the first double as 44.234 but after i receive it, the buffer 44. (it chops off the decimal. Anyone know what causes this? do i have to format the doubles in some fashion before sending them? If there are any sections of code u need let me know. code:
odi3 fucked around with this message at 06:53 on Mar 13, 2008 |
# ? Mar 13, 2008 06:44 |
|
You should probably have something to delimit the fields of the struct. You're munging all the numbers together.
|
# ? Mar 13, 2008 06:53 |
|
How would i do that? when i debug and print the code before i send and receive, its correct. I assumed that sscan and sprintf were working properly? odi3 fucked around with this message at 07:21 on Mar 13, 2008 |
# ? Mar 13, 2008 07:19 |
|
Well, let's say you have a struct with two doubles: x and y. Using your method, here's what happens:code:
code:
|
# ? Mar 13, 2008 07:27 |
|
odi3 posted:How would i do that? Withouth delimiters, how is scanf supposed to know the difference between "44.234" followed by "55.1", and "44.2345" followed by "5.1"?
|
# ? Mar 13, 2008 07:28 |
|
i read that sscanf ignores spaces. I am pretty new to all this so i probably misunderstood/misread my book. Thanks for the help! ill try it out Edit: so i attempted to send 9 doubles 1.1 2.2 3.3 etc the buffer before the send command showed 9, but only 1.1 came out on the rec side. odi3 fucked around with this message at 08:10 on Mar 13, 2008 |
# ? Mar 13, 2008 07:34 |
|
Not sure if this is worthy of it's own thread so I thought I would just post it here. I just switched my hosting to NearlyFreeSpeech.NET and they don't support any fancy web frameworks like Django or Rails. No big deal, there's always PHP, except I hate PHP. They do however support CGI Python. I like Python, but I don't know much about CGI. In other words, could I create my own blog or small application using Python CGI? Would this be viable or a waste of time? Should I just suck it up and go with PHP? (Blarg!)
|
# ? Mar 13, 2008 15:08 |
|
Gary the Llama posted:Not sure if this is worthy of it's own thread so I thought I would just post it here. I just switched my hosting to NearlyFreeSpeech.NET and they don't support any fancy web frameworks like Django or Rails. No big deal, there's always PHP, except I hate PHP. They do however support CGI Python. I like Python, but I don't know much about CGI. All CGI means is that the webserver runs your script, with some environment variables set (like QUERY_STRING), and sets your stdout to the socket for the HTTP connection. In its simplest form, a python CGI script would look like this: code:
|
# ? Mar 13, 2008 17:07 |
|
Ada question:code:
I've withed Ada.Real_Time, it knows the types, but it's ignoring the overloading for some reason. I've just started learning Ada for this project at work, so if I'm missing something completely obvious, then I wouldn't be surprised.
|
# ? Mar 14, 2008 18:16 |
|
Alright, really dumb and most likely easy HTML question, but I don't know much of any html and our web guy doesn't know how to do this off the top of his head: I need an easy web submission form for service requests, and we have everything flushed out except I want some of the text boxes to contain that grey, italic text that goes away when cursor focus is brought to the box or something is typed in to it. I have no idea what this element property is called though, and googling a general description of it turns up a mess of garbage. Can someone point me in the right direction or give me some quick example code to give to my web guy?
|
# ? Mar 14, 2008 20:30 |
|
Bender posted:Ada question: Congratulations on having the first Ada question in CoC, to the best of my knowledge.
|
# ? Mar 14, 2008 20:57 |
|
BangersInMyKnickers posted:Alright, really dumb and most likely easy HTML question, but I don't know much of any html and our web guy doesn't know how to do this off the top of his head: CSS: code:
code:
edit: table breaking is always fun.
|
# ? Mar 14, 2008 21:16 |
|
In bash, is there a way to redirect stdout to a command that works on files? I have a list that I'd like to compare to another list using comm. One of the lists is created by a [long tangle of seds, awks and greps], while the other is a file (mylist). The command comm only takes input as files. Do I have to go by a temp file, or is there some way to get comm to work with the stdout? from: [long tangle of seds, awks and greps] >tempfile comm tempfile mylist to: comm mylist [long tangle of seds, awks and greps]
|
# ? Mar 14, 2008 22:30 |
|
axolotl farmer posted:In bash, is there a way to redirect stdout to a command that works on files? Yes. You want "comm mylist <(long tangle of seds awks and greps)". Under the hood, bash replaces <(...) with something like /dev/fd/XXX which is the dev path to the stdout of the process.
|
# ? Mar 14, 2008 22:40 |
|
What is the most efficient way to find the location in an integer of a specific byte value? For instance, suppose that I have an integer of 0x43001928, how do I find the byte position of the value 0x00? Obviously I could just cast to a char pointer and walk the bytes, but it seems like there is a faster (no matter how marginally faster) way to do this. Specifically I have a large buffer from which I need to find strings of bytes in a specific range (pretend that range is 0x00-0x3f). A comparison of every byte is easy but non-optimal so I'm casting to an unsigned integer pointer, allowing me to look at 4 bytes in one instruction. However, I need to know if the last 1, 2, or 3 bytes in that integer are in my approved range, otherwise I'll skip over them when I increment my pointer. That sounds confusing, so assume the following (and ignore endianness as a concern for now): code:
code:
code:
Is there a mathematical or logical operation that I'm missing here? I don't mind inlining IA86 asm if necessary. I considered the following: code:
Suggestions? Does any of this make any sense at all?
|
# ? Mar 15, 2008 15:53 |
|
Plastic Jesus posted:Suggestions? Does any of this make any sense at all? If you have access to a library or something check out this book. Pages 91-96 discuss your problem. It's available on Safari if you've got a subscription. Undocumented source code is available here. The example "// Find leftmost byte having an upper case letter." can be modified for your range of valid bytes (assuming your range of bytes between your lowest byte and your highest byte is less than 128).
|
# ? Mar 15, 2008 16:44 |
|
Alan Greenspan posted:Undocumented source code is available This rules, thanks.
|
# ? Mar 15, 2008 17:26 |
|
Plastic Jesus posted:The performance concern here is that your method appears to require misaligned loads from puc. I don't know the details for x86, but most hardware hates this. You may want to consider making only aligned loads to keep 64 bits of the buffer in memory, search for the sequence within those bits, and if not found slide the 'window' forward by 32 bits.
|
# ? Mar 16, 2008 05:36 |
|
black candy posted:The performance concern here is that your method appears to require misaligned loads from puc. I don't know the details for x86, but most hardware hates this. You may want to consider making only aligned loads to keep 64 bits of the buffer in memory, search for the sequence within those bits, and if not found slide the 'window' forward by 32 bits. Well I'll be damned. I always assumed that because data didn't have to be aligned (and since x86 doesn't even have standard length opcodes) that it didn't matter. But I just found this: Intel Architecture Software Developer’s Manual Volume 1: Basic Architecture posted:Words, doublewords, and quadwords do not need to be aligned in memory on natural boundaries...However, to improve the performance of programs, data structures (especially stacks) should be aligned on natural boundaries whenever possible. The reason for this is that the processor requires two memory accesses to make an unaligned memory access; whereas, aligned accesses require only one memory access. A word or doubleword operand that crosses a 4-byte boundary or a quadword operand that crosses an 8-byte boundary is considered unaligned and requires two separate memory bus cycles to access it; a word that starts on an odd Just to think out loud here- I can keep puc pointing to the beginning of what appears to be a series and only cast pui onto 4-byte boundaries, correct? This will complicate things a little, as the series of interest are of a fixed size so my AND masks will have to be variable when checking the series end. But that's not a big deal. God I love it when I get direct, usable information about questions. Thanks guys.
|
# ? Mar 16, 2008 11:24 |
|
I've been looking into writing a vista sidebar IM client using libpurple (gaim/pidgin/finch libraries) but I wasn't sure if it would even be possible. The IM interface would be in C++. I know you can execute C++ code with a DHTML interface, but I don't have enough experience with DHTML to know if something of this magnitude would be possible. So any suggestions as far as the best way to go about doing this or a pointer to some good reference material would be appreciated. Or just shoot the idea down if it's not feasible.
|
# ? Mar 17, 2008 19:00 |
|
floWenoL posted:Yes. You want "comm mylist <(long tangle of seds awks and greps)". Under the hood, bash replaces <(...) with something like /dev/fd/XXX which is the dev path to the stdout of the process. Thank you! This is extremely useful. I haven't seen this in any of the many bash tutorials/tips/tricks I've seen online. This is as useful as 2>&1 !
|
# ? Mar 17, 2008 19:42 |
|
astr0man posted:I've been looking into writing a vista sidebar IM client using libpurple (gaim/pidgin/finch libraries) but I wasn't sure if it would even be possible. The IM interface would be in C++. I know you can execute C++ code with a DHTML interface, but I don't have enough experience with DHTML to know if something of this magnitude would be possible. So any suggestions as far as the best way to go about doing this or a pointer to some good reference material would be appreciated. Or just shoot the idea down if it's not feasible. libpurple is probably ridiculously heavyweight for a sidebar IM application...it's basically an entire backend framework that implementors provide a frontend to (see: Adium). This is something of a design flaw with libpurple in my opinion, because using it isn't as simple as calling a function with a message and the screen name you want to send to. That said, I really have no idea how you could go about interfacing with libpurple from DHTML in the first place. If you're not set on C++, and you can use something like Script#, you could leverage .NET solutions for instant messaging libraries (such as OscarLib, MsnLib, and JabberLib ). Disclaimer: I have never tried to make a sidebar application, or used Script#, but I do know a lot about IM applications in general. If you'd like any information on that end please feel free to ask.
|
# ? Mar 17, 2008 19:46 |
|
csammis posted:Alright, I've never used Script# or C# but I'll look into that. Thanks for the suggestions.
|
# ? Mar 17, 2008 22:08 |
|
more falafel please posted:Congratulations on having the first Ada question in CoC, to the best of my knowledge. Looks like it will be the last Ada question, too. For those 15 years from now who search this thread and maybe would like a stop-gap solution, I was able to get Ada.Real_Time."+"(Poll_Time, Period) to work. Don't ask me why the normal way doesn't work, because I have no clue. Bender fucked around with this message at 00:35 on Mar 18, 2008 |
# ? Mar 18, 2008 00:33 |
|
Bender posted:Looks like it will be the last Ada question, too. God Ada is horrible. I had one assignment to use it and that was enough.
|
# ? Mar 19, 2008 18:34 |
|
What is the proper way to send and receive messages to a multicast group over all network interfaces, instead of just the default one? Apparently it vaguely works if I create one socket per interface and specify the interface index explicitly when I join the multicast group, but that seems a bit unnecessary. Somehow default routes keep getting in my way.
|
# ? Mar 20, 2008 14:18 |
|
I've been playing around with Project Euler and I've come across a small portion that I think has to have a better solution. In particular I'm working on problem 35 which has a rotation element. The idea is to take the least significant digit radix ten and make it the most significant with the remaining digits each becoming slightly less significant. For example 12345 would become 51234. I've come up with the following solution to this.code:
edit: In case you are curious the converter<unsigned int, double> comes from Boost's numeric conversion stuff. I'm also more interested in the algorithm than an implementation which I can easily code up myself. 6174 fucked around with this message at 03:50 on Mar 22, 2008 |
# ? Mar 22, 2008 03:46 |
|
6174 posted:The problem I have with this solution is it is dependent upon functions that operate on floating point numbers (log10, pow, etc). Is there a way to do this with only integral operations? Sure. First, you want floor(log10(number)) + 1, and not ceil(log10(number)). That avoids the need for the extra test after. You can do discrete log10 (floor . log10) easily by trial multiplication of 10; there's no known efficient solution, though, but for the size of integers you're working with, it doesn't really matter. You can also do pow(10,x) easily by repeated multiplication, or repeated squaring, which is a bit faster, but again, it doesn't really matter for the size of the numbers you're working with.
|
# ? Mar 22, 2008 05:32 |
|
floWenoL posted:Sure. First, you want floor(log10(number)) + 1, and not ceil(log10(number)). That avoids the need for the extra test after. You can do discrete log10 (floor . log10) easily by trial multiplication of 10; there's no known efficient solution, though, but for the size of integers you're working with, it doesn't really matter. You can also do pow(10,x) easily by repeated multiplication, or repeated squaring, which is a bit faster, but again, it doesn't really matter for the size of the numbers you're working with. I really should have seen those. Stupid being sick. Thanks floWenoL.
|
# ? Mar 22, 2008 05:49 |
|
Plastic Jesus posted:Suggestions? Does any of this make any sense at all? If you say you're looking into asm as well, the x86 asm code has instructions specifically for finding bytes in strings. You should look at REP SCANSB for your task, something like this maybe: mov edi, _string ;your string mov ecx, [string_length] ;your string's length mov al, 0 repnz scansb ;the magic, scan for 0 jnz not_found mov [pointer_to_result], edi jmp exit_point not_found: movd [pointer_to_result], 0 exit_point: I'm pretty sure nothing a compiler outputs is as efficient as the processor's string scaning instructions. I'm not really experinced in inlining the asm in various compilers though, the syntax is very different between Intel and that AT&T syntax GCC uses.
|
# ? Mar 22, 2008 10:47 |
|
When using Eclipse to code java I know there is a way to make it automaticaly insert stubs for javadoc comments, but I can't for the life of me find out how. Anyone know if it's an add-on or pre-installed, and how to use it? Can't find anything useful on google.
|
# ? Mar 22, 2008 16:07 |
|
Blacknose posted:When using Eclipse to code java I know there is a way to make it automaticaly insert stubs for javadoc comments, but I can't for the life of me find out how. Anyone know if it's an add-on or pre-installed, and how to use it? Can't find anything useful on google. I just go into the line right above a function and hit /** [SHIFT-ENTER] That picks up on the parameters, thrown exceptions, etc Edit: Simply hitting ENTER seems to work too.
|
# ? Mar 22, 2008 16:55 |
|
Blacknose posted:When using Eclipse to code java I know there is a way to make it automaticaly insert stubs for javadoc comments, but I can't for the life of me find out how. Anyone know if it's an add-on or pre-installed, and how to use it? Can't find anything useful on google. When you're using the wizard to create a new object, there's a checkbox for "Generate Javadoc comments" or something like that. I didn't add any plugins to get that behavior. Also, you can put your cursor on the member in question and hit Shift-Alt-J to get Javadoc automatically inserted in the same manner Rheingold mentioned. And finally, you're looking for the Java megathread
|
# ? Mar 22, 2008 17:37 |
|
Dauq posted:If you say you're looking into asm as well, the x86 asm code has instructions specifically for finding bytes in strings. I thought about this, but the byte of interest will be part of an integer (and in a register already), not a string of characters. On a related note, does anyone know if Microsoft's implementation of things like strlen() and strchr() make use of the REP SCAN instructions? I suppose that if I wasn't so lazy I'd just open in up in IDA right now. But I am.
|
# ? Mar 22, 2008 18:14 |
|
|
# ? May 28, 2024 15:46 |
|
csammis posted:When you're using the wizard to create a new object, there's a checkbox for "Generate Javadoc comments" or something like that. I didn't add any plugins to get that behavior. Oops, sorry. Was in a rush for the information and didn't look properly, my bad.
|
# ? Mar 22, 2008 20:59 |