636 Posted Topics
Re: [QUOTE=blackrobe;1171524]I've added a counter on the number of connections added, which is incremented every time a new connection is added, but didn't work as expected, because each client would initiate an extra random connection/request after its initial request has been processed, and therefore the server exits before it processes the … | |
Re: Few things are obvious right away: 1. cmdstr is not initialized. 2. my_env and my_args are not terminated by NULL. 3. A first element of my_args is a program name. The way you set the arguments up is not fatal, but highly unconventional. 4. You [I]must[/I] test the value returned … | |
Re: [QUOTE]if fclose(thefile) is closing all references to the file opened[/QUOTE] fclose doesn't close references. It closes a FILE object. It doesn't matter how many pointers point a particular one. It was opened once, and it must be closed also once. | |
Re: The postincrement is defined to return [ICODE]int[/ICODE]. The preincrement is defined to return [ICODE]int&[/ICODE]. In other words, [ICODE]y++[/ICODE] yields an lvalue, and [ICODE]++y[/ICODE] does not. That is, the result of [ICODE]y++[/ICODE] cannot be referenced. It can be const referenced however. [CODE]void foo(int & x); void bar(const int & x); void … | |
Re: The way you describe it, no. You cannot fork into another system. Usually you may assume that a target is running xinetd or some equivalent, and that it is properly configured. It will do the forking and execing on your behalf. Man xinetd and xinetd.conf. | |
Re: Thou shalt not [ICODE]while(!myfile.eof())[/ICODE]. Since [B]Dave Sinkula[/B] is silent, let me take on this: [CODE] while(!myfile.eof()) { myfile >> circle1 >> op >> circle2; do_something(); }[/CODE] Consider the last good iteration. It consumed all the bytes from myfile, but didn't try to read beyond its limits. The end of file … | |
Re: Line 55. How [ICODE]current[/ICODE] is initialized? | |
Re: The [ICODE]err[/ICODE] calculation (line 19) is meaningless. You need to watch not [ICODE]x^2+y^2[/ICODE] as you do, but [COLOR="Red"]f1^2 + f2^2[/COLOR]. The goal is to get f1 and f2 to approach 0, isn't it? The [ICODE]dy[/ICODE] calculation (line 16) is wrong. How did you come up with this formula? What is … | |
Re: Line 21 doesn't do what you want it to do. Look closely. PS: Such implementation of swap is very dangerous. In this program it's all right, but in general it may really hurt you. | |
Re: [QUOTE=laehc;1169416]I recently unrolled an insertion sort and on 60 items it was twice as slow as the looped version. I'm guessing that's because it was too big for the instruction cache, being 1032 KB. [/QUOTE] The correct question would be "it was too big for the instruction cache [B]line[/B]". I … | |
Re: Where did you get this? You must be an archaeologist. The code truly belongs to the past millenium. The error comes from make, which tries to call lint. Lint is morally obsolete tool (again from seventies), which purpose was to validate the program syntax in such details the old compilers … | |
Re: [QUOTE=TheWolverine;1168712]Hi all, I am in the process of optimizing my code and I was wondering what the fastest way is to compute trig functions. [/QUOTE] libm [QUOTE] I profiled my code and to my astonishment discovered that one of the most time-consuming processes is computing cos(theta) and sin(theta) using the … | |
Re: [QUOTE=evstevemd;1168433]not program output..but the content of the file PJ657_output.txt[/QUOTE] [QUOTE=fugnut;1168436]that is the contents of PJ657_output.txt[/QUOTE] He surely meant PJ657_Shapes.txt; it has been posted in the very first post: [QUOTE]input file is as follows R 42 10 T 10 20 c 10 s 20 D 10 10 (this line is intentional … | |
Re: Just to be on a safe side: after you added the flags, did the project files actually recompile? | |
Re: [QUOTE=leverin4;1163594]I understand, vaguely, what a reduce/reduce conflict is, but I don't understand why I'm getting one in my Yacc Parser. Can anyone help me out? [code=yacc] Expr : LEFTPAR Expr RIGHTPAR { }; Term : LEFTPAR Expr RIGHTPAR { }; Factor : LEFTPAR Expr RIGHTPAR { }; End : LEFTPAR … | |
Re: Writing (line 25) is almost OK (I think that a "+1" was added in an act of desperation, it is not needed there). Reading (line 30) is a problem. First, a readbuffer is not initialized, so the segfault is imminent. Second, you only reading 4 bytes of the message. Fix … | |
Re: [QUOTE=tux4life;1164652]The [I]compiler[/I] must convert it...[/QUOTE] The [I]compiler [/I]can't possibly do that. The conversion happens at runtime, by crt0 or something else. | |
Re: Salem's answer is correct but it I am afraid it misses the point. An implicit question is "why a system call needs an interrupt?" Why can't an application just call a kernel procedure? To answer these you have to realize that (a) a kernel procedure may issue privileged instructions not … | |
Re: Line 30 is suspicious. sizeof(numbers) yields a size of a pointer to double. | |
Re: [QUOTE=SilentDuck;1161213]I'm trying to create this pattern: [url]http://mathworld.wolfram.com/Rule60.html[/url] I cannot get my code to print this. It runs, it just does not print the right pattern. I know I am doing something wrong, I'm just not sure what. [CODE] int main() { //Declare variables bool line[78]; bool nextLine[78]; void firstline(); void … | |
Re: Your understanding is generally correct. The only problem is that the script filename is not the last argument ([ICODE]argv[argc - 1][/ICODE]) but rather the third: [CODE]nezachem@Home ~/tmp/dani/shebang $ ./script -z argv[0]->/home/nezachem/tmp/dani/shebang/gg argv[1]->-1 -2 -3 -4 argv[2]->./script argv[3]->-z could not open -z [/CODE] Otherwise I would also add that #! is … | |
Re: [QUOTE=infrapt;1160175] [CODE]double *ptr; spe_in_mbox_ write(thread_args[i].spe_context,(uint32_t*)&ptr,SPE_MBOX...)[/CODE] its that second parameter thats bugging me giving me a bus error. Thanks[/QUOTE] It would be [I]immensely[/I] helpful to see an [I]actual[/I] code and an [I]actual[/I] error message. For now I see a missing [ICODE]count[/ICODE] argument. | |
Re: You test 2 conditions (lines 18 and 21). One of them is supposed to filter out incorrect attempts. Another is supposed to accept correct ones. Logically, they should be mutual negations. The way they are written they are not. [URL="http://en.wikipedia.org/wiki/De_Morgan's_laws"]Hint[/URL]. Besides, why do you want to test both? | |
Re: To begin with, remove semicolons at lines 100, 107, 112 and 119. | |
Re: Take a look at SO_REUSEADDR socket option. For a record, I didn't recommend using it. | |
Re: Let me jump in. One immediate problem is that redirections seem to be reversed. On ">" your code prepares for reading, and on "<" for writing. | |
Re: [QUOTE=Whoever90;1152777]Sorry, this is not my example. It comes from another person, that why I am confuse also. I just dont get how can we can split a random string into part like compression and decompression EX:'ABCD' into 'A', 'AB', 'ABC', 'ABCD'[/QUOTE] The example suspiciously resembles the LZ compression (at least … | |
Re: Lines 16-19: you allocate just one byte per each variable. Then you copy some substantial strings there. After that all bets are off. Fix the buffer overflows first, and then see if the problem persists. | |
Re: I believe you are supposed to kfree_skb when you done with it. And at least check the value returned from skb_copy. Same goes for all other resources you allocate. | |
Re: A major pro the huge table is a fast dispatch. To make it actually fast, the table shall be stored in an on-chip RAM. This is very expensive gatewise. This is a major con. To minimize gates some designs go to the extreme of a single interrupt vector with a … | |
Re: [QUOTE=iNach;1147736]I think now I can tell you more... I found out that if you right click the blue bar of the border at the top of the program's window, you have propeties and there's history for the lines... I need a code that increases them.[/QUOTE] Will [ICODE]SetConsoleScreenBufferSize[/ICODE] help? | |
Re: [QUOTE=iliali16;1150112] As a grasshoper[/QUOTE] Man... grasshopper is a development strategy, not a personal epithet. It means "one jump at a time". [QUOTE] I don't need scorring or anything else just a moveing snake and another moving snake since the [B]aim of the assignment is the multiplayer part[/B].[/QUOTE] Forget the snake. … | |
Re: [QUOTE=Dave Sinkula;1150069]I thought there was the thing in C++ where constant variables were generally optimized away and treated as #defines.[/QUOTE] Fantastic. I mean, [B]wow[/B]. [I]Phantastic[/I] in fact. I wouldn't believe it unless I compiled and run it myself. The assembly output does show indeed that constant variable [ICODE]x[/ICODE] is replaced … | |
Re: Your order of arguments for atan2 is wrong. It should be (y, x), not (x, y). | |
Re: [QUOTE=freakzilla;1148200] Snippet of client [code] // loads shm and creates a new_client_id client_entry_t client; client.shmid = new_client_id; client.pid = 1; pthread_mutex_lock(&shm->region_mutex); add_to_client(shm, &client); pthread_mutex_unlock(&shm->region_mutex); thread_mutex_lock(&shm->region_mutex); //shm->num_entries = 0; shm->notify = 1; pthread_mutex_unlock(&shm->region_mutex); printf("\nClient finds SHMID as %ld", shm->first->shmid ); [/code] [/QUOTE] Can you expand a client snippet? I don't quite … | |
Re: [QUOTE=BeyondTheEye;1144307]The problem I'm having is it requires a clock signal sent from the PC as synchronisation, and a transmit/receive data line. For these data lines I can just use the WriteFile() and ReadFile() in the win32 API, but so far I havn't found a way of transfering a clock signal. … | |
Re: > what is the value of info.regis? That really doesn't matter, because the comparison at line 21 is guaranteed to yield true. | |
Re: [QUOTE=Ancient Dragon;1146486]AFAIK ESC can not be detected using standard i/o, such as getchar() and fgets(). Same with other special keys such as function and arrow keys.[/QUOTE] Not so. From the standard IO perspective, escape is just a regular character. getchar is perfectly happy to read it, and putchar - to … | |
Re: Since there are zillions of such lines, and they refer to a particular gcc installation, the makefile is most likely autogenerated. Check the Readme (or Install) for clues of how to regenerate it. Does the tarball have something like configure? Is there a 'depend' target in the makefile? autoconf sources? | |
Re: Banned at [URL="http://www.google.com/search?q=bucket+sort"]Google[/URL]? | |
Re: [QUOTE]//help me i dont know what wrong with list function[/QUOTE] There's absolutely nothing wrong with it. What's wrong is how it is called. Look at line 36, and ask yourself what is a type of [ICODE]library[count][/ICODE]. | |
Re: The program will just emit a literal encoded by a backslash escape. It is up to the terminal to interpret it. | |
Re: [QUOTE]We aren't psychic... [/QUOTE] I am, sort of. At least I have a crystal ball. And it tells me about the problems: - writing to invalid memory - printing an address as "%d" - #including conio.h | |
Re: [QUOTE][CODE]int * FileFunc::LoadFile(char *fileName) { int *pSignals = 0; int Signal[280];//The array which will store the signal files. // Irrelevant code skipped pSignals = Signal;//points at the first integer in the array. return pSignals; }[/CODE][/QUOTE] Signal is a local array. Once the function completes, it is gone. It is a … | |
Re: You should not set a non-blocking node. Select returns when a requested operation will not block. If a socket is in a non-blocking node, select returns immediately. That defeats the very purpose of select. | |
Re: [QUOTE]is not calculating all the possible combinations[/QUOTE] Why do you think it should? PS: your rgennum wastes a lot of time, and does not generate true randoms. I'd rather have it as [CODE]int rgennum(int min, int max) { return min + rand() % (max - min); }[/CODE] | |
Re: [QUOTE=johndoe444;1140018][CODE]typedef struct _node node; typedef struct _node { int is_leaf; node child[THRESHOLD_ITEM_SET]; list<item_set> candidate_set; } node;[/CODE] [/QUOTE] No you can not. Try to calculate a size of this structure. Seems to be infinite, don't you think so? In a recursive structure definition the recursive reference must be a pointer: [CODE]typedef … | |
Re: [QUOTE=IntegrySoft;1139605]Not tied to C++. I know it and Java, just learning ruby. Thought it'd be an interesting thing to learn in one of those contexts, but bottom line is I do need to get the files down (too many to do manually) to my HD, so any suggestion you can … | |
Re: Check the logic of the [ICODE]while[/ICODE] condition. The loop is skipped only when pizza_establishment is nicks, rays and mikes simultaneously. | |
Re: [QUOTE=oxy77;1138960]Thanks. I will try to figure it out from there. I just needed a little boost on it cause it was getting frustrating. I did similair to what you did and got 3 also. its a summation of the formula [CODE]pow(double(-1),n)*(4/(2*n +1))[/CODE] so plug 0 then n++ to 15 starting … |
The End.