Search Results

Search: Posts Made By: calv
Forum: Programming 12-08-2008
4,412
Posted By calv
Sdl ?
Sdl ?
Forum: Programming 12-08-2008
10,868
Posted By calv
This is not surprising at all. An rwlock can also...
This is not surprising at all. An rwlock can also be "rdlock"ed, while a mutex can't. This means an rwlock can be in one of the three states:

1. free
2. locked with one wrlock
3. locked with one...
Forum: Programming 10-23-2008
7,066
Posted By calv
Java's .class files are platform independend. You...
Java's .class files are platform independend. You can compile the .java files on any machine with any jdk version to .class files and use them there. Just install the jdk for windows on your windows...
Forum: Programming 10-21-2008
6,193
Posted By calv
Well, I don't think so. Passing a "char*" to a...
Well, I don't think so. Passing a "char*" to a function that expects "const char*" is perfectly legal. And if it wasn't, then the compiler would say so.

On the other hand, if the function would in...
Forum: Programming 10-21-2008
6,193
Posted By calv
Either the constructor of Connection, or the...
Either the constructor of Connection, or the Query() method throws an exception of type const char *. You can catch it, by enclosing the calls with try, and adding a catch block, like:


try {
...
Forum: Programming 10-21-2008
5,637
Posted By calv
A web browser is a pretty big application. A...
A web browser is a pretty big application. A minimal browser would need an http client, an html parser, and something that displays html files. Even this would be a lot of work. And this minimal...
Forum: Programming 10-17-2008
193,452
Posted By calv
Yeah, on second thought I realized that if...
Yeah, on second thought I realized that if someone adds the variable "end" without initializing it, the result can crash. However the correct initial value is not NULL, but start (after the first...
Forum: Programming 10-17-2008
193,452
Posted By calv
error in trim_copy() was a typo: "ouput" ->...
error in trim_copy() was a typo: "ouput" -> "output" (but no segfault)

error in trim_nocopy() was an undeclared variable (that also needs to be initialized. segfault, if the new variable is not...
Forum: Programming 10-17-2008
193,452
Posted By calv
Why would they crash? Please explain to me the...
Why would they crash? Please explain to me the conditions, under which that happens. I tested them, and they don't crash. The change you made has the effect, that if the input is empty, or contains...
Forum: Programming 10-09-2008
18,707
Posted By calv
Yes, I realized that given the alternatives I...
Yes, I realized that given the alternatives I have to "die one death". I think I will make a single threaded app, that multiplexes sockets using select(). File operations will then still block, but...
Forum: Programming 10-09-2008
18,707
Posted By calv
After some further reading, I found out that all...
After some further reading, I found out that all this is not true for regular files. select() behaves as if a file is ready for reading and writing at any time:

"File descriptors associated with...
Forum: Programming 10-09-2008
193,452
Posted By calv
This is all just overkill. There are three...
This is all just overkill. There are three variants to do trimming in C:

1. Output in another place

void trim_copy(char *input, char *output)
{
char *end = ouput;
char c;

// skip...
Forum: Programming 10-09-2008
193,452
Posted By calv
This is optimizing in the wrong place. Your...
This is optimizing in the wrong place. Your algorithm is O(nē), with or without register. Trimming a string can be done in O(n), which is much more efficient. On the other hand the function has not...
Forum: Programming 10-06-2008
7,883
Posted By calv
The HTTP Protocol is designed to always send the...
The HTTP Protocol is designed to always send the size of the data in the "Content-Length:" field. You must count the bytes you read after the "\r\n\r\n", so you exactly stop, when there is nothing...
Forum: Programming 10-01-2008
18,707
Posted By calv
Thank you, didn't know that page. This really...
Thank you, didn't know that page. This really helped, since it confirmed my expectations :) and prove all other posters here wrong (no offence)

EDIT: well, not about the thing with the first write...
Forum: Programming 10-01-2008
18,707
Posted By calv
I use read(), not fread(). read() could for...
I use read(), not fread(). read() could for example only return 1 byte. As all available docs say, that read() *can* return less bytes then requested. So the return value of the read() call in your...
Forum: Programming 10-01-2008
18,707
Posted By calv
I don't want to use tape drives. But the term...
I don't want to use tape drives. But the term "slow device" is relative. Even with a fast device, a read can block, even if it is only about a few milliseconds. In that case I can use select to watch...
Forum: Programming 10-01-2008
3,380
Posted By calv
Seems like the ncurses maintainers would be the...
Seems like the ncurses maintainers would be the right people for this question.
Forum: Programming 10-01-2008
8,831
Posted By calv
Seems to me that this is exactly what changes,...
Seems to me that this is exactly what changes, when stdout is redirected to disk. But an fflush should always flush buffers, so a printf done before forking should not be written twice anymore.
Forum: Programming 10-01-2008
18,161
Posted By calv
Granted, the OP seems to have some confusion in...
Granted, the OP seems to have some confusion in destinguishing input from output, but I don't think anyone suggested to him to fflush stdin.
Forum: Programming 10-01-2008
3,878
Posted By calv
First of all, you don't "read" to the screen (or...
First of all, you don't "read" to the screen (or stdout), you "write" to it.

Second, I would store the number of bytes received in a variable. This way you don't need to use memset. Instead you...
Forum: Programming 10-01-2008
4,552
Posted By calv
It's really a lot of work to read all that code....
It's really a lot of work to read all that code. Do you think, you could isolate the error to a smaller program?

Also: I have never used shared memory in a multithreaded program. Why are you doing...
Forum: Programming 10-01-2008
18,707
Posted By calv
hmm... If this doesn't apply to slow devices,...
hmm... If this doesn't apply to slow devices, then what is select() for anyway? If I am working with a fast device, I wouldn't need it in the first place.

I know I could use async. or nonblocking...
Forum: Programming 09-30-2008
88,373
Posted By calv
rdtsc is not good for time measurement. The...
rdtsc is not good for time measurement.

The problem is, that the CPU might throttle (with it does most of the time, when all processes are blocked), so a cpu clock might mean more time in that...
Forum: Programming 09-30-2008
18,161
Posted By calv
as far as i know, all functions using a FILE * do...
as far as i know, all functions using a FILE * do buffered I/O. This means, that data is not written immediately, but when the kernel thinks, it is the right time. This is normally the case, when a...
Showing results 1 to 25 of 26

 
All times are GMT -4. The time now is 07:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy