Linux Tips #16



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

If you like Tip of the Day please share it with friends and 
co-workers, and encourage them to sign up! It's free. You can
unsubscribe or change your e-mail address at any time.

To subscribe to or unsubscribe from this newsletter:
* Use your browser to visit our Newsletter Subscription Center:
  http://www.winmag.com/subscribe/
* Scroll down to the Tip of the Day section.
* Click "Choose an option," and select Subscribe or Unsubscribe.
* Scroll to the top of the page, and type your e-mail address 
  in the "E-mail" field.
* Click the Submit button below your e-mail address.

Copyright 2000 CMP Media Inc. A service of Winmag.com.
http://www.winmag.com/

Distributed by MessageMedia Inc. - http://www.messagemedia.com

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


*1. Jason from Kesseltown, WV just installed Linux on his machine
 and wonders how to install software that doesn't come already
 compiled. That's one of the problems with Linux - it expects
 more of you than Windows. In this case, you'll have to compile
 the source code into binary files you can actually run. The
 first place to look for help is the INSTALL text file that
 comes with all such programs. You can get general help on all
 Linux topics from the Linux Documentation Project
 http://www.redhat.com/mirrors/LDP/. Make sure to read Mendel
 Cooper's HOW-TO on "Building and Installing Software
 Packages for Linux."

http://www.redhat.com/mirrors/LDP/HOWTO/Software-Building-HOWTO.html


*2. THE SAWMILL WINDOW MANAGER                 
        
Sawmill is a highly configurable window manager for Linux and
 several Unix flavors. Its major advantage over the Enlightenment
 window manager is its minimal system requirements. Thus, it can
 run on Linux machines that have slow processors and
 minimal memory. 

Sawmill is distributed under the terms of the GNU GPL license.
 You can find more information on Sawmill and download it from 

http://www.dcs.warwick.ac.uk/~john/sw/sawmill/


*3. THE QUANDARIES OF FLOATING POINT NUMBERS                 
        
People sometimes complain about the inaccuracy of floating point
 arithmetic. To demonstrate that, try the following program: 

#include <stdio.h> 
int main() 
{ 
  float f1 = 2000.58; 
  float f2 =  2000.0; 
  printf("%f", f1 - f2); 
} 

On an Intel-based machine, this program prints 0.579956 instead
 of 0.58. More complex calculations yield higher inaccuracy. What
 is going on here? First, remember that rounding, approximation,
 and truncation are not the responsibility of a particular
 programming language or compiler. Rather, they depend on the
 hardware that your machine uses. Floating point numbers are
 merely an approximation based on the IEEE standard. On most
 machines, the type float occupies 32 bits. The IEEE standard for
 32-bit floating point numbers requires that 1 bit be used for
 the sign representation, 8 bits for exponent, and the remaining
 23 bits are for the mantissa. Since a mantissa always has the
 form 1.nnnn..., the leading 1 can be dropped, so there are
 actually 24 bits allocated for the mantissa. This 24-bit
 accuracy can have a deviation of plus or minus %0.0000062 from
 the original number. For higher accuracy, you can use the type
 double, which provides 53 bits of mantissa. This is more
 accurate than 24 bits, but you can never get absolute accuracy
 with built-in data types.


*4. UNDERSTANDING COPY-ON-WRITE                 
        
When you invoke the fork() command, Linux creates a new process
 that is an exact copy of the existing one. When Linux
 instantiates the new process, it uses an optimization method
 called "copy-on-write." Instead of copying the memory block that
 contains the original process's attributes, the new process's
 attributes are mapped to the original memory block and marked as
 "read-only." When the new process changes any of its attributes,
 it attempts to write to that read-only memory block.
 Consequently, the exception handler allocates a new block of
 memory, copies the data into it, marks the newly allocated block
 as "write-enabled," and changes the mapping of the new process
 to it. Thus, no actual copy takes place as long as the new
 process doesn't change any of its attributes.


*5. LINUX 2000 ORGANIZATION                 
        
Linux 2000 Online is a resource site for Linux users--beginners
 and experienced alike. The site contains forums, links to
 portals, hardware and software vendors, and newsgroups from all
 over the world. The Linux 2000 Online site is at 

http://www.linux-2000.org/


*6. WHAT IS A SIDE EFFECT?                 
        
In standard C and C++, a side effect is defined as a "change in
 the state of the execution environment." Modifying an object,
 accessing an object that is declared volatile, invoking an I/O
 function, or calling a function that does any of these
 operations are all side effects. The validity of many operations
 depends on the existence of a side effect (or lack thereof). The
 following are instances of side effects: 

volatile int n = 0; int j = 0; 
++j; /* object modification */ 
j = n; /* two side effects: accessing a volatile object
          and modifying 
j */ 
printf( "hello world"); /* I/O function call */


*7. AVOID PASSING ARGUMENTS WITH SIDE EFFECTS                 
        
Many of the ANSI C functions are in fact macros in disguise.
 <stdlib.h> routines, memset(), strcpy(), and other runtime
 library functions are examples of such macros in disguise. You
 should beware of passing expressions with a side effect as
 arguments to these functions, because the results may be
 undefined. Consider the following example: 

char buff[12]; 
int n = 0; 
memset(buff, ++n, sizeof(buff); /* ++n has a side-effect;
     bad idea */ 

If memset() happens to be a macro that passes its arguments to
 another function, the value of n may be incremented twice before
 it is used.


*8. THE UTOPIX WEB SITE                 
        
Utopix is a Web site dedicated to Linux and Windows users alike.
 It provides news from the Linux industry and promotes the
 adoption of Linux as a mainstream OS. The site offers a chat
 room, a forum, and online polls. You can find Utopix at 

http://utopix.cjb.net/


*9. THE REBOL PROGRAMMING LANGUAGE                 
        
REBOL (Relative Expression-Based Object Language) is a new,
 portable, general purpose, and efficient programming language
 for intercommunications and interoperability. The language
 supports almost 40 hardware platforms, including Win32, Solaris,
 various Unix flavors, Macintosh, and Linux. REBOL has a simple
 and intuitive structure with English-like syntax. You can find
 further info on REBOL at 

http://www.rebol.com


*10. THE GEEKNEWS ORGANIZATION                 
        
The Geeknews site is devoted to reporting Linux-related
 technology news from around the Web. The site includes news
 flashes, reviews, and downloads of open source software tools.
 The Geeknews Web site is at 

http://www.Geeknews.org
