Linux-Development-Apps Digest #411, Volume #6     Tue, 7 Mar 00 22:13:12 EST

Contents:
  Re: Struct size and allocate problem! need help. (Nix)
  Re: Struct size and allocate problem! need help. (Nix)
  Re: array of semaphores... (Nix)
  Re: I can't stand this X anymore! (Christopher Wong)
  Re: I can't stand this X anymore! (Donovan Rebbechi)
  Re: Free Agent for Linux (Victor Wagner)
  Re: Advice needed on JSP and servlets on Linux (Dustin Aleksiuk)
  Re: [Q] TickCount equivalent? (Brett Hall)
  Re: I can't stand this X anymore! (David T. Blake)
  Re: I can't stand this X anymore! (Donovan Rebbechi)
  Re: I can't stand this X anymore! (Donovan Rebbechi)
  Re: Problem with dlopen() function. ("Arthur H. Gold")
  Re: getchar with timeout? (Donald Arseneau)

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

From: Nix <$}xinix{$@esperi.demon.co.uk>
Crossposted-To: 
alt.os.linux,comp.os.linux.development.system,comp.unix.sco.misc,comp.unix.sco.programmer,comp.unix.unixware.misc,tw.bbs.comp.linux
Subject: Re: Struct size and allocate problem! need help.
Date: 07 Mar 2000 20:40:36 +0000

Chris Zagar <[EMAIL PROTECTED]> writes:

> When possible, my first recommendation is to reform your struct with
> variables from largest size to smallest, such as:
> 
>  struct    a {
>         unsigned long    a5;
>         unsigned short   a3;
>         unsigned short   a4;
>         unsigned char    a1;
>         unsigned char    a2;
>     };
> 
> as some architectures become really annoyed when you access a variable
> that isn't aligned on its natural boundary.

Er, that's what structure padding is for.

-- 
`> KNOWLEDGE AND SKILLS
 You must have some, but I don't see any evidence of it.'
   --- Craig Hardie flames a luser recruitment consultant
       advertising `Microsoft based solutions' on uk.comp.os.linux

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

From: Nix <$}xinix{$@esperi.demon.co.uk>
Crossposted-To: 
alt.os.linux,comp.os.linux.development.system,comp.unix.sco.misc,comp.unix.sco.programmer,comp.unix.unixware.misc,tw.bbs.comp.linux
Subject: Re: Struct size and allocate problem! need help.
Date: 07 Mar 2000 20:50:07 +0000

"P.G.Hamer" <[EMAIL PROTECTED]> writes:

> Looks like this is true, although I'm uncertain of its date
> http://www.lysator.liu.se/c/rat/c3.html#3-3-3-4
> says:
> It is fundamental to the correct usage of functions such as malloc and
> fread that sizeof (char) be exactly one.  In practice, this means that a byte
> in C terms is the smallest unit of storage, even if this unit is 36 bits wide;
> and all objects are comprised of an integral number of these smallest units.

Exactly. However, section 3.4 of my copy of the draft C9X Standard says

       3.4  Byte

       [#1] The unit of data  storage  large  enough  to  hold  any
       member   of   the  basic  character  set  of  the  execution
       environment.  It shall be possible to express the address of
       each  individual  byte  of  an  object  uniquely.  A byte is
       composed of a contiguous sequence of  bits,  the  number  of
       which  is implementation-defined.  The least significant bit
       is called the low-order bit; the  most  significant  bit  is
       called the high-order bit.

and in section 5.2.4.2.1.1 (`Sizes of integer types <limits.h>') is
stated

          - number of bits for smallest object that is not  a  bit-
            field (byte)
            CHAR_BIT                         8

and in section 6.3.3.4 (`The sizeof operator') is stated

       [#2] The sizeof operator yields the size (in bytes)  of  its
       operand
[chop]
       [#3] When applied to an operand that has type char, unsigned
       char,  or  signed char, (or a qualified version thereof) the
       result is 1.

Oops, so a byte is CHAR_BITs long, no matter how long that may be, and
sizeof() will return 1 for chars. So if a char is 400 bits long, a byte
on that system is 400 bits long, as far as C is concerned.

(This used to be not uncommon. Some of the first systems ever to run C
had 36-bit bytes, and suchlike.)

-- 
`> KNOWLEDGE AND SKILLS
 You must have some, but I don't see any evidence of it.'
   --- Craig Hardie flames a luser recruitment consultant
       advertising `Microsoft based solutions' on uk.comp.os.linux

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

From: Nix <$}xinix{$@esperi.demon.co.uk>
Crossposted-To: comp.programming.threads,comp.os.linux.development.system
Subject: Re: array of semaphores...
Date: 07 Mar 2000 22:05:46 +0000

Joe Pfeiffer <[EMAIL PROTECTED]> writes:

> "Vitaliy Rabotnik" <[EMAIL PROTECTED]> writes:
> 
> > I now use pthreads to solve the same dining filosophers problem :)
> > How do I create an array of semaphores for each of 5 philosophers (pthreads)
> > ?
> > It has to be in C language and runable on Linux OS.
> 
> You'll probably get a quicker response by asking your professor than
> by asking a newsgroup.

... indeed, there have been cases where asking on the newsgroup has led
to the prof following up ;)

-- 
`> KNOWLEDGE AND SKILLS
 You must have some, but I don't see any evidence of it.'
   --- Craig Hardie flames a luser recruitment consultant
       advertising `Microsoft based solutions' on uk.comp.os.linux

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

From: [EMAIL PROTECTED] (Christopher Wong)
Crossposted-To: comp.os.linux.x,comp.os.linux.advocacy
Subject: Re: I can't stand this X anymore!
Reply-To: [EMAIL PROTECTED]
Date: Tue, 07 Mar 2000 23:56:03 GMT

On 7 Mar 2000 16:31:59 GMT, Donal K. Fellows <[EMAIL PROTECTED]> wrote:
>Half the problem is that there are several groups of people wanting to
>use fonts.  There are the "we want perfect WYSIWYG" types[*] and there
>are the "if it's close enough, I'm happy" types.
>
>Donal.
>[* These are pretty much the same people who claim that a graphics
>   program is completely useless to all mankind if it can't match the
>   colour on the screen perfectly to the colour on the printer.  IOW
>   total control freaks.  They like fixed-width web-pages too.  Grr! ]

Come now, we have the right to be that demanding. It is not unreasonable
to want to see readable fonts onscreen that reflect the correct spacing
and line breaks as they would on paper. It's a basic issue with word
processing and desktop publishing. Never mind the color. Adobe Type
Manager appeared in 1990, bringing scalable Type 1 fonts and thus true
WYSIWYG to the Mac. ATM made it to Win3.1 the next year, and even to
OS/2. It is kind of sad that Linux cannot attain the kind of WYSIWYG
that was available on far lesser platforms a decade ago.

Chris


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

From: [EMAIL PROTECTED] (Donovan Rebbechi)
Crossposted-To: comp.os.linux.x,comp.os.linux.advocacy
Subject: Re: I can't stand this X anymore!
Date: 8 Mar 2000 00:00:46 GMT

On 7 Mar 2000 22:35:34 GMT, David T. Blake wrote:
 
>> References ? 
>
>www.freetype.org
>"
>We are now in contact with Apple's legal department to discuss
>the TrueType patents issues with them. However, we'll be unable
>to comment on the current discussion until they take an official
>position. This could take some time, so don't expect anything too
>soon. 

In other words, nothing. Apple have not threatened to do anything.

>Even though we're unable to tell for now whether FreeType
>violates them, this could mean that the free use of the library
>could be illegal in the US or other countries like Japan, be it
>in commercial or free projects.

Wrong. It would mean that freetype would have to license the patent.

>To add to this Microsoft currently pays a licensing fee
>to Apple for use of TrueType fonts in Windows. 

Sure. The whole point of their patent is to give them one up in negotiations
with Microsoft. Anyone else licensing their patents ?

> It is also
>highly unlikely that Freetype is legal, and that SOME
>licensing would have to be arranged (or else Apple would lose
>royalties from others that pay it to use TrueType).

The licensing wouldn't necessarily require a fee, especially if the
software in question is free. Patents are usually licensed on 
a royalties basis as you've indicated. What's 10% of nothing ?

>The Freetype developers seem to think they have reverse
>engineered the patents by only using the published specs -

I'm not clear on what you mean by "reverse engineer" a patent.
If you mean that they've reinvented the same thing, it certainly 
sounds plausible, but doesn't help them much.

>and the licensing that must be getting paid to Apple. Adobe uses
>them in everything. 

Adobe ? They use Type1 where possible. They only started paying lip 
service to TrueType because Apple and MS pushed TrueType so hard.

>This is not chump change for Apple to throw out to the free
>software community.

Well your entire post and your assumption that Apple are going to 
enforce their patent is at this stage entirely speculative at best.

>Which is almost certainly illegal, the fallout of which we
>can only just barely currently grasp. What will Apple decide
>to do ? Give up the royalties, or give up the patents ? I see
>almost no way they are biased to give up the royalties. Patents
>have been violated, and patent holders do not benefit from 
>giving the patents away after someone violates them.

Patent holders do not benefit from bad publicity. And they don't stand
to gain financially from setting their lawyers onto the little guys.
And there's no evidence they plan to do that.

-- 
Donovan

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

From: [EMAIL PROTECTED] (Victor Wagner)
Subject: Re: Free Agent for Linux
Date: 7 Mar 2000 23:08:57 +0300

Warren Young <[EMAIL PROTECTED]> wrote:
:> Jaap <[EMAIL PROTECTED]> wrote:
:> : i use 'pine' for email and news. works nice (without threads)
:> 
:> I think that pine is for mail, but for news tin is way better.
:> I'm even thinking of gating some high-volume mailing lists into local
:> newsserver, becouse they are hard to read without threads.

:> So, GUI is for graphic-based work - image processing, chartography,
:> typesetting, web-surfing, and text-mode interfaces for text-based work -
:> programming, entering text, mail, news.

: The purpose of a GUI is to allow you to open 10 xterms at once.  :)

No, there is gimp, xdvi, framemaker, acrobat reader and lot of other
things which are useful in GUI form. But of course, 10 xterms are nice,
especially if they are taught to float to the top if something need
attention (for example, when micq recieves a message).

: ....Or for running Netscape Communicator, which can do threading even on

Netscape Communicator? Just say no! I use Netscape Navigator, just
becouse there is no better alternative, but it calls pine on mailto:
urls and tin on news: ones.

: mailing lists.  Just filter the group's messages into a folder of their
: own, and turn on the threaded view in that folder.  It's the main reason

It is not a bit more complicated to tell procmail pass certain messages
to mail2news.pl.

-- 
Linux - Where do you want to fly today?
        -- Unknown source

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

Date: Tue, 07 Mar 2000 17:23:14 -0700
From: Dustin Aleksiuk <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.misc,comp.os.linux.misc
Subject: Re: Advice needed on JSP and servlets on Linux

I simply use Nedit to do JSP stuff.  It works pretty well if you map the
.JSP extension to the JAVA filetype.  I like it because it's simple.

Dustin Aleksiuk
[EMAIL PROTECTED]

[EMAIL PROTECTED] wrote:

> Hi folks,
>
> Any advise for a Linux newbie who is intending to use JSP for his thesis
> work? I'm trying to write an indexing and retrieval web application that
> can allow users to submit by their browser text files for index and
> search for documents. Thinking of using JSP or servlets with Apache on
> Linux. Can recommend a good IDE that allows me to work with servlets ? I
> have downloaded JServ but haven't install it yet. I have also tried
> JBuilder foundation for Linux and found it really crippled in terms of
> features (versus the Windows version my company is using).
>
> Any pointers, suggestions and advise would be greatly appreciated.
> Please remove tag on email address to correspond.
>
> Thanks in advance.
>
> Regards
> Damon


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

From: Brett Hall <[EMAIL PROTECTED]>
Subject: Re: [Q] TickCount equivalent?
Date: Wed, 08 Mar 2000 01:32:52 +0000
Reply-To: [EMAIL PROTECTED]

[EMAIL PROTECTED] wrote:

> I'm looking for a equivalent to GetTickCount() in XLib. The closest I
> was able to find was getrusage() but I don't think that is what I want.

Check out gettimeofday().
-brett


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

From: [EMAIL PROTECTED] (David T. Blake)
Crossposted-To: comp.os.linux.x,comp.os.linux.advocacy
Subject: Re: I can't stand this X anymore!
Date: 8 Mar 2000 00:58:42 GMT
Reply-To: [EMAIL PROTECTED]

Donovan Rebbechi <[EMAIL PROTECTED]> wrote:
> On 7 Mar 2000 22:35:34 GMT, David T. Blake wrote:

> >Even though we're unable to tell for now whether FreeType
> >violates them, this could mean that the free use of the library
> >could be illegal in the US or other countries like Japan, be it
> >in commercial or free projects.
> 
> Wrong. It would mean that freetype would have to license the patent.

Well, it is unclear whether this could ever happen. Apple
would be unlikely to grant a free ride for True Type fonts
on a free platform while it accumulates royalties from other
platforms - it doesn't make sense. They would have to freely
license the technology to all. 

What is more likely is that Apple would propose a licensing
plan that is untenable for the Freetype developers, and that
something like metafont rendering would be used instead. Don't
forget, metafont rendering PRECEDES TrueType by some time, and
is actually a bit nicer.


> >To add to this Microsoft currently pays a licensing fee
> >to Apple for use of TrueType fonts in Windows. 
> 
> Sure. The whole point of their patent is to give them one up in
> negotiations with Microsoft. Anyone else licensing their patents ?

The whole point of their patent was the same reason for 
developing any patent - protection of innovation for a fixed
length of time through a legal granted monopoly. They enjoy
this protection with TrueType fonts and make a lot of money
from it.


 
> > It is also
> >highly unlikely that Freetype is legal, and that SOME
> >licensing would have to be arranged (or else Apple would lose
> >royalties from others that pay it to use TrueType).
> 
> The licensing wouldn't necessarily require a fee, especially if
> the software in question is free. Patents are usually licensed on
> a royalties basis as you've indicated. What's 10% of nothing ?

Don't be silly. They would most certainly not grant free software
developers a royalty based license. The license can be 
any form of contract. LZW has certainly not been licensed on a 
royalty basis - but on a per use basis. 


> >and the licensing that must be getting paid to Apple. Adobe uses
> >them in everything. 
> 
> Adobe ? They use Type1 where possible. They only started paying lip 
> service to TrueType because Apple and MS pushed TrueType so hard.

Still, TrueType is included in most of their products, and
they pay for it.


> >This is not chump change for Apple to throw out to the free
> >software community.
> 
> Well your entire post and your assumption that Apple are going
> to enforce their patent is at this stage entirely speculative at
> best.

I find it highly likely. The corporate world lives by protecting
their products. IT people like Apple do this especially through
patent protection. Their mentality is that TrueType represents
their intellectual property, and I suspect that soon they will
claim Freetype is STEALING their IP through patent violations. The
Freetype people are NOT rich developers or even well funded. The
site will shut down while they use a work around technique
like metafont.


> >...patent holders do not benefit from giving the
> >patents away after someone violates them.

> Patent holders do not benefit from bad publicity. And they
> don't stand to gain financially from setting their lawyers onto
> the little guys. And there's no evidence they plan to do that.

This is not something tremendously widespread in Unixland. Most
people don't even understand that Freetype exists, or even 
an X server based on it. I don't see that much publicity would
ensue. The workaround would probably be better, and more widely
used (witness the rapid dropoff in gifs for pngs).


-- 
Dave Blake
[EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Donovan Rebbechi)
Crossposted-To: comp.os.linux.x,comp.os.linux.advocacy
Subject: Re: I can't stand this X anymore!
Date: 8 Mar 2000 02:18:00 GMT

On Tue, 07 Mar 2000 23:48:05 GMT, Christopher Wong wrote:
>On 7 Mar 2000 05:55:38 GMT, Donovan Rebbechi <[EMAIL PROTECTED]> wrote:

>If I throw out a bundle of extra cash to get a Postscript-capable
>printer, 

Myth: Postscript printers are expensive
Fact: Postscript Lasers start at $400-, postscript inkjets start at $100-

> then I get Type 1 fonts that look awful onscreen but great on
>paper, 

Again, I disagree with your contention that Type1 fonts look that much
worse than TrueType. In one fairly contrived example, it's true. But unless
you're using these special "webfonts" from Monotype ( or from Adobe ),
it's not true.

> and TrueType fonts that look great onscreen but awful on paper
>(if at all).

Huh ? TrueType fonts look fine on paper. They look at least as good on 
paper as they do on screen. 

And I don't know what "if at all" 
is supposed to mean -- but Postscript supports TrueType as of level 2
and you'll find it hard to get a PS printer that doesn't do level 2 ( or
3 )

-- 
Donovan


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

From: [EMAIL PROTECTED] (Donovan Rebbechi)
Crossposted-To: comp.os.linux.x,comp.os.linux.advocacy
Subject: Re: I can't stand this X anymore!
Date: 8 Mar 2000 02:22:57 GMT

On Tue, 07 Mar 2000 23:46:18 GMT, Christopher Wong wrote:

>I was addressing your point which had the phrase "in practice". In
>practice, TrueType on X is far superior to Type 1 on X, as that screen
>shot amply shows. 

... but this only applies to those particular TrueType fonts.

> Microsoft has quite a selection of good fonts in their
>free package: Andale Mono, Trebuchet MS, Georgia, Verdana, Comic Sans,
>Arial, Arial Black, Impact, Times New Roman and Courier New. These 10 font
>families are all well-hinted and professionally designed. It is not like
>I need anything more. 

Fair enough. My main point is that outside these fonts, you won't notice
much difference. Even with the sans fonts ( Arial, Verdana ), the difference
is quite small.

>In practice: if I "load up a gazillion fonts", there are two
>scenarios. If I go with TT, I get excellent fonts most of the time and
>ugly fonts some of the time. With Type 1, I get ugly fonts all of the
>time. I think it does matter which one I would go with.

This is misrepresenting the situation. If you "go with" TT, you get 
*very few* excellent fonts. In particular, outside the special webfonts,
you will notice next to no difference.

>I would need more than a decent Type 1 font. I need a decent Type 1
>rasterizer: the one that comes with XFree86 is crap. 

Like I said, an apples to apples comparison, where you convert TrueType
to Type1 shows that there is very little difference. Perhaps I can post
some screenshots.

>have a TT to Type 1 converter, I doubt if I can get even one Type 1 font
>that looks comparable to my TrueType fonts. I'll try your font RPM,

Well I've actually tried this, and I believe that you are greatly exaggerating
the differences.

-- 
Donovan

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

Date: Tue, 07 Mar 2000 20:26:13 -0600
From: "Arthur H. Gold" <[EMAIL PROTECTED]>
Subject: Re: Problem with dlopen() function.

Alexander Zviaguine wrote:
> 
> Hello,
> 
> I want to load shared library during execution of a process. This work
> may be done with the help of dlopen() function.
> Unfortunatly I have problem with this under Linux. I have very simple
> code (please, take a look, these are only 15 lines of code) that works
> just fine under Digital Unix OSF1.  The same code does not work under
> Linux. I need help! What is wrong?
> 
> Thanks in advance,
> Alexander Zvyagin.
> 
> /* File m.c */
> #include <dlfcn.h>
> #include <stdio.h>
> void f(void); // In shared library.
> int main(void)
> {
>   void *handle = dlopen ("l.so", RTLD_LAZY); // load shared library.
>   if(!handle)
>     printf("Can not load library.\n");  // can not load - print message.
>   else
>     f();                                // call function from l.so
> }
> 
> /* File l.c */
> #include "stdio.h"
> void f(void) { printf("Hello, WORLD!\n"); }
> 
> Compilation, linking and running under digital unix
> OSF1 dxplus02 V4.0 878 alpha:
> $ cc -c l.c
> $ ld -shared -o l.so l.o -lc
> $ cc -expect_unresolved \* m.c -o m
> $ ./m
> Hello, WORLD!
> 
> Under Linux (redhat 5.1 distriubution, kernel 2.2.`0):
> $ gcc -c l.c
> $ ld -shared -o l.so l.o
> $ gcc -rdynamic -Xlinker -noinhibit-exec m.c -o m -ldl
> /tmp/ccc9IP00.o: In function `main':
> /tmp/ccc9IP00.o(.text+0x31): undefined reference to `f'
> $ ./m
> Segmentation fault
The result of dlopen is merely a handle to the library in question.
To get a given symbol (in this case "f") you need to do a dlsym( handle,
"f" )

I would advise you to look at the man page for dlopen/dlsym/dlclose.

HTH,
--ag
-- 
Artie Gold, Austin, TX  (finger the cs.utexas.edu account for more info)
mailto:[EMAIL PROTECTED] or mailto:[EMAIL PROTECTED]
--
A: Look for a lawyer who speaks Aramaic...about trademark infringement.

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

From: Donald Arseneau <[EMAIL PROTECTED]>
Subject: Re: getchar with timeout?
Date: 07 Mar 2000 18:46:31 -0800

[EMAIL PROTECTED] (Juergen Heinzl) writes:

> In article <[EMAIL PROTECTED]>, nightstalker wrote:
> >Donald Arseneau wrote:
> >
> >> I'm wondering if anyone has pointers to a simple getchar() with
> >> a timeout.  Curses has a good getch and timeout, but I don't want
> >> to use ncurses screen management or cooked escape sequences.
> 
> http://www.monocerus.demon.co.uk/httpd-server/juergen/code/c/unix/getch.html

Thanks everybody.  It is working fine now based on Juergen's 
example.  That piece is very well explained, and seems to be
careful about the details.

> >void alarm_func()
> >{
> >        printf("\n20 second time-out reached ... aborting !\n");
> >        exit(0);
> >}

Although nightstalker's alarm example worked as shown, I couldn't
convert it to getchar(), and I couldn't see how to do anything
less drastic than exit() (unless I forked to read each character!)


[EMAIL PROTECTED] (Paul D. Boyle) writes:

> Yes, use ioctl(2) with the FIONREAD request.  For example, on file

>     ret = ioctl( fd, FIONREAD, &n_to_read );

This example is like my almost-successful try, and I think it 
will work; I haven't tried it yet though.

Thanks again.

Donald Arseneau                         [EMAIL PROTECTED]

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


** 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 (and comp.os.linux.development.apps) via:

    Internet: [EMAIL PROTECTED]

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