Recent Posts

Pages: [1] 2 3 ... 10
1
Code: [Select]
// several 'definitions' follow ... //

template< typename T >
void print( const T ary[], size_t size )
{
    for( size_t i = 0; i < size; ++i ) cout << setw(8) << ary[i];
    if( size ) std::cout << std::endl;
}
template< typename T >
void print( const vector < T >& v )
{
    for( size_t i = 0; i < v.size(); ++i ) cout << setw(8) << v[i];
    if( v.size() ) cout << endl;
}

template< typename T >
bool isSorted( const T* ary, size_t size, bool a )
{
    if( a ) // ascending
    {
        for( int i = size-1; i > 0; --i )
        {
            if( ary[i-1] > ary[i] )
            {
#if myDebug
                cout << ary[i-1] << ", " << ary[i] << endl;
                pause();
#endif
                return false;
            }
        }
    }
    else // descending //
    {
        for( int i = size-1; i > 0; --i )
        {
            if( ary[i-1] < ary[i] )
            {
#if myDebug
                cout << ary[i-1] << ", " << ary[i] << endl;
                pause();
#endif
                return false;
            }
        }
    }
    // else ...
    return true;
}
template< typename T >
bool isSorted( const vector< T >& ary, bool a )
{
    if( a )
    {
        for( int i = ary.size()-1 ; i > 0 ; --i )
        {
            if( ary[i-1] > ary[i] )
            {
#if myDebug
                cout << ary[i-1] << ", " << ary[i] << endl;
                pause();
#endif
                return false;
            }
        }
    }
    else
    {
        for( int i = ary.size()-1 ; i > 0 ; --i )
        {
            if( ary[i-1] < ary[i] )
            {
#if myDebug
                cout << ary[i-1] << ", " << ary[i] << endl;
                pause();
#endif
                return false;
            }
        }
    }
    // else ...
    return true;
}

bool isSortedCstrs( char** ary, size_t size, bool a )
{
    if( a ) // ascending
    {
        for( int i = size-1; i > 0; --i )
        {
            if( strcmp( ary[i-1], ary[i] ) > 0 )
            {
#if myDebug
                cout << "'" << ary[i-1] << "', '" << ary[i] << "'\n";
                pause();
#endif
                return false;
            }
        }
    }
    else // descending //
    {
        for( int i = size-1; i > 0; --i )
        {
            if( strcmp( ary[i-1], ary[i] ) < 0 )
            {
#if myDebug
                cout << "'" << ary[i-1] << "', '" << ary[i] << "'\n";
                pause();
#endif
                return false;
            }
        }
    }
    // else ...
    return true;
}

bool fillFromFile( const char* fname, Words& wds, std::map<  string, int >& myPairs )
{
    ifstream fin( fname );
    if( fin.is_open() )
    {
        string line, word;
        while( getline( fin, line ) )
        {
            istringstream iss(line);
            while( iss >> word )
            {

                if( word[0] == '[' ) continue;

                toAllCaps( word );

                unsigned i = 0, len = word.size();
                while( i < len  &&  ('A' <= word[i] && word[i] <= 'Z') )
                    ++i ;

                if( i < len )
                    word.erase(i);

                if( !word.size() ) continue;


                if( myPairs.count( word ) ) ++ myPairs[word] ;
                else myPairs[word]  = 1;

                wds.push_back( word );
            }
        }
        fin.close();
        return true;
    }
    // else
    std::cout << "\nThere was a problem opening file "
              << fname << "\n\n";
    return false;
}

void toAllCaps( string& str )
{
    unsigned i = 0, len = str.size();
    while( i < len ) {
        str[i] = toupper(str[i]);
        ++ i;
    }
}

void pause( const string& msg )
{
    cout << msg << flush;
    string dummyLine;
    getline( cin, dummyLine );
}



// typical output to first part ... //
/*
There were 300160 words read from file: 'Psalms119times128.txt'
495 of which were unique ...

Re. the vector 'myWords' and the array 'ary' ...

Time to msort vector was 0.499 seconds.
Time to msort vector (passing in functor) was 0.499 seconds.
Time to msort vector (down, passing in functor) was 0.374 seconds.

Time to msort array was 0.515 seconds.
Time to msort array (passing in functor) was 0.523 seconds.
Time to msort array (down, passing in functor) was 0.43 seconds.

Time to qSort2 vector was 0.327 seconds.
Time to qSort2 vector (passing in functor) was 0.358 seconds.
Time to qSort2 vector (down, passing in functor) was 0.297 seconds.

Time to qSort2 array was 0.296 seconds.
Time to qSort2 array (passing in functor) was 0.327 seconds.
Time to qSort2 array (down, passing in functor) was 0.281 seconds.

Time to qSort vector was 0.265 seconds.
Time to qSort vector (passing in functor) was 0.265 seconds.
Time to qSort vector (down, passing in functor) was 0.218 seconds.

Time to qsort array of string was 0.124 seconds.
Time to qsort array of string (down) was 0.094 seconds.

Time to qsort ragged array was 0.093 seconds.
Time to qsort ragged array (down) was 0.031 seconds.

Time to C++ library sort vector was 0.156 seconds.
Time to C++ library sort vector (passing in compare function) was 0.171 seconds.

Time to C++ library sort vector (down, passing in compare function) was 0.125 se
conds.

Time to shellsort vector was 0.608 seconds.
Time to shellsort vector (passing in functor) was 0.558 seconds.
Time to shellsort vector (down, passing in functor) was 0.421 seconds.
Press 'Enter' to continue and see the (word, count) pairs ...
The word: 'A' occured 1536 times =? 1536 times.
The word: 'ABHOR' occured 128 times =? 128 times.
The word: 'ABIDETH' occured 128 times =? 128 times.
The word: 'ABOVE' occured 256 times =? 256 times.
The word: 'ACCEPT' occured 128 times =? 128 times.
The word: 'ACCORDING' occured 2304 times =? 2304 times.
The word: 'AFFLICTED' occured 512 times =? 512 times.
The word: 'AFFLICTION' occured 384 times =? 384 times.
The word: 'AFRAID' occured 128 times =? 128 times.
The word: 'AFTER' occured 512 times =? 512 times.
The word: 'AGAINST' occured 384 times =? 384 times.
The word: 'AIN' occured 128 times =? 128 times.
The word: 'ALEPH' occured 128 times =? 128 times.
The word: 'ALL' occured 2304 times =? 2304 times.
The word: 'ALMOST' occured 128 times =? 128 times.
The word: 'ALSO' occured 768 times =? 768 times.
The word: 'ALWAY' occured 128 times =? 128 times.
The word: 'AM' occured 384 times =? 384 times.
The word: 'AN' occured 384 times =? 384 times.
The word: 'ANCIENTS' occured 128 times =? 128 times.
Press 'Enter' to continue ...
The word: 'AND' occured 8064 times =? 8064 times.
The word: 'ANGUISH' occured 128 times =? 128 times.
The word: 'ANSWER' occured 128 times =? 128 times.
The word: 'ANY' occured 128 times =? 128 times.
The word: 'ARE' occured 384 times =? 384 times.
The word: 'ART' occured 128 times =? 128 times.
The word: 'AS' occured 896 times =? 896 times.
The word: 'ASHAMED' occured 640 times =? 640 times.
The word: 'ASTRAY' occured 256 times =? 256 times.
The word: 'AT' occured 512 times =? 512 times.
The word: 'AWAY' occured 384 times =? 384 times.
The word: 'AWE' occured 128 times =? 128 times.
The word: 'BANDS' occured 128 times =? 128 times.
The word: 'BE' occured 1664 times =? 1664 times.
The word: 'BECAUSE' occured 1152 times =? 1152 times.
The word: 'BECOME' occured 128 times =? 128 times.
The word: 'BEEN' occured 384 times =? 384 times.
The word: 'BEFORE' occured 640 times =? 640 times.
The word: 'BEGINNING' occured 128 times =? 128 times.
The word: 'BEHELD' occured 128 times =? 128 times.
Press 'Enter' to continue ...
*/
2
Here is a text file that I used in the times sorts above:


https://drive.google.com/file/d/15IyD5UD8bCp69qeE1IbOzweiNzivbm4A/view?usp=sharing


There were 75040 words read from file: 'Psalms119times32.txt'
495 of which were unique ...


Try this also with C++ library sort added ... also C qsort added with C strings

This next link has the data text file used in the program that follows ...

https://drive.google.com/file/d/1gzwjG_lJj46eEbOcI23ynIqk79WhTArY/view?usp=sharing

Code: [Select]
// test_msort_vs_qsort_etc.etc.cpp //  // 2018-10-10 //

/*
Merge-Sort times compared to various quick sort times and shell sort time //
*/

// sorts and counts word duplicates ...
// comparing TWO different methods
// 1. using a map to hold in insert sorted order, the (key.value) pairs -> (word, count)
// 2. using a vector to hold all the words, then after sorting it, count any duplicates. //



#define myDebug 1 // set to 0 to turn off, to 1 to turn on //

#include "msort.h" // NOTE!!!  ALSO has: typedef unsigned int uns; //
#include "qSort2.H"  // a NON 'record order preserving' qsort //
#include "qsort_isort_vector.h" // an 'record order preserving' qsort //

#include <iostream>
#include <fstream> // re. ifstream
#include <iomanip> // re. std::setw(..)
#include <sstream> // re. std::istringstream
#include <string>
#include <cctype> // re. isalpha, toupper

#include <vector>
#include <map>
#include <ctime> // re. running timimg via clock()
#include <cstdlib> // re. qsort //
#include <cstring> // re. strcmp //
#include <algorithm> // re. vector sorts using STL library sort //


using std::cin;
using std::cout;
using std::endl;
using std::flush;
using std::ifstream;
using std::setw;
using std::istringstream;
using std::string;
using std::vector;
using std::map;


const char* IN_FNAME = "Psalms119times128.txt";


template< typename T >
void print( const T ary[], size_t );

template< typename T >
void print( const vector < T >& );


template< typename T >
bool isSorted( const T* ary, size_t, bool a = true );

bool isSortedCstrs( char** ary, size_t, bool a = true );

template< typename T >
bool isSorted( const vector< T >&, bool a = true );


typedef std::vector<  string > Words; // this is used in next function qnd following ... //

bool fillFromFile( const char* fname, Words& wds, std::map< string, int >& myPairs );

void toAllCaps( string& str );
void pause( const string& msg = "Press 'Enter' to continue ... " );


char** toCstrings( const string* ary, size_t size )
{
    char** pp = (char**)malloc( size*sizeof(char*) );
    if( pp )
    {
        for( size_t i = 0; i < size; ++ i )
        {
            pp[i] = (char*)malloc( sizeof(char)*(ary[i].size() + 1) );
            if(pp[i])
            {
                size_t j = 0;
                for( ; j < ary[i].size(); ++ j ) pp[i][j] = ary[i][j];
                pp[i][j] = 0;
               
            }
            // else  print error and exit //
        }
    }
    // else print srror and exit //
    return pp;
}


struct MyCmp // re. demo sorting strings... using functors ... //
{
    int operator () ( const string& a, const string& b )
    {
        if( a < b ) return -1;
        if( a > b ) return  1;
        return 0;
    }
} ;
bool myStrCmp( const string& a, const string& b )
{
    return a < b;
}

struct MyCmpRev // re. demo sorting strings... using functors ... //
{
    int operator () ( const string& a, const string& b )
    {
        if( b < a ) return -1;
        if( b > a ) return  1;
        return 0;
    }
} ;

int myCmpCstr( const void* a, const void* b )
{
    //return strcmp( *(char* const*)a, *(char* const*)b ); // or //
    return strcmp( *(const char**)a, *(const char**)b );
}
bool myStrCmpRev( const string& a, const string& b )
{
    return b < a;
}

int myCmpCstrRev( const void* a, const void* b )
{
    //return strcmp( *(char* const*)b, *(char* const*)a ); // or //
    return strcmp( *(const char**)b, *(const char**)a );
}


int myqStrCmp( const void* a, const void* b )
{
    return ( (*(string*)a) ).compare( *(string*)b );
}
int myqStrCmpRev( const void* a, const void* b )
{
    return ( (*(string*)b) ).compare( *(string*)a );
}



int main() /////////// MAIN BEGINS /////////////////////////
{
    vector< string > myWords;
    map < string, int > myPairs; // to hold sorted (word, count) pairs //

    if( fillFromFile( IN_FNAME, myWords, myPairs ) )
    {

        // NOW ... GET/HOLD a copy of the 'unsorted'
        // vector in a 'new array' ...
        string* ary = new string[myWords.size()];
        string* aryCpy = new string[myWords.size()];
        for( unsigned i = 0; i < myWords.size(); ++ i )
            aryCpy[i] = ary[i] = myWords[i];


        double t1 = clock();
        msort( myWords, 0, myWords.size()-1 );
        double t2 = clock();


        cout << "There were " << myWords.size()
             << " words read from file: '" <<  IN_FNAME << "'\n"
             << myPairs.size()
             << " of which were unique ... \n\n"

             <<"Re. the vector 'myWords' and the array 'ary' ...\n "

             << "\nTime to msort vector was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted ... report only if NOT //


        // re-inital vector ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        MyCmp ascending;
        msort( myWords, 0, myWords.size()-1, ascending );
        t2 = clock();

        cout << "Time to msort vector (passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        t1 = clock();
        MyCmpRev descending;
        msort( myWords, 0, myWords.size()-1, descending );
        t2 = clock();

        cout << "Time to msort vector (down, passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords, false ); // test if rev. sorted  //
       
       
        ////////////////////////////////////////////////////////////
        t1 = clock();
        msort( ary, 0, myWords.size()-1 );
        t2 = clock();
        cout << "\nTime to msort array was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size() ); // test if sorted //

        // re-inital ary... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            ary[i] = aryCpy[i];

        t1 = clock();
        msort( ary, 0, myWords.size()-1, ascending );
        t2 = clock();
        cout << "Time to msort array (passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size() ); // test if sorted //

        t1 = clock();
        msort( ary, 0, myWords.size()-1, descending );
        t2 = clock();
        cout << "Time to msort array (down, passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size(), false ); // test if rev. sorted //
       
       
        ////////////////////////////////////////////////////////////
        // re-inital ary... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        qSort2( myWords, 0, myWords.size()-1 );
        t2 = clock();
        cout << "\nTime to qSort2 vector was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        // re-inital vector ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        qSort2( myWords, 0, myWords.size()-1, ascending );
        t2 = clock();
        cout << "Time to qSort2 vector (passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        t1 = clock();
        qSort2( myWords, 0, myWords.size()-1, descending );
        t2 = clock();
        cout << "Time to qSort2 vector (down, passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords, false ); // test if sorted //
       
       
        ////////////////////////////////////////////////////////////
        // re-inital ary ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            ary[i] = aryCpy[i];
        t1 = clock();
        qSort2( ary, 0, myWords.size()-1 );
        t2 = clock();
        cout << "\nTime to qSort2 array was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size() ); // test if sorted //

        // re-inital ary ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            ary[i] = aryCpy[i];

        t1 = clock();
        qSort2( ary, 0, myWords.size()-1, ascending );
        t2 = clock();
        cout << "Time to qSort2 array (passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size() ); // test if sorted //

        t1 = clock();
        qSort2( ary, 0, myWords.size()-1, descending );
        t2 = clock();
        cout << "Time to qSort2 array (down, passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size(), false ); // test if rev. sorted //
       
       
        ////////////////////////////////////////////////////////////
        // re-inital vector... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        qSort( myWords, 0, myWords.size()-1 );
        t2 = clock();
        cout << "\nTime to qSort vector was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        // re-inital vector ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        qSort( myWords, 0, myWords.size()-1, ascending );
        t2 = clock();
        cout << "Time to qSort vector (passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        t1 = clock();
        qSort( myWords, 0, myWords.size()-1, descending );
        t2 = clock();
        cout << "Time to qSort vector (down, passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords, false ); // test if rev. sorted //
       

        ////////////////////////////////////////////////////////////
        // re-inital ary... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            ary[i] = aryCpy[i];

        t1 = clock();
        qsort( ary, myWords.size(), sizeof(string), myqStrCmp );
        t2 = clock();
        cout << "\nTime to qsort array of string was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size() ); // test if sorted //

        t1 = clock();
        qsort( ary, myWords.size(), sizeof(string), myqStrCmpRev );
        t2 = clock();
        cout << "Time to qsort array of string (down) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( ary, myWords.size(), false ); // test if rev. sorted //
       
       
        ////////////////////////////////////////////////////////////
        // get ragged ary of C strings ... //
        char** rAryStrs = toCstrings( aryCpy, myWords.size() );
       
        // debugging ...
        // for( size_t k = 0; k < 10; ++ k ) cout << rAryStrs[k] << '\n';

        t1 = clock();
        qsort( rAryStrs, myWords.size(), sizeof(char*), myCmpCstr );
        t2 = clock();
        cout << "\nTime to qsort ragged array was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSortedCstrs( rAryStrs, myWords.size() ); // test if sorted //

        t1 = clock();
        qsort( rAryStrs, myWords.size(), sizeof(char*), myCmpCstrRev );
        t2 = clock();
        cout << "Time to qsort ragged array (down) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSortedCstrs( rAryStrs, myWords.size(), false ); // test if rev. sorted //
       
       
       
        ////////////////////////////////////////////////////////////
        // re-inital ary... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        sort( myWords.begin(), myWords.end() );
        t2 = clock();
        cout << "\nTime to C++ library sort vector was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        // re-inital vector ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        sort( myWords.begin(), myWords.end(), myStrCmp );
        t2 = clock();
        cout << "Time to C++ library sort vector (passing in compare function) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        t1 = clock();
        sort( myWords.begin(), myWords.end(), myStrCmpRev );
        t2 = clock();
        cout << "Time to C++ library sort vector (down, passing in compare function) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords, false ); // test if sorted //
       
       
       
        ////////////////////////////////////////////////////////////
        // re-inital vector ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        shellsort( myWords );
        t2 = clock();
        cout << "\nTime to shellsort vector was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        // re-inital vector ... //
        for( unsigned i = 0; i < myWords.size(); ++ i )
            myWords[i] = aryCpy[i];

        t1 = clock();
        shellsort( myWords, ascending );
        t2 = clock();
        cout << "Time to shellsort vector (passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords ); // test if sorted //

        t1 = clock();
        shellsort( myWords, descending );
        t2 = clock();
        cout << "Time to shellsort vector (down, passing in functor) was "
             << (t2-t1)/CLOCKS_PER_SEC << " seconds.\n";
        isSorted( myWords, false ); // test if sorted //


        qSort( myWords, 0, myWords.size()-1, ascending ); // resort up to get ready for next part //

        pause("Press 'Enter' to continue and see the (word, count) pairs ... " );



        // Ok ... show the words and count, 20 at a time ... //
       
        unsigned i = 0, count = 0, stop = 0;
        map< string, int >::const_iterator it; // to traverse the map ... //

        for( it = myPairs.begin(); it != myPairs.end(); ++ it )
        {
            ++stop; // pause every 20 words //

            while( (i < myWords.size())  &&  (myWords[i] == it->first) )
            {
                ++count;
                ++i;
            }
            cout << "The word: '" << it->first << "' occured "
                 << it->second << " times =? " << count << " times.\n";
            if( stop % 20 == 0 )
                pause();

            count = 0; // get ready to count the next duplicate words in the vector //
        }


        cout << "All done?  Now i = " << i
             << " and words in myWords = " << myWords.size() << endl;
             
        delete [] aryCpy;
        delete [] ary;
        // can you code up a clear function for the ragges array? //
    }

    pause( "\nPress 'Enter' to continue/exit ..." );

} //////////////////// MAIN ENDS ///////////////////////////

(CODE CONTINUES on next PAGE ... )
3
Ask the Author / A way to show your appreciation ..
« Last post by David on September 06, 2018, 02:52:33 AM »
I recently became aware of a delightful young lady neighbour who has hit a wall in her University studies for lack of funding ... so I thought to appeal to all who have appreciated the 'helps here' to donate whatever you would like to give, to help me to help her complete her professional goals.

In Canada, presently, the smallest paper amount, (paper will easily hide in an envelope), is a five dollar note, but please feel free to send any amount and I will keep a tally posted below here, of all funds received with your name also (unless you specify in your enclosed short note that you prefer to be anonymous.)

You can send mail to me at:

David W. Zavitz
3869 Concession 2
RR3
Stouffville, Ontario
Canada  L4A 7X4m

dwzavitz@gmail.com

P.S. This young lady is just 21, and recently lost her mom. I know her because my oldest granddaughter, went all through lower grades of school with her ... who will have their names at the top ... on the list below?

https://sites.google.com/site/andeveryeyeshallseehim/home/three-pups
4
Ask the Author / Re: A reply letter to a friend’s question ...
« Last post by David on July 23, 2018, 09:16:46 PM »
An addendum:

My friend, Sacha, the USA father of three, who I met as a ‘computer programming student’ several years ago (6 or 7?) ... added this pithy comment:

“The complexity of human existence takes the software / hardware analogy to an even higher level:

not only does the software (spirit, soul) affect the hardware (body), but the causality works in the other direction too.

This seems to indicate that the Intelligence that designed both intended to create a framework that establishes human responsibility...”
5
Ask the Author / Re: A reply letter to a friend’s question ...
« Last post by David on July 23, 2018, 09:14:01 PM »
An added thought I’d like to share ...

after my breakfast time together recently with my oldest grand-daughter ...

It concerns a very common fallacy for all to note well:

Let me start by stating the fallacy as simply as I might ...

The fallacy:

A person thinks that they are taking the ‘high ground’ by accusing the other person that ... that person just thinks that they ‘are right in their understanding.’

What the accuser forgets is best illustrated by the reality that we all regularly do go to ‘experts’ ...

Examples:

1) we take our car to a expert mechanic to get it fixed.

2) we take our deep long cut to a medical expert to have that cut sutured.

So ... it is not improper to think oneself to have a measure of expertise in a field of experience  ...  if ... that one is truly experienced in that area of activity.

In court:

we find that we do regularly bring in ‘an expert witness’ ... say in an area of forensic science to asset that the ‘evidence’ is either sound ... or not.

Or ... we bring in credible eye witnesses to give testimony of what they observed.

 So ... as ‘an expert enough’ witness in the field of computer programming ... I can confidently assert:

We **never ever** get a computer program, (i.e. code to do anything useful), without firstly designing and building the hardware and compatible software ... to do that ‘task’ ... 

and this process of ‘design / building’ **never ever** happens by using ‘undirected energy’ !!!!
6
Ask the Author / A reply letter to a friend’s question ...
« Last post by David on July 13, 2018, 10:22:58 PM »
Subject: A reply to a letter with a question from a friend

Update: FREE homework help NOW available ...


A copy for you to see and pass on as you see fit ...

Yesterday, I had an email from a friend in the USA ...

Please see copy/paste of main part of text below:


Hi David,

If you had a son today who was say, 11, 12, or 13 ... and he came to you and said:

"Dad, is evolution across species true?"

how would you guide him?

...

Thanks ...


My reply:


A good place to start is with:

Can you see that every house had a builder?

(i.e. every complex structure is designed and built to perform some function ... and a child can easily classify / play the game called: ‘Animal, Mineral, Vegetable’ ...)


Then ... I’d emphasize that we can be often deceived by repeated emphatic lies ...

For example, a child knows (and can know for sure) that any explosion, an example of *un-directed energy*,

*always* degrades existing order / structure ... i.e. *all* mutations *always* degrade

*pre-existing code* ...

(and note that mutations are examples of an *un-directed energy* event) ...

however we were designed/built with a DNA ‘code backup’ (and pre-built with hardware/software to permit this ‘restore operation’) ... so ... many mutations can be repaired / restored to original ... however as mutations build up ... to a critical loss of vital info ... extinction takes place ... so ... the fossil record is really a record of (Noah’s flood and) extinctions.


(The oft repeated *big lie* is that mutations are, very rarely, but sometimes, ‘helpful’ ... ‘helpful’ to create new ‘useful’ code, and that this ‘useful’ code accumulated over long periods to create purposeful structures and function ... by a process of survival of fittest ... *but* only *already* highly designed and prebuilt / predesigned systems can be ready to accommodate a limited variety of external conditions ... and they can ‘survive’ ... *only* as long as they are NOT degraded too much ... and only as long as they are still fit enough to ‘function’ in a new environment that is within the original design specs ... just ask any real engineer!)


The biblical ‘kind’ was created with the potential for a limited wide variation in ... offspring ...

but all mating of a ‘kind’ to a ‘different kind’ ...

*if* there is any (temporary) viable product ...

that 'product’ ...it is *always* sterile ... i.e. not able to reproduce.


An example of 'variation within the same kind' is seen in the hospitals these days where, if you go for even a short stay, you too often come away with an ‘opportunistic’ infection ...

The wide spread misuse of antibiotics, in modern medicine, (especially in hospitals), reduces the ‘vital healthy’ gut flora, (our vital healthy bacteria that keeps the pathogenic bacteria in check ... and is also vital to make ... and to make bioavailable ... essential nutrients from the GI tract) ...

so those pathogens they were already resistant to that antibiotic... flourish ...

and typically then, another antibiotic is tried ...

but ...

it often seems there were still pathogenic bacteria that were kept in check by all the
now wiped out competitors ... and these 'resistant to all typically used antibiotics'

... can now flourish ...


So ... you go to an hospital for some ‘minor’ problem ...

and you come away with a life threatening bacterial infection ... one that is resistant to all presently designed antibiotics ...

but that infection is probably still able to be managed if you support your highly complex and multifaceted immune system with something like nano-silver 10 ppm.


And these ... now 'resistant bacteria' ... tend to be passed on, in hospitals, from one patient to another ... by a not perfect containment of these so nasty pathogens that now seem to live in so many hospital settings.


A computer example:

Can (C++) compiled code from one computer, say a Windows OS, run on an other (as is),

say with a Linux OS ?

No !

Not unless there is a carefully designed and executed re-compile of the original text code ... and that original text code ... was re-compiled for that Linux Os with a C++ Linux based compiler for C++ code ... (and the original text code used no (non-standard) features that were machine dependent.)


Can a dog be trained to fetch ‘your slippers’ ?

Yes.

Can a child be trained to fetch ‘your slippers’ ?

Yes.

Here are examples of two highly engineered *self-replicating/self-repairing* and very mobile ‘computer systems’ that can be ‘taught’ to respond to the same input instructions ... to produce a very similar ‘end result'.

The dog used his mouth.
The child used his hand.

Just think of the hardware and the software that might need to be designed and built to accommodate just the simple task of *learning*, and *executing* the simple task of fetching slippers ... for two such distinct systems ... but they each need to be pre-programed with software (and pre-built with hardware) to be able to learn to do this simple task ... but also ... in any of the known languages of the world ... and in any of a wide variety of a limited and yet future context !!!

? ? ?

A very wise and exceeding skillful software and hardware engineer is needed ... one who is able to ‘control and limit’  future conditions that will arise ... and that sure is pushing way beyond the limits of (our) present (AI) ability ... yes  ? ? ?

--
dwzavitz@gmail.com
http://sites.google.com/site/andeveryeyeshallseehim/

Secure Services
http://SecureServices.ca
or try ...
http://securejoules.googlepages.com/securetransportservices
7
Ask the Author / Re: Poems and writings to encourage ...
« Last post by David on March 07, 2018, 11:53:32 AM »
Appendix two


Wonderful Counselor - Everlasting Father

Can you see this wonderful counselor, and everlasting father ... we have in Messiah?


Let the LORD, the God of the spirits of all flesh,
 set a man over the congregation.  (Numbers 27:16)

In whose hand [is] the soul of every living thing,
and the breath of all mankind.
(Job 12:10)

Behold my servant, whom I uphold; mine elect,
[in whom] my soul delighteth;
I have put my spirit upon him:
he shall bring forth judgment to the Gentiles.
He shall not cry, nor lift up, nor cause his voice to be heard in the street.
A bruised reed shall he not break,
and the smoking flax shall he not quench:
he shall bring forth judgment unto truth.
He shall not fail nor be discouraged,
till he have set judgment in the earth:
and the isles shall wait for his law.

Thus saith God the LORD,
he that created the heavens, and stretched them out;
he that spread forth the earth, and that which cometh out of it;
he that giveth breath unto the people upon it,
and spirit to them that walk therein:
I the LORD have called thee in righteousness,
and will hold thine hand, and will keep thee,
and give thee for a covenant of the people,
for a light of the Gentiles;
To open the blind eyes,
to bring out the prisoners from the prison,
[and] them that sit in darkness out of the prison house.
I [am] the LORD: that [is] my name: and my glory will I not give to another, neither my praise to graven images. (Isaiah 42:1 8)

For thus saith the high and lofty One that inhabiteth eternity,
whose name [is] Holy;
I dwell in the high and holy [place],
with him also [that is] of a contrite and humble spirit,
to revive the spirit of the humble,
and to revive the heart of the contrite ones.
For I will not contend for ever, neither will I be always wroth:
for the spirit should fail before me, and the souls [which] I have made.

For the iniquity of his covetousness was I wroth, and smote him:
I hid me, and was wroth,
and he went on frowardly in the way of his heart.

I have seen his ways, and will heal him:
I will lead him also, and restore comforts unto him and to his mourners.
I create the fruit of the lips;
Peace, peace to [him that is] far off, and to [him that is] near,
 saith the LORD; and I will heal him.
But the wicked [are] like the troubled sea, when it cannot rest,
whose waters cast up mire and dirt.
[There is] no peace, saith my God, to the wicked. (Isaiah 57:15 21)

Cry aloud, spare not, lift up thy voice like a trumpet,
and shew my people their transgression,
and the house of Jacob their sins. (Isaiah 58:1)

Woe to the idol shepherd that leaveth the flock!
 the sword [shall be] upon his arm, and upon his right eye:
his arm shall be clean dried up,
and his right eye shall be utterly darkened.  (Zechariah 11:17)

That which is born of the flesh is flesh; and that which is born of the Spirit is spirit. Marvel not that I said unto thee,
Ye must be born again. (John 3:6 7)

If I have told you earthly things, and ye believe not,
how shall ye believe, if I tell you [of] heavenly things? (John 3:12)



And as Moses lifted up the serpent in the wilderness,
even so must the Son of man be lifted up:
That whosoever believeth in him should not perish, but have eternal life. For God so loved the world, that he gave his only begotten Son,
that whosoever believeth in him should not perish,
but have everlasting life.
For God sent not his Son into the world to condemn the world;
 but that the world through him might be saved.
He that believeth on him is not condemned:
but he that believeth not is condemned already,
because he hath not believed in the name of the only begotten Son of God. And this is the condemnation, that light is come into the world,
and men loved darkness rather than light,
because their deeds were evil.
For every one that doeth evil hateth the light,
neither cometh to the light, lest his deeds should be reproved.
But he that doeth truth cometh to the light,
that his deeds may be made manifest, that they are wrought in God.
(John 3:14 21)

For this cause I bow my knees unto
the Father of our Lord Jesus Messiah,
Of whom the whole family in heaven and earth is named,
That he would grant you, according to the riches of his glory,
to be strengthened with might by his Spirit in the inner man;
That Messiah may dwell in your hearts by faith;
that ye, being rooted and grounded in love,
May be able to comprehend with all saints
what [is] the breadth, and length, and depth, and height;
And to know the love of Messiah, which passeth knowledge,
that ye might be filled with all the fulness of God.

Now unto him that is able to do exceeding abundantly above
all that we ask or think,
according to the power that worketh in us,
Unto him [be] glory in the church by Messiah Jesus
throughout all ages, world without end. Amen. (Ephesians 3:14 21)



I therefore, the prisoner of the Lord, beseech you
that ye walk worthy of the vocation wherewith ye are called,
With all lowliness and meekness,
with longsuffering, forbearing one another in love;
Endeavouring to keep the unity of the Spirit in the bond of peace.
[There is] one body, and one Spirit,
even as ye are called in one hope of your calling;
One Lord, one faith, one baptism,
One God and Father of all,
who [is] above all, and through all, and in you all.

But unto every one of us is given grace
according to the measure of the gift of Messiah. (Ephesians 4:1 7)

Furthermore we have had fathers of our flesh which corrected [us],
and we gave [them] reverence:
shall we not much rather be in subjection unto the Father of spirits,
and live?
For they verily for a few days chastened [us] after their own pleasure;
but he for [our] profit, that [we] might be partakers of his holiness.
Now no chastening for the present seemeth to be joyous, but grievous: nevertheless afterward it yieldeth the peaceable fruit of righteousness unto them which are exercised thereby.
Wherefore lift up the hands which hang down,
and the feeble knees;
And make straight paths for your feet,
lest that which is lame be turned out of the way;
but let it rather be healed.
Follow peace with all [men], and holiness,
without which no man shall see the Lord:
Looking diligently lest any man fail of the grace of God;
lest any root of bitterness springing up trouble [you],
and thereby many be defiled;
Lest there [be] any fornicator, or profane person, as Esau,
who for one morsel of meat sold his birthright.
For ye know how that afterward,
when he would have inherited the blessing,
he was rejected:
for he found no place of repentance,
though he sought it carefully with tears.
For ye are not come unto the mount that might be touched,
and that burned with fire,
nor unto blackness, and darkness, and tempest,
And the sound of a trumpet, and the voice of words;
which [voice] they that heard intreated
that the word should not be spoken to them any more:
(For they could not endure that which was commanded,
And if so much as a beast touch the mountain,
it shall be stoned, or thrust through with a dart:
And so terrible was the sight, [that] Moses said,
I exceedingly fear and quake:)
But ye are come unto mount Sion, and unto the city of the living God, the heavenly Jerusalem,
and to an innumerable company of angels,
To the general assembly and church of the firstborn,
which are written in heaven,
and to God the Judge of all,
and to the spirits of just men made perfect,
And to Jesus the mediator of the new covenant,
and to the blood of sprinkling,
that speaketh better things than [that of] Abel.

See that ye refuse not him that speaketh.
For if they escaped not who refused him that spake on earth,
much more [shall not] we [escape],
if we turn away from him that [speaketh] from heaven:
Whose voice then shook the earth:
but now he hath promised, saying,
Yet once more I shake not the earth only, but also heaven.
And this [word], Yet once more, signifieth the removing of those things that are shaken, as of things that are made,
that those things which cannot be shaken may remain.
Wherefore we receiving a kingdom which cannot be moved,
let us have grace, whereby we may serve God acceptably
with reverence and godly fear:
For our God [is] a consuming fire. (Hebrews 12:9 29)




Let brotherly love continue.
Be not forgetful to entertain strangers:
for thereby some have entertained angels unawares.
Remember them that are in bonds, as bound with them;
[and] them which suffer adversity, as being yourselves also in the body.

Marriage [is] honourable in all, and the bed undefiled:
but whoremongers [fornicators and porno lovers] and adulterers
God will judge.
[Let your] conversation [i.e. life] [be] without covetousness;
[and be] content with such things as ye have:
for he hath said,
I will never leave thee, nor forsake thee.
So that we may boldly say,
The Lord [is] my helper,
and I will not fear what man shall do unto me. (Hebrews 13:1 6)

SO YES, ... NOW, ... MAY HE, OUR WONDERFUL COUNSELOR, OUR FAITHFUL FRIEND, OUR EVERLASTING FATHER, ...  MAY HE EVEN NOW TURN THE HEARTS OF THE FATHERS TO THE CHILDREN, AND THE HEARTS OF THE CHILDREN TO THEIR FATHERS, ... BEFORE HE COMES.  AMEN.  (Malachi 4:6).


8
Ask the Author / Re: Poems and writings to encourage ...
« Last post by David on March 07, 2018, 11:52:02 AM »
Appendix one


1.    I have chosen your mom, and your mom only to be my wife as long as I live and so I have set my love upon you and mom to faithfully live for you and to be only good, kind, tender hearted and forgiving to you just as God, in Messiah, has set His love upon me. I will love you just as Messiah has loved me and will give myself in providing for you just as Messiah did give Himself for me.

2.    So you, our precious child(ren), are mine. What God has joined together, man can NOT separate. I am your father.

3.    You can depend on God's faithful goodness to you from me.

4.    I will show you the path that leads to life. Since no test can come to you except that which is common to man, I  will be faithful in preparing you so that you might experience God's faithfulness to those who trust in Him; thus, you would never be tested beyond what you are able to bear, but when you're tested, you will find THE WAY, THE TRUTH and THE LIFE, ... even in Abundance.

5.    In my presence may you find fullness of joy, and at my right hand, pleasures for evermore. This is only because the Lord is teaching me to live in His presence and to taste His delight, .. and so I delight in your presence, ... and in you.

6.    Since God gives grace to the humble but resists the proud, and since pride goes before a fall, and I do not want you to fall as I have, I will be teachable, be correctable, be a learner. I will submit myself to God and resist the devil so that he will flee from us. I will draw close to God so that God will draw close to us. I will humble myself under God's mighty hand and in due season, He will lift us up.

7.    I will be like my father in heaven. Our father in heaven is GOOD! He rewards those who diligently seek Him. Our father in heaven is long suffering, kind, and merciful, ... to the wicked and ungrateful. Our father wants none to perish but all to come to a knowledge of the truth and thus to escape the trap of the devil. He gave us His own Son to be our accessible Way to Him, our assured Truth from Him, and our abundant Life ever springing up fresh from Him. Yes, our God so loved the world that He gave His only begotten Son, ... that whosoever would believe in Him would not perish but have everlasting life ... not sending His Son into the world to condemn the world, but that the world, through Him might be saved. 

As The Father has sent me, (Jesus said), so (might) I send you ...
9
Ask the Author / Re: Poems and writings to encourage ...
« Last post by David on March 07, 2018, 11:49:59 AM »
Chapter Seven - Seven Tips dad


SEVENTH FOUNDATION STONE FOR YOUR CHILD


BE LIKE THE BEST DAD OF ALL


I will be like my Father in heaven. Our Father in heaven is GOOD! He rewards those who diligently seek Him. Our Father in heaven is long suffering, kind, and merciful, ... to the wicked and ungrateful. Our Father wants none to perish but all to come to a knowledge of the truth and thus to escape the trap of the devil. He gave us His own Son to be our accessible Way to Him, our assured Truth from Him, and our abundant Life ever springing up fresh from Him. Yes, our God so loved the world that He gave His only begotten Son, ... that whosoever would believe in Him would not perish but have everlasting life ... not sending His Son into the world to condemn the world, but that the world, through Him might be saved. 

As The Father has sent me, (Jesus said), so (might) I send you ...

Please see appendix 2 ...

SO YES, ... NOW, … MAY HE, OUR WONDERFUL COUNSELOR, OUR FAITHFUL FRIEND, OUR EVERLASTING FATHER, ... MAY HE EVEN NOW TURN THE HEARTS OF THE FATHERS TO THE CHILDREN, AND THE HEARTS OF THE CHILDREN TO THEIR FATHERS, ... BEFORE HE COMES.  AMEN.  (Malachi 4:6)
10
Ask the Author / Re: Poems and writings to encourage ...
« Last post by David on March 07, 2018, 11:48:15 AM »
Chapter Six - Seven Tips dad


SIXTH FOUNDATION STONE FOR YOUR CHILD


BE HUMBLE


Since God gives grace to the humble but resists the proud, and since pride goes before a fall, and I do not want you to fall as I have, I will be teachable, be correctable, be a learner. I will submit myself to God and resist the devil so that he will flee from us. I will draw close to God so that God will draw close to us. I will humble myself under God's mighty hand and in due season, He will lift us up.


Pride goes before a fall.

So ...

SIXTH QUICK KEY:  BE HUMBLE

Are you easily entreated by your children?
Pages: [1] 2 3 ... 10