636 Posted Topics

Member Avatar for blackrobe

[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 …

Member Avatar for nezachem
0
169
Member Avatar for QuantumMechanic

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 …

Member Avatar for QuantumMechanic
0
1K
Member Avatar for saulocpp

[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.

Member Avatar for jephthah
0
192
Member Avatar for cpp.coder

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 …

Member Avatar for cpp.coder
0
200
Member Avatar for en12ic0

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.

Member Avatar for jephthah
0
87
Member Avatar for sfurlow2

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 …

Member Avatar for sfurlow2
0
107
Member Avatar for MWE_QUE
Member Avatar for callister

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 …

Member Avatar for nezachem
0
297
Member Avatar for mebob

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.

Member Avatar for WaltP
0
89
Member Avatar for laehc

[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 …

Member Avatar for laehc
0
149
Member Avatar for guest7

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 …

Member Avatar for nezachem
0
466
Member Avatar for TheWolverine

[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 …

Member Avatar for nezachem
0
135
Member Avatar for fugnut

[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 …

Member Avatar for fugnut
0
99
Member Avatar for TheWolverine

Just to be on a safe side: after you added the flags, did the project files actually recompile?

Member Avatar for TheWolverine
0
2K
Member Avatar for leverin4

[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 …

Member Avatar for nezachem
0
399
Member Avatar for mikabark

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 …

Member Avatar for nezachem
0
143
Member Avatar for Iam3R

[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.

Member Avatar for nezachem
0
226
Member Avatar for BestJewSinceJC

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 …

Member Avatar for BestJewSinceJC
0
170
Member Avatar for tararengan
Member Avatar for tararengan
0
123
Member Avatar for SilentDuck

[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 …

Member Avatar for Banfa
0
211
Member Avatar for gerard4143

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 …

Member Avatar for gerard4143
0
330
Member Avatar for infrapt

[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.

Member Avatar for nezachem
0
132
Member Avatar for wilko1995

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?

Member Avatar for wilko1995
0
123
Member Avatar for oxy77
Member Avatar for oxy77
1
155
Member Avatar for marcux

Take a look at SO_REUSEADDR socket option. For a record, I didn't recommend using it.

Member Avatar for marcux
0
2K
Member Avatar for phil750

Let me jump in. One immediate problem is that redirections seem to be reversed. On ">" your code prepares for reading, and on "<" for writing.

Member Avatar for phil750
0
1K
Member Avatar for Whoever90

[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 …

Member Avatar for Whoever90
0
188
Member Avatar for rgpii

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.

Member Avatar for rgpii
0
192
Member Avatar for csurfer

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.

Member Avatar for nezachem
0
299
Member Avatar for BestJewSinceJC

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 …

Member Avatar for BestJewSinceJC
0
194
Member Avatar for iNach

[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?

Member Avatar for mitrmkar
0
151
Member Avatar for iliali16

[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. …

Member Avatar for jephthah
0
288
Member Avatar for Kikazaru

[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 …

Member Avatar for vijayan121
0
3K
Member Avatar for noey699
Member Avatar for freakzilla

[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 …

Member Avatar for Salem
0
170
Member Avatar for BeyondTheEye

[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. …

Member Avatar for BeyondTheEye
0
264
Member Avatar for donelliewhyte

> what is the value of info.regis? That really doesn't matter, because the comparison at line 21 is guaranteed to yield true.

Member Avatar for WaltP
0
218
Member Avatar for iNach

[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 …

Member Avatar for xavier666
0
8K
Member Avatar for daviddoria

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?

Member Avatar for daviddoria
0
403
Member Avatar for programer411

Banned at [URL="http://www.google.com/search?q=bucket+sort"]Google[/URL]?

Member Avatar for programer411
0
151
Member Avatar for konata_89

[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].

Member Avatar for konata_89
0
129
Member Avatar for vincenzorm117

The program will just emit a literal encoded by a backslash escape. It is up to the terminal to interpret it.

Member Avatar for nezachem
0
100
Member Avatar for cyberguy007

[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

Member Avatar for Dave Sinkula
0
76
Member Avatar for indigo.8

[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 …

Member Avatar for indigo.8
0
114
Member Avatar for Sobakaa

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.

Member Avatar for Sobakaa
0
236
Member Avatar for rom87

[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]

Member Avatar for nezachem
0
138
Member Avatar for johndoe444

[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 …

Member Avatar for mitrmkar
0
97
Member Avatar for IntegrySoft

[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 …

Member Avatar for nezachem
0
101
Member Avatar for Encrypted

Check the logic of the [ICODE]while[/ICODE] condition. The loop is skipped only when pizza_establishment is nicks, rays and mikes simultaneously.

Member Avatar for Encrypted
0
115
Member Avatar for oxy77

[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 …

Member Avatar for oxy77
0
97

The End.