Linux-Development-Apps Digest #442, Volume #7    Wed, 30 May 01 12:13:14 EDT

Contents:
  Re: newbie with read problem (manik roy)
  Re: newbie with read problem (Remco Poelstra)
  Re: newbie with read problem (Remco Poelstra)
  Re: how can i do this?? ("Zoran Cutura")
  Re: newbie with read problem (Rolf Magnus)
  Re: Advice needed. (William Morris)
  Re: Package unstallation Problem (Rolf Magnus)
  Can anybody suggest a good online email system? (Christopher Cheng)
  TTI (TTY?) ("Ludwig")
  GCC: "unused variable" warning not reported (Mathieu Deziel)
  gdb message when debugging (Charles Wilkins)
  Re: Is java good enough? ("Andrew R. Thomas-Cramer")
  Re: newbie with read problem (manik roy)
  [Q] How do I get html file in C-network programming? ("Dong-Shin Kim")
  Re: GCC: "unused variable" warning not reported (Villy Kruse)
  Re: Posix thread join problem (Kaz Kylheku)
  Re: Faster than strstr (Christopher Wong)
  Re: [Q] How do I get html file in C-network programming? (Dean Thompson)
  Re: C++ linux server to java client: connection problem ("Somkith Chai")
  Re: TTI (TTY?) ("Christian Schröder")
  Re: GCC: "unused variable" warning not reported (Charles Wilkins)
  Development under Linux (Daniel Kaminsky)

----------------------------------------------------------------------------

From: [EMAIL PROTECTED] (manik roy)
Subject: Re: newbie with read problem
Date: 30 May 2001 01:37:07 -0700

Remco Poelstra <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Hi,
> 
> I'm writing a simple wave file player, but have some problems.
> I read the filesize with
> read(fd, GroupHeader->groupSize, 4);
> But when I print the size on the console, it sais that it's 0
> The structure I use is:
> 
> typedef struct {
>      char groupID[5];
>      long groupSize;
>      char riffType[5];
> } GroupChunk;
> 
> GroupChunk *GroupHeader;
> 
> I'ce allocated memory for it, the first read succeeds.
> 
> What am I doing wrong?
> 
> Thanks in advance,
> 
> Remco Poelstra

read the wave chunk at a time.

typedef struct {
      char groupID[4];  //changed
      long groupSize;
      char riffType[4]; //changed
 } GroupChunk;
 
GroupChunk GroupHeader;

read(fd, &GroupHeader, 12);

And remember that, wave file is little-endian format.

------------------------------

From: Remco Poelstra <[EMAIL PROTECTED]>
Subject: Re: newbie with read problem
Date: Wed, 30 May 2001 08:40:10 GMT

Josef Moellers wrote:

> David Tanzer wrote:
> 
>>Hi.
>>
>>Remco Poelstra wrote:
>>
> 
>>>I'm writing a simple wave file player, but have some problems.
>>>I read the filesize with
>>>read(fd, GroupHeader->groupSize, 4);
>>>But when I print the size on the console, it sais that it's 0
>>>The structure I use is:
>>>
>>I'm not sure, but your problem *might* be, that read expects a
>>void * as 2nd argument, and you pass a normal variable. Even if
>>thats not the problem, I'd pass a pointer to "read", just because
>>of correctness.
>>
>>read(fd, &(GroupHeader->groupSize), 4)
>>
> 
> Remco should have checked the return value of the read() call, it will
> definitely have been -1 with the external variable errno being set to
> EFAULT.
> 
> Another reason why he should have checked the return value is that the
> program will happily return from read() even if no data is there, i.e.
> if the file has zero length.
> 


I completly forgot that I should check the output!
Thanks for the tip, I'll never forget it anymore.



Remco Poelstra


------------------------------

From: Remco Poelstra <[EMAIL PROTECTED]>
Subject: Re: newbie with read problem
Date: Wed, 30 May 2001 08:42:26 GMT

manik roy wrote:

> Remco Poelstra <[EMAIL PROTECTED]> wrote in message 
>news:<[EMAIL PROTECTED]>...
> 
>>Hi,
>>
>>I'm writing a simple wave file player, but have some problems.
>>I read the filesize with
>>read(fd, GroupHeader->groupSize, 4);
>>But when I print the size on the console, it sais that it's 0
>>The structure I use is:
>>
>>typedef struct {
>>     char groupID[5];
>>     long groupSize;
>>     char riffType[5];
>>} GroupChunk;
>>
>>GroupChunk *GroupHeader;
>>
>>I'ce allocated memory for it, the first read succeeds.
>>
>>What am I doing wrong?
>>
>>Thanks in advance,
>>
>>Remco Poelstra
>>
> 
> read the wave chunk at a time.
> 
> typedef struct {
>       char groupID[4];        //changed
>       long groupSize;
>       char riffType[4]; //changed
>  } GroupChunk;
>  
> GroupChunk GroupHeader;
> 
> read(fd, &GroupHeader, 12);
>


Is this always possible? If I want to read the sample data, can I make 
an array of records with two fields ( short l,r) and just read in a huge 
block?

Are there no problems with alignment?



> And remember that, wave file is little-endian format.
> 

My machine too, so that will not be a problem for the moment.

Remco Poelstra


------------------------------

From: "Zoran Cutura" <[EMAIL PROTECTED]>
Subject: Re: how can i do this??
Date: Wed, 30 May 2001 11:01:38 +0200
Reply-To: [EMAIL PROTECTED]

Once upon a while "mark" <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> I have a large B-Tree, each node contain a string, an integer
> and obviously the pointers to children. what i want to do is
> write out the content of each node to a binary file, and index
> to the children of the node. how can i go about doing this .


indexing into the file? 
That would imply that you already know where the children
of a node are located in the file when you write a node. I
expect that by this "optimization" you'll slow down one
part of the program when you wanted to speed up another part
of the program.

You would either start by writing the first node, leaving enough
place to store "offsets" to its children, write the children,
calculate the offset from the parent node, go back to the parent
node and write the offset to the previously left space.
This is all to complicated and I'ld expect that building a
tree upon reading a simple list (data records from the file)
will be as fast if not faster.




-- 
Z ([EMAIL PROTECTED])
"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond

------------------------------

From: Rolf Magnus <[EMAIL PROTECTED]>
Subject: Re: newbie with read problem
Date: Wed, 30 May 2001 11:15:45 +0200

Remco Poelstra wrote:

>> read the wave chunk at a time.
>> 
>> typedef struct {
>>       char groupID[4];       //changed
>>       long groupSize;
>>       char riffType[4]; //changed
>>  } GroupChunk;
>>  
>> GroupChunk GroupHeader;
>> 
>> read(fd, &GroupHeader, 12);
>>
> 
> 
> Is this always possible? If I want to read the sample data, can I make
> an array of records with two fields ( short l,r) and just read in a huge
> block?
> 
> Are there no problems with alignment?

You are right, NEVER do such things. This always can and will lead to 
problems.

------------------------------

From: William Morris <[EMAIL PROTECTED]>
Subject: Re: Advice needed.
Date: Wed, 30 May 2001 09:24:54 GMT

David Kistner <[EMAIL PROTECTED]> wrote:

> Any additional advice would be greatly appreciated.  I'm very very
> disillusioned with Microsoft and would like to escape to a better world - I'
> m hoping it's Linux.

David

It might well be Linux. But then again it might not.  It seems to me 
that you run the risk of being disillusioned by Linux if you try 
switch your whole environment including tools in one go.  If you are
interested in computing for its own sake, then you might be happy making the
complete changeover.  But if you (like the majority of people) are more
interested in the end product of your work, then you might be disappointed.

Others may disagree, but I would recommend that you try to migrate more
slowly.  You could try out the various programs suggested by others on Windows
(mysql will run on Windows, as will Java, probably python etc) so that you
don't get overloaded with new things to learn at the same time.  If you find
you are happy with the tools you can then switch OS as well.

Regards
-- 
William Morris
[EMAIL PROTECTED]


------------------------------

From: Rolf Magnus <[EMAIL PROTECTED]>
Subject: Re: Package unstallation Problem
Date: Wed, 30 May 2001 11:22:44 +0200

Nate Eldredge wrote:

> Unfortunately, if you installed a program that didn't come in a nice
> package (like RPM), there is probably no automatic way to reliably
> uninstall it.  .tar.gz style source and binary archives don't normally
> log the files they installed anywhere, so you don't know what to
> remove.  They also don't keep dependencies, so you don't know what
> might break if you do remove things.

Source archives DO normally support a "make uninstall", if you still have 
the source tree around. This will reverse what was done by "make install".

------------------------------

From: Christopher Cheng <[EMAIL PROTECTED]>
Subject: Can anybody suggest a good online email system?
Date: Wed, 30 May 2001 18:25:23 +0800

I am looking for a good online email system.

------------------------------

From: "Ludwig" <[EMAIL PROTECTED]>
Subject: TTI (TTY?)
Date: Wed, 30 May 2001 11:02:32 GMT

Hi,

does anyone know what we need to be able to communicate with our Linux
platform using a serial line, instead of using ethernet + telnet?

It appears there is a 'default ' application for Linux supporting this...
Also, what do we need on the other pc then? A terminal application?

Thanks,






------------------------------

From: [EMAIL PROTECTED] (Mathieu Deziel)
Subject: GCC: "unused variable" warning not reported
Date: 30 May 2001 05:05:42 -0700

Hi all,

Even when I am using the option -Wall OR -Wunused, I am not warned
about unused variables (I deliberately introduce unused variables to
test the compiler ability to warn).
Any idea?

I am compiling C++ program with G++.

Thank you,
Mathieu Deziel

------------------------------

From: [EMAIL PROTECTED] (Charles Wilkins)
Subject: gdb message when debugging
Date: Wed, 30 May 2001 13:01:54 GMT
Reply-To: [EMAIL PROTECTED]

When i run gdb, I get warning: unable to find dynamic linker
breakpoint function.
GDB will be unable to debug shared library initializers and track
explicitly loaded dynamic code.

Any ideas why this comes up?


Here is my config.status:

#!/bin/sh
# This file was generated automatically by configure.  Do not edit.
# This directory was configured as follows:
./configure --host=i686-pc-linux-gnu --norecursion 
#  using "mt-frag"

the target and host are one and the same


Best regards,
Charles


------------------------------

Reply-To: "Andrew R. Thomas-Cramer" <[EMAIL PROTECTED]>
From: "Andrew R. Thomas-Cramer" <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.java.programmer
Subject: Re: Is java good enough?
Date: Wed, 30 May 2001 09:10:42 -0500



My experience with Java3D and OpenGL in C++ has been:

Java/Java3D
* Java3D is easier to use; provides higher-level APIs; allows faster
development. It's can run on top of OpenGL, but there's a significant layer
of additional complexity between your code and it.
* Java is much easier to program; reduces risks of errors; and allows faster
development.
* Interfacing Java to existing C++ programs can be expensive in development
time -- and runtime. JNI calls are slow. If your company primarily uses
C/C++, is it possible you might want to interface to some existing code?
* Java programs have a much greater startup time. If your product is to be
used during surgery, do you want to force the surgeons to wait half a minute
while Java starts? What if they have to restart the program?

C/C++/OpenGL
* OpenGL in C++ allows much faster graphics. I am astounded at the speed. On
the other hand, I sometimes find myself implementing classes similar to
those that Java3D provides free.
* C++ reduces memory requirements significantly; provides language
constructs Java lacks that affect performance.


"Jon Novak" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> I've spent the last half year writing java code for a class, and I've
> come to like it fairly well.  Now, I'm working at a company that
> primarily uses C/C++.  I will be working on a medical system used in
> surgery. Part of this program involves some 3D rendering.  The machine
> that will run this system is a duel processor 1 GHz machine with 1 GB
> of RAM, running the RedHat Linux OS.
>
> My question is, will java and Java3D be "good enough" to take
> advantage of this machine's configuration?  I want the 3D to be fairly
> "impressive", not in terms of special effects or complex coding, but
> in terms of many polygons being rendered.  I also need to take
> advantage of 1 GB of ram and two processors.
>
> Can java do this?  Is it appropriate for a large system like this,
> with possibly demanding 3D?  Can it take advantage of all that memory
> and the duel processors?  I know java isn't as fast (at least with the
> VM -- how does compiled code compare?), but I think it's fast enough
> for everything I need to do (with the possible exception of 3D, like I
> said).
>
> Like I said, I like java much more than C++, but I don't want to
> handycap this program by using it.  Any advice would be appreciated.




------------------------------

From: [EMAIL PROTECTED] (manik roy)
Subject: Re: newbie with read problem
Date: 30 May 2001 07:13:50 -0700

Remco Poelstra <[EMAIL PROTECTED]> wrote in message 

> Is this always possible? If I want to read the sample data, can I make 
> an array of records with two fields ( short l,r) and just read in a huge 
> block?
> 
> Are there no problems with alignment?

You have to write one at a time. But you can take advantage reading
the header at a time and then processing...
 
> 
> 
> > And remember that, wave file is little-endian format.
> > 
> 
> My machine too, so that will not be a problem for the moment.
> 
> Remco Poelstra


Good.

------------------------------

From: "Dong-Shin Kim" <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.networking,comp.os.linux.development,linux.dev.apps,linux.dev.c-programming
Subject: [Q] How do I get html file in C-network programming?
Date: Wed, 30 May 2001 14:41:48 GMT

Hi.
I am a beginner of c-network progam in Linux.
I want to make a simple Internet program that can get a html file using
given URL.
I can't find any documentation about that.
Thank you.




------------------------------

From: [EMAIL PROTECTED] (Villy Kruse)
Subject: Re: GCC: "unused variable" warning not reported
Date: 30 May 2001 14:53:15 GMT

On 30 May 2001 05:05:42 -0700,
          Mathieu Deziel <[EMAIL PROTECTED]> wrote:



>Hi all,
>
>Even when I am using the option -Wall OR -Wunused, I am not warned
>about unused variables (I deliberately introduce unused variables to
>test the compiler ability to warn).
>Any idea?
>



Its ability to do so depend on the chosen optimization level.  The
information about unused variables is a side product of optimizing
the code.



Villy

------------------------------

From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: Posix thread join problem
Reply-To: [EMAIL PROTECTED]
Date: Wed, 30 May 2001 14:59:33 GMT

On Tue, 29 May 2001 20:53:47 GMT, ZoombyWoof <[EMAIL PROTECTED]> wrote:
>I want to do the same thing in Linux, but I haven't been able to do so. The
>Posix version of joining a thread is pthread_join, which can only wait for 1
>specific thread, you give the thread id as an argument to pthread_join.
>The Solaris version is much more useful (at least for me:-)

Sure, but the problem is you have to install an entire proprietary operating
system to use the nonstandard function! If you know what you are doing, you
should be able to write something that provides the same functionality. Here
is a candidate design: have your terminating threads add a message to a shared
queue and hit a condition variable.  Some thread can wait on the condition and
then examine the queue to see what threads have terminated (or are about to)
and do the corresponding pthread_joins.

------------------------------

Crossposted-To: comp.lang.c
From: [EMAIL PROTECTED] (Christopher Wong)
Subject: Re: Faster than strstr
Date: Wed, 30 May 2001 15:16:47 GMT
Reply-To: [EMAIL PROTECTED]

There were lots of different methods, algorithms, libraries suggested
here. What about a simple solution like adding a -O or -O2 switch to
the compile stage? The headers define a number of macros to speed up
string operations, and apparently newer versions of gcc have
optimizations built in. The header files bits/string.h and
bits/strings.h (called by string.h when __OPTIMIZE__ is defined) both
have optimizing macros such as the following from the latter:

/* Find the first occurrence of NEEDLE in HAYSTACK.  Newer gcc
versions do this itself.  */
#if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97)
# define strstr(haystack, needle) \
  (__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p
(needle) \
                  ? (((__const char *) (needle))[0] == '\0' \
                     ? (char *) (size_t) (haystack) \
                     : (((__const char *) (needle))[1] == '\0' \
                        ? strchr (haystack, \
                                  ((__const char *) (needle))[0]) \
                        : strstr (haystack, needle))) \
                  : strstr (haystack, needle)))
#endif

Perhaps for some cases, it might be best to use the built-in
optimizations rather than to roll your own.

Chris


------------------------------

From: Dean Thompson <[EMAIL PROTECTED]>
Crossposted-To: 
comp.os.linux.networking,comp.os.linux.development,linux.dev.apps,linux.dev.c-programming
Subject: Re: [Q] How do I get html file in C-network programming?
Date: Thu, 31 May 2001 01:20:20 +1000


Hi!,

> I am a beginner of c-network progam in Linux.
> I want to make a simple Internet program that can get a html file using
> given URL. I can't find any documentation about that.

Take a look on google and do a search for "Networking Programming C++".  You
basically just need to create a socket, bind it to the WWW server and then
issue your get instruction and read the contents back.

Once you know how to create, send and receive data over a TCP/IP socket, you
will be in business.

See ya

Dean Thompson

-- 
+____________________________+____________________________________________+
| Dean Thompson              | E-mail  - [EMAIL PROTECTED] |
| Bach. Computing (Hons)     | ICQ     - 45191180                         |
| PhD Student                | Office  - <Off-Campus>                     |
| School Comp.Sci & Soft.Eng | Phone   - +61 3 9903 2787 (Gen. Office)    |
| MONASH (Caulfield Campus)  | Fax     - +61 3 9903 1077                  |
| Melbourne, Australia       |                                            |
+----------------------------+--------------------------------------------+

------------------------------

From: "Somkith Chai" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.system
Subject: Re: C++ linux server to java client: connection problem
Date: Wed, 30 May 2001 11:27:45 -0400

Mike Hebert wrote ...
> Somkith Chai wrote:
>
> > Hello,
> >
> > I'm running into problems sending data between my server and client.  My
> > server is compiled using Linux C++ and my client is on java.  I'm
getting a
> > Connection refused on the java side.  I've also seen situations with the
> > error Connection reset by peer.  Similar server code compiled on Solaris
> > works fine.  It looks like the close() is terminating the connection
> > prematurely on Linux.  If I put a sleep just before the close()
statement,
> > the data is sent.  Can anyone tell me what is going on?  I've copied my
> > code below.
>
> >  ret = write(sd_out, buf, 50000);
> >  printf("write returned %d...\n", ret);
>
> I wonder: does it work if you use a "send" here rather than a "write"?
>
> Another thing to try is a fflush(sd_out) just before you close the
> connection.
>
> Let me know if these work!
>

The same problem occurs when using send(...) and the fflush(...) doesn't
seem to work at all.
Anyhow, I ended up just delaying the close statement to keep the connection
open for as long as possible.

Thanks,
Somkith



------------------------------

From: "Christian Schröder" <[EMAIL PROTECTED]>
Subject: Re: TTI (TTY?)
Date: Wed, 30 May 2001 17:21:14 +0200


Ludwig schrieb in Nachricht ...
>Hi,
>
>does anyone know what we need to be able to communicate with our Linux
>platform using a serial line, instead of using ethernet + telnet?
>
>It appears there is a 'default ' application for Linux supporting this...
>Also, what do we need on the other pc then? A terminal application?
>
>Thanks,
>

As Linux Newbie:
Not 100% shure but try 'getty'.
getty, agetty, mingetty offer Posibilities to connect through serial lines.
They will give you a prompt when you connect with Hyperterminal (Microsoft)
for Example.
Or of course use a 'Console'.
Or try ppp over serial line.

HTH

Cris



------------------------------

From: [EMAIL PROTECTED] (Charles Wilkins)
Subject: Re: GCC: "unused variable" warning not reported
Date: Wed, 30 May 2001 15:52:34 GMT
Reply-To: [EMAIL PROTECTED]

To get that, I use:

g++ -O2 -Wall -W binaryoutfile -o sourcefile.c

Charles


On 30 May 2001 05:05:42 -0700, [EMAIL PROTECTED] (Mathieu
Deziel) wrote:

>Hi all,
>
>Even when I am using the option -Wall OR -Wunused, I am not warned
>about unused variables (I deliberately introduce unused variables to
>test the compiler ability to warn).
>Any idea?
>
>I am compiling C++ program with G++.
>
>Thank you,
>Mathieu Deziel


------------------------------

From: Daniel Kaminsky <[EMAIL PROTECTED]>
Subject: Development under Linux
Date: Wed, 30 May 2001 18:00:39 +0200

Hi!


I want to develope a simple database application under Linux. But the
program should run (stable) under Windows.
The language should be C(++).
Is there a possibility for my idea? A name of an program should be
enogh...
If it's possible, it should be for free.

Thanks a lot for every tip.

Greetings Daniel

Ps:
I'm German, thats why my English is so bad. ;)

-- 
The worst day finswimming is better than
the best day working.

------------------------------


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list by posting to the
comp.os.linux.development.apps newsgroup.

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-Apps Digest
******************************

Reply via email to