364 Posted Topics
Re: Everything actually looks OK, except that following your use of sort->unique->erase, there's still potentially a single -1 in your convex array (if there were any points not on the convex hull), and while you skip it for i, you include it for j when i is at the end of … | |
Re: A short answer ... if you want to have a separate thread for each client connection, then when you receive an incoming message from one client, you need to communicate to each of the other threads so they can send it out. Unless your server process needs to do something … | |
Re: Well, you've commented out your "while()" expression. {}s don't create a loop by themselves, they just define a "scope" -- a conceptual container where (a) anything declared within it, exists and is visible only within it, and (b) anything declared in an outer scope which contains this one is also … | |
Re: I think you're confused about the dict notation. It's [CODE] d = {key:value, key:value, ...} [/CODE] Since you already have alternating keys and values in your list, you could do something like: [CODE] d = {} for i in xrange(len(my_list)/2): key = my_list[i*2] value = my_list[i*2 + 1] d[key] = … | |
Re: looking at the 1-D example(s) on the page you referenced: [CODE] grad[0] = (vals[1] - vals[0]) / dx; grad[i] = (vals[i+1] - vals[i-1]) / (2*dx); // for i in [1,N-2] grad[N-1] = (vals[N-1] - vals[N-2]) / dx; [/CODE] for the 2-D case, you have to figure out which direction in … | |
Re: The first problem I see is that you ask for T/F within a loop that depends on variable "check" which you never update. So your program can't possibly get beyond that point. After that, it's clear that what you read in, in terms of an ENG or IT phrase, never … | |
Re: If you look at your own code objectively (which is hard when you're in a blind panic about finishing an assignment on schedule), you'll see that you're running your grade-input-loop four times, and in each time through the loop, you're asking for each of four grades. Do one or the … | |
Re: Following up, in case it helps: Looking at your ENTRY struct, you say at the top it's a "struct entry" and then when you define the "next" pointer, you specify "struct contact" -- copy & paste & edit error? Since the values you're reading into are all char-arrays, they already … | |
Re: > but my key '596' is present in 'map_dict2'. but according to the error, it's not present in map_dict1. Check for that using map_dict1.has_key(key) (or the new and preferred "key in map_dict1") before checking whether the value at that key equals the expected value. | |
Re: Have you tried "%hd" for a short int? scanf() is -very- picky about pointer-types and how to deal with them. (For people with more time on their hands, start reading up on stdarg and variable argument-list processing, which is why you can pass a format string and then the correct … | |
Re: Hey rockerjhr. First of all, a little less attitude would be great. There are many experienced programmers on here, but not all of them are mathematicians. And they're all answering questions in their spare time, because they care. I got as far as hand-plotting your sorted points, and they appear … | |
Re: I don't have pylab installed, but looking at page 15 of [url]http://matplotlib.sourceforge.net/Matplotlib.pdf[/url], it looks like you -might- be able to do something crazy like: [CODE] xlabel('letters') ylabel('counts') axis('a', 'z', 0, max_count) [/CODE] If that doesn't work, I'd see if there are any transformation functions you can apply, that will take … | |
Re: tonyjv, nice images there. For what it's worth, converting to polar coordinates is interesting: If A = (a + bi) = (a, b) = (R, theta) where R = sqrt(a^2 + b^2) and theta = atan2(b, a) (and thus, a = R*cos(theta) and b = R*sin(theta)) then A^2 = (R^2, … | |
Re: linuxoidoz, since i haven't seen this come up yet, if you don't want to destroy and create your dialog each time, have you considered using hide() rather than close(), especially if it's not a modal dialog? also, i noticed both of your classes are subclassed from QMainWindow ... i haven't … |
The End.