mirror of https://github.com/tLDP/LDP
updated
This commit is contained in:
parent
740f7532f8
commit
43d59f8474
File diff suppressed because it is too large
Load Diff
|
@ -42,7 +42,7 @@ C++ Programming HOW-TO
|
|||
<author>Al Dev (Alavoor Vasudevan)
|
||||
<htmlurl url="mailto:alavoor@yahoo.com"
|
||||
name="alavoor@yahoo.com">
|
||||
<date>v17.0, 08 Oct 2000
|
||||
<date>v19.0, 16 Oct 2000
|
||||
<abstract>
|
||||
This document discusses methods to avoid memory problems in C++ and
|
||||
also will help you to program properly in C++ language.
|
||||
|
@ -185,6 +185,60 @@ about the memory problems and memory allocation at all!!
|
|||
|
||||
|
||||
|
||||
-->
|
||||
<sect1> COOP - C++ Object Oriented Programming-language
|
||||
<p>
|
||||
"C++" is the super-set of "C" and it is proposed that super-set
|
||||
of "C++" be named <bf>COOP</bf> which is acronym for "
|
||||
<bf>C++</bf>
|
||||
<bf> O</bf>
|
||||
bject
|
||||
<bf> O</bf>
|
||||
riented
|
||||
<bf> P</bf>
|
||||
rogramming-language" pronounced as <bf>"koooop"</bf>.
|
||||
The "C" files have *.c as file extenstions, "C++" have *.cpp
|
||||
and it is proposed that "COOP" have *.coo as file extenstions.
|
||||
There is a need for "COOP" because I found some programs which were written
|
||||
in C++ but never used Object oriented techniques!! Also programs
|
||||
written in C++ are very hard to maitain as someone can write "C" like programs
|
||||
with C++!!
|
||||
The following can be the features of COOP -
|
||||
<itemize>
|
||||
<item> Is a super-set of C++ language but will force programmer to
|
||||
use obejct oriented programming.
|
||||
<item> Pure Object-oriented langauge but retains syntax of C++.
|
||||
<item> Remove all bad features of C++ in COOP.
|
||||
<item> Prevent writing "C" like programming in COOP, something which C++ currently allows.
|
||||
<item> Syntax very close to C++.
|
||||
<item> Maintaining code written in "COOP" will be more easy.
|
||||
<item> Code written in "COOP" will be re-usable (thru components, modules, objects).
|
||||
<item> No downward compatibility to "C" language.
|
||||
<item> Borrow best ideas from Microsoft's C#, Java and Python.
|
||||
<item> COOP is simple, robust, OOP, has bare mininum syntax (avoiding confusing, redundant, extra constructs)
|
||||
<item> COOP is GNU/GPL and is open-standard language.
|
||||
</itemize>
|
||||
|
||||
In order implement this "COOP" borrow ideas from -
|
||||
<itemize>
|
||||
<item> Java - Sun Microsystem put lot of effort, and you can simply utilize that.
|
||||
<item> C# - Microsoft put lot of efforts, and you can simply utilize them. Specs at
|
||||
<url url="http://msdn.microsoft.com/vstudio/nextgen/technology/csharpdownload.asp">
|
||||
</itemize>
|
||||
|
||||
COOP will compete with proprietary Microsoft C# and Sun's Java langauges.
|
||||
Microsoft C# overview is at -
|
||||
<url url="http://msdn.microsoft.com/vstudio/nextgen/technology/csharpintro.asp">.
|
||||
Microsoft should have named C# as "COOP" because "coop" is a better name than C#
|
||||
and more easy to say and files can have *.coo as extension!!
|
||||
Also take a look at Connective C++ at <url url="http://www.quintessent.com/products/cc++">.
|
||||
<!--
|
||||
*******************************************
|
||||
************ End of Section ***************
|
||||
*******************************************
|
||||
|
||||
|
||||
|
||||
-->
|
||||
<sect1>Which one "C", "C++" or Java ?
|
||||
<p>
|
||||
|
@ -405,19 +459,26 @@ as much as possible.
|
|||
To make
|
||||
<bf>delete</bf>
|
||||
command even more cleaner, make a Zap() command. Define
|
||||
a zap() command like this:
|
||||
a zap() or delete9() command like this:
|
||||
<code>
|
||||
/*
|
||||
** Use do while to make it robust and bullet-proof macro.
|
||||
** For example, if "do-while" is NOT used then results will be
|
||||
** something else just as in -
|
||||
** if (bbint == 4)
|
||||
** aa = 0
|
||||
** else
|
||||
** zap(aptr); // Problem!! aptr will be always set to NULL
|
||||
*/
|
||||
|
||||
** Note: But not using do while works for some C++ pre-processors ..
|
||||
#define zap(x) do { delete(x); x = NULL; } while (0)
|
||||
#define delete9(x) do { delete(x); x = NULL; } while (0)
|
||||
*/
|
||||
#define zap(x) { delete(x); x = NULL; }
|
||||
#define delete9(x) { delete(x); x = NULL; }
|
||||
</code>
|
||||
|
||||
Make sure that your C++ pre-processor is putting the surrounding brackets
|
||||
for delete. If it does not then use the do - while loop.
|
||||
Use -E option with GNU C++ to generate only the pre-processed file
|
||||
and view the output file to verify.
|
||||
Test using this -
|
||||
<code>
|
||||
bash$ g++ -E example_String.cpp > preprocess.out
|
||||
bash$ vi preprocess.out
|
||||
</code>
|
||||
|
||||
The zap() command will delete the pointer and set it NULL.
|
||||
|
@ -432,6 +493,7 @@ program will not crash. For example -
|
|||
|
||||
zap(pLastname);
|
||||
zap(pJobDescription);
|
||||
delete9(pFirstname); // you can use either zap or delete9
|
||||
</code>
|
||||
|
||||
There is nothing magical about this, it just saves
|
||||
|
@ -661,6 +723,8 @@ Visit the following C++ sites :-
|
|||
<item>C++ Memory site<url url="http://www.troubleshooters.com/codecorn/memleak.htm">
|
||||
<item>C++ Online Textbook <url url="http://www.bruceeckel.com/DownloadSites">
|
||||
<item>Porting C++ to Java <url url="http://www.ibm.com/java/education/portingc">
|
||||
<item>GNU Main site <url url="http://www.gnu.org"> and gnu C++ site at
|
||||
<url url="http://www.gnu.org/software/gcc/gcc.html">
|
||||
<item>GNU C++ Library - socs <url url="http://www.socs.uts.edu.au/doc/gnuinfo/libg++/libg++_18.html">
|
||||
<item>GNU C++ Library - gsi <url url="http://www.gsi.de/doc/gnu/libg++_toc.html">
|
||||
<item>GNU C++ Library - techno <url url="http://www.techno.spb.ru/~xbatob/FAQ/GNU/libg++_toc.html">
|
||||
|
@ -1008,6 +1072,8 @@ void zap_example()
|
|||
zap(pp);
|
||||
zap(pp); // no core dump here!!
|
||||
zap(pp); // no core dump here!!
|
||||
|
||||
delete9(pp); // you can use either zap or delete9
|
||||
}
|
||||
|
||||
// Sample code to demo imitation of Java's String class
|
||||
|
@ -5108,6 +5174,7 @@ To get this file, in the web-browser, save this file as 'Text' type.
|
|||
/* Use zap instead of delete as this will be very clean!!
|
||||
** Use do while to make it robust and bullet-proof macro
|
||||
*/
|
||||
// You can use either zap or delete9
|
||||
/*
|
||||
template <class T*>
|
||||
inline void zap( T*& p )
|
||||
|
@ -5117,6 +5184,7 @@ inline void zap( T*& p )
|
|||
}
|
||||
*/
|
||||
#define zap(x) do { delete(x); x = 0; } while (0)
|
||||
#define delete9(x) do { delete(x); x = 0; } while (0)
|
||||
|
||||
void *local_my_malloc(size_t size, char fname[], int lineno);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ Covers PostgreSQL Version 6.5.3
|
|||
<author>Al Dev (Alavoor Vasudevan)
|
||||
<htmlurl url="mailto:alavoor@yahoo.com"
|
||||
name="alavoor@yahoo.com">
|
||||
<date>v33.0, 10 Oct 2000
|
||||
<date>v34.0, 15 Oct 2000
|
||||
<abstract>
|
||||
This document is a "practical guide" to very quickly setup a SQL Database
|
||||
engine and
|
||||
|
@ -283,8 +283,9 @@ this universe you are currently living in.
|
|||
It is indeed possible for man to create a new universe.
|
||||
Total number of universes that can be created
|
||||
is <bf>INFINITY</bf> and similarly total number of operating systems that
|
||||
can be created is also <bf>infinity</bf>!! Infinite number
|
||||
universes and infinite
|
||||
can be created is also <bf>infinity</bf>!! There are millions of universes
|
||||
classified into 3 major categories.
|
||||
Infinite number universes and infinite
|
||||
variety of multi-dimensional atoms collapse down
|
||||
into few <it>primary-dimensional-universe</it>. Very advanced mathematical
|
||||
equations support this theory.
|
||||
|
@ -492,7 +493,7 @@ Read the benchmarks at <url url="http://www.greatbridge.com/news/p_081420001.htm
|
|||
*******************************************
|
||||
|
||||
-->
|
||||
<sect1> MySQL and other duplicate RDBMSes should be eradicated
|
||||
<sect1> MySQL and other duplicate RDBMSes
|
||||
<p>
|
||||
MySQL is another open-source SQL server, but it does not support
|
||||
transactions. It is suitable for very small databases and does not
|
||||
|
@ -504,6 +505,10 @@ advanced features which are not available in commercial database systems!!
|
|||
|
||||
In near future development of MySQL will be dropped,
|
||||
since MySQL is duplicate product working towards ANSI SQL.
|
||||
We would take the most advanced and mature open-source SQL server and
|
||||
drop all others as we do not have lots of time (to deal with multiple
|
||||
RDBMSes)!! In fact, you do not have time to deal with just one
|
||||
powerful SQL server like PostgreSQL!
|
||||
And all the MySQL users will be migrated to PostgreSQL.
|
||||
Also MySQL is a 'quasi-commercial' product unlike
|
||||
PostgreSQL which is open-source and there is no license fee.
|
||||
|
@ -517,6 +522,7 @@ Duplicate products cause more harm than good and hence division of
|
|||
resources must be strongly discouraged. This already happened in case of
|
||||
commercial database systems like Oracle, Sybase, Informix and MS SQL server
|
||||
which caused splintering of user base and often they are incompatible.
|
||||
<bf><it>I want put the source code of SQL server under your control!!!</it></bf>
|
||||
|
||||
You do not need hundreds of database systems, all you need is just one
|
||||
best database server which happens to be 'PostgreSQL'.
|
||||
|
@ -1382,6 +1388,10 @@ other manuals.
|
|||
-->
|
||||
<sect>PostgreSQL Supports Extremely Large Databases greater than 200 Gig
|
||||
<p>
|
||||
PostgreSQL is already used by many companies supporting large databases.
|
||||
The following techniques are suggested :
|
||||
<sect1> CPU types - 32-bit or 64-bit
|
||||
<p>
|
||||
Performance of 32-bit cpu machines will decline rapidly when the database size
|
||||
exceeds 5 GigaByte. You can run 30 gig database on 32-bit cpu but the
|
||||
performance will be degraded.
|
||||
|
@ -1405,6 +1415,60 @@ large databases, support much larger memory (RAM), have more capabilities etc..
|
|||
************ End of Section ***************
|
||||
*******************************************
|
||||
|
||||
-->
|
||||
<sect1> Multiple CPUs
|
||||
<p>
|
||||
For large databases it is recommended that you use SMP boxes which have 4, 16 or
|
||||
32 CPUs. Alternatively, you can use 4 or 5 single CPU boxes and you can
|
||||
partition the database into 4 or 5 seperate databases and each database running
|
||||
on a seperate box. Each CPU will be connected with fast NIC (100MBits) ethernet card.
|
||||
For example - if you have 200 tables in a database, you
|
||||
can distribute 200 tables to 4 database each having 50 tables.
|
||||
In this way, you are distributing the load evenly among 4 seperate machines.
|
||||
This is a cheaper alternative to
|
||||
4-way CPU box. You would use
|
||||
<bf>'Queries across multiple databases'</bf>,
|
||||
NFS mounts in LAN,
|
||||
'CREATE VIEW' for read-only tables
|
||||
to accomplish this task. And each CPU "can see" all the databases i.e all the
|
||||
200 tables.
|
||||
In future PostgreSQL may provide support for <bf>'Queries across multiple
|
||||
databases'</bf> (already in the TODO list), which may appear in upcoming version 7.1.
|
||||
For example, queries across multiple databases using aliases a, b for table names
|
||||
can be like -
|
||||
<code>
|
||||
select a.col1, a.col2, b.col4, b.col7
|
||||
from
|
||||
database1.my_tablea a, database2.my_tableb b
|
||||
where
|
||||
a.col1 = b.col3 and
|
||||
a.col4 = b.col9;
|
||||
|
||||
update my_tablea
|
||||
set
|
||||
col1 = b.col2
|
||||
from
|
||||
database1.my_tablea a, database2.my_tableb b
|
||||
where
|
||||
a.col4 = b.col9;
|
||||
</code>
|
||||
<!--
|
||||
*******************************************
|
||||
************ End of Section ***************
|
||||
*******************************************
|
||||
|
||||
-->
|
||||
<sect1> Replication Server
|
||||
<p>
|
||||
Replication server for large enterprises/businesses is sold commercially by
|
||||
PostgreSQL Inc. You use replication server to provide redundancy and
|
||||
high availability. Replication server is a complex, sophisticated product
|
||||
and hence costs $$$$s.
|
||||
<!--
|
||||
*******************************************
|
||||
************ End of Section ***************
|
||||
*******************************************
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -2557,6 +2621,21 @@ it at
|
|||
<htmlurl url="mailto:de@ucolick.org"
|
||||
name="de@ucolick.org">
|
||||
</itemize>
|
||||
<!--
|
||||
|
||||
*******************************************
|
||||
************ End of Section ***************
|
||||
*******************************************
|
||||
-->
|
||||
<sect1> PgAdmin, PhpPgAdmin tools
|
||||
<p>
|
||||
<itemize>
|
||||
<item> PgAdmin tool for Windows 95/NT
|
||||
Database design tool for PostgreSQL for Windows 95/NT
|
||||
<url url="http://www.pgadmin.freeserve.co.uk">
|
||||
<item> Web based admin tool - PhpPgAdmin for Postgresql is at
|
||||
<url url="http://www.phpwizard.net/projects/phpPgAdmin">
|
||||
</itemize>
|
||||
<!--
|
||||
*******************************************
|
||||
************ End of Section ***************
|
||||
|
@ -2572,7 +2651,28 @@ it at
|
|||
The following CPUs (both 64-bit and 32-bit) are available for PostgreSQL. All these
|
||||
CPUs run Linux.
|
||||
<itemize>
|
||||
<item> GNU/GPL Freedom 64-bit F-CPU <url url="http://f-cpu.tux.org">
|
||||
<item> Main CPU site is : Google Search engine CPU site "Computers>Hardware>Components>Microprocessors" <url url="http://directory.google.com/Top/Computers/Hardware/Components/Microprocessors">
|
||||
</itemize>
|
||||
|
||||
The following is GNU/GPL open-source CPU list:
|
||||
<itemize>
|
||||
<item> Open-source CPU site - Google Search "Computers>Hardware>Open Source"
|
||||
<url url="http://directory.google.com/Top/Computers/Hardware/Open_Source">
|
||||
<item> European Space Agency's ESA-32bit and ESA-64bit CPUs "LEON" Sparc <url url="http://www.estec.esa.nl/wsmwww/leon">
|
||||
<item> ARM CPU <url url="http://www.arm.com/Documentation">
|
||||
<item> Cogent CPUs <url url="http://www.cogcomp.com">
|
||||
<item> GNU/GPL Freedom 64-bit F-CPU
|
||||
<url url="http://www.f-cpu.org"> or at
|
||||
<url url="http://f-cpu.tux.org">
|
||||
<item> STM 32-bit, 2-way superscalar RISC CPU <url url="http://www.asahi-net.or.jp/~uf8e-itu">
|
||||
<item> Free microprocessor and DSP IP cores written in Verilog or VHDL <url url="http://www.cmosexod.com">
|
||||
<item> Free hardware cores to speed development <url url="http://www.scrap.de/html/opencore.htm">
|
||||
<item> Opencores org - open source, free IP cores <url url="http://www.opencores.org">
|
||||
<item> Linux open hardware and free EDA systems <url url="http://opencollector.org">
|
||||
</itemize>
|
||||
|
||||
The following is commercial CPU list:
|
||||
<itemize>
|
||||
<item> Russian E2k 64-bit CPU (Very fast CPU !!!)
|
||||
website : <url url="http://www.elbrus.ru/roadmap/e2k.html">
|
||||
Elbrus is now partnered (alliance) with Sun Microsystems of USA
|
||||
|
@ -2586,8 +2686,11 @@ CPUs run Linux.
|
|||
<item> Sun Ultra-sparc 64-bit CPU
|
||||
<url url="http://www.sun.com">
|
||||
or <url url="http://www.sunmicrosystems.com">
|
||||
<item> MIPS RISC CPUs <url url="http://www.mips.com">
|
||||
<item> Silicon Graphics MIPS Architecture CPUs <url url="http://www.sgi.com/processors">
|
||||
<item> IDT MIPS Architecture CPUs <url url="http://www.idt.com">
|
||||
<item> IBM Power PC (motorola) <url url="http://www.motorola.com/SPS/PowerPC/index.html">
|
||||
<item> Motorola embedded processors. SPS processor based on PowerPC, M-CORE, ColdFire, M68k, or M68HC cores <url url="http://www.mot-sps.com">
|
||||
<item> Hitachi SuperH 64-bit RISC processor SH7750 <url url="http://www.hitachi.com"> sold at $40 per cpu in quantities of 10,000
|
||||
<item> Fujitsu 64-bit processor <url url="http://www.fujitsu.com">
|
||||
<item> HAL (California) Super-Sparc 64-bit processor <url url="http://www.hal.com"> also compatible to Sun's sparc architecture.
|
||||
|
@ -2595,9 +2698,17 @@ or <url url="http://www.sunmicrosystems.com">
|
|||
<item> Intel X86 series 32-bit CPUs Pentiums, Celeron etc..
|
||||
<item> AMDs X86 series 32-bit CPUs K-6, Athlon etc..
|
||||
<item> National's Cyrix X86 series 32-bit CPUs Cyrix etc..
|
||||
<item> European Space Agency's ESA-32bit and ESA-64bit CPUs
|
||||
<item> Other CPUs from other countries (Taiwan, Korea, Japan) ?? Let me know...
|
||||
</itemize>
|
||||
|
||||
Other important CPU sites are at -
|
||||
<itemize>
|
||||
<item> World-wide 24-hour news on CPUs <url url="http://www.newsnow.co.uk/cgi/NewsNow/NewsLink.htm?Theme=Processors">
|
||||
<item> The computer architecture site is at <url url="http://www.cs.wisc.edu/~arch/www">
|
||||
<item> ARM CPU <url url="http://www.arm.com/Documentation">
|
||||
<item> Great CPUs <url url="http://www.cs.uregina.ca/~bayko/cpu.html">
|
||||
<item> Microdesign resources <url url="http://www.mdronline.com">
|
||||
</itemize>
|
||||
<!--
|
||||
*******************************************
|
||||
************ End of Section ***************
|
||||
|
|
Loading…
Reference in New Issue