text:
// Copyright (c) 2014-2017 The Dash Core developers
// Copyright (c) 2017-2018 The Syscoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <activemasternode.h>
#include <governance.h>
#include <validation.h>
#include <masternode.h>
#include <masternodepayments.h>
#include <masternodesync.h>
#include <masternodeman.h>
#include <netfulfilledman.h>
#include <netmessagemaker.h>
#include <spork.h>
#include <ui_interface.h>
#include <util/translation.h>
class CMasternodeSync;
CMasternodeSync masternodeSync;

void CMasternodeSync::Fail()
{
    nTimeLastFailure = GetTime();
    nRequestedMasternodeAssets = MASTERNODE_SYNC_FAILED;
}

void CMasternodeSync::Reset()
{
    nRequestedMasternodeAssets = MASTERNODE_SYNC_INITIAL;
    nRequestedMasternodeAttempt = 0;
    nTimeAssetSyncStarted = GetTime();
    nTimeLastBumped = GetTime();
    nTimeLastFailure = 0;
}

void CMasternodeSync::BumpAssetLastTime(const std::string& strFuncName)
{
    if(IsSynced() || IsFailed()) return;
    nTimeLastBumped = GetTime();
    LogPrint(BCLog::MNSYNC, "CMasternodeSync::BumpAssetLastTime -- %s\n", strFuncName);
}

std::string CMasternodeSync::GetAssetName()
{
    switch(nRequestedMasternodeAssets)
    {
        case(MASTERNODE_SYNC_INITIAL):      return "MASTERNODE_SYNC_INITIAL";
        case(MASTERNODE_SYNC_WAITING):      return "MASTERNODE_SYNC_WAITING";
        case(MASTERNODE_SYNC_LIST):         return "MASTERNODE_SYNC_LIST";
        case(MASTERNODE_SYNC_MNW):          return "MASTERNODE_SYNC_MNW";
        case(MASTERNODE_SYNC_GOVERNANCE):   return "MASTERNODE_SYNC_GOVERNANCE";
        case(MASTERNODE_SYNC_FAILED):       return "MASTERNODE_SYNC_FAILED";
        case MASTERNODE_SYNC_FINISHED:      return "MASTERNODE_SYNC_FINISHED";
        default:                            return "UNKNOWN";
    }
}

void CMasternodeSync::SwitchToNextAsset(CConnman& connman)
{
    switch(nRequestedMasternodeAssets)
    {
        case(MASTERNODE_SYNC_FAILED):
            throw std::runtime_error("Can't switch to next asset from failed, should use Reset() first!");
            break;
        case(MASTERNODE_SYNC_INITIAL):
            nRequestedMasternodeAssets = MASTERNODE_SYNC_WAITING;
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
            break;
        case(MASTERNODE_SYNC_WAITING):
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Completed %s in %llds\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
            nRequestedMasternodeAssets = MASTERNODE_SYNC_LIST;
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
            break;
        case(MASTERNODE_SYNC_LIST):
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Completed %s in %llds\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
            nRequestedMasternodeAssets = MASTERNODE_SYNC_MNW;
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
            break;
        case(MASTERNODE_SYNC_MNW):
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Completed %s in %llds\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
            nRequestedMasternodeAssets = MASTERNODE_SYNC_GOVERNANCE;
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Starting %s\n", GetAssetName());
            break;
        case(MASTERNODE_SYNC_GOVERNANCE):
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Completed %s in %llds\n", GetAssetName(), GetTime() - nTimeAssetSyncStarted);
            nRequestedMasternodeAssets = MASTERNODE_SYNC_FINISHED;
            uiInterface.NotifyAdditionalDataSyncProgressChanged(1);
            //try to activate our masternode if possible
            activeMasternode.ManageState(connman);
            connman.ForEachNode([](CNode* pnode) {
                netfulfilledman.AddFulfilledRequest(pnode->addr, "full-sync");
            });
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::SwitchToNextAsset -- Sync has finished\n");

            break;
    }
    nRequestedMasternodeAttempt = 0;
    nTimeAssetSyncStarted = GetTime();
    BumpAssetLastTime("CMasternodeSync::SwitchToNextAsset");
}

std::string CMasternodeSync::GetSyncStatus()
{
    switch (masternodeSync.nRequestedMasternodeAssets) {
        case MASTERNODE_SYNC_INITIAL:       return _("Synchronization blockchain...").translated;
        case MASTERNODE_SYNC_WAITING:       return _("Synchronization pending...").translated;
        case MASTERNODE_SYNC_LIST:          return _("Synchronizing masternodes...").translated;
        case MASTERNODE_SYNC_MNW:           return _("Synchronizing masternode payments...").translated;
        case MASTERNODE_SYNC_GOVERNANCE:    return _("Synchronizing governance objects...").translated;
        case MASTERNODE_SYNC_FAILED:        return _("Synchronization failed").translated;
        case MASTERNODE_SYNC_FINISHED:      return _("Synchronization finished").translated;
        default:                            return "";
    }
}

void CMasternodeSync::ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv)
{
    if (strCommand == NetMsgType::SYNCSTATUSCOUNT) { //Sync status count

        //do not care about stats if sync process finished or failed
        if(IsSynced() || IsFailed()) return;

        int nItemID;
        int nCount;
        vRecv >> nItemID >> nCount;

        LogPrint(BCLog::MNSYNC, "SYNCSTATUSCOUNT -- got inventory count: nItemID=%d  nCount=%d  peer=%d\n", nItemID, nCount, pfrom->GetId());
    }
}

void CMasternodeSync::ProcessTick(CConnman& connman)
{
    static int nTick = 0;
    nTick++;

    // reset the sync process if the last call to this function was more than 60 minutes ago (client was in sleep mode)
    static int64_t nTimeLastProcess = GetTime();
    if(GetTime() - nTimeLastProcess > 60*60) {
        LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- WARNING: no actions for too long, restarting sync...\n");
        Reset();
        SwitchToNextAsset(connman);
        nTimeLastProcess = GetTime();
        return;
    }
    nTimeLastProcess = GetTime();

    // reset sync status in case of any other sync failure
    if(IsFailed()) {
        if(nTimeLastFailure + (1*60) < nTimeLastProcess) { // 1 minute cooldown after failed sync
            LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- WARNING: failed to sync, trying again...\n");
            Reset();
            SwitchToNextAsset(connman);
        }
        return;
    }

    // gradually request the rest of the votes after sync finished
    if(IsSynced()) {
        std::vector<CNode*> vNodesCopy = connman.CopyNodeVector(CConnman::FullyConnectedOnly);
        governance.RequestGovernanceObjectVotes(vNodesCopy, connman);
        connman.ReleaseNodeVector(vNodesCopy);
        return;
    }

    // Calculate "progress" for LOG reporting / GUI notification
    double nSyncProgress = double(nRequestedMasternodeAttempt + (nRequestedMasternodeAssets - 1) * 8) / (8*4);
    LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d nRequestedMasternodeAttempt %d nSyncProgress %f\n", nTick, nRequestedMasternodeAssets, nRequestedMasternodeAttempt, nSyncProgress);
    uiInterface.NotifyAdditionalDataSyncProgressChanged(nSyncProgress);

    std::vector<CNode*> vNodesCopy = connman.CopyNodeVector(CConnman::FullyConnectedOnly);

    for (auto& pnode : vNodesCopy)
    {
        CNetMsgMaker msgMaker(pnode->GetSendVersion());

        // Don't try to sync any data from outbound "masternode" connections -
        // they are temporary and should be considered unreliable for a sync process.
        // Inbound connection this early is most likely a "masternode" connection
        // initiated from another node, so skip it too.
        // also skip syncing with nodes that are on an old unsupported version or something like bitcoinj which doesn't support these messages
        if(pnode->nVersion < PROTOCOL_VERSION || pnode->fMasternode || (fMasternodeMode && pnode->fInbound)) continue;

        // QUICK MODE (REGTEST ONLY!)
        if(Params().NetworkIDString() == CBaseChainParams::REGTEST)
        {
            if (nRequestedMasternodeAssets == MASTERNODE_SYNC_WAITING) {
                connman.PushMessage(pnode, msgMaker.Make(NetMsgType::GETSPORKS)); //get current network sporks
            } else if (nRequestedMasternodeAssets == MASTERNODE_SYNC_LIST) {
                mnodeman.DsegUpdate(pnode, connman);
            } else if (nRequestedMasternodeAssets == MASTERNODE_SYNC_MNW) {
                connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC)); //sync payment votes
            } else if (nRequestedMasternodeAssets == MASTERNODE_SYNC_GOVERNANCE) {
                SendGovernanceSyncRequest(pnode, connman);
            }
            SwitchToNextAsset(connman);
            connman.ReleaseNodeVector(vNodesCopy);
            return;
        }

        // NORMAL NETWORK MODE - TESTNET/MAINNET
        {
            if(netfulfilledman.HasFulfilledRequest(pnode->addr, "full-sync")) {
                // We already fully synced from this node recently,
                // disconnect to free this connection slot for another peer.
                pnode->fDisconnect = true;
                LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- disconnecting from recently synced peer=%d\n", pnode->GetId());
                continue;
            }

            // SPORK : ALWAYS ASK FOR SPORKS AS WE SYNC

            if(!netfulfilledman.HasFulfilledRequest(pnode->addr, "spork-sync")) {
                // always get sporks first, only request once from each peer
                netfulfilledman.AddFulfilledRequest(pnode->addr, "spork-sync");
                // get current network sporks
                connman.PushMessage(pnode, msgMaker.Make(NetMsgType::GETSPORKS));
                LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d -- requesting sporks from peer=%d\n", nTick, nRequestedMasternodeAssets, pnode->GetId());
            }

            // INITIAL TIMEOUT

            if(nRequestedMasternodeAssets == MASTERNODE_SYNC_WAITING) {
                if(nTimeLastProcess - nTimeLastBumped > MASTERNODE_SYNC_TIMEOUT_SECONDS) {
                    // At this point we know that:
                    // a) there are peers (because we are looping on at least one of them);
                    // b) we waited for at least MASTERNODE_SYNC_TIMEOUT_SECONDS since we reached
                    //    the headers tip the last time (i.e. since we switched from
                    //     MASTERNODE_SYNC_INITIAL to MASTERNODE_SYNC_WAITING and bumped time);
                    // c) there were no blocks (UpdatedBlockTip, NotifyHeaderTip) or headers (AcceptedBlockHeader)
                    //    for at least MASTERNODE_SYNC_TIMEOUT_SECONDS.
                    // We must be at the tip already, let's move to the next asset.
                    SwitchToNextAsset(connman);
                }
            }

            // MNLIST : SYNC MASTERNODE LIST FROM OTHER CONNECTED CLIENTS

            if(nRequestedMasternodeAssets == MASTERNODE_SYNC_LIST) {
                LogPrint(BCLog::MN, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d nTimeLastBumped %lld nTimeLastProcess %lld diff %lld\n", nTick, nRequestedMasternodeAssets, nTimeLastBumped, nTimeLastProcess, nTimeLastProcess - nTimeLastBumped);
                // check for timeout first
                if(nTimeLastProcess - nTimeLastBumped > MASTERNODE_SYNC_TIMEOUT_SECONDS) {
                    LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d -- timeout\n", nTick, nRequestedMasternodeAssets);
                    if (nRequestedMasternodeAttempt == 0) {
                        LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- ERROR: failed to sync %s\n", GetAssetName());
                        // there is no way we can continue without masternode list, fail here and try later
                        Fail();
                        connman.ReleaseNodeVector(vNodesCopy);
                        return;
                    }
                    SwitchToNextAsset(connman);
                    connman.ReleaseNodeVector(vNodesCopy);
                    return;
                }

	            // request from three peers max
				if (nRequestedMasternodeAttempt > 2) {
					connman.ReleaseNodeVector(vNodesCopy);
					return;

				}
                // only request once from each peer
                if(netfulfilledman.HasFulfilledRequest(pnode->addr, "masternode-list-sync")) continue;
                netfulfilledman.AddFulfilledRequest(pnode->addr, "masternode-list-sync");

                if (pnode->nVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
                nRequestedMasternodeAttempt++;

                mnodeman.DsegUpdate(pnode, connman);

                connman.ReleaseNodeVector(vNodesCopy);
                return; //this will cause each peer to get one request each six seconds for the various assets we need
            }

            // MNW : SYNC MASTERNODE PAYMENT VOTES FROM OTHER CONNECTED CLIENTS

            if(nRequestedMasternodeAssets == MASTERNODE_SYNC_MNW) {
                LogPrint(BCLog::MNPAYMENT, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d nTimeLastBumped %lld nTimeLastProcess %lld diff %lld\n", nTick, nRequestedMasternodeAssets, nTimeLastBumped, nTimeLastProcess, nTimeLastProcess - nTimeLastBumped);
                // check for timeout first
                // This might take a lot longer than MASTERNODE_SYNC_TIMEOUT_SECONDS due to new blocks,
                // but that should be OK and it should timeout eventually.
                if(nTimeLastProcess - nTimeLastBumped > MASTERNODE_SYNC_TIMEOUT_SECONDS) {
                    LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d -- timeout\n", nTick, nRequestedMasternodeAssets);
                    if (nRequestedMasternodeAttempt == 0) {
                        LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- ERROR: failed to sync %s\n", GetAssetName());
                        // probably not a good idea to proceed without winner list
                        Fail();
                        connman.ReleaseNodeVector(vNodesCopy);
                        return;
                    }
                    SwitchToNextAsset(connman);
                    connman.ReleaseNodeVector(vNodesCopy);
                    return;
                }

                // check for data
                // if mnpayments already has enough blocks and votes, switch to the next asset
                // try to fetch data from at least two peers though
                if(nRequestedMasternodeAttempt > 1 && mnpayments.IsEnoughData()) {
                    LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d -- found enough data\n", nTick, nRequestedMasternodeAssets);
                    SwitchToNextAsset(connman);
                    connman.ReleaseNodeVector(vNodesCopy);
                    return;
                }

				// request from three peers max
				if (nRequestedMasternodeAttempt > 2) {
					connman.ReleaseNodeVector(vNodesCopy);
					return;

				}

                // only request once from each peer
                if(netfulfilledman.HasFulfilledRequest(pnode->addr, "masternodepayment-sync")) continue;
                netfulfilledman.AddFulfilledRequest(pnode->addr, "masternodepayment-sync");

                if(pnode->nVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
                nRequestedMasternodeAttempt++;

                // ask node for all payment votes it has (new nodes will only return votes for future payments)
                //sync payment votes

                connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MASTERNODEPAYMENTSYNC));

                // ask node for missing pieces only (old nodes will not be asked)
                mnpayments.RequestLowDataPaymentBlocks(pnode, connman);

                connman.ReleaseNodeVector(vNodesCopy);
                return; //this will cause each peer to get one request each six seconds for the various assets we need
            }

            // GOVOBJ : SYNC GOVERNANCE ITEMS FROM OUR PEERS

            if(nRequestedMasternodeAssets == MASTERNODE_SYNC_GOVERNANCE) {
                LogPrint(BCLog::GOBJECT, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d nTimeLastBumped %lld nTimeLastProcess %lld diff %lld\n", nTick, nRequestedMasternodeAssets, nTimeLastBumped, nTimeLastProcess, nTimeLastProcess - nTimeLastBumped);

                // check for timeout first
                if(nTimeLastProcess - nTimeLastBumped > MASTERNODE_SYNC_TIMEOUT_SECONDS) {
                    LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d -- timeout\n", nTick, nRequestedMasternodeAssets);
                    if(nRequestedMasternodeAttempt == 0) {
                        LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- WARNING: failed to sync %s\n", GetAssetName());
                        // it's kind of ok to skip this for now, hopefully we'll catch up later?
                    }
                    SwitchToNextAsset(connman);
                    connman.ReleaseNodeVector(vNodesCopy);
                    return;
                }

                // only request obj sync once from each peer, then request votes on per-obj basis
                if(netfulfilledman.HasFulfilledRequest(pnode->addr, "governancesync")) {
                    int nObjsLeftToAsk = governance.RequestGovernanceObjectVotes(pnode, connman);
                    static int64_t nTimeNoObjectsLeft = 0;
                    // check for data
                    if(nObjsLeftToAsk == 0) {
                        static int nLastTick = 0;
                        static int nLastVotes = 0;
                        if(nTimeNoObjectsLeft == 0) {
                            // asked all objects for votes for the first time
                            nTimeNoObjectsLeft = nTimeLastProcess;
                        }
                        // make sure the condition below is checked only once per tick
                        if(nLastTick == nTick) continue;
                        if(nTimeLastProcess - nTimeNoObjectsLeft > MASTERNODE_SYNC_TIMEOUT_SECONDS &&
                            governance.GetVoteCount() - nLastVotes < std::max(int(0.0001 * nLastVotes), MASTERNODE_SYNC_TICK_SECONDS)
                        ) {
                            // We already asked for all objects, waited for MASTERNODE_SYNC_TIMEOUT_SECONDS
                            // after that and less then 0.01% or MASTERNODE_SYNC_TICK_SECONDS
                            // (i.e. 1 per second) votes were received during the last tick.
                            // We can be pretty sure that we are done syncing.
                            LogPrint(BCLog::MNSYNC, "CMasternodeSync::ProcessTick -- nTick %d nRequestedMasternodeAssets %d -- asked for all objects, nothing to do\n", nTick, nRequestedMasternodeAssets);
                            // reset nTimeNoObjectsLeft to be able to use the same condition on resync
                            nTimeNoObjectsLeft = 0;
                            SwitchToNextAsset(connman);
                            connman.ReleaseNodeVector(vNodesCopy);
                            return;
                        }
                        nLastTick = nTick;
                        nLastVotes = governance.GetVoteCount();
                    }
                    continue;
                }
                netfulfilledman.AddFulfilledRequest(pnode->addr, "governancesync");

                if (pnode->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) continue;
                nRequestedMasternodeAttempt++;

                SendGovernanceSyncRequest(pnode, connman);

                connman.ReleaseNodeVector(vNodesCopy);
                return; //this will cause each peer to get one request each six seconds for the various assets we need
            }
        }
    }
    // looped through all nodes, release them
    connman.ReleaseNodeVector(vNodesCopy);
}

void CMasternodeSync::SendGovernanceSyncRequest(CNode* pnode, CConnman& connman)
{
    CNetMsgMaker msgMaker(pnode->GetSendVersion());

    if(pnode->nVersion >= GOVERNANCE_FILTER_PROTO_VERSION) {
        CBloomFilter filter;
        filter.clear();

        connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MNGOVERNANCESYNC, uint256(), filter));
    }
    else {
        connman.PushMessage(pnode, msgMaker.Make(NetMsgType::MNGOVERNANCESYNC, uint256()));
    }
}

void CMasternodeSync::AcceptedBlockHeader(const CBlockIndex *pindexNew)
{
    LogPrint(BCLog::MNSYNC, "CMasternodeSync::AcceptedBlockHeader -- pindexNew->nHeight: %d\n", pindexNew->nHeight);

    if (!IsBlockchainSynced()) {
        // Postpone timeout each time new block header arrives while we are still syncing blockchain
        BumpAssetLastTime("CMasternodeSync::AcceptedBlockHeader");
    }
}

void CMasternodeSync::NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman& connman)
{
    LogPrint(BCLog::MNSYNC, "CMasternodeSync::NotifyHeaderTip -- pindexNew->nHeight: %d fInitialDownload=%d\n", pindexNew->nHeight, fInitialDownload);

    if (IsFailed() || IsSynced() || !pindexBestHeader)
        return;

    if (!IsBlockchainSynced()) {
        // Postpone timeout each time new block arrives while we are still syncing blockchain
        BumpAssetLastTime("CMasternodeSync::NotifyHeaderTip");
    }
}

void CMasternodeSync::UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload, CConnman& connman)
{
    LogPrint(BCLog::MNSYNC, "CMasternodeSync::UpdatedBlockTip -- pindexNew->nHeight: %d fInitialDownload=%d\n", pindexNew->nHeight, fInitialDownload);

    if (IsFailed() || IsSynced() || !pindexBestHeader)
        return;

    if (!IsBlockchainSynced()) {
        // Postpone timeout each time new block arrives while we are still syncing blockchain
        BumpAssetLastTime("CMasternodeSync::UpdatedBlockTip");
    }

    if (fInitialDownload) {
        // switched too early
        if (IsBlockchainSynced()) {
            Reset();
        }

        // no need to check any further while still in IBD mode
        return;
    }

    // Note: since we sync headers first, it should be ok to use this
    static bool fReachedBestHeader = false;
    bool fReachedBestHeaderNew = pindexNew->GetBlockHash() == pindexBestHeader->GetBlockHash();

    if (fReachedBestHeader && !fReachedBestHeaderNew) {
        // Switching from true to false means that we previousely stuck syncing headers for some reason,
        // probably initial timeout was not enough,
        // because there is no way we can update tip not having best header
        Reset();
        fReachedBestHeader = false;
        return;
    }

    fReachedBestHeader = fReachedBestHeaderNew;

    LogPrint(BCLog::MNSYNC, "CMasternodeSync::UpdatedBlockTip -- pindexNew->nHeight: %d pindexBestHeader->nHeight: %d fInitialDownload=%d fReachedBestHeader=%d\n",
                pindexNew->nHeight, pindexBestHeader->nHeight, fInitialDownload, fReachedBestHeader);

    if (!IsBlockchainSynced() && fReachedBestHeader) {
        if (fLiteMode) {
            // nothing to do in lite mode, just finish the process immediately
            nRequestedMasternodeAssets = MASTERNODE_SYNC_FINISHED;
            return;
        }
        // Reached best header while being in initial mode.
        // We must be at the tip already, let's move to the next asset.
        SwitchToNextAsset(connman);
    }
}

redpajama_set_name: RedPajamaGithub


text:
X-Buy
You are here: Home / International Hockey Federation announce India as hosts for FIH Junior Men's World Cup 2021
International Hockey Federation announce India as hosts for FIH Junior Men's World Cup 2021
February 17, 2020 by www.mykhel.com Leave a Comment
In an official announcement on Monday, the international governing body also announced that the competition will be played towards the end of 2021. The competition, which features the best young U-21 level talent from across the world, will again be heading to India, which won accolades from around the world for hosting one of the best FIH Senior Men's Hockey World Cups in 2018 held at the Kalinga Hockey Stadium, Bhubaneswar. After having hosted the FIH Junior Men's World Cup in Lucknow, Uttar Pradesh in 2016, where India lifted the coveted trophy, India will again be hosting the biggest Junior-level competition in hockey. 🚨 Venues for the 2021 FIH Hockey Junior World Cup (Women's and Men's) are announced! 🚨#IndiaKaGame #WorldCup pic.twitter.com/xWc0smmhTo — Hockey India (@TheHockeyIndia) February 17, 2020 The FIH Junior Men's World Cup will see a total of 16 teams compete for the title, out of which six will be from Europe, four from Asia including hosts India, two from Africa, two from Oceania and two from Pan America. Out of the 16 teams, the six European teams who have already qualified for the event in India are – Germany, England, Netherlands, Spain, Belgium and France, as they secured… Read full this story
FIFA considering four bids to host 2023 Women's World Cup
Trent Boult, Ross Taylor Star As New Zealand Crush India By 6 Wickets In World Cup Warm-Up
FIFA to consider four bids to host 2023 Women's World Cup
FIFA to consider four bids to host 2023 Women's World Cup
Goa given green light to host FIFA U-17 World Cup India
How India should plan for T20 World Cup next year
There will be no World Cup of Hockey during 2021 season
Australia, NZ confirm joint bid for 2023 Women's World Cup
England suffer World Cup heartbreak against USA as penalty curse strikes again
What is the kinesio tape that Ivan Perisic and Dele Alli are wearing at the World Cup and what does it do?
International Hockey Federation announce India as hosts for FIH Junior Men's World Cup 2021 have 327 words, post on www.mykhel.com at February 17, 2020. This is cached page on X-Buy. If you want remove this page, please contact us.
Filed Under: Sport fih, hockey, hockey india, junior mens hockey team, international hockey federation, india, world cup, fih junior mens world cup 2021, hockey world cup, schedule, indian hockey, para cycling world cup canada, junior a world hockey, junior a world championships hockey, live u 19 world cup 2018, sony 3 live world cup, junior golf world cup japan, junior golf world cup, where is the world cup, ko osvaja world cup 2018 u rusiji, next rugby world cup, when england won cricket world cup, why india does not play fifa world cup, when india will announce world cup squad, india how many world cup won, india how many times won world cup, india for world cup 2019, 2023 fifa women's world cup host, 2023 icc world cup host, who hosted the first world cup, men's hockey world cup 2018, when hockey world cup started, india announces world cup squad, when will afghanistan announce world cup squad, why t20 world cup in 2021, when india will host fifa world cup, t20 world cup live streaming free, pakistan vs india hockey
These sterilizers will make prepping baby bottles a breeze
Meet the man on a controversial mission to preserve and digitize your brain
This strange planet has three suns and orbits at a funky angle
Trump Finally Admits He Had to Be Stopped From Assassinating Assad After Years of Denying It
The Right Wing's New Election Boogeyman
Trump dubs Carl Bernstein a 'total nut job' after Watergate legend calls president 'homicidal'
Stars on to Stanley Cup Final after 3-2 OT win over Vegas
Wounded hero LA County sheriff's deputy identified, was librarian before joining police force
Copyright © 2021 X-Buy. Power by Wordpress.

redpajama_set_name: RedPajamaCommonCrawl


text:
NRA Gun Of The Week
NRA Gun Gear Of The Week
American Riflewoman
Exploded-View
Pump-Action
Break-Action
APPEARS IN News Handguns Historical
Heckler & Koch P7 Pistol
by NRA Staff - Tuesday, May 19, 2009
The H&K P7 pistol is famous for its innovative design and unique squeeze cocking system of operation. Originally designated "PSP," for Police Service Pistol, it was H&K's bid to replace the German federal police agency's aging stock of Walther P.38s. The German government wanted a single, universal, semi-automatic pistol compact and light enough for undercover officers yet capable of firing 9 mm Luger (9x19 mm) ammunition.
To meet the government's weight limit of 2 pounds, 3 ounces, H&K took an unusual route and opted for a gas-retarded, delayed blowback operating system. The violence of a blowback design usually limits its use to relatively low-power cartridges such as .32 ACP or .380 ACP and requires a heavy slide and recoil spring. But H&K designers delayed or retarded the gun's blowback action with a gas system. The PSP's barrel is ported just forward of the case mouth seat in the bottom of the fluted chamber. Gas pressure diverted to the cylinder impinges on a piston pinned to the slide, retarding normal blowback operation until chamber pressure drops to a point safe enough for extraction and ejection. This eliminates the need for a heavy slide and recoil spring. The unique operating system brought the PSP within the weight limit despite its all-steel construction.
The PSP was also among the first pistols to incorporate polygonal rifling, which at the time was thought to produce higher velocities than conventional rifling. Our "Dope Bag" testing of the gun in March of 1981 did not bear that out, however, that may have been because the pistol's 37⁄8-inch barrel was one of the shortest available in 9x19 mm.
Far beyond its small size and unusual delayed blowback design, the PSP is best known for its squeeze-cocking operation. In lieu of a fixed front strap the gun uses a finger-grooved cocking bar/lever that initially requires 13 pounds of pressure to make the gun ready to fire. While that might seem overly stiff, it is actually rather easy to apply because three fingers are at work. Also, once the squeeze cocker's spring is compressed, only 1 1⁄2-pounds. of pressure is required to keep the gun ready to fire. Aside from this cocking lever/grip safety, there are no other external safeties.
After emerging as the clear winner of the German government tests, the PSP was adopted as the standard pistol for its federal police force in 1978 and designated the P7. The German police contract was so large that there were no commercial sales until 1981. Once available for the civilian market, the P7 was offered in a variety of models, including the P7 M13. This gun has a double-column, 13-round magazine in place of the original's single-column, eight-round type. Alternate chamberings included .40 S&W in the P7 M10 with a 10-round, double-column magazine and the straight-blowback P7 K3 in .32 ACP, .380 ACP and .22 LR.
The P7 does not require the shooter to master two distinct trigger pulls. It also requires no manual manipulation of a separate safety lever as in a single-action design. The cocking lever cocks the hammer and acts as a decocker, grip safety and slide release. The only other external controls are a slide stop, a magazine release and a take-down latch.
The P7 appeared at a time when most U.S. law enforcement officers were equipped with revolvers, because semi-automatics were deemed too complex and unreliable for use by officers on the street. Despite its high price and sporadic availability, the P7 was adopted by a number of U.S. police departments. The gun's ease of operation, slim profile and light weight changed the way police and licensed individuals look at carry guns.
handguns Heckler & Hoch Heckler & Koch P7 historical hk P7 Pistol semi-auto
More Like This From Around The NRA
The Great Ammo Shortage of 2020: When Will It End?
6 Unique Handguns That Break The Mold
The Keefe Report: Where's All The Ammo?
Ammo Shortage Will Last Deep into 2021
6.8 mm Western: Winchester Charges Ahead
The Keefe Report: 1911 Pistols Then and Now
Power Couple: Wilson Combat Southpaw Protector Series AR In .300 HAM'R
New for 2021: CZ TS2 Competition Pistol
EmediaRifleman@nrahq.org
For questions/comments about American Rifleman magazine, please e-mail:
To advertise on American Rifleman, visit nramediakit.com for more information
FOLLOW AMERICAN RIFLEMAN
Get the American Rifleman Insider newsletter for at-a-glance access to industry news, gear, gun reviews, videos and more—delivered directly to your Inbox.


.In unistd.h int brk "const void *addr" void * sbrk "intptr_t incr"
.Bf -symbolic The brk and sbrk functions are legacy interfaces from before the advent of modern virtual memory management.
The brk and sbrk functions are used to change the amount of memory allocated in a process's data segment. They do this by moving the location of the "break". The break is the first address after the end of the process's uninitialized data segment (also known as the "BSS").
The brk function sets the break to addr.
The sbrk function raises the break by incr bytes, thus allocating at least incr bytes of new memory in the data segment. If incr is negative, the break is lowered by incr bytes.
While the actual process data segment size maintained by the kernel will only grow or shrink in page sizes, these functions allow setting the break to unaligned values (i.e., it may point to any address inside the last page of the data segment).
The current value of the program break may be determined by calling sbrk 0. See also end(3).
The getrlimit(2) system call may be used to determine the maximum permissible size of the data segment. It will not be possible to set the break beyond "etext + rlim.rlim_max" where the rlim.rlim_max value is returned from a call to getrlimit RLIMIT_DATA &rlim. (See end(3) for the definition of etext).
The sbrk function returns the prior break value if successful; otherwise the value (Vt "void *"-1) is returned and the global variable errno is set to indicate the error.
The requested break value was beyond the beginning of the data segment.
The data segment size limit, as set by setrlimit(2), was exceeded.
Insufficient space existed in the swap area to support the expansion of the data segment.


text:
Q: use of the word 'salve' instead of ''ointment'' A few days back I popped in a question  here on this forum about the use of 'salve' as a remedy in figurative language. Later on, another question pinched my mind that is, do native use this word 'salve' for "a substance that you put on a wound or sore skin to help it heal or to protect it"  or they simply prefer to use the word 'ointment'?

A: That is the meaning of the word. But it is quite rare, because most people are not in the business of dressing wounds. So a nurse might use the word, but it is not common for other people.
The usual antiseptic salves that you might have in your first aid kit would probably be called "cream"

If you have grazed your knee, put some of this cream on it and an Elastoplast.

A: Salve is an oily substance that is put on sore skin or a wound to help it heal. An ointment is a smooth thick substance that is put on sore skin or a wound to help it heal. These are the definitions of the Collins Dictionary.
I think salve is more similar to balm. My first association is lip salve, which is the same as lip balm.
Ointment usually contains medicine, salve - not necessarily.

redpajama_set_name: RedPajamaStackExchange


Ballarat Synagogue, cnr Princes & Barkly Streets, Ballarat. Gold Museum Collection.
"Hidden away in plain view", that is how many people describe the location of the Ballarat Synagogue. On the main tourist route from Melbourne to Sovereign Hill, a large stone structure on a bend of road near the East Ballarat Fire Station, hints at a connection to a Jewish community in Ballarat. In fact there have been people of the Jewish faith involved actively in Ballarat's history from the beginning of European settlement here.
On Tuesday evening, 11 October 1853, Jews from Ballarat town and the adjacent gold-mining diggings gathered in the dining room of the Clarendon Hotel, Ballarat, to usher in "Yom Kippur", their Day of Atonement and the most sacred festival in the Jewish year. That night, the Ballarat Jewish community was established. Inside dust jacket of Formula For Survival by Newman Rosenthall (1979).
Emmanuel Steinfeld 1893. Latrobe picture collection, State Library of Victoria.
Creswick Mining Disaster Relief Fund Executive Committee, set up after the tragedy at the Australasian Mine in Creswick. This committee worked to set up a relief fund helping sufferers of mining disasters. Sovereign Hill has recreated the facade of his furniture store at the top of Main St to honour his contribution to the settlement of Ballarat.
Edward Thonen is remembered in Ballarat as the 'lemonade seller' who was the first digger killed during the battle at the Eureka Stockade. Thonen came from Eberfeldt in Prussia. He travelled around the goldfields with a keg, selling lemonade. This lemonade may have actually been alcohol, but selling alcohol was illegal so no official reports confirm this. Rafaello Carboni, who was in Ballarat at this time and wrote the first account, reported that no one could defeat Thonen at chess.
Burning of the Eureka Hotel, by Charles Doudiet 1854. Gold Museum Collection.
Another German who was directly involved in the events leading up to Eureka was Manastra (or Manestra) Flatow. He was one of the ten men taken up by the authorities following the riot and burning of Bentley's Eureka Hotel. Three of these men were sent to prison for their involvement but Manastra and six others were released.
Charles Dyte was a witness to, and a victim of, the events around Eureka in 1854. Dyte immigrated from London and became a prominent citizen of Ballarat before the Eureka battle. In 1854 he was about to open a new store on the goldfields. He had directed the goods for the store to be delivered to his friend, James Bentley at the Eureka Hotel. The next day the Hotel and all his goods were ashes. Dyte submitted a claim for his losses but did not receive any compensation. Directly after the Eureka battle, on the 6th Dec 1854, a meeting was called and several resolutions were made and forwarded on to the Governor. Dyte was one of three prominent Jewish men involved in this meeting along with W. Levy and Henry Harris who was the first president of the Ballarat Hebrew Congregation. Dyte laid the foundation stone for the Ballarat Synagogue mentioned above on January 25, 1861.
Jewish people have actively contributed to Ballarat's growth since the gold rush and right up to the present day. When Jewish culture thrived, Ballarat boasted a Jewish Philanthropic Society, Hebrew day school, Hebrew Ladies Benevolent Society, Jewish Club, a Jewish Young Men's Literary and Debating Society, and even a Hebrew Fire Brigade. Several of the members of the community have been Members of Parliament, local Councillors and mayors of the different boroughs of Ballarat. One of the most prominent of these people was Nathan Spielvogel.
Entrance to Jessica and Paul Simon Pavillion, Gold Museum Ballarat.
Sovereign Hill has been blessed with patronage from several prominent members of the Ballarat Hebrew congregation over many years, especially Jessica and Paul Simon who have a pavilion in the Gold Museum named in their honour.
Another notable figure from Ballarat's history is Abraham Levy. In 1925 Abraham was President of the Hebrew Congregation in Ballarat, Mayor of Ballarat and the first President of the Rotary Club of Ballarat. Quite a contribution in a single year.
The current President of Ballarat's Hebrew Congregation is Mr John Abraham. John's family arrived in Ballarat in 1853 and have lived and worked in the community up to the present day. John has also been an active member of Rotary in Ballarat having served as the 50th and 75th President of Rotary in the city. John has also been a great supporter of Sovereign Hill over many years, .
If you have any further information or questions about the Jewish people in Ballarat please contact us.
This entry was posted in Immigration, Sovereign Hill, Victorian Gold Rush and tagged 1850s people, Ballarat, immigration. Bookmark the permalink.


text:
Q: Как связать Bounds динамически созданных контролов (Windows Forms) Суть:
Появилось у меня желание слегка кастомизировать ListView, путём прикручивания к его Subitems[ind] элемента ProgressBar, и в целом само по себе прикручивание я кое-как реализовал (см. скриншот)
Код добавления элемента списка с ProgressBar-ом:
private void btAdd_click(object sender, EventArgs e) {
    var item = new ListViewItem("Test");
    var progressSubitem = new ListViewItem.ListViewSubItem();
    var pb = new ProgressBar();

    progressSubitem.Tag = pb; // За это не ругайте
    lvFilesList.Controls.Add(pb);
    item.SubItems.Add(progressSubitem);
    lvFilesList.Items.Add(item);

    pb.Bounds = progressSubitem.Bounds;
}

Прикольно? Прикольно. Но тут появился вопрос: Если я захочу изменить ширину колонки ListView-а, то мои ProgressBar-ы должны как-то об этом узнать, и соответствующим образом на мои действия отреагировать. Было решено попробовать пойти в лоб, и циклами перебрать каждый ListViewItem моего ListView, и каждый ListViewSubItem моих ListViewItem-ов в событии ColumnWidthChanging ListView-а (звучит вся эта конструкция ужасно):
Код обновления размеров всех ProgressBar-ов
private void lvFilesList_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) {
            ProgressBar instantBar;
            foreach (ListViewItem item in lvFilesList.Items) {
                foreach (ListViewItem.ListViewSubItem subitem in item.SubItems) {
                    instantBar = (subitem.Tag as ProgressBar);
                    if (instantBar != null) {
                        instantBar.Bounds = subitem.Bounds;
                    }
                }
            }
        }

И это в принципе работает при небольшом количестве записей в списке, и все размеры изменяются адекватно. Но как только список разрастается - начинаются (вполне ожидаемо для такого подхода) тормоза.
А теперь вопрос: Как правильно изменить Bounds каждого ProgressBar-а в соответствии с Bounds соответствующего ему Subitem-а? Ведь по-любому должен быть другой, более быстрый и эффективный способ решить эту проблему, но я его просто не знаю. Заранее спасибо.
P.S.: Сторонние штуки желательно не предлагать
Бонусом: Наглядная иллюстрация проблемы


Taking the listener from 1960 – 1995. A must for completists. Steve ties up all the loose ends of his solo career, collaborations, rarities, hard to finds, demos and one offs. Some of this is crystal clear precision and clarity, some of this is not for the faint hearted – unless you loved your old tape deck, all of it however is guaranteed to please the connoisseur.
CD art comes to you as a 'Green Forestry Sleeve'. Made with 100% Green Forestry Practices Certified board only and using 100% vegetable inks. We here at TTB Headquarters care about what happens to our planet.
(Double check you click the correct postage upon checkout for your area too to avoid delays).


text:
Posted on January 31, 2019 by Baseballia
N.L. President John Heydler rules that Rogers Hornsby cannot continue to both hold stock in the Cardinals and play for the Giants. In early 1927, Hornsby was able to sell his shares at $105 each, enabling him to officially become a Giant.
Major League Baseball Commissioner Happy Chandler fined the New York Yankees, Chicago Cubs, and Philadelphia Phillies $500 each after it was discovered that they were attempting to sign high school players for the upcoming season.
Lou Perini, Guido Rugo, and Joseph Maney buy control of the Boston Braves and Casey Stengel is soon out as manager. In six seasons at the helm, the "Old Perfesser" had not been able to lift the talent-challenged Bees/Braves out of the second division.
Happy 84th birthday to Milwaukee's own "Mr. Baseball," Bob Uecker. No words can adequately describe this Brewers icon. He spent parts of six seasons in MLB with the Braves, Phillies and Cardinals. Here is hoping he has a GREAT day!
Neil Allen was born in Kansas City, Kansas. Allen was 21 years old when he broke into the big leagues on April 15, 1979, with the New York Mets. He eventually became the Amazin's closer. Unwilling to part with Allen in a trade, the Mets sent Jeff Reardon to the Expos. Reardon would go on to save 152 games for…
Continue readingOn This Day: January 24
Modern New York Yankees great Don Mattingly officially announces his retirement at a media conference in Yankee Stadium. In 14 seasons with the Bronx Bombers, "Donnie Baseball" hit to a slash line of .307/.358/.471
In a move that stuns New York Mets fans, the Chicago White Sox draft pitcher Tom Seaver as compensation for losing Type A free agent Dennis Lamp to the Blue Jays. The Mets left Seaver off their protected list, foolishly assuming that no team would select the aging star. He will win his 300th game in a White Sox uniform…
Happy 69th birthday to Jon Matlack of the New York Mets and Texas Rangers. Matlack, the 1972 NL Rookie of the Year, compiled 1,023 strikeouts and a 3.03 ERA in a seven-year run as one of the "Big Three" pitchers the New York Mets were built around in the 1970s, along with Tom Seaver and Jerry Koosman.
Orlando Cepeda signs with the Boston Red Sox, making him the first player signed by a team specifically to be a designated hitter. His slash line will be .289/.350/.444 with 20 HRs and 86 RBI in his one Beantown season.
A.L. owners vote 9-1 against Charlie Finley's proposal to move the Kansas City A's to Louisville. Finley is given an ultimatum to sign a lease in Kansas City or lose his franchise. The Athletics will play four more seasons in Kansas City before moving to Oakland.
Page 1 Page 2 →


Charles Wesley, perhaps best known for his hymns, "Hark the Herald Angels Sing" and "Jesus Lover of My Soul," was the younger brother of John Wesley and the co-founder and poet-laureate of Methodism. Although he was an important figure in the history of Protestantism, Wesley's personal life was shrouded by a cloak of silence and much of his work went unpublished. In this illuminating reader, John Tyson has collected hymns, sermons, letters, and journal material--many rare and hitherto unknown--to chronicle the life and works of Wesley in his own words. Tyson provides an extensive biographical-theological introduction, and supplements Wesley's collected works with interpretative and introductory notes, creating a definitive account of Wesley's character and contribution to the Methodist heritage.


text:
Q: Looking for a tutorial on moving Pre-Storyboard code (XCode4) to Storyboard code (XCode5) I'm trying to get to grips with XCode5, but most code samples are pre-XCode5. and of course pre iOS7. The main issue is Storyboards. LOTS of people want to know how to build in SCode5 without Storyboards - but I wan't to know how to move pre-storyboard code to storyboard code.
For Example. The most excellent book, "Geolocation in iOS" Alasdair Allan, O'Reilly, 2012, is full of code written a few releases ago. Of course as I am coming into XCode at XCode5/iOS7 level, I have no idea what they are talking about in various parts.
I kind of have the beginning of the sample code working but it's throwing an erro now and I can't figure it out. I suspect because its trying to do it Code4 way, and I'm in XCode5.
Anyway - what would be nice is a tutorial that points out what one changes.
Let me give an example:
The code for the first example in the book goes like this.
In the Project Navigator image in the book, it shows
LocationAppDelegate.h
LocationAppDelegate.m
LocationViewController.h
LocationViewController.
LocationViewController.xib

In my display, I have all the same files, Except. Instead of the ".xib" file I have "Main.storyboard"
So far ok - I believe from what I have read, that the Main.storyboard is the new equivelant of the xib file.
But there are a LOT of differences in the automatically generated code within the .h and .m files. So having done my best, I at least have the location service displaying a dummy location in the debug window.
But - now I have this error. Well two errors actually.
The first, a Semantic warning
LocationViewController.m:15:17: Method 'tableView:cellForRowAtIndexPath:' in protocol not implemented

The second, an error with the red ! mark
LocationViewController.m:60:9: No visible @interface for 'UITableView' declares the selector 'dequeueReusableCellWithIndentifier:'

The code as it appears in the book is fairly straight forward, but this error has lost me.
The code from LocationViewController.m
//
//  LocationViewController.h
//  Location
//
//  Created by Robert Chalmers on 08/10/2013.
//  Copyright (c) 2013 Robert Chalmers. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface LocationViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>

@property (strong, nonatomic) IBOutlet UITableView *tableView;

@end

The code from LocationViewController.m
//
//  LocationViewController.m
//  Location
//
//  Created by Robert Chalmers on 08/10/2013.
//  Copyright (c) 2013 Robert Chalmers. All rights reserved.
//

#import "LocationViewController.h"

@interface LocationViewController ()

@end

@implementation LocationViewController

@synthesize tableView = _tableView;

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - View lifecycle

#pragma mark UITableViewDelegate Methods

- (void)tableView:(UITableView *)tv
        didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    //add code here
}

#pragma mark UITableViewDataSource Methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tv {
    return 1;
}

- (NSInteger) tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section {
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *identifier = @"cell";
    UITableViewCell *cell =
    //[tv dequeueReusableCellWithIndentifier:@"cell"];
    [tv dequeueReusableCellWithIndentifier:@"cell"];
    if (cell == nil ) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                       reuseIdentifier:identifier];
        cell.accessoryType = UITableViewCellAccessoryNone;

    return cell;
    }

}

@end

and for what it's worth, the code from LocationAppDelegate.h and followed by .m
//
//  LocationAppDelegate.h
//  Location
//
//  Created by Robert Chalmers on 08/10/2013.
//  Copyright (c) 2013 Robert Chalmers. All rights reserved.
//

#import <UIKit/UIKit.h>

@class viewController;

@interface LocationAppDelegate : UIResponder <UIApplicationDelegate, CLLocationManagerDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) viewController *viewController;
@property (strong, nonatomic) CLLocationManager *locationManager;

@end

============

//
//  LocationAppDelegate.m
//  Location
//
//  Created by Robert Chalmers on 08/10/2013.
//  Copyright (c) 2013 Robert Chalmers. All rights reserved.
//

#import "LocationAppDelegate.h"
#import "LocationViewController.h"

@implementation LocationAppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;
@synthesize locationManager = _locationManager;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    if ([CLLocationManager locationServicesEnabled]) {
        self.locationManager = [[CLLocationManager alloc] init];
        self.locationManager.delegate = self;
        self.locationManager.distanceFilter = 1000;
        [self.locationManager startUpdatingLocation];
    }

    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

- (void)locationManager:(CLLocationManager *)manager
                         didUpdateToLocation:(CLLocation *)newLocation
                          fromLocation:(CLLocation *)oldLocation {
                              NSLog(@"Location: %@", [newLocation description]);
                          }

- (void)locationManager:(CLLocationManager *)manager
       didFailWithError:(NSError *)error {
    NSLog(@"Error: %@", [error description]);
}

@end

Mostly of course, I'd like to know what that error is, but also if there is some guidelines as to what now goes in what files?
Thanks.

A: I think you should have a look into this to fix xcode 5 storyboards errors.
Regarding the error, you should try:
[tv dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];

Instead of:
[tv dequeueReusableCellWithIndentifier:@"cell"];

A: Here you can find your answer
iOS7 storyboard in Xcode 5 keep growing vertically

*

*Commit a version of your code before Xcode changes its storyboard

*

*Click on the storyboard. Xcode will ask if you want to upgrade.

*Choose the always upgrade

*At this state the storyboard is already messed up by Xcode. don't
worry. just close the project.

*Do a "git stash" and go back to the version to committed in step 0
above

*Open your project again.


available to anyone affected by MS.
Karen has been compensated by Sanofi Genzyme.
to get help at any time, 24/7.
Geoff has been compensated by Sanofi Genzyme.
Emily has been compensated by Sanofi Genzyme.
Mary Beth has been compensated by Sanofi Genzyme.
Julie has been compensated by Sanofi Genzyme.
well your treatment is working.
Know what to look for and when to act.
as important as your treatment.
Are you getting the care you need?
We have events all across the country. Learn more about these relapsing MS treatment options.
using our Doctor Discussion Guide.
symptoms with our Symptom Tracker.


text:
Q: 80s TV movie: ship with child crew Question regarding a TV movie from the 80s with a ship crewed entirely by children.  These children were geniuses who were specifically chosen because it was the only way a crew could make it all the way to the destination and back again.  They were shepherding a bunch of scientists, etc., who were in suspended animation.

A: Are you looking for Earth Star Voyager? This is actually a miniseries that never got past the pilot.

The Earth Star Voyager is a spaceship sent to another solar system to prepare it for colonization. Earth itself is horribly polluted, so the mission is vitally important. But as the departing starship gets under way, signs begin to emerge that their mission may unwittingly be part of a larger conspiracy.

See also: Earth Star Voyager (IMDB)


text:
River Farset: Belfast's Forgotten River
by Kaushik Patowary Thursday, June 21, 2018
The city of Belfast in Northern Ireland looked very different when it was a thriving industrial city in the 18th century. A large river flowed through the heart of the city flanked by mills and factories that produced the finest linen in the world. But then the river was bricked up and it disappeared forever underneath the city. Now many Belfast residents look incredulous when they are told that there is a river flowing under their feet.
When Belfast was founded, it was little more than a village located at the confluence of two rivers—Farset and Lagan. There was a narrow sandbar here that provided a natural crossing over River Farset when the tide was low. This area would later develop into the intersection of High Street and Victoria Street. A little over two hundred meters to the east, the Farset emptied into the Lagan. The settlement's original Irish name Béal Feirste alludes to this sandbar; it means "the sandbar across the river's mouth".
River Lagan in Belfast. Photo credit: William Murphy/Flickr
Up until the 1600s, Belfast was pretty much an insignificant village. Then in 1640, the Lord Deputy of Ireland bestowed upon Belfast significant custom rights and also relocated the customs house to Belfast, and new trade flooded into the town. Belfast grew throughout the 17th century, and the banks of the Farset soon developed into the first quaysides of the burgeoning merchant town. Around this time, the linen trade in Northern Ireland blossomed and by the middle of the 18th century, one fifth of all the linen exported from Ireland was shipped from Belfast. By the turn of the 19th century, Belfast had transformed into the largest linen producing center in the world earning the nickname "Linenopolis".
As Belfast began to develop into a big industrial town, rivers Farset and Blackstaff—another principle tributary of river Lagan—began to suffer. The rivers that helped propel Belfast into the industrial age became an open sewage. Waste materials from factories and distilleries as well as garbage and refuse from homes were conveniently dumped into the flowing waters. Before long the smell from the polluted river became so bad that the town unanimously decided to bury the rivers under a culvert.
The river on High Street, c 1830.
There is some discrepancies regarding the dates of exactly when this happened. According to the The Town book of the Corporation of Belfast, published in 1892, the High Street section of the Farset was buried in 1770, while the final section, close to Princes Street, was covered over in 1804, as per George Benn's A history of the town of Belfast, published in 1877. But it wasn't until 1848, according to BBC, that the last section of the Farset disappeared underground. River Blackstaff was also culverted over in 1881.
Running silently under the feet of Belfast's residents, Farset has been mostly forgotten but its legacy still lives on in the city above in the names of streets and pubs that echoes the city's sea-faring heritage. There is a Skipper Street, so named because that's where the ships' captains lodged while their ships unloaded and loaded on what is now High Street. The Bridge Street gets its name from a small footbridge that once crossed the Farset. The Crow's Nest in Skipper Street, The Morning Star in Pottinger's Entry, and the Mermaid Inn, Wilson's Court, for example, are some of the pubs here that reflect this connection.
Then there is the Albert Memorial Clock, the city erected in memory of Queen Victoria's husband, Prince Albert, which is one of the city's most recognized landmarks. The 35-meters-tall sandstone tower leans 4 feet off the vertical because it was built on swampy land reclaimed from the Farset.
Belfast linen trade started to decline after World War I following the rise of mass-produced cotton clothing. Belfast's traditional heavy industry, including shipbuilding—Belfast had the world's largest shipyard; the historic RMS Titanic was built here—also suffered serious decline since the 1960s following the outbreak of the 'Troubles', a violent thirty-year conflict between the Republican and the Loyalist regarding the status of Northern Ireland. Belfast's shipbuilding and textile industries are now replaced by shopping complexes, universities, hotels and airports. Belfast is now a popular tourist destination in the UK.
The Albert Memorial Clock in Belfast. Photo credit: William Murphy/Flickr
River Farset: Belfast's Forgotten River Reviewed by Kaushik Patowary on Thursday, June 21, 2018 Rating: 5
Tags : Historical Oddities Ireland River


text:
You are here: Home » Articles filed under: 'News' » Article: 'AWM Chair Kerry Stokes rejects criticism'
AWM Chair Kerry Stokes rejects criticism
July 16th, 2020 | Browse other: News. | Tagged with: australian war memorial, opponents of the AWM $500 million expansion dismissed as special interest groups |
An artist's impressions of the Australian War Memorial redevelopment. Picture: Supplied.
Elliot Williams, War memorial chair Kerry Stokes rejects redevelopment criticism from 'special interest groups', The Canberra Times, 15 July 2020
Australian War Memorial representatives giving evidence to a parliamentary committee have dismissed opponents of the memorial's $500 million expansion merely as special interest groups from Canberra.
The standing committee on public works heard from a procession of witnesses who questioned the proposed redevelopment and its hefty price tag, including former memorial directors, war historians and a war widow.
Witnesses complained of a lack of consultation with stakeholders, former staff, experts and the general public and the overwhelming concern was the impact of the redevelopment on the social and physical heritage of the site.
However, Australian War Memorial Council chair Kerry Stokes said the public supported the expansion and was critical of those opposing the plans.
"Only after the final designs came out did the special interest groups seem to gather their momentum," said Mr Stokes.
"And most of those are in Canberra. We will not satisfy every single person.
"The number of people who claim not to have been involved is very small."
Former memorial directors Brendon Kelson and Major General Steve Gower and noted war historian Peter Stanley all said they had received no invitations to provide input on the project.
Member for Bean David Smith said he was disappointed to see the concerns of eminent individuals and Canberrans dismissed.
"It's disappointing to hear the views of Canberrans diminished or dismissed," Mr Smith said.
"We're talking about people who have made incredible contributions to the story of the [memorial]. Dismissing them as special interests reflects very poorly on the [memorial]."
Mr Stokes also addressed the criticism of the project's $500 million price tag saying there was no longer an option to redirect the funds towards any other projects or institutions as the money had already been earmarked by Treasury for the redevelopment.
"If they're [the funds] not spent for this project, they're not spent," he said.
Architect and town planner Roger Pegrum detailed his concerns that the expansion would irreversibly damage the heritage of the site and alter the character of the memorial building.
He said the memorial was intended as a "simple statement of sacrifice and valour' and housed a small amount of objects to better understand the actions of those who had served.
However, to extend the building so dramatically would "conceal the primacy of the fact that it is a memorial".
"If built as drawn, it is an irreversible and complete change to the memorial," he said.
Kellie Merritt, who's husband Paul was killed while serving in Iraq, described at the memorial as a special place for her family, somewhere she could visit and see her great-grandfather's, grandfather's and husband's name on the Wall of Honour.
She said it would be a shame if the memorial was forced to have "the burden of a brutish building on its shoulders". She was also concerned the plan risked glorifying war.
Major General Gower questioned why alternative plans such as a previously discussed exhibition space in Mitchell for large objects in the collection or a separate gallery at the Campbell site which would leave the current Anzac Hall intact. He said this option has had plans drawn up since his time as director.
Former president of the Australian Institute of Architects Clare Cousins said due process had not been followed when asking for designs and could set a dangerous precedent.
She said prospective architects were told any designs must include the demolition of Anzac Hall and did not give architects an opportunity to offer different solutions for the memorial's perceived space issue.
Current memorial director Matt Anderson said the building was never designed to be static and justified the expansion by saying Australia owed it to modern veterans to honour their service.
"We owe them no less than the debt we owe to previous generations," Mr Anderson said.
"The most significant thing we can do is allow them to see their service recognised. To allow veterans to find a touch point, if not an actual object they served with, but something they can relate with."
Several witnesses noted they did not oppose the inclusion of modern conflicts and resented the assertion, but argued these conflicts could be commemorated without such an extravagant expansion and cost.


text:
Transcript: Rep. Elijah Cummings on "Face the Nation," June 24, 2018
June 24, 2018 / 1:04 PM / CBS News
Rep. Cummings: Trump created "false crisis"
Rep. Cummings: Trump created "false crisis" 05:07
The following is a transcript of the interview with Rep. Elijah Cummings, D-Maryland, that aired Sunday, June 24, 2018, on "Face the Nation."
MARGARET BRENNAN: We are back with Maryland Representative Elijah Cummings, he is the top Democrat on the Oversight and Government Reform Committee, which is the chief investigative committee in the house and I'm going to ask you about some of that in a moment. But I want to bring you back to the topic of the day which is immigration. President Trump describes the Democrats as purely resistance. Obstructionist. Being pro criminal and pro open borders. What exactly is the Democrats platform on immigration?
REP. ELIJAH CUMMINGS: That we want to be humane. We want to make sure that these families are reunited after the president created this false crisis. And we - we want to get these families back together again we want to get rid of this zero tolerance policy that has been announced by the president. And we want to make sure as Senator Corker says, that people are given an opportunity to pursue, and legally pursue an opportunity to be a part of the United States of America.
MARGARET BRENNAN: When you say the zero tolerance policy for President Trump, the change there has been to criminally prosecute those who crossed the border with their children. Are you arguing that that should not be the case they should not be considered criminals?
REP. CUMMINGS: I think these are basically, these are misdemeanor charges. The problem is that. Sessions, Attorney General Sessions has said as you stated a little bit earlier that gang violence and domestic violence could not be used anymore with regard to asylum. Well everybody has a right to assert an asylum request. Here, we have a situation where they basically cut off, and Jordan said it too. They basically are trying to cut off people from even having that opportunity to assert asylum. So -
MARGARET BRENNAN: Gang violence is obviously being discussed because it is such a huge issue for those fleeing from El Salvador.
REP. CUMMINGS: Yes. And it also and as far as domestic violence, it affects women tremendously.
BRENNAN: So the administration argues though that if you went back to the Obama era policy of prosecuting these individuals in civil proceedings, that it allows for what they call catch and release that individuals wouldn't be detained they'd be set free into the middle of the country and simply asked to come back.
REP. CUMMINGS: If you look at back at statistics you'll see that basically what happened was a huge percentage of those, overwhelming percentage those people were given ankle bracelets and basically allowed to stay with their families. And then, and they returned to court to go through the process. And I think that's -
MARGARET BRENNAN: But you understand -
REP. CUMMINGS: - a much more humane way to deal with people.
BRENNAN: But do you understand that to a large percentage of America that sounds like it's a get out of jail free card.
REP. CUMMINGS: No. Yeah I can understand it. But what we're doing now I think is far worse. We're placing kids, and by the way kids who will be harmed for the rest of their lives, and that's by the way child abuse. We're placing them in a bad situation. And again this is something that worked, and is a lot less expensive and by the - and we have no clue as to what this is costing the United States and how these contracted - contracts are being given out. The urgency right now is to get these young people back with their parents.
MARGARET BRENNAN: I want to ask you about sort of the question of the tone or lack of civility right now. Over the weekend, Sarah Sanders the president's press secretary was refused service at a restaurant in Virginia because of who she works for. Her father the former governor of Arkansas also tweeted out a photo showing M.S. 13 gang members, or claiming that's who these men were, and called them Democrat Nancy Pelosi's Campaign Committees some heard that as racist.
MARGARET BRENNAN: What do you make of- of this kind of discourse right now?
REP. CUMMINGS: First of all I think, as far as the restaurant incident, I think the restaurant should have served her. I really do. But this tone is horrible. But again, I think President Trump has created this, since he's become president and even before. He's basically giving people license to do state things that are ugly, and those things then turn into actions, as we can now see. But we've got to get away from this, and we've got to concentrate on what is important at this moment. And we've got to get a – he's got to be more competent. Even the policies that he likes, he has not been very good at executing. And so we- we've got to find a way to- to address that.
MARGARET BRENNAN: Very quickly, anything that you want to respond to in terms of Peter Strzok, the FBI agent and--?
REP. CUMMINGS: I'm looking forward to hearing from him, but the Republicans have not- told us anything. We don't even know whether we'll be invited, Democrats, to the deposition.
MARGARET BRENNAN: Wow. Thank you very much, Congressman.
REP. CUMMINGS: Thank you.
MARGARET BRENNAN: We will be back with more Face the Nation in a moment and a look at what the voters are saying about immigration.
Transcript: Mayor Quinton Lucas on "Face the Nation"
Transcript: New York Mayor Eric Adams on "Face the Nation"
First published on June 24, 2018 / 1:04 PM


59 years experience serving Kincardine and Surrounding Grey Bruce area!
We have 59 years of experience providing stone and brick work the right way! If you're looking for the perfect craftsmanship and design you have come to the right place. We still use and prefer the old methods of doing stone and brick work! Why? Because we know that it not only looks better but it has been proven for hundreds of years that these methods can hold up.
The Farrells built a beach stone fireplace surround and porch columns for our recent home. They used reclaimed stone from our property and the result is beautiful, allowing our house to blend perfectly with it's lake front surrounds. Their work was very professional and the highest standard. We highly recommend Farrell Masonry.


Laundry Connection, laundromat, listed under "Laundromats" category, is located at 3520 Burnet Ave Cincinnati OH, 45229 and can be reached by 5138615088 phone number. Laundry Connection has currently 0 reviews.
Browse all Laundromats in Cincinnati OH. Discover census data for Cincinnati, OH.


I enjoy helping people learn and develop their fitness regimen. When it comes to boxing, I feel everyone can benefit from not only the physical aspects of training, but also the mental and emotional components of a sustained boxing program such as building self discipline and self confidence.
An initial assessment helps me determine the students abilities, goals, target areas, health concerns, and limitations. The first workout is typically a primer to guage the students fitness level and abilities. A proper program can then be developed and used to help the student progress at an optimal level.
I have over 15 years experience as an active boxer. I am a current active professional boxer and I have trained under a former WBC Intercontinental Latino Champion and World Title prospect for the past 5 years. I also have 10 plus years experience in personal training and group fitness.
I have worked with students from all skill and ability levels including amatuer boxers, professional boxers, amatuer/professional MMA fighters, and handicapped/disabled clients.