Recent Posts

Pages: 1 ... 3 4 [5] 6 7 ... 10
41
Ask the Author / Re: The Roman Road ...
« Last post by David on April 21, 2019, 12:09:43 AM »
Psalm 90

1  [A Prayer of Moses the man of God.] Lord, thou hast been our dwelling place in all generations.
2  Before the mountains were brought forth, or ever thou hadst formed the earth and the world, even from everlasting to everlasting, thou [art] God.
3  Thou turnest man to destruction; and sayest, Return, ye children of men.
4  For a thousand years in thy sight [are but] as yesterday when it is past, and [as] a watch in the night.
5  Thou carriest them away as with a flood; they are [as] a sleep: in the morning [they are] like grass [which] groweth up.
6  In the morning it flourisheth, and groweth up; in the evening it is cut down, and withereth.

7  For we are consumed by thine anger, and by thy wrath are we troubled.
8  Thou hast set our iniquities before thee, our secret [sins] in the light of thy countenance.
9  For all our days are passed away in thy wrath: we spend our years as a tale [that is told].
10  The days of our years [are] threescore years and ten; and if by reason of strength [they be] fourscore years, yet [is] their strength labour and sorrow; for it is soon cut off, and we fly away.
11  Who knoweth the power of thine anger? even according to thy fear, [so is] thy wrath.

12  So teach [us] to number our days, that we may apply [our] hearts unto wisdom.
13  Return, O LORD, how long? and let it repent thee concerning thy servants.
14  O satisfy us early with thy mercy; that we may rejoice and be glad all our days.
15  Make us glad according to the days [wherein] thou hast afflicted us, [and] the years [wherein] we have seen evil.
16  Let thy work appear unto thy servants, and thy glory unto their children.
17  And let the beauty of the LORD our God be upon us: and establish thou the work of our hands upon us; yea, the work of our hands establish thou it.
42
P.S.

A second extra example, one where many years ago, I was first made aware that there was a BIG problem with the NIV, is in ...

1 John 4:19

(KJV) We love him, because he first loved us.

(NIV) We love because he first loved us.

Do you think that the NIV version ... leaving HIM out ... pleases GOD?
43
THE FACTS ON DIFFERENT POPULAR HOLY BIBLE TRANSLATIONS (KJV – NIV- ESV- THE MESSAGE)


Although the NIV has some footnotes, these footnotes are not always available in bible verse searches on devices.  People are using devices much more and are relying on leadership to be giving them correct scripture.  When in church or a study you hardly have enough time to check if the translation they are using is correct.  The footnotes are only added in one of the verses below.


(1) Revelation 1:11 
   
(KJV) Saying, I am Alpha and Omega, the first and the last: and, what thou seest, write in a book, and send it unto the seven churches which are in Asia; unto Ephesus, and unto Smyrna, and unto Pergamos, and unto Thyatira, and unto Sardis, and unto Philadelphia, and unto Laodicea.

(NIV) which said: “Write on a scroll what you see and send it to the seven churches: to Ephesus, Smyrna, Pergamum, Thyatira, Sardis, Philadelphia and Laodicea. (Not in footnotes in NIV) I would say this is the most important part of what we believe.

(ESV) saying, “Write what you see in a book and send it to the seven churches, to Ephesus and to Smyrna and to Pergamum and to Thyatira and to Sardis and to Philadelphia and to Laodicea.”

(MSG) I, John, with you all the way in the trial and the Kingdom and the passion of patience in Jesus, was on the island called Patmos because of God’s Word, the witness of Jesus. It was Sunday and I was in the Spirit, praying. I heard a loud voice behind me, trumpet-clear and piercing: “Write what you see into a book. Send it to the seven churches: to Ephesus, Smyrna, Pergamum, Thyatira, Sardis, Philadelphia, Laodicea.” I turned and saw the voice. I saw a gold menorah with seven branches, And in the center, the Son of Man, in a robe and gold breastplate, hair a blizzard of white, Eyes pouring fire-blaze, both feet furnace-fired bronze, His voice a cataract, right hand holding the Seven Stars, His mouth a sharp-biting sword, his face a perigee sun. I saw this and fainted dead at his feet. His right hand pulled me upright, his voice reassured me

SOME OF THESE TRANSLATIONS TOTALLY OMIT I am Alpha and Omega, the first and the last:  While the Message translates Alpha and Omega the First and the Last as:  'trumpet-clear and piercing'. 

Interesting that these are supposed to be better translations?

In the Message it says trumpet clear and piercing.  Notice that Trumpet is with a small t.  No acknowledging to the Supreme Authority of our mighty God.

God is sounding the Trumpet on this matter of tampering with his Word.  The evidence is Clear and Piercing.


(2) John 9:35  Note the change from  the "Son of God" to the "Son of Man ...

(KJV) Jesus heard that they had cast him out; and when he had found him, he said unto him, Dost thou believe on the Son of God?

(NIV) Jesus heard that they had thrown him out, and when he found him, he said, "Do you believe in the Son of Man?" No footnotes.

(ESV) Jesus heard that they had cast him out, and having found him he said, “Do you believe in the Son of Man?”

(MSG) Jesus heard that they had thrown him out, and went and found him. He asked him, “Do you believe in the Son of Man?”


(3) John 6:69 This name for God "One" is used by the New Age ...  the universal god - "the One"

(KJV) And we believe and are sure that thou art that Christ, the Son of the living God.

(NIV) We believe and know that you are the Holy One of God."  No Footnotes

(ESV) and we have believed, and have come to know, that you are the Holy One of God.John 6:69 (MSG) Peter replied, “Master, to whom would we go? You have the words of real life, eternal life. We’ve already committed ourselves, confident that you are the Holy One of God.”


(4) Isaiah 14:12

(KJV) How art thou fallen from heaven, O Lucifer, son of the morning! how art thou cut down to the ground, which didst weaken the nations!

(NIV) How you have fallen from heaven, O morning star, son of the dawn! You have been cast down to the earth, you who once laid low the nations! Isaiah 14:15 (NIV) But you are brought down to the grave, to the depths of the pit.   No footnotes Note that an online NIV version on 2019-04-10 revised to the grave, to read: to the realm of the dead, ... (NO foot note either to explain this 'correction/change'?) ...so we can see that these new versions keep changing.

(ESV) How you are fallen from heaven, O Day Star, son of Dawn!  How you are cut down to the ground, you who laid the nations low!

(MSG) What a comedown this, O Babylon! Daystar!  Son of Dawn!   Flat on your face in the underworld mud,  you, famous for flattening nations


(5) Luke 4:4

(KJV) And Jesus answered him, saying, It is written, That man shall not live by bread alone, but by every word of God.

(NIV) Jesus answered, "It is written: 'Man does not live on bread alone.'"  No footnotes

(ESV) And Jesus answered him,     “It is written, ‘Man shall not live by bread alone.’”

(MSG) 4 Jesus answered by quoting Deuteronomy: “It takes more than bread to really live.”


(6) Revelation 22:18-19

(KJV) For I testify unto every man that heareth the words of the prophecy of this book, If any man shall add unto these things, God shall add unto him the plagues that are written in this book: 19 And if any man shall take away from the words of the book of this prophecy, God shall take away his part out of the book of life, and out of the holy city, and from the things which are written in this book.

(NIV) I warn everyone who hears the words of the prophecy of this book: If anyone adds anything to them, God will add to him the plagues described in this book. And if anyone takes words away from this book of prophecy, God will take away from him his share in the tree of life and in the holy city, which are described in this book. No footnotes.

(ESV) I warn everyone who hears the words of the prophecy of this book: if anyone adds to them, God will add to him the plagues described in this book, 19 and if anyone takes away from the words of the book of this prophecy, God will take away his share in the tree of life and in the holy city, which are described in this book.

(MSG) I give fair warning to all who hear the words of the prophecy of this book: If you add to the words of this prophecy, God will add to your life the disasters written in this book; if you subtract from the words of the book of this prophecy, God will subtract your part from the Tree of Life and the Holy City that are written in this book.


(7) Matthew 1:25 The NIV removes "firstborn" - questions the virgin birth!

 (KJV) And knew her not till she had brought forth her firstborn son: and he called his name JESUS.

(NIV) But he had no union with her until she gave birth to a son. And he gave him the name Jesus. No footnotes

(ESV) but knew her not until she had given birth to a son. And he called his name Jesus.

(MSG) Then Joseph woke up. He did exactly what God’s angel commanded in the dream: He married Mary. But he did not consummate the marriage until she had the baby. He named the baby Jesus.


( 8 ) 1 John 5:7-8

(KJV) For there are three that bear record in heaven, the Father, the Word, and the Holy Ghost: and these three are one. And there are three that bear witness in earth, the Spirit, and the water, and the blood: and these three agree in one.

(NIV) For there are three that testify: the Spirit, the water and the blood; and the three are in agreement.
Missing quite a bit of truth here ... What about bear record in heaven?

(ESV)  For there are three that testify: 8 the Spirit and the water and the blood; and these three agree.

(MSG) Jesus—the Divine Christ! He experienced a life-giving birth and a death-killing death. Not only birth from the womb, but baptismal birth of his ministry and sacrificial death. And all the while the Spirit is confirming the truth, the reality of God’s presence at Jesus’ baptism and crucifixion, bringing those occasions alive for us. A triple testimony: the Spirit, the Baptism, the Crucifixion. And the three in perfect agreement.


(9) 1 John 4:3 Notice the NIV omits "Christ" and "is come in the flesh".
This is important to us who are saved.

(KJV) And every spirit that confesseth not that Jesus Christ is come in the flesh is not of God: and this is that spirit of antichrist, whereof ye have heard that it should come; and even now already is it in the world.

(NIV) but every spirit that does not acknowledge Jesus is not from God. This is the spirit of the antichrist, which you have heard is coming and even now is already in the world.


(10) Matthew 9:13 Repentance is omitted!
Satan hates real heart felt, Holy Ghost inspired repentance.

(KJV) But go ye and learn what that meanth, I will have mercy, and not sacrifice: for I am not come to call the righteous, but sinners to repentance.

(NIV) But go and learn what this means: 'I desire mercy, not sacrifice.' For I have not come to call the righteous, but sinners."  Not in NIV footnotes

(ESV) Go and learn what this means: ‘I desire mercy, and not sacrifice.’ For I came not to call the righteous, but sinners.”

(MSG) Jesus, overhearing, shot back, “Who needs a doctor: the healthy or the sick? Go figure out what this Scripture means: ‘I’m after mercy, not religion.’ I’m here to invite outsiders, not coddle insiders.”
44
A few months ago, a dear friend and former neighbour of many years, asked me to review the following pages she wrote ... now posted here below, for your easy reference, and only slightly edited ...

By Sandra - 2018

I have been concerned regarding the many so called new translations of the bible.  So I decided to research for myself.

I read the KJV (the Authorized by King James Version) and when I compared it to the newer versions ... I found that the changes they make only weaken or minimize who God truly is.  They omit very important details in scripture. 

So ... one must ask one’s self:

Is my choice on what Bible (version) I'm reading because some say that The Authorized King James Version is too hard to understand?

Is it because my pastor or bible study leader is using this new version?  My group of Bible believing friends use it?  Or ... everyone I know uses it?

Do I like the translation (version) I'm reading because it is poetic?  Because it does not have (the old English) thee and thou’s, or because it is paraphrased into a story?

So, what are you reading and promoting in the version you are reading?

Wouldn't it be advisable for you to do your own research and decide for yourself, if the modern version you are reading is correct, and not just to rely on what the majority says?

(Note that a majority vote is not the way truth is discerned.  Please recall: 

Enter ye in at the strait gate: for wide is the gate, and broad is the way, that leadeth to destruction, and many there be which go in thereat.  Because strait is the gate, and narrow is the way, which leadeth unto life, and few there be that find it.)
(Matthew 7:13,14)

But NOTE the false gospel taught by the New King James Version (NKJV) for Matthew 7:13,14

Enter by the narrow gate; for wide is the gate and broad is the way that leads to destruction, and there are many who go in by it.  Because narrow is the gate and difficult is the way which leads to life, and there are few who find it. (NKJV)

But is that what Jesus taught ... that His way was DIFFICULT/HARD?  Recall Jesus said: Come unto me, all ye that labour and are heavy laden, and I will give you rest.  Take my yoke upon you, and learn of me; for I am meek and lowly in heart: and ye shall find rest unto your souls.  For my yoke is easy, and my burden is light. (Matthew 11:28-29)

The warning to all who would preach a false gospel is very severe: As we said before, so say I now again, if any man preach any other gospel unto you than that ye have received, let him be accursed. (Galatians 1:9)


I believe I was led to find out who (presently) owns the NIV bible.  It is published by Zondervan, who sold to Harper Collins, then owned by News Corp, that is owned by a man named Rupert Murdoch.  Note that Rupert Murdoch produces World Wide pornography and that Harper Collins also publishes the satanic bible.  It is perplexing to me that the writers of the NIV would entrust God's Holy Word to an organization controlled by such as Rupert Murdoch.  I always thought that the writers of Gods Word were Holy Men of God.  So, don't you think that the publishers should be the same? 

We seem already to be deep into deception, (but recall, Jesus said this deception would happen, that in the end times, even the elect could/would be deceived.)

However, I believe that God’s Spirit is at work in those people who truly want to walk in truth, and not to stay deceived.  If that is you, then please do your own research about this forewarned great deception.

In the following web page, you will see examples with 4 different versions to compare. 

Please pray for discernment for yourself, (if your desire is to not teach, or to be taught, from a Bible that has been corrupted.)  It seems that these un-holy editors and publishers are on a path to revise more and more … until the gospel they proclaim is NO Gospel at all. 

It will be difficult for leaders to take a stand against these new versions if they fear protest from their congregations, groups and peers.   But please recall that we are cautioned about this, that: The fear of man is a snare.

(By taking a stand I mean reading and teaching from the KJV, not the other versions. )

We are coming into times that we will have to make clear and firm choices not to go with the flow or the majority.  Have we become a church that wants to please men MORE than to please God?

I am convinced that many a preacher and teacher have seen errors … but are presently choosing to ignore them.  (Have they fully reckoned what this will cost them eternally?)

Is it possible we have entered into the times of the separation of the sheep from the goats?

I encourage all pastors, teachers and all who are seeking God in truth, to research for themselves and to not shut out the Holy Spirit’s warnings. 

Be strong to make the change, regardless of what others may say.  Is it not time to start speaking the truth about these versions and to warn others?

Silence is not golden here, but it is deadly.  It is a gateway to so deadly  great, and ever greater deception, as the flurry of revisions keep rolling off the printing presses, to be sold to an increasingly apostate church, just as we were cautioned against: Let no man deceive you by any means: for that day shall not come, except there come a falling away first, and that man of sin be revealed, the son of perdition.
45
Ask the Author / The Roman Road ...
« Last post by David on April 07, 2019, 03:58:51 AM »
Dear family and friends,

Recently, my 56 year old nephew, suddenly died with NO signs of distress ... NO warning ... this has given me and my family 'pause' ...

and I was reminded again about that prayer of Moses, recorded for us all in Psalm 90 :  http://developers-heaven.net/forum/index.php/topic,2637.msg3278.html#msg3278 

because my father often reminded me to ponder this part of that prayer (made personal here):

So, teach me to number my days so that I might apply my heart to wisdom.


In light of this ... please see carefully the following:


There is a 'Roman Road' that my 'big sister' reminded me about, recently, that we would like to share with you via this web page:

In Paul's letter to the church at Rome,
We find (an overview of) the way to the Heavenly Home.

Some of these verses are special as can be,
And so the 'Roman Road' ... PLEASE...  DO SEE!

This 'Roman Road' is very close, these days, to my heart,
Now ... here (below) ... is where this heaven blessed journey starts ...

(by Donna Jean Zavitz - 2019 at age 84 - slightly edited for this page.)


Did you know that Heaven sees ALL and thus says that ...

1)
"As it is written, There is none righteous, no, not one: ... all have sinned, and come short of the glory of God;" (Romans 3:10,23)

2)
"Wherefore, as by one man sin entered into the world, and death by sin; and so death passed upon all men, for that all have sinned:" (Romans 5:12)


BUT here is really GOOD NEWS ...

3)
"... scarcely for a righteous man will one die: yet peradventure for a good man some would even dare to die. But God commendeth his love toward us, in that, while we were yet sinners, Christ died for us. ... if, when we were enemies, we were reconciled to God by the death of his Son, much more, being reconciled, we shall be saved by his life." (Romans 5:7,8,10)

4)
"... the wages of sin [is] death; but the gift of God [is] eternal life through Jesus Christ our Lord." (Romans 6:23)

5)
" ... if thou shalt confess with thy mouth the Lord Jesus, and shalt believe in thine heart that God hath raised him from the dead, thou shalt be saved. For with the heart man believeth unto righteousness; and with the mouth confession is made unto salvation." (Romans 10:9,10)


P.S. You may also want to see:
(Go to: Ask the Author)
http://developers-heaven.net/forum/index.php/topic,2587.0.html
46
This C++ Shortest Path demo uses a heap as a priority queue ... (Instead of set and map as used in C++ version above.)

Code: [Select]
//  dijkstra_shortest_path_via_min_heap.cpp //  // 2018-11-21 //

// This example uses a MIN HEAP as a MIN PRIORITY QUEUE //


#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <limits> // for numeric_limits
#include <algorithm> // re. make_heap(...), pop_heap(...), // renove(...) //


using std::vector;
using std::list;


// utility forward declaration /////////////////////////////////////
template< typename T >
T takeIn( const std::string& msg, const T& min, const T& max );
////////////////////////////////////////////////////////////////////


const double INF = std::numeric_limits< double >::infinity();


struct Edge
{
    size_t target;
    double distance;
    Edge( size_t t, double d ) : target(t), distance(d) {}
};


typedef vector< vector< Edge > > adj_vec_t;
typedef std::pair< size_t, double > pair_t;
typedef vector< std::string > place_vec_t;


struct MyMinCmp
{
    bool operator () ( const pair_t& a, const pair_t& b )
    {
        return b.second < a.second ;
    }
} ;


void dijkstraPaths( int source,
                    const adj_vec_t& adj_vec,
                    vector< double >& min_distance,
                    vector< int >& previous )
{
    size_t n = adj_vec.size();
    min_distance.clear();
    min_distance.resize( n, INF );
    min_distance[source] = 0;
    previous.clear();
    previous.resize( n, -1 );

    vector< pair_t > vertex_queue;
    vertex_queue.push_back( pair_t( source, min_distance[source] ) );

    while( !vertex_queue.empty() )
    {
        size_t u = vertex_queue.front().first;
        double dist_first = vertex_queue.front().second;

        pop_heap( vertex_queue.begin(), vertex_queue.end(), MyMinCmp() );
        vertex_queue.pop_back();

        // Visit each edge adjacent to u //
        const vector< Edge > &edges = adj_vec[u];
        vector< Edge >::const_iterator it = edges.begin();
        for ( ; it != edges.end(); ++ it )
        {
            double through_u = dist_first + it->distance;
            size_t v = it->target;
        if( through_u < min_distance[v] )
            {
                pair_t pr = pair_t( v, min_distance[v] );
                // THIS BLOCK OF code may be faster RUNNING than 'remove' below ?? //
                vector< pair_t >::iterator itt = std::find(
                        vertex_queue.begin(), vertex_queue.end(), pr );

                if (itt != vertex_queue.end() )
                {
                    // swap the one to be removed with the last element
                    // and remove the item at the end of the container
                    // to prevent moving all items after '5' by one
                    std::swap( *itt, vertex_queue.back() );
                    vertex_queue.pop_back();
                }
                //std::remove( vertex_queue.begin(), vertex_queue.end(), pr );
                ////////////////////////////////////////////////////

            min_distance[v] = through_u;
            previous[v] = u;

            vertex_queue.push_back( pair_t( v, min_distance[v] ) );
            make_heap( vertex_queue.begin(), vertex_queue.end(), MyMinCmp() );
        }
        }
    }
}


list<int> getShortestPath( int vertex, const vector< int >& previous )
{
    list< int > path;
    for ( ; vertex != -1; vertex = previous[vertex])
        path.push_front(vertex);
    return path;
}


void loadAdjList( adj_vec_t& adjacency_list )
{
    // NOTE! insert edges both ways for undirected graphs //

    adjacency_list[0].push_back(Edge(1, 7));
    adjacency_list[1].push_back(Edge(0, 7));
    adjacency_list[0].push_back(Edge(2, 9));
    adjacency_list[2].push_back(Edge(0, 9));
    adjacency_list[0].push_back(Edge(5, 12));
    adjacency_list[5].push_back(Edge(0, 12));

    adjacency_list[1].push_back(Edge(2, 10));
    adjacency_list[2].push_back(Edge(1, 10));
    adjacency_list[1].push_back(Edge(3, 13));
    adjacency_list[3].push_back(Edge(1, 13));

    adjacency_list[2].push_back(Edge(3, 11));
    adjacency_list[3].push_back(Edge(2, 11));
    adjacency_list[2].push_back(Edge(5, 2));
    adjacency_list[5].push_back(Edge(2, 2));

    adjacency_list[3].push_back(Edge(4, 6));
    adjacency_list[4].push_back(Edge(3, 6));

    adjacency_list[4].push_back(Edge(5, 9));
    adjacency_list[5].push_back(Edge(4, 9));
}

void showPlaces( const place_vec_t& places )
{
    for( size_t i = 0; i < places.size(); ++ i )
        std::cout << i << "->" << places[i] << '\n';
}


int main()
{
    place_vec_t places;
    for( size_t i = 0; i < 6; ++ i )
    {
        std::ostringstream oss;
        oss << i;
        places.push_back( "Town_" + oss.str() );
    }


    adj_vec_t adjacency_list(6);
    loadAdjList( adjacency_list );

    size_t n = adjacency_list.size();
    std::stringstream ss;
    ss << n-1;
    std::string topStr = ss.str();

    // these get initialed inside function dijkstraPaths called below
    vector< double > min_distance;
    vector< int > previous;
    ////////////////////////////////////////////////////////////////

    while( true )
    {
        showPlaces( places );
        size_t start = takeIn< int>( "Enter place to start (0.." +
                                     topStr + "): ", 0, n-1 );
        size_t stop =  takeIn< int>( "Enter place to stop (0.." +
                                     topStr + "): ", 0, n-1 );

        dijkstraPaths( start, adjacency_list, min_distance, previous );

        std::cout << "Distance from " << start << " to " << stop << ": "
                  << min_distance[stop] << std::endl;

        list< int > path = getShortestPath( stop, previous );

        std::cout << "Path : ";
        list< int >::const_iterator it = path.begin();
        for( ; it != path.end(); ++ it )
            std::cout << *it << "->" << places[*it] << "  ";
        std::cout << std::endl;

        std::cout << "More (y/n) ? ";
        std::string reply;
        getline( std::cin, reply );
        if( reply.size() && (reply[0] == 'n' || reply[0] == 'N') )
            break;
    }

    std::cout << "Ok ... exiting ... \nPress 'Enter' to continue/exit ... ";
    std::cin.get();
    return 0;
}


////////////////////////////////////////////////////////////////////
// definition utility //////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
template< typename T >
T takeIn( const std::string& msg, const T& min, const T& max )
{
    while( true )
    {
        std::cout << msg;
        std::string s, tmp;
        getline( std::cin, s );

        std::istringstream iss( s );
        T val;
        if( iss >> val && !(iss >> tmp) && val >= min && val <= max )
            return val;
        // else if reach here ... nOT in valid range //
        std::cout << "Only single values in range "
                  << min << ".." << max << " are valid here.\n";
    }
}
47
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 ...
*/
48
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 ... )
49
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 profound 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...”
50
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’ !!!!
Pages: 1 ... 3 4 [5] 6 7 ... 10