Translation of the verse 23 from Surah Al-hadid : Number of verses 29 - - page 540 - Part 27.
In order that you may not be sad over matters that you fail to get, nor rejoice because of that which has been given to you. And Allah likes not prideful boasters.
In order that you not despair over what has eluded you and not exult [in pride] over what He has given you. And Allah does not like everyone self-deluded and boastful -
(57:23) (We do so) that you may not grieve over *42 the loss you suffer, nor exult over what He gave you. Allah does not love the vainglorious, the boastful,
*42) In order to understand why this has been said in that context, one should keep in mind the conditions through which the Muslims were passing at the time this Surah was revealed. 'An ever present danger of attack by the enemy, battles in quick succession, a state of constant siege, hardships caused by economic boycott by the disbelievers, persecution of the converts to Islam everywhere in Arabia, these were the conditions that the Muslims were confronted with at that time. The disbelievers looked upon these as a proof of the Muslims having been forsaken and rejected, and the hypocrites took these as a confirmation of their own suspicions and doubts. As for the sincere Muslims, they were facing these bravely and resolutely, yet the excess of hardship and suffering would sometimes become trying even for them. So, the Muslims are being consoled, as if to say: "No affliction, God forbid, has befallen you without the knowledge of your Lord. Whatever you are experiencing is according to the pre-ordained scheme of Allah, which is already recorded in the Writ of destiny. And you are being made to pass through these trials and tribulations for the sake of your own training for the great service that Allah wills to take from you. If you are made to attain to success without passing through these hardships, weaknesses will remain in your character due to which you will neither be able to digest power and authority nor withstand the tempests and furies of falsehood."