text:
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2017 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////

#include "RocksDBCounterManager.h"

#include "ApplicationFeatures/ApplicationServer.h"
#include "Basics/ReadLocker.h"
#include "Basics/StringUtils.h"
#include "Basics/VelocyPackHelper.h"
#include "Basics/WriteLocker.h"
#include "Logger/Logger.h"
#include "RestServer/DatabaseFeature.h"
#include "RocksDBEngine/RocksDBCollection.h"
#include "RocksDBEngine/RocksDBColumnFamily.h"
#include "RocksDBEngine/RocksDBCommon.h"
#include "RocksDBEngine/RocksDBCuckooIndexEstimator.h"
#include "RocksDBEngine/RocksDBEdgeIndex.h"
#include "RocksDBEngine/RocksDBKey.h"
#include "RocksDBEngine/RocksDBKeyBounds.h"
#include "RocksDBEngine/RocksDBVPackIndex.h"
#include "RocksDBEngine/RocksDBValue.h"
#include "StorageEngine/EngineSelectorFeature.h"
#include "VocBase/ticks.h"

#include <rocksdb/utilities/transaction_db.h>
#include <rocksdb/utilities/write_batch_with_index.h>
#include <rocksdb/write_batch.h>

#include <velocypack/Iterator.h>
#include <velocypack/Parser.h>
#include <velocypack/Slice.h>
#include <velocypack/velocypack-aliases.h>

using namespace arangodb;
using namespace arangodb::application_features;

RocksDBCounterManager::CMValue::CMValue(VPackSlice const& slice)
    : _sequenceNum(0), _count(0), _revisionId(0) {
  if (!slice.isArray()) {
    // got a somewhat invalid slice. probably old data from before the key
    // structure changes
    return;
  }

  velocypack::ArrayIterator array(slice);
  if (array.valid()) {
    this->_sequenceNum = (*array).getUInt();
    this->_count = (*(++array)).getUInt();
    this->_revisionId = (*(++array)).getUInt();
  }
}

void RocksDBCounterManager::CMValue::serialize(VPackBuilder& b) const {
  b.openArray();
  b.add(VPackValue(this->_sequenceNum));
  b.add(VPackValue(this->_count));
  b.add(VPackValue(this->_revisionId));
  b.close();
}

/// Constructor needs to be called synchrunously,
/// will load counts from the db and scan the WAL
RocksDBCounterManager::RocksDBCounterManager(rocksdb::DB* db)
    : _lastSync(0),_syncing(false), _db(db) {
  readSettings();
  readIndexEstimates();
  readCounterValues();
  readKeyGenerators();
}

/// parse recent RocksDB WAL entries and notify the
/// DatabaseFeature about the successful recovery
void RocksDBCounterManager::runRecovery() {
  if (!_counters.empty()) {
    if (parseRocksWAL()) {
      // TODO: what do we do if parseRocksWAL returns false?
      sync(false);
    }
  }

  // notify everyone that recovery is now done
  auto databaseFeature = ApplicationServer::getFeature<DatabaseFeature>("Database");
  databaseFeature->recoveryDone();
}

RocksDBCounterManager::CounterAdjustment RocksDBCounterManager::loadCounter(
    uint64_t objectId) const {
  TRI_ASSERT(objectId != 0);  // TODO fix this

  READ_LOCKER(guard, _rwLock);
  auto const& it = _counters.find(objectId);
  if (it != _counters.end()) {
    return CounterAdjustment(it->second._sequenceNum, it->second._count, 0,
                             it->second._revisionId);
  }
  return CounterAdjustment();  // do not create
}

/// collections / views / indexes can call this method to update
/// their total counts. Thread-Safe needs the snapshot so we know
/// the sequence number used
void RocksDBCounterManager::updateCounter(uint64_t objectId,
                                          CounterAdjustment const& update) {
  // From write_batch.cc in rocksdb: first 64 bits in the internal rep_
  // buffer are the sequence number
  /*TRI_ASSERT(trx->GetState() == rocksdb::Transaction::COMMITED);
  rocksdb::WriteBatchWithIndex *batch = trx->GetWriteBatch();
  rocksdb::SequenceNumber seq =
  DecodeFixed64(batch->GetWriteBatch()->Data().data());*/

  bool needsSync = false;
  {
    WRITE_LOCKER(guard, _rwLock);

    auto it = _counters.find(objectId);
    if (it != _counters.end()) {
      it->second._count += update.added();
      it->second._count -= update.removed();
      // just use the latest trx info
      if (update.sequenceNumber() > it->second._sequenceNum) {
        it->second._sequenceNum = update.sequenceNumber();
        it->second._revisionId = update.revisionId();
      }
    } else {
      // insert new counter
      _counters.emplace(std::make_pair(
          objectId,
          CMValue(update.sequenceNumber(), update.added() - update.removed(),
                  update.revisionId())));
      needsSync = true;  // only count values from WAL if they are in the DB
    }
  }
  if (needsSync) {
    sync(true);
  }
}

arangodb::Result RocksDBCounterManager::setAbsoluteCounter(uint64_t objectId,
                                                           uint64_t value) {
  arangodb::Result res;
  WRITE_LOCKER(guard, _rwLock);
  auto it = _counters.find(objectId);
  if (it != _counters.end()) {
    it->second._count = value;
  } else {
    // nothing to do as the counter has never been written it can not be set to
    // a value that would require correction. but we use the return value to
    // signal that no sync is rquired
    res.reset(TRI_ERROR_INTERNAL, "counter value not found - no sync required");
  }
  return res;
}

void RocksDBCounterManager::removeCounter(uint64_t objectId) {
  WRITE_LOCKER(guard, _rwLock);
  auto const& it = _counters.find(objectId);
  if (it != _counters.end()) {
    RocksDBKey key;
    key.constructCounterValue(it->first);
    rocksdb::WriteOptions options;
    rocksdb::Status s = _db->Delete(options, RocksDBColumnFamily::definitions(), key.string());
    if (!s.ok()) {
      LOG_TOPIC(ERR, Logger::ENGINES) << "deleting counter failed";
    }
    _counters.erase(it);
  }
}

/// Thread-Safe force sync
Result RocksDBCounterManager::sync(bool force) {
  TRI_IF_FAILURE("RocksDBCounterManagerSync") {
    return Result();
  }

  if (force) {
    while (true) {
      bool expected = false;
      bool res = _syncing.compare_exchange_strong(
          expected, true, std::memory_order_acquire, std::memory_order_relaxed);
      if (res) {
        break;
      }
      usleep(10000);
    }
  } else {
    bool expected = false;

    if (!_syncing.compare_exchange_strong(expected, true,
                                          std::memory_order_acquire,
                                          std::memory_order_relaxed)) {
      return Result();
    }
  }

  TRI_DEFER(_syncing = false);

  std::unordered_map<uint64_t, CMValue> copy;
  {  // block all updates
    WRITE_LOCKER(guard, _rwLock);
    copy = _counters;
  }

  rocksdb::WriteOptions writeOptions;
  rocksdb::TransactionDB* db = rocksutils::globalRocksDB();
  auto seqNumber = db->GetLatestSequenceNumber();
  std::unique_ptr<rocksdb::Transaction> rtrx(
      db->BeginTransaction(writeOptions));

  VPackBuilder b;
  for (std::pair<uint64_t, CMValue> const& pair : copy) {
    // Skip values which we did not change
    auto const& it = _syncedSeqNums.find(pair.first);
    if (it != _syncedSeqNums.end() && it->second == pair.second._sequenceNum) {
      continue;
    }

    b.clear();
    pair.second.serialize(b);

    RocksDBKey key;
    key.constructCounterValue(pair.first);
    rocksdb::Slice value((char*)b.start(), b.size());
    rocksdb::Status s = rtrx->Put(RocksDBColumnFamily::definitions(),
                                  key.string(), value);
    if (!s.ok()) {
      rtrx->Rollback();
      auto rStatus = rocksutils::convertStatus(s);
      LOG_TOPIC(WARN, Logger::ENGINES) << "writing counters failed: " << rStatus.errorMessage();
      return rStatus;
    }
  }

  // now write global settings
  b.clear();
  b.openObject();
  b.add("tick", VPackValue(std::to_string(TRI_CurrentTickServer())));
  b.add("hlc", VPackValue(std::to_string(TRI_HybridLogicalClock())));
  b.add("lastSync", VPackValue(std::to_string(seqNumber)));
  b.close();

  VPackSlice slice = b.slice();
  LOG_TOPIC(TRACE, Logger::ENGINES) << "writing settings: " << slice.toJson();

  RocksDBKey key;
  key.constructSettingsValue(RocksDBSettingsType::ServerTick);
  rocksdb::Slice value(slice.startAs<char>(), slice.byteSize());

  rocksdb::Status s = rtrx->Put(RocksDBColumnFamily::definitions(),
                                key.string(), value);

  if (!s.ok()) {
    auto rStatus = rocksutils::convertStatus(s);
    LOG_TOPIC(WARN, Logger::ENGINES) << "writing settings failed: " << rStatus.errorMessage();
    rtrx->Rollback();
    return rStatus;
  }

  // Now persist the index estimates and key generators
  {
    for (auto const& pair : copy) {
      auto dbColPair = rocksutils::mapObjectToCollection(pair.first);
      if (dbColPair.second == 0 && dbColPair.first == 0) {
        // collection with this objectID not known.Skip.
        continue;
      }
      auto dbfeature =
          ApplicationServer::getFeature<DatabaseFeature>("Database");
      TRI_ASSERT(dbfeature != nullptr);
      auto vocbase = dbfeature->useDatabase(dbColPair.first);
      if (vocbase == nullptr) {
        // Bad state, we have references to a database that is not known
        // anymore.
        // However let's just skip in production. Not allowed to crash.
        // If we cannot find this infos during recovery we can either recompute
        // or start fresh.
        continue;
      }
      TRI_DEFER(vocbase->release());

      auto collection = vocbase->lookupCollection(dbColPair.second);
      if (collection == nullptr) {
        // Bad state, we have references to a collection that is not known
        // anymore.
        // However let's just skip in production. Not allowed to crash.
        // If we cannot find this infos during recovery we can either recompute
        // or start fresh.
        continue;
      }
      auto rocksCollection =
          static_cast<RocksDBCollection*>(collection->getPhysical());
      TRI_ASSERT(rocksCollection != nullptr);
      Result res = rocksCollection->serializeIndexEstimates(rtrx.get());
      if (!res.ok()) {
        LOG_TOPIC(WARN, Logger::ENGINES) << "writing index estimates failed: " << res.errorMessage();
        return res;
      }

      res = rocksCollection->serializeKeyGenerator(rtrx.get());
      if (!res.ok()) {
        LOG_TOPIC(WARN, Logger::ENGINES) << "writing key generators failed: " << res.errorMessage();
        return res;
      }
    }
  }

  // we have to commit all counters in one batch
  s = rtrx->Commit();
  if (s.ok()) {
    {
      WRITE_LOCKER(guard, _rwLock);
      _lastSync = seqNumber;
    }
    for (std::pair<uint64_t, CMValue> const& pair : copy) {
      _syncedSeqNums[pair.first] = pair.second._sequenceNum;
    }
  }

  return rocksutils::convertStatus(s);
}

void RocksDBCounterManager::readSettings() {
  RocksDBKey key;
  key.constructSettingsValue(RocksDBSettingsType::ServerTick);

  rocksdb::PinnableSlice result;
  rocksdb::Status status =
      _db->Get(rocksdb::ReadOptions(), RocksDBColumnFamily::definitions(),
               key.string(), &result);
  if (status.ok()) {
    // key may not be there, so don't fail when not found
    VPackSlice slice = VPackSlice(result.data());
    TRI_ASSERT(slice.isObject());
    LOG_TOPIC(TRACE, Logger::ENGINES) << "read initial settings: "
                                      << slice.toJson();

    if (!result.empty()) {
      try {
        uint64_t lastTick =
            basics::VelocyPackHelper::stringUInt64(slice.get("tick"));
        LOG_TOPIC(TRACE, Logger::ENGINES) << "using last tick: " << lastTick;
        TRI_UpdateTickServer(lastTick);

        if (slice.hasKey("hlc")) {
          uint64_t lastHlc =
              basics::VelocyPackHelper::stringUInt64(slice.get("hlc"));
          LOG_TOPIC(TRACE, Logger::ENGINES) << "using last hlc: " << lastHlc;
          TRI_HybridLogicalClock(lastHlc);
        }

        _lastSync = basics::VelocyPackHelper::stringUInt64(slice.get("lastSync"));
        LOG_TOPIC(TRACE, Logger::ENGINES) << "last background settings sync: "
                                          << _lastSync;
      } catch (...) {
        LOG_TOPIC(WARN, Logger::ENGINES)
            << "unable to read initial settings: invalid data";
      }
    }
  }
}

void RocksDBCounterManager::readIndexEstimates() {
  WRITE_LOCKER(guard, _rwLock);
  RocksDBKeyBounds bounds = RocksDBKeyBounds::IndexEstimateValues();

  auto cf = RocksDBColumnFamily::definitions();
  rocksdb::Comparator const* cmp = cf->GetComparator();
  rocksdb::ReadOptions readOptions;
  std::unique_ptr<rocksdb::Iterator> iter(
      _db->NewIterator(readOptions, cf));
  iter->Seek(bounds.start());

  for (; iter->Valid() && cmp->Compare(iter->key(), bounds.end()) < 0;
       iter->Next()) {
    uint64_t objectId = RocksDBKey::definitionsObjectId(iter->key());
    uint64_t lastSeqNumber =
        rocksutils::uint64FromPersistent(iter->value().data());

    StringRef estimateSerialisation(iter->value().data() + sizeof(uint64_t),
                                    iter->value().size() - sizeof(uint64_t));
    // If this hits we have two estimates for the same index
    TRI_ASSERT(_estimators.find(objectId) == _estimators.end());
    try {
      if (RocksDBCuckooIndexEstimator<uint64_t>::isFormatSupported(
              estimateSerialisation)) {
        _estimators.emplace(
            objectId,
            std::make_pair(
                lastSeqNumber,
                std::make_unique<RocksDBCuckooIndexEstimator<uint64_t>>(
                    estimateSerialisation)));
      }
    } catch (...) {
      // Nothing to do, if the estimator fails to create we let it be recreated.
      // Just validate that no corrupted memory was produced.
      TRI_ASSERT(_estimators.find(objectId) == _estimators.end());
    }
  }
}

void RocksDBCounterManager::readKeyGenerators() {
  WRITE_LOCKER(guard, _rwLock);
  RocksDBKeyBounds bounds = RocksDBKeyBounds::KeyGenerators();

  auto cf = RocksDBColumnFamily::definitions();
  rocksdb::Comparator const* cmp = cf->GetComparator();
  rocksdb::ReadOptions readOptions;
  std::unique_ptr<rocksdb::Iterator> iter(
      _db->NewIterator(readOptions, cf));
  iter->Seek(bounds.start());

  for (; iter->Valid() && cmp->Compare(iter->key(), bounds.end()) < 0;
       iter->Next()) {
    uint64_t objectId = RocksDBKey::definitionsObjectId(iter->key());
    auto properties = RocksDBValue::data(iter->value());
    uint64_t lastValue = properties.get("lastValue").getUInt();

    // If this hits we have two generators for the same collection
    TRI_ASSERT(_generators.find(objectId) == _generators.end());
    try {
      _generators.emplace(objectId, lastValue);
    } catch (...) {
      // Nothing to do, just validate that no corrupted memory was produced.
      TRI_ASSERT(_generators.find(objectId) == _generators.end());
    }
  }
}

std::unique_ptr<RocksDBCuckooIndexEstimator<uint64_t>>
RocksDBCounterManager::stealIndexEstimator(uint64_t objectId) {
  std::unique_ptr<RocksDBCuckooIndexEstimator<uint64_t>> res(nullptr);
  auto it = _estimators.find(objectId);
  if (it != _estimators.end()) {
    // We swap out the stored estimate in order to move it to the caller
    res.swap(it->second.second);
    // Drop the now empty estimator
    _estimators.erase(objectId);
  }
  return res;
}

uint64_t RocksDBCounterManager::stealKeyGenerator(uint64_t objectId) {
  uint64_t res = 0;
  auto it = _generators.find(objectId);
  if (it != _generators.end()) {
    // We swap out the stored estimate in order to move it to the caller
    res = it->second;
    // Drop the now empty estimator
    _generators.erase(objectId);
  }
  return res;
}

void RocksDBCounterManager::clearIndexEstimators() {
  // We call this to remove all index estimators that have been stored but are
  // no longer read
  // by recovery.

  // TODO REMOVE RocksDB Keys of all not stolen values?
  _estimators.clear();
}

void RocksDBCounterManager::clearKeyGenerators() { _generators.clear(); }

/// Parse counter values from rocksdb
void RocksDBCounterManager::readCounterValues() {
  WRITE_LOCKER(guard, _rwLock);
  RocksDBKeyBounds bounds = RocksDBKeyBounds::CounterValues();

  auto cf = RocksDBColumnFamily::definitions();
  rocksdb::Comparator const* cmp = cf->GetComparator();
  rocksdb::ReadOptions readOptions;
  std::unique_ptr<rocksdb::Iterator> iter(
      _db->NewIterator(readOptions, cf));
  iter->Seek(bounds.start());

  while (iter->Valid() && cmp->Compare(iter->key(), bounds.end()) < 0) {
    uint64_t objectId = RocksDBKey::definitionsObjectId(iter->key());
    auto const& it =
        _counters.emplace(objectId, CMValue(VPackSlice(iter->value().data())));
    _syncedSeqNums[objectId] = it.first->second._sequenceNum;

    iter->Next();
  }
}

/// WAL parser, no locking required here, because we have been locked from the
/// outside
class WBReader final : public rocksdb::WriteBatch::Handler {
 public:
  // must be set by the counter manager
  std::unordered_map<uint64_t, rocksdb::SequenceNumber> seqStart;
  std::unordered_map<uint64_t, RocksDBCounterManager::CounterAdjustment> deltas;
  std::unordered_map<
      uint64_t,
      std::pair<uint64_t,
                std::unique_ptr<RocksDBCuckooIndexEstimator<uint64_t>>>>*
      _estimators;
  std::unordered_map<uint64_t, uint64_t>* _generators;
  rocksdb::SequenceNumber currentSeqNum;
  uint64_t _maxTick = 0;
  uint64_t _maxHLC = 0;

  explicit WBReader(
      std::unordered_map<
          uint64_t,
          std::pair<uint64_t,
                    std::unique_ptr<RocksDBCuckooIndexEstimator<uint64_t>>>>*
          estimators,
      std::unordered_map<uint64_t, uint64_t>* generators)
      : _estimators(estimators), _generators(generators), currentSeqNum(0) {}

  ~WBReader() {
    // update ticks after parsing wal
    LOG_TOPIC(TRACE, Logger::ENGINES) << "max tick found in WAL: " << _maxTick
                                      << ", last HLC value: " << _maxHLC;

    TRI_UpdateTickServer(_maxTick);
    TRI_HybridLogicalClock(_maxHLC);
  }

  bool shouldHandleDocument(uint32_t column_family_id,
                            const rocksdb::Slice& key) {
    if (column_family_id == RocksDBColumnFamily::documents()->GetID()) {
      uint64_t objectId = RocksDBKey::objectId(key);
      auto const& it = seqStart.find(objectId);
      if (it != seqStart.end()) {
        if (deltas.find(objectId) == deltas.end()) {
          deltas.emplace(objectId, RocksDBCounterManager::CounterAdjustment());
        }
        return it->second <= currentSeqNum;
      }
    }
    return false;
  }

  void storeMaxHLC(uint64_t hlc) {
    if (hlc > _maxHLC) {
      _maxHLC = hlc;
    }
  }

  void storeMaxTick(uint64_t tick) {
    if (tick > _maxTick) {
      _maxTick = tick;
    }
  }

  void storeLastKeyValue(uint64_t objectId, uint64_t keyValue) {
    if (keyValue == 0) {
      return;
    }

    auto it = _generators->find(objectId);

    if (it == _generators->end()) {
      try {
        _generators->emplace(objectId, keyValue);
      } catch (...) {
      }
      return;
    }

    if (keyValue > (*it).second) {
      (*it).second = keyValue;
    }
  }

  void updateMaxTick(uint32_t column_family_id, const rocksdb::Slice& key,
                     const rocksdb::Slice& value) {
    // RETURN (side-effect): update _maxTick
    //
    // extract max tick from Markers and store them as side-effect in
    // _maxTick member variable that can be used later (dtor) to call
    // TRI_UpdateTickServer (ticks.h)
    // Markers: - collections (id,objectid) as tick and max tick in indexes
    // array
    //          - documents - _rev (revision as maxtick)
    //          - databases

    if (column_family_id == RocksDBColumnFamily::documents()->GetID()) {
      storeMaxHLC(RocksDBKey::revisionId(RocksDBEntryType::Document, key));
      storeLastKeyValue(RocksDBKey::objectId(key),
                        RocksDBValue::keyValue(value));
    } else if (column_family_id == RocksDBColumnFamily::primary()->GetID()) {
      // document key
      StringRef ref = RocksDBKey::primaryKey(key);
      TRI_ASSERT(!ref.empty());
      // check if the key is numeric
      if (ref[0] >= '1' && ref[0] <= '9') {
        // numeric start byte. looks good
        try {
          // extract uint64_t value from key. this will throw if the key
          // is non-numeric
          uint64_t tick =
              basics::StringUtils::uint64_check(ref.data(), ref.size());
          // if no previous _maxTick set or the numeric value found is
          // "near" our previous _maxTick, then we update it
          if (tick > _maxTick && (_maxTick == 0 || tick - _maxTick < 2048)) {
            storeMaxTick(tick);
          }
        } catch (...) {
          // non-numeric key. simply ignore it
        }
      }
    } else if (column_family_id ==
               RocksDBColumnFamily::definitions()->GetID()) {
      auto const type = RocksDBKey::type(key);

      if (type == RocksDBEntryType::Collection) {
        storeMaxTick(RocksDBKey::collectionId(key));
        auto slice = RocksDBValue::data(value);
        storeMaxTick(basics::VelocyPackHelper::stringUInt64(slice, "objectId"));
        VPackSlice indexes = slice.get("indexes");
        for (VPackSlice const& idx : VPackArrayIterator(indexes)) {
          storeMaxTick(
              std::max(basics::VelocyPackHelper::stringUInt64(idx, "objectId"),
                       basics::VelocyPackHelper::stringUInt64(idx, "id")));
        }
      } else if (type == RocksDBEntryType::Database) {
        storeMaxTick(RocksDBKey::databaseId(key));
      } else if (type == RocksDBEntryType::View) {
        storeMaxTick(std::max(RocksDBKey::databaseId(key),
                              RocksDBKey::viewId(key)));
      }
    }
  }

  rocksdb::Status PutCF(uint32_t column_family_id, const rocksdb::Slice& key,
                        const rocksdb::Slice& value) override {
    updateMaxTick(column_family_id, key, value);
    if (shouldHandleDocument(column_family_id, key)) {
      uint64_t objectId = RocksDBKey::objectId(key);
      uint64_t revisionId =
          RocksDBKey::revisionId(RocksDBEntryType::Document, key);

      auto const& it = deltas.find(objectId);
      if (it != deltas.end()) {
        it->second._sequenceNum = currentSeqNum;
        it->second._added++;
        it->second._revisionId = revisionId;
      }
    } else {
      // We have to adjust the estimate with an insert
      if (column_family_id == RocksDBColumnFamily::vpack()->GetID()) {
        uint64_t objectId = RocksDBKey::objectId(key);
        auto it = _estimators->find(objectId);
        if (it != _estimators->end() && it->second.first < currentSeqNum) {
          // We track estimates for this index
          uint64_t hash = RocksDBVPackIndex::HashForKey(key);
          it->second.second->insert(hash);
        }
      } else if (column_family_id == RocksDBColumnFamily::edge()->GetID()) {
        uint64_t objectId = RocksDBKey::objectId(key);
        auto it = _estimators->find(objectId);
        if (it != _estimators->end() && it->second.first < currentSeqNum) {
          // We track estimates for this index
          uint64_t hash = RocksDBEdgeIndex::HashForKey(key);
          it->second.second->insert(hash);
        }
      }
    }
    return rocksdb::Status();
  }

  rocksdb::Status DeleteCF(uint32_t column_family_id,
                           const rocksdb::Slice& key) override {
    if (shouldHandleDocument(column_family_id, key)) {
      uint64_t objectId = RocksDBKey::objectId(key);
      uint64_t revisionId =
          RocksDBKey::revisionId(RocksDBEntryType::Document, key);

      auto const& it = deltas.find(objectId);
      if (it != deltas.end()) {
        it->second._sequenceNum = currentSeqNum;
        it->second._removed++;
        it->second._revisionId = revisionId;
      }
    } else {
      // We have to adjust the estimate with an remove
      if (column_family_id == RocksDBColumnFamily::vpack()->GetID()) {
        uint64_t objectId = RocksDBKey::objectId(key);
        auto it = _estimators->find(objectId);
        if (it != _estimators->end() && it->second.first < currentSeqNum) {
          // We track estimates for this index
          uint64_t hash = RocksDBVPackIndex::HashForKey(key);
          it->second.second->remove(hash);
        }
      } else if (column_family_id == RocksDBColumnFamily::edge()->GetID()) {
        uint64_t objectId = RocksDBKey::objectId(key);
        auto it = _estimators->find(objectId);
        if (it != _estimators->end() && it->second.first < currentSeqNum) {
          // We track estimates for this index
          uint64_t hash = RocksDBEdgeIndex::HashForKey(key);
          it->second.second->remove(hash);
        }
      }
    }
    return rocksdb::Status();
  }
};

/// earliest safe sequence number to throw away from wal
rocksdb::SequenceNumber RocksDBCounterManager::earliestSeqNeeded() const {
  READ_LOCKER(guard, _rwLock);
  return _lastSync;
}

/// parse the WAL with the above handler parser class
bool RocksDBCounterManager::parseRocksWAL() {
  WRITE_LOCKER(guard, _rwLock);
  TRI_ASSERT(_counters.size() > 0);

  rocksdb::SequenceNumber start = _lastSync;
  // Tell the WriteBatch reader the transaction markers to look for
  auto handler = std::make_unique<WBReader>(&_estimators, &_generators);

  for (auto const& pair : _counters) {
    handler->seqStart.emplace(pair.first, pair.second._sequenceNum);
  }

  std::unique_ptr<rocksdb::TransactionLogIterator> iterator;  // reader();
  rocksdb::Status s = _db->GetUpdatesSince(start, &iterator);
  if (!s.ok()) {  // TODO do something?
    return false;
  }

  while (iterator->Valid()) {
    s = iterator->status();
    if (s.ok()) {
      rocksdb::BatchResult batch = iterator->GetBatch();
      start = batch.sequence;
      handler->currentSeqNum = start;
      s = batch.writeBatchPtr->Iterate(handler.get());
    }
    if (!s.ok()) {
      LOG_TOPIC(ERR, Logger::ENGINES) << "error during WAL scan";
      break;
    }

    iterator->Next();
  }

  LOG_TOPIC(TRACE, Logger::ENGINES) << "finished WAL scan with "
                                    << handler->deltas.size();
  for (std::pair<uint64_t, RocksDBCounterManager::CounterAdjustment> pair :
       handler->deltas) {
    auto const& it = _counters.find(pair.first);
    if (it != _counters.end()) {
      it->second._sequenceNum = start;
      it->second._count += pair.second.added();
      it->second._count -= pair.second.removed();
      it->second._revisionId = pair.second._revisionId;
      LOG_TOPIC(TRACE, Logger::ENGINES)
          << "WAL recovered " << pair.second.added() << " PUTs and "
          << pair.second.removed() << " DELETEs for a total of "
          << it->second._count;
    }
  }
  return handler->deltas.size() > 0;
}


text:
ActiveRecord::Schema.define(version: 20141223221012) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "entries", force: true do |t|
    t.string   "fecha"
    t.string   "linkMD"
    t.integer  "publicacion_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "nombre"
    t.integer  "entry_anterior_id"
  end

  add_index "entries", ["entry_anterior_id"], name: "index_entries_on_entry_anterior_id", using: :btree
  add_index "entries", ["publicacion_id"], name: "index_entries_on_publicacion_id", using: :btree

  create_table "expositors", force: true do |t|
    t.string   "nombre"
    t.integer  "publicacion_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "expositors", ["publicacion_id"], name: "index_expositors_on_publicacion_id", using: :btree

  create_table "publicacions", force: true do |t|
    t.string   "nombre"
    t.string   "year"
    t.string   "semestre"
    t.integer  "section_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "linkMD"
    t.string   "siglas"
  end

  add_index "publicacions", ["section_id"], name: "index_publicacions_on_section_id", using: :btree

  create_table "sections", force: true do |t|
    t.string   "nombre"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "sub_nombre"
  end

  create_table "users", force: true do |t|
    t.string   "email",                  default: "", null: false
    t.string   "encrypted_password",     default: "", null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          default: 0,  null: false
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.inet     "current_sign_in_ip"
    t.inet     "last_sign_in_ip"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree

end

redpajama_set_name: RedPajamaGithub


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.deu.talha.deuyemek.akillikart.AkilliKartFragment">

    <WebView
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</FrameLayout>


text:
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2002
 *
 *  Last modified:
 *     $Date: 2011-08-12 15:27:20 +0200 (Fri, 12 Aug 2011) $ by $Author: tack $
 *     $Revision: 12285 $
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  Permission is hereby granted, free of charge, to any person obtaining
 *  a copy of this software and associated documentation files (the
 *  "Software"), to deal in the Software without restriction, including
 *  without limitation the rights to use, copy, modify, merge, publish,
 *  distribute, sublicense, and/or sell copies of the Software, and to
 *  permit persons to whom the Software is furnished to do so, subject to
 *  the following conditions:
 *
 *  The above copyright notice and this permission notice shall be
 *  included in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */

#include <algorithm>
#include <climits>

namespace Gecode { namespace Int { namespace Linear {

  template<class View>
  inline void
  estimate(Term<View>* t, int n, int c, int& l, int &u) {
    double min = c;
    double max = c;
    for (int i=n; i--; ) {
      double a = t[i].a;
      if (a > 0) {
        min += a*t[i].x.min();
        max += a*t[i].x.max();
      } else {
        max += a*t[i].x.min();
        min += a*t[i].x.max();
      }
    }
    if (min < Limits::min)
      min = Limits::min;
    if (min > Limits::max)
      min = Limits::max;
    l = static_cast<int>(min);
    if (max < Limits::min)
      max = Limits::min;
    if (max > Limits::max)
      max = Limits::max;
    u = static_cast<int>(max);
  }

  /// Sort linear terms by view
  template<class View>
  class TermLess {
  public:
    forceinline bool
    operator ()(const Term<View>& a, const Term<View>& b) {
      return before(a.x,b.x);
    }
  };

  template<class View>
  inline bool
  normalize(Term<View>* t, int &n,
            Term<View>* &t_p, int &n_p,
            Term<View>* &t_n, int &n_n) {
    /*
     * Join coefficients for aliased variables:
     *
     */
    {
      // Group same variables
      TermLess<View> tl;
      Support::quicksort<Term<View>,TermLess<View> >(t,n,tl);

      // Join adjacent variables
      int i = 0;
      int j = 0;
      while (i < n) {
        Limits::check(t[i].a,"Int::linear");
        double a = t[i].a;
        View x = t[i].x;
        while ((++i < n) && same(t[i].x,x)) {
          a += t[i].a;
          Limits::check(a,"Int::linear");
        }
        if (a != 0.0) {
          t[j].a = static_cast<int>(a); t[j].x = x; j++;
        }
      }
      n = j;
    }

    /*
     * Partition into positive/negative coefficents
     *
     */
    if (n > 0) {
      int i = 0;
      int j = n-1;
      while (true) {
        while ((t[j].a < 0) && (--j >= 0)) ;
        while ((t[i].a > 0) && (++i <  n)) ;
        if (j <= i) break;
        std::swap(t[i],t[j]);
      }
      t_p = t;     n_p = i;
      t_n = t+n_p; n_n = n-n_p;
    } else {
      t_p = t; n_p = 0;
      t_n = t; n_n = 0;
    }

    /*
     * Make all coefficients positive
     *
     */
    for (int i=n_n; i--; )
      t_n[i].a = -t_n[i].a;

    /*
     * Test for unit coefficients only
     *
     */
    for (int i=n; i--; )
      if (t[i].a != 1)
        return false;
    return true;
  }

}}}

// STATISTICS: int-post


text: Projet des FA (best project ever)


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

package org.apache.kudu.test;

import com.google.protobuf.ByteString;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability;

import org.apache.kudu.Common;
import org.apache.kudu.consensus.Metadata;
import org.apache.kudu.master.Master;

@InterfaceAudience.Private
@InterfaceStability.Unstable
public class ProtobufUtils {

  /**
   * Get a PartitionPB with empty start and end keys.
   * @return a fake partition
   */
  public static Common.PartitionPB.Builder getFakePartitionPB() {
    Common.PartitionPB.Builder partition = Common.PartitionPB.newBuilder();
    partition.setPartitionKeyStart(ByteString.EMPTY);
    partition.setPartitionKeyEnd(ByteString.EMPTY);
    return partition;
  }

  /**
   * Create a InternedReplicaPB based on the passed information.
   * @param tsInfoIndex server's index in the TSInfoPB list
   * @param role server's role in the configuration
   * @return a fake InternedReplicaPB
   */
  public static Master.TabletLocationsPB.InternedReplicaPB.Builder getFakeTabletInternedReplicaPB(
      int tsInfoIndex,  Metadata.RaftPeerPB.Role role) {
    Master.TabletLocationsPB.InternedReplicaPB.Builder internedReplicaBuilder =
        Master.TabletLocationsPB.InternedReplicaPB.newBuilder();
    internedReplicaBuilder.setTsInfoIdx(tsInfoIndex);
    internedReplicaBuilder.setRole(role);
    return internedReplicaBuilder;
  }

  /**
   * Create a TSInfoPB based on the passed information.
   * @param uuid server's identifier
   * @param host server's hostname
   * @param port server's port
   * @return a fake TSInfoPB
   */
  public static Master.TSInfoPB.Builder getFakeTSInfoPB(String uuid, String host, int port) {
    Master.TSInfoPB.Builder tsInfoBuilder = Master.TSInfoPB.newBuilder();
    Common.HostPortPB.Builder hostBuilder = Common.HostPortPB.newBuilder();
    hostBuilder.setHost(host);
    hostBuilder.setPort(port);
    tsInfoBuilder.addRpcAddresses(hostBuilder);
    tsInfoBuilder.setPermanentUuid(ByteString.copyFromUtf8(uuid));
    return tsInfoBuilder;
  }
}


text:
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;

namespace SocialFrameworkDemo
{
    [Register ("ViewController")]
    partial class ViewController
    {
        [Outlet]
        [GeneratedCode ("iOS Designer", "1.0")]
        UIKit.UIButton PostToFacebook { get; set; }

        [Outlet]
        [GeneratedCode ("iOS Designer", "1.0")]
        UIKit.UIButton RequestFacebookTimeline { get; set; }

        [Outlet]
        [GeneratedCode ("iOS Designer", "1.0")]
        UIKit.UIButton RequestTwitterTimeline { get; set; }

        [Outlet]
        [GeneratedCode ("iOS Designer", "1.0")]
        UIKit.UITextView Results { get; set; }

        [Outlet]
        [GeneratedCode ("iOS Designer", "1.0")]
        UIKit.UIButton SendTweet { get; set; }

        [Action ("SendTweet_TouchUpInside:")]
        [GeneratedCode ("iOS Designer", "1.0")]
        partial void SendTweet_TouchUpInside (UIKit.UIButton sender);

        [Action ("RequestTwitterTimeline_TouchUpInside:")]
        [GeneratedCode ("iOS Designer", "1.0")]
        partial void RequestTwitterTimeline_TouchUpInside (UIKit.UIButton sender);

        [Action ("PostToFacebook_TouchUpInside:")]
        [GeneratedCode ("iOS Designer", "1.0")]
        partial void PostToFacebook_TouchUpInside (UIKit.UIButton sender);

        [Action ("RequestFacebookTimeline_TouchUpInside:")]
        [GeneratedCode ("iOS Designer", "1.0")]
        partial void RequestFacebookTimeline_TouchUpInside (UIKit.UIButton sender);

        void ReleaseDesignerOutlets ()
        {
            if (PostToFacebook != null) {
                PostToFacebook.Dispose ();
                PostToFacebook = null;
            }

            if (RequestFacebookTimeline != null) {
                RequestFacebookTimeline.Dispose ();
                RequestFacebookTimeline = null;
            }

            if (RequestTwitterTimeline != null) {
                RequestTwitterTimeline.Dispose ();
                RequestTwitterTimeline = null;
            }

            if (Results != null) {
                Results.Dispose ();
                Results = null;
            }

            if (SendTweet != null) {
                SendTweet.Dispose ();
                SendTweet = null;
            }
        }
    }
}


text:
package com.zontzor.lab5_morelists;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import java.util.ArrayList;

public class MainActivity extends ListActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ArrayList<String> countries = new ArrayList<String>();
        countries.add("Ireland");
        countries.add("Sri Lanka");
        countries.add("Saudi Arabia");
        countries.add("China");
        countries.add("Sealand");
        countries.add("Christmas Island");
        countries.add("DRPK");

        ListAdapter basicAdapter = new MyAdapter(this,countries);
        setListAdapter(basicAdapter);
    }

    public void onListItemClick(ListView list, View v, int position, long id) {
        String selection = list.getItemAtPosition(position).toString();
        Intent myNewActivity = new Intent(MainActivity.this, Country.class);
        myNewActivity.putExtra("Country", selection);
        myNewActivity.putExtra("Position", position);
        startActivity(myNewActivity);
    }
}


text:
angular.module('ToDoList.common', [
    'ngRoute',
    'ngStorage'
])
    .service('tasksFactory', function () {
        function Task(name, priority, endDate, isCompleted, description) {
            this.name = name;
            this.priority = priority;
            this.endDate = endDate;
            this.isCompleted = isCompleted;
            this.description = description;
            return this;
        }

        function createEmptyTask() {
            var tomorrow = new Date();
            tomorrow.setDate(tomorrow.getDate() + 1);
            return new Task('', 1, tomorrow, false, '');
        }

        function getTasksPriorities() {
            return [1, 2, 3];
        }

        function getTasksDefaultPriority() {
            return getTasksPriorities()[0];
        }

        return {
            createNewTask: createEmptyTask,
            getTasksPriorities: getTasksPriorities,
            getTasksDefaultPriority: getTasksDefaultPriority
        };
    })
    .service('tasksValidator', function () {
        function isTaskNameValid(task) {
            if (task.name) {
                return true;
            }
            return false;
        };

        function isTaskValid(task) {
            return isTaskNameValid(task);
        }

        return {
            isTaskNameValid: isTaskNameValid,
            isTaskValid: isTaskValid
        };
    })
    .service('tasksStorage', function ($localStorage, tasksValidator, $log) {
        //$localStorage.$reset();

        function initStorage() {
            $localStorage.tasks = [];
            $localStorage.$apply();
        }

        function isStorageInitialized() {
            return $localStorage.tasks;
        }

        function getTasks() {
            if (!isStorageInitialized()) {
                initStorage();
            }
            return $localStorage.tasks;
        }

        function saveTasks(tasks) {
            $localStorage.tasks = tasks;
            $localStorage.$apply();
        }

        function addTask(task) {
            if (!isStorageInitialized($localStorage)) {
                initStorage($localStorage);
            }
            if (tasksValidator.isTaskValid(task)) {
                var tasks = getTasks();
                tasks.push(task);
                saveTasks(tasks);
            } else {
                $log.error("Try to save invalid task!");
            }
        }

        function updateTask(originalTask, updatedTask) {
            if (!isStorageInitialized($localStorage)) {
                initStorage($localStorage);
            }
            var tasks = getTasks();
            var index = tasks.indexOf(originalTask);
            if (index >= 0) {
                // Because ngStore has a bug when after refresh page it's break data
                var task = tasks[index];
                task.name = updatedTask.name;
                task.priority = updatedTask.priority;
                task.endDate = updatedTask.endDate;
                task.isCompleted = updatedTask.isCompleted;
                task.description = updatedTask.description;
                saveTasks(tasks);
            }
        }

        return {
            getTasks: getTasks,
            addTask: addTask,
            updateTask: updateTask
        };
    });


text:
@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements.  See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License.  You may obtain a copy of the License at
REM
REM      http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.

REM
REM Environment variables:
REM
REM GF_JAVA - java executable path.
REM
REM JAVA_ARGS - java arguments, i.e., -Xms1024m -Xmx1024m ...
REM
REM GEMFIRE - GemFire product Directory
REM
REM

@setlocal enableextensions
@set scriptdir=%~dp0
@set gf=%scriptdir:\bin\=%
REM echo %gf%
REM echo %scriptdir%
@if exist "%gf%\lib\geode-dependencies.jar" @goto gfok
@echo Could not determine GEMFIRE location
@verify other 2>nul
@goto done
:gfok
@set GEMFIRE=%gf%

@set GEMFIRE_JARS=%GEMFIRE%\lib\gfsh-dependencies.jar
@if defined CLASSPATH (
@set GEMFIRE_JARS=%GEMFIRE_JARS%;%CLASSPATH%
)

@if not defined GF_JAVA (
@REM %GF_JAVA% is not defined, assume it is on the PATH
@if defined JAVA_HOME (
@set GF_JAVA=%JAVA_HOME%\bin\java.exe
) else (
@set GF_JAVA=java
)
)

REM
REM GFSH_JARS
REM
@set GFSH_JARS=;%GEMFIRE%\lib\gfsh-dependencies.jar
@set CLASSPATH=%GFSH_JARS%;%GEMFIRE_JARS%

REM
REM Copy default .gfshrc to the home directory. Uncomment if needed.
REM
REM @if not exist "%USERPROFILE%\.gemfire\.gfsh2rc" (
REM @xcopy /q "%GEMFIRE%\defaultConfigs\.gfsh2rc" "%USERPROFILE%\.gemfire"
REM )

REM
REM Make dir if .gemfire does not exist. Uncomment if needed.
REM
REM @if not exist "%USERPROFILE%\.gemfire" (
REM @mkdir "%USERPROFILE%\.gemfire"
REM )

REM  Consider java is from JDK
@set TOOLS_JAR=%JAVA_HOME%\lib\tools.jar
@IF EXIST "%TOOLS_JAR%" (
    @set CLASSPATH=%CLASSPATH%;%TOOLS_JAR%
) ELSE (
    set TOOLS_JAR=
)

@set LAUNCHER=com.gemstone.gemfire.management.internal.cli.Launcher
@if defined JAVA_ARGS (
@set JAVA_ARGS="%JAVA_ARGS%"
)
@"%GF_JAVA%" -Dgfsh=true -Dlog4j.configurationFile=classpath:log4j2-cli.xml %JAVA_ARGS% %LAUNCHER% %*
:done


text:
/********************************************************************************
** Form generated from reading UI file 'dialog.ui'
**
** Created by: Qt User Interface Compiler version 5.9.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_DIALOG_H
#define UI_DIALOG_H

#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QDialog>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLCDNumber>
#include <QtWidgets/QLabel>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>

QT_BEGIN_NAMESPACE

class Ui_Dialog
{
public:
    QWidget *widget;
    QHBoxLayout *horizontalLayout;
    QVBoxLayout *Readouts;
    QHBoxLayout *Thermocouple1;
    QLabel *temp_label;
    QLCDNumber *temp1_display;
    QHBoxLayout *Thermocouple2;
    QLabel *temp_label_2;
    QLCDNumber *temp2_display;
    QHBoxLayout *OxTankPressure;
    QLabel *temp_label_3;
    QLCDNumber *pressure1_display;
    QHBoxLayout *FuelTankPressure;
    QLabel *temp_label_4;
    QLCDNumber *pressure2_display;
    QHBoxLayout *OxPressure;
    QLabel *temp_label_6;
    QLCDNumber *pressure3_display;
    QHBoxLayout *FuelPressure;
    QLabel *temp_label_5;
    QLCDNumber *pressure4_display;
    QVBoxLayout *SolenoidStates;
    QLabel *recordingLabel;
    QLabel *StateTitle;
    QHBoxLayout *EnginePurge;
    QLabel *EnginePurgeLabel;
    QLabel *EnginePurgeState;
    QHBoxLayout *LOXPress;
    QLabel *LOXPressLabel;
    QLabel *LOXPressState;
    QHBoxLayout *LOXVent;
    QLabel *LOXVentLabel;
    QLabel *LOXVentState;
    QHBoxLayout *InjectorChill;
    QLabel *InjectorChillLabel;
    QLabel *InjectorChillState;
    QHBoxLayout *LOXMain;
    QLabel *LOXMainLabel;
    QLabel *LOXMainState;
    QHBoxLayout *FuelPress;
    QLabel *FuelPressLabel;
    QLabel *FuelPressState;
    QHBoxLayout *FuelPre;
    QLabel *FuelPreLabel;
    QLabel *FuelPreState;
    QHBoxLayout *FuelMain;
    QLabel *FuelMainLabel;
    QLabel *FuelMainState;

    void setupUi(QDialog *Dialog)
    {
        if (Dialog->objectName().isEmpty())
            Dialog->setObjectName(QStringLiteral("Dialog"));
        Dialog->resize(800, 600);
        QFont font;
        font.setBold(false);
        font.setWeight(50);
        Dialog->setFont(font);
        widget = new QWidget(Dialog);
        widget->setObjectName(QStringLiteral("widget"));
        widget->setGeometry(QRect(0, 10, 771, 501));
        horizontalLayout = new QHBoxLayout(widget);
        horizontalLayout->setSpacing(6);
        horizontalLayout->setContentsMargins(11, 11, 11, 11);
        horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
        horizontalLayout->setContentsMargins(0, 0, 0, 0);
        Readouts = new QVBoxLayout();
        Readouts->setSpacing(6);
        Readouts->setObjectName(QStringLiteral("Readouts"));
        Thermocouple1 = new QHBoxLayout();
        Thermocouple1->setSpacing(6);
        Thermocouple1->setObjectName(QStringLiteral("Thermocouple1"));
        Thermocouple1->setSizeConstraint(QLayout::SetFixedSize);
        temp_label = new QLabel(widget);
        temp_label->setObjectName(QStringLiteral("temp_label"));
        QFont font1;
        font1.setPointSize(10);
        font1.setBold(true);
        font1.setWeight(75);
        temp_label->setFont(font1);
        temp_label->setAlignment(Qt::AlignCenter);

        Thermocouple1->addWidget(temp_label);

        temp1_display = new QLCDNumber(widget);
        temp1_display->setObjectName(QStringLiteral("temp1_display"));
        temp1_display->setMinimumSize(QSize(187, 77));
        QPalette palette;
        QBrush brush(QColor(0, 0, 94, 255));
        brush.setStyle(Qt::SolidPattern);
        palette.setBrush(QPalette::Active, QPalette::WindowText, brush);
        QBrush brush1(QColor(0, 0, 255, 255));
        brush1.setStyle(Qt::SolidPattern);
        palette.setBrush(QPalette::Active, QPalette::Light, brush1);
        palette.setBrush(QPalette::Active, QPalette::Dark, brush);
        QBrush brush2(QColor(60, 60, 60, 255));
        brush2.setStyle(Qt::SolidPattern);
        palette.setBrush(QPalette::Active, QPalette::Text, brush2);
        QBrush brush3(QColor(76, 76, 76, 255));
        brush3.setStyle(Qt::SolidPattern);
        palette.setBrush(QPalette::Active, QPalette::ButtonText, brush3);
        palette.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
        palette.setBrush(QPalette::Inactive, QPalette::Light, brush1);
        palette.setBrush(QPalette::Inactive, QPalette::Dark, brush);
        palette.setBrush(QPalette::Inactive, QPalette::Text, brush2);
        palette.setBrush(QPalette::Inactive, QPalette::ButtonText, brush3);
        palette.setBrush(QPalette::Disabled, QPalette::WindowText, brush);
        palette.setBrush(QPalette::Disabled, QPalette::Light, brush1);
        palette.setBrush(QPalette::Disabled, QPalette::Dark, brush);
        palette.setBrush(QPalette::Disabled, QPalette::Text, brush);
        palette.setBrush(QPalette::Disabled, QPalette::ButtonText, brush);
        temp1_display->setPalette(palette);
        temp1_display->setDigitCount(7);

        Thermocouple1->addWidget(temp1_display);

        Readouts->addLayout(Thermocouple1);

        Thermocouple2 = new QHBoxLayout();
        Thermocouple2->setSpacing(6);
        Thermocouple2->setObjectName(QStringLiteral("Thermocouple2"));
        temp_label_2 = new QLabel(widget);
        temp_label_2->setObjectName(QStringLiteral("temp_label_2"));
        temp_label_2->setFont(font1);
        temp_label_2->setAlignment(Qt::AlignCenter);

        Thermocouple2->addWidget(temp_label_2);

        temp2_display = new QLCDNumber(widget);
        temp2_display->setObjectName(QStringLiteral("temp2_display"));
        temp2_display->setMinimumSize(QSize(187, 77));
        QPalette palette1;
        palette1.setBrush(QPalette::Active, QPalette::WindowText, brush);
        palette1.setBrush(QPalette::Active, QPalette::Light, brush1);
        palette1.setBrush(QPalette::Active, QPalette::Dark, brush);
        palette1.setBrush(QPalette::Active, QPalette::Text, brush2);
        palette1.setBrush(QPalette::Active, QPalette::ButtonText, brush3);
        palette1.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
        palette1.setBrush(QPalette::Inactive, QPalette::Light, brush1);
        palette1.setBrush(QPalette::Inactive, QPalette::Dark, brush);
        palette1.setBrush(QPalette::Inactive, QPalette::Text, brush2);
        palette1.setBrush(QPalette::Inactive, QPalette::ButtonText, brush3);
        palette1.setBrush(QPalette::Disabled, QPalette::WindowText, brush);
        palette1.setBrush(QPalette::Disabled, QPalette::Light, brush1);
        palette1.setBrush(QPalette::Disabled, QPalette::Dark, brush);
        palette1.setBrush(QPalette::Disabled, QPalette::Text, brush);
        palette1.setBrush(QPalette::Disabled, QPalette::ButtonText, brush);
        temp2_display->setPalette(palette1);
        temp2_display->setDigitCount(7);

        Thermocouple2->addWidget(temp2_display);

        Readouts->addLayout(Thermocouple2);

        OxTankPressure = new QHBoxLayout();
        OxTankPressure->setSpacing(6);
        OxTankPressure->setObjectName(QStringLiteral("OxTankPressure"));
        temp_label_3 = new QLabel(widget);
        temp_label_3->setObjectName(QStringLiteral("temp_label_3"));
        temp_label_3->setFont(font1);
        temp_label_3->setAlignment(Qt::AlignCenter);

        OxTankPressure->addWidget(temp_label_3);

        pressure1_display = new QLCDNumber(widget);
        pressure1_display->setObjectName(QStringLiteral("pressure1_display"));
        pressure1_display->setMinimumSize(QSize(187, 77));
        QPalette palette2;
        palette2.setBrush(QPalette::Active, QPalette::WindowText, brush);
        palette2.setBrush(QPalette::Active, QPalette::Light, brush1);
        palette2.setBrush(QPalette::Active, QPalette::Dark, brush);
        palette2.setBrush(QPalette::Active, QPalette::Text, brush2);
        palette2.setBrush(QPalette::Active, QPalette::ButtonText, brush3);
        palette2.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
        palette2.setBrush(QPalette::Inactive, QPalette::Light, brush1);
        palette2.setBrush(QPalette::Inactive, QPalette::Dark, brush);
        palette2.setBrush(QPalette::Inactive, QPalette::Text, brush2);
        palette2.setBrush(QPalette::Inactive, QPalette::ButtonText, brush3);
        palette2.setBrush(QPalette::Disabled, QPalette::WindowText, brush);
        palette2.setBrush(QPalette::Disabled, QPalette::Light, brush1);
        palette2.setBrush(QPalette::Disabled, QPalette::Dark, brush);
        palette2.setBrush(QPalette::Disabled, QPalette::Text, brush);
        palette2.setBrush(QPalette::Disabled, QPalette::ButtonText, brush);
        pressure1_display->setPalette(palette2);
        pressure1_display->setDigitCount(7);

        OxTankPressure->addWidget(pressure1_display);

        Readouts->addLayout(OxTankPressure);

        FuelTankPressure = new QHBoxLayout();
        FuelTankPressure->setSpacing(6);
        FuelTankPressure->setObjectName(QStringLiteral("FuelTankPressure"));
        temp_label_4 = new QLabel(widget);
        temp_label_4->setObjectName(QStringLiteral("temp_label_4"));
        temp_label_4->setFont(font1);
        temp_label_4->setAlignment(Qt::AlignCenter);

        FuelTankPressure->addWidget(temp_label_4);

        pressure2_display = new QLCDNumber(widget);
        pressure2_display->setObjectName(QStringLiteral("pressure2_display"));
        pressure2_display->setMinimumSize(QSize(187, 77));
        QPalette palette3;
        palette3.setBrush(QPalette::Active, QPalette::WindowText, brush);
        palette3.setBrush(QPalette::Active, QPalette::Light, brush1);
        palette3.setBrush(QPalette::Active, QPalette::Dark, brush);
        palette3.setBrush(QPalette::Active, QPalette::Text, brush2);
        palette3.setBrush(QPalette::Active, QPalette::ButtonText, brush3);
        palette3.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
        palette3.setBrush(QPalette::Inactive, QPalette::Light, brush1);
        palette3.setBrush(QPalette::Inactive, QPalette::Dark, brush);
        palette3.setBrush(QPalette::Inactive, QPalette::Text, brush2);
        palette3.setBrush(QPalette::Inactive, QPalette::ButtonText, brush3);
        palette3.setBrush(QPalette::Disabled, QPalette::WindowText, brush);
        palette3.setBrush(QPalette::Disabled, QPalette::Light, brush1);
        palette3.setBrush(QPalette::Disabled, QPalette::Dark, brush);
        palette3.setBrush(QPalette::Disabled, QPalette::Text, brush);
        palette3.setBrush(QPalette::Disabled, QPalette::ButtonText, brush);
        pressure2_display->setPalette(palette3);
        pressure2_display->setDigitCount(7);

        FuelTankPressure->addWidget(pressure2_display);

        Readouts->addLayout(FuelTankPressure);

        OxPressure = new QHBoxLayout();
        OxPressure->setSpacing(6);
        OxPressure->setObjectName(QStringLiteral("OxPressure"));
        temp_label_6 = new QLabel(widget);
        temp_label_6->setObjectName(QStringLiteral("temp_label_6"));
        temp_label_6->setFont(font1);
        temp_label_6->setAlignment(Qt::AlignCenter);

        OxPressure->addWidget(temp_label_6);

        pressure3_display = new QLCDNumber(widget);
        pressure3_display->setObjectName(QStringLiteral("pressure3_display"));
        pressure3_display->setMinimumSize(QSize(187, 77));
        QPalette palette4;
        palette4.setBrush(QPalette::Active, QPalette::WindowText, brush);
        palette4.setBrush(QPalette::Active, QPalette::Light, brush1);
        palette4.setBrush(QPalette::Active, QPalette::Dark, brush);
        palette4.setBrush(QPalette::Active, QPalette::Text, brush2);
        palette4.setBrush(QPalette::Active, QPalette::ButtonText, brush3);
        palette4.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
        palette4.setBrush(QPalette::Inactive, QPalette::Light, brush1);
        palette4.setBrush(QPalette::Inactive, QPalette::Dark, brush);
        palette4.setBrush(QPalette::Inactive, QPalette::Text, brush2);
        palette4.setBrush(QPalette::Inactive, QPalette::ButtonText, brush3);
        palette4.setBrush(QPalette::Disabled, QPalette::WindowText, brush);
        palette4.setBrush(QPalette::Disabled, QPalette::Light, brush1);
        palette4.setBrush(QPalette::Disabled, QPalette::Dark, brush);
        palette4.setBrush(QPalette::Disabled, QPalette::Text, brush);
        palette4.setBrush(QPalette::Disabled, QPalette::ButtonText, brush);
        pressure3_display->setPalette(palette4);
        pressure3_display->setDigitCount(7);

        OxPressure->addWidget(pressure3_display);

        Readouts->addLayout(OxPressure);

        FuelPressure = new QHBoxLayout();
        FuelPressure->setSpacing(6);
        FuelPressure->setObjectName(QStringLiteral("FuelPressure"));
        temp_label_5 = new QLabel(widget);
        temp_label_5->setObjectName(QStringLiteral("temp_label_5"));
        temp_label_5->setFont(font1);
        temp_label_5->setAlignment(Qt::AlignCenter);

        FuelPressure->addWidget(temp_label_5);

        pressure4_display = new QLCDNumber(widget);
        pressure4_display->setObjectName(QStringLiteral("pressure4_display"));
        pressure4_display->setMinimumSize(QSize(187, 77));
        QPalette palette5;
        palette5.setBrush(QPalette::Active, QPalette::WindowText, brush);
        palette5.setBrush(QPalette::Active, QPalette::Light, brush1);
        palette5.setBrush(QPalette::Active, QPalette::Dark, brush);
        palette5.setBrush(QPalette::Active, QPalette::Text, brush2);
        palette5.setBrush(QPalette::Active, QPalette::ButtonText, brush3);
        palette5.setBrush(QPalette::Inactive, QPalette::WindowText, brush);
        palette5.setBrush(QPalette::Inactive, QPalette::Light, brush1);
        palette5.setBrush(QPalette::Inactive, QPalette::Dark, brush);
        palette5.setBrush(QPalette::Inactive, QPalette::Text, brush2);
        palette5.setBrush(QPalette::Inactive, QPalette::ButtonText, brush3);
        palette5.setBrush(QPalette::Disabled, QPalette::WindowText, brush);
        palette5.setBrush(QPalette::Disabled, QPalette::Light, brush1);
        palette5.setBrush(QPalette::Disabled, QPalette::Dark, brush);
        palette5.setBrush(QPalette::Disabled, QPalette::Text, brush);
        palette5.setBrush(QPalette::Disabled, QPalette::ButtonText, brush);
        pressure4_display->setPalette(palette5);
        pressure4_display->setDigitCount(7);

        FuelPressure->addWidget(pressure4_display);

        Readouts->addLayout(FuelPressure);

        horizontalLayout->addLayout(Readouts);

        SolenoidStates = new QVBoxLayout();
        SolenoidStates->setSpacing(6);
        SolenoidStates->setObjectName(QStringLiteral("SolenoidStates"));
        SolenoidStates->setSizeConstraint(QLayout::SetFixedSize);
        SolenoidStates->setContentsMargins(-1, -1, -1, 0);
        recordingLabel = new QLabel(widget);
        recordingLabel->setObjectName(QStringLiteral("recordingLabel"));
        QFont font2;
        font2.setPointSize(14);
        font2.setBold(true);
        font2.setUnderline(true);
        font2.setWeight(75);
        recordingLabel->setFont(font2);
        recordingLabel->setFrameShape(QFrame::Panel);
        recordingLabel->setTextFormat(Qt::PlainText);
        recordingLabel->setAlignment(Qt::AlignCenter);

        SolenoidStates->addWidget(recordingLabel);

        StateTitle = new QLabel(widget);
        StateTitle->setObjectName(QStringLiteral("StateTitle"));
        QFont font3;
        font3.setPointSize(14);
        font3.setBold(true);
        font3.setItalic(false);
        font3.setWeight(75);
        StateTitle->setFont(font3);
        StateTitle->setAutoFillBackground(false);
        StateTitle->setFrameShape(QFrame::Box);
        StateTitle->setFrameShadow(QFrame::Plain);
        StateTitle->setTextFormat(Qt::RichText);
        StateTitle->setAlignment(Qt::AlignCenter);

        SolenoidStates->addWidget(StateTitle);

        EnginePurge = new QHBoxLayout();
        EnginePurge->setSpacing(6);
        EnginePurge->setObjectName(QStringLiteral("EnginePurge"));
        EnginePurge->setSizeConstraint(QLayout::SetFixedSize);
        EnginePurgeLabel = new QLabel(widget);
        EnginePurgeLabel->setObjectName(QStringLiteral("EnginePurgeLabel"));
        QFont font4;
        font4.setPointSize(12);
        EnginePurgeLabel->setFont(font4);
        EnginePurgeLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        EnginePurge->addWidget(EnginePurgeLabel);

        EnginePurgeState = new QLabel(widget);
        EnginePurgeState->setObjectName(QStringLiteral("EnginePurgeState"));
        EnginePurgeState->setEnabled(true);
        QFont font5;
        font5.setPointSize(12);
        font5.setBold(true);
        font5.setWeight(75);
        EnginePurgeState->setFont(font5);
        EnginePurgeState->setFrameShape(QFrame::Box);
        EnginePurgeState->setFrameShadow(QFrame::Raised);
        EnginePurgeState->setAlignment(Qt::AlignCenter);

        EnginePurge->addWidget(EnginePurgeState);

        SolenoidStates->addLayout(EnginePurge);

        LOXPress = new QHBoxLayout();
        LOXPress->setSpacing(6);
        LOXPress->setObjectName(QStringLiteral("LOXPress"));
        LOXPressLabel = new QLabel(widget);
        LOXPressLabel->setObjectName(QStringLiteral("LOXPressLabel"));
        LOXPressLabel->setFont(font4);
        LOXPressLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        LOXPress->addWidget(LOXPressLabel);

        LOXPressState = new QLabel(widget);
        LOXPressState->setObjectName(QStringLiteral("LOXPressState"));
        LOXPressState->setFont(font5);
        LOXPressState->setFrameShape(QFrame::Box);
        LOXPressState->setFrameShadow(QFrame::Raised);
        LOXPressState->setAlignment(Qt::AlignCenter);

        LOXPress->addWidget(LOXPressState);

        SolenoidStates->addLayout(LOXPress);

        LOXVent = new QHBoxLayout();
        LOXVent->setSpacing(6);
        LOXVent->setObjectName(QStringLiteral("LOXVent"));
        LOXVentLabel = new QLabel(widget);
        LOXVentLabel->setObjectName(QStringLiteral("LOXVentLabel"));
        LOXVentLabel->setFont(font4);
        LOXVentLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        LOXVent->addWidget(LOXVentLabel);

        LOXVentState = new QLabel(widget);
        LOXVentState->setObjectName(QStringLiteral("LOXVentState"));
        LOXVentState->setFont(font5);
        LOXVentState->setFrameShape(QFrame::Box);
        LOXVentState->setFrameShadow(QFrame::Raised);
        LOXVentState->setAlignment(Qt::AlignCenter);

        LOXVent->addWidget(LOXVentState);

        SolenoidStates->addLayout(LOXVent);

        InjectorChill = new QHBoxLayout();
        InjectorChill->setSpacing(6);
        InjectorChill->setObjectName(QStringLiteral("InjectorChill"));
        InjectorChillLabel = new QLabel(widget);
        InjectorChillLabel->setObjectName(QStringLiteral("InjectorChillLabel"));
        InjectorChillLabel->setFont(font4);
        InjectorChillLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        InjectorChill->addWidget(InjectorChillLabel);

        InjectorChillState = new QLabel(widget);
        InjectorChillState->setObjectName(QStringLiteral("InjectorChillState"));
        InjectorChillState->setFont(font5);
        InjectorChillState->setFrameShape(QFrame::Box);
        InjectorChillState->setFrameShadow(QFrame::Raised);
        InjectorChillState->setAlignment(Qt::AlignCenter);

        InjectorChill->addWidget(InjectorChillState);

        SolenoidStates->addLayout(InjectorChill);

        LOXMain = new QHBoxLayout();
        LOXMain->setSpacing(6);
        LOXMain->setObjectName(QStringLiteral("LOXMain"));
        LOXMainLabel = new QLabel(widget);
        LOXMainLabel->setObjectName(QStringLiteral("LOXMainLabel"));
        LOXMainLabel->setFont(font4);
        LOXMainLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        LOXMain->addWidget(LOXMainLabel);

        LOXMainState = new QLabel(widget);
        LOXMainState->setObjectName(QStringLiteral("LOXMainState"));
        LOXMainState->setFont(font5);
        LOXMainState->setFrameShape(QFrame::Box);
        LOXMainState->setFrameShadow(QFrame::Raised);
        LOXMainState->setAlignment(Qt::AlignCenter);

        LOXMain->addWidget(LOXMainState);

        SolenoidStates->addLayout(LOXMain);

        FuelPress = new QHBoxLayout();
        FuelPress->setSpacing(6);
        FuelPress->setObjectName(QStringLiteral("FuelPress"));
        FuelPressLabel = new QLabel(widget);
        FuelPressLabel->setObjectName(QStringLiteral("FuelPressLabel"));
        FuelPressLabel->setFont(font4);
        FuelPressLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        FuelPress->addWidget(FuelPressLabel);

        FuelPressState = new QLabel(widget);
        FuelPressState->setObjectName(QStringLiteral("FuelPressState"));
        FuelPressState->setFont(font5);
        FuelPressState->setFrameShape(QFrame::Box);
        FuelPressState->setFrameShadow(QFrame::Raised);
        FuelPressState->setAlignment(Qt::AlignCenter);

        FuelPress->addWidget(FuelPressState);

        SolenoidStates->addLayout(FuelPress);

        FuelPre = new QHBoxLayout();
        FuelPre->setSpacing(6);
        FuelPre->setObjectName(QStringLiteral("FuelPre"));
        FuelPreLabel = new QLabel(widget);
        FuelPreLabel->setObjectName(QStringLiteral("FuelPreLabel"));
        FuelPreLabel->setFont(font4);
        FuelPreLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        FuelPre->addWidget(FuelPreLabel);

        FuelPreState = new QLabel(widget);
        FuelPreState->setObjectName(QStringLiteral("FuelPreState"));
        FuelPreState->setFont(font5);
        FuelPreState->setFrameShape(QFrame::Box);
        FuelPreState->setFrameShadow(QFrame::Raised);
        FuelPreState->setAlignment(Qt::AlignCenter);

        FuelPre->addWidget(FuelPreState);

        SolenoidStates->addLayout(FuelPre);

        FuelMain = new QHBoxLayout();
        FuelMain->setSpacing(6);
        FuelMain->setObjectName(QStringLiteral("FuelMain"));
        FuelMainLabel = new QLabel(widget);
        FuelMainLabel->setObjectName(QStringLiteral("FuelMainLabel"));
        FuelMainLabel->setFont(font4);
        FuelMainLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        FuelMain->addWidget(FuelMainLabel);

        FuelMainState = new QLabel(widget);
        FuelMainState->setObjectName(QStringLiteral("FuelMainState"));
        FuelMainState->setFont(font5);
        FuelMainState->setFrameShape(QFrame::Box);
        FuelMainState->setFrameShadow(QFrame::Raised);
        FuelMainState->setAlignment(Qt::AlignCenter);

        FuelMain->addWidget(FuelMainState);

        SolenoidStates->addLayout(FuelMain);

        horizontalLayout->addLayout(SolenoidStates);

        retranslateUi(Dialog);

        QMetaObject::connectSlotsByName(Dialog);
    } // setupUi

    void retranslateUi(QDialog *Dialog)
    {
        Dialog->setWindowTitle(QApplication::translate("Dialog", "Dialog", Q_NULLPTR));
        temp_label->setText(QApplication::translate("Dialog", "<html><head/><body><p>TC 1 Temperature</p></body></html>", Q_NULLPTR));
        temp_label_2->setText(QApplication::translate("Dialog", "<html><head/><body><p>TC 2 Temperature</p></body></html>", Q_NULLPTR));
        temp_label_3->setText(QApplication::translate("Dialog", "<html><head/><body><p>PT1 (F-INJECTOR)</p></body></html>", Q_NULLPTR));
        temp_label_4->setText(QApplication::translate("Dialog", "<html><head/><body><p>PT2</p></body></html>", Q_NULLPTR));
        temp_label_6->setText(QApplication::translate("Dialog", "<html><head/><body><p>PT3 (FUEL TANK)</p></body></html>", Q_NULLPTR));
        temp_label_5->setText(QApplication::translate("Dialog", "<html><head/><body><p>PT4</p></body></html>", Q_NULLPTR));
        recordingLabel->setText(QApplication::translate("Dialog", "RECORDING: OFF", Q_NULLPTR));
        StateTitle->setText(QApplication::translate("Dialog", "SOLENOID STATES", Q_NULLPTR));
        EnginePurgeLabel->setText(QApplication::translate("Dialog", "Engine Purge:", Q_NULLPTR));
        EnginePurgeState->setText(QApplication::translate("Dialog", "CLOSED", Q_NULLPTR));
        LOXPressLabel->setText(QApplication::translate("Dialog", "LOX Press", Q_NULLPTR));
        LOXPressState->setText(QApplication::translate("Dialog", "CLOSED", Q_NULLPTR));
        LOXVentLabel->setText(QApplication::translate("Dialog", "LOX Vent:", Q_NULLPTR));
        LOXVentState->setText(QApplication::translate("Dialog", "CLOSED", Q_NULLPTR));
        InjectorChillLabel->setText(QApplication::translate("Dialog", "Injector Chill:", Q_NULLPTR));
        InjectorChillState->setText(QApplication::translate("Dialog", "INHIBIT", Q_NULLPTR));
        LOXMainLabel->setText(QApplication::translate("Dialog", "LOX Main:", Q_NULLPTR));
        LOXMainState->setText(QApplication::translate("Dialog", "INHIBIT", Q_NULLPTR));
        FuelPressLabel->setText(QApplication::translate("Dialog", "Fuel Press:", Q_NULLPTR));
        FuelPressState->setText(QApplication::translate("Dialog", "CLOSED", Q_NULLPTR));
        FuelPreLabel->setText(QApplication::translate("Dialog", "Fuel Pre-Stage:", Q_NULLPTR));
        FuelPreState->setText(QApplication::translate("Dialog", "INHIBIT", Q_NULLPTR));
        FuelMainLabel->setText(QApplication::translate("Dialog", "Fuel Main:", Q_NULLPTR));
        FuelMainState->setText(QApplication::translate("Dialog", "INHIBIT", Q_NULLPTR));
    } // retranslateUi

};

namespace Ui {
    class Dialog: public Ui_Dialog {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_DIALOG_H


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
net.didion.jwnl.data
</TITLE>

<META NAME="keywords" CONTENT="net.didion.jwnl.data package">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

net.didion.jwnl.data

Interfaces

DatabaseDictionaryElementFactory

DictionaryElement

FileDictionaryElementFactory

Classes

Adjective

Adjective.AdjectivePosition

DictionaryElementType

Exc

IndexWord

IndexWordSet

LexFileIdMap

Pointer

PointerTarget

PointerType

PointerUtils

POS

Synset

SynsetProxy

Verb

VerbFrame

Word


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>Your ASP.NET application</title>

Your ASP.NET application

Congratulations! You've created a project

This application consists of:

Help Page for documenting your Web APIs

Theming using Bootstrap

Authentication, if selected, shows how to register and sign in

ASP.NET features managed using NuGet

Customize app

Get started with HTTP services using ASP.NET Web API

Change the site's theme

Add more libraries using NuGet

Configure authentication

Scaffold an ASP.NET Web API from a model

Secure your web API

Access your web API on different devices

Enable tracing for testing and debugging

Add real-time web with ASP.NET SignalR

Add components using Scaffolding

Share your project

Deploy

Ensure your app is ready for production

Microsoft Azure

Hosting providers

Get help

Get help

Get more templates


text:
package hu.akarnokd.rxjava2flow.internal.operators.nbp;

import hu.akarnokd.rxjava2flow.NbpObservable.*;
import hu.akarnokd.rxjava2flow.disposables.Disposable;
import hu.akarnokd.rxjava2flow.internal.subscriptions.SubscriptionHelper;

public final class NbpOperatorElementAt<T> implements NbpOperator<T, T> {
    final long index;
    final T defaultValue;
    public NbpOperatorElementAt(long index, T defaultValue) {
        this.index = index;
        this.defaultValue = defaultValue;
    }
    @Override
    public NbpSubscriber<? super T> apply(NbpSubscriber<? super T> t) {
        return new ElementAtSubscriber<>(t, index, defaultValue);
    }

    static final class ElementAtSubscriber<T> implements NbpSubscriber<T> {
        final NbpSubscriber<? super T> actual;
        final long index;
        final T defaultValue;

        Disposable s;

        long count;

        boolean done;

        public ElementAtSubscriber(NbpSubscriber<? super T> actual, long index, T defaultValue) {
            this.actual = actual;
            this.index = index;
            this.defaultValue = defaultValue;
        }

        @Override
        public void onSubscribe(Disposable s) {
            if (SubscriptionHelper.validateDisposable(this.s, s)) {
                return;
            }
            this.s = s;
            actual.onSubscribe(s);
        }

        @Override
        public void onNext(T t) {
            if (done) {
                return;
            }
            long c = count;
            if (c == index) {
                done = true;
                s.dispose();
                actual.onNext(t);
                actual.onComplete();
                return;
            }
            count = c + 1;
        }

        @Override
        public void onError(Throwable t) {
            if (done) {
                return;
            }
            done = true;
            actual.onError(t);
        }

        @Override
        public void onComplete() {
            if (index <= count && !done) {
                done = true;
                T v = defaultValue;
                if (v == null) {
                    actual.onError(new IndexOutOfBoundsException());
                } else {
                    actual.onNext(v);
                    actual.onComplete();
                }
            }
        }
    }
}


text:
using Lucene.Net.Index;
using Lucene.Net.Store;
using Lucene.Net.Util;
using System;
using System.Collections.Generic;
using System.IO;
using Directory = Lucene.Net.Store.Directory;

namespace Lucene.Net.Replicator
{

    /// <summary>
    /// A <see cref="IReplicationHandler"/> for replication of an index and taxonomy pair.
    /// See <see cref="IReplicationHandler"/> for more detail. This handler ensures
    /// that the search and taxonomy indexes are replicated in a consistent way.
    /// </summary>
    /// <remarks>
    /// <b>NOTE:</b> If you intend to recreate a taxonomy index, you should make sure
    /// to reopen an IndexSearcher and TaxonomyReader pair via the provided callback,
    /// to guarantee that both indexes are in sync. This handler does not prevent
    /// replicating such index and taxonomy pairs, and if they are reopened by a
    /// different thread, unexpected errors can occur, as well as inconsistency
    /// between the taxonomy and index readers.
    /// <para/>
    /// @lucene.experimental
    /// </remarks>
    /// <seealso cref="IndexReplicationHandler"/>
    public class IndexAndTaxonomyReplicationHandler : IReplicationHandler
    {
        /// <summary>
        /// The component used to log messages to the <see cref="Util.InfoStream.Default"/> <see cref="Util.InfoStream"/>.
        /// </summary>
        public const string INFO_STREAM_COMPONENT = "IndexAndTaxonomyReplicationHandler";

        private readonly Directory indexDirectory;
        private readonly Directory taxonomyDirectory;
        private readonly Func<bool?> callback;

        private volatile IDictionary<string, IList<RevisionFile>> currentRevisionFiles;
        private volatile string currentVersion;
        private volatile InfoStream infoStream = InfoStream.Default;

        /// <summary>
        /// Constructor with the given index directory and callback to notify when the indexes were updated.
        /// </summary>
        /// <exception cref="IOException"></exception>
        public IndexAndTaxonomyReplicationHandler(Directory indexDirectory, Directory taxonomyDirectory, Func<bool?> callback)
        {
            this.indexDirectory = indexDirectory;
            this.taxonomyDirectory = taxonomyDirectory;
            this.callback = callback;

            currentVersion = null;
            currentRevisionFiles = null;

            bool indexExists = DirectoryReader.IndexExists(indexDirectory);
            bool taxonomyExists = DirectoryReader.IndexExists(taxonomyDirectory);

            if (indexExists != taxonomyExists)
                throw new InvalidOperationException(string.Format("search and taxonomy indexes must either both exist or not: index={0} taxo={1}", indexExists, taxonomyExists));

            if (indexExists)
            {
                IndexCommit indexCommit = IndexReplicationHandler.GetLastCommit(indexDirectory);
                IndexCommit taxonomyCommit = IndexReplicationHandler.GetLastCommit(taxonomyDirectory);

                currentRevisionFiles = IndexAndTaxonomyRevision.RevisionFiles(indexCommit, taxonomyCommit);
                currentVersion = IndexAndTaxonomyRevision.RevisionVersion(indexCommit, taxonomyCommit);

                WriteToInfoStream(
                    string.Format("constructor(): currentVersion={0} currentRevisionFiles={1}", currentVersion, currentRevisionFiles),
                    string.Format("constructor(): indexCommit={0} taxoCommit={1}", indexCommit, taxonomyCommit));
            }
        }

        public virtual string CurrentVersion => currentVersion;
        public virtual IDictionary<string, IList<RevisionFile>> CurrentRevisionFiles => currentRevisionFiles;

        public virtual void RevisionReady(string version,
            IDictionary<string, IList<RevisionFile>> revisionFiles,
            IDictionary<string, IList<string>> copiedFiles,
            IDictionary<string, Directory> sourceDirectory)
        {
            Directory taxonomyClientDirectory = sourceDirectory[IndexAndTaxonomyRevision.TAXONOMY_SOURCE];
            Directory indexClientDirectory = sourceDirectory[IndexAndTaxonomyRevision.INDEX_SOURCE];
            IList<string> taxonomyFiles = copiedFiles[IndexAndTaxonomyRevision.TAXONOMY_SOURCE];
            IList<string> indexFiles = copiedFiles[IndexAndTaxonomyRevision.INDEX_SOURCE];
            string taxonomySegmentsFile = IndexReplicationHandler.GetSegmentsFile(taxonomyFiles, true);
            string indexSegmentsFile = IndexReplicationHandler.GetSegmentsFile(indexFiles, false);

            bool success = false;
            try
            {
                // copy taxonomy files before index files
                IndexReplicationHandler.CopyFiles(taxonomyClientDirectory, taxonomyDirectory, taxonomyFiles);
                IndexReplicationHandler.CopyFiles(indexClientDirectory, indexDirectory, indexFiles);

                // fsync all copied files (except segmentsFile)
                if (taxonomyFiles.Count > 0)
                    taxonomyDirectory.Sync(taxonomyFiles);
                indexDirectory.Sync(indexFiles);

                // now copy and fsync segmentsFile, taxonomy first because it is ok if a
                // reader sees a more advanced taxonomy than the index.
                if (taxonomySegmentsFile != null)
                    taxonomyClientDirectory.Copy(taxonomyDirectory, taxonomySegmentsFile, taxonomySegmentsFile, IOContext.READ_ONCE);
                indexClientDirectory.Copy(indexDirectory, indexSegmentsFile, indexSegmentsFile, IOContext.READ_ONCE);

                if (taxonomySegmentsFile != null)
                    taxonomyDirectory.Sync(new[] { taxonomySegmentsFile });
                indexDirectory.Sync(new[] { indexSegmentsFile });

                success = true;
            }
            finally
            {
                if (!success)
                {
                    taxonomyFiles.Add(taxonomySegmentsFile); // add it back so it gets deleted too
                    IndexReplicationHandler.CleanupFilesOnFailure(taxonomyDirectory, taxonomyFiles);
                    indexFiles.Add(indexSegmentsFile); // add it back so it gets deleted too
                    IndexReplicationHandler.CleanupFilesOnFailure(indexDirectory, indexFiles);
                }
            }

            // all files have been successfully copied + sync'd. update the handler's state
            currentRevisionFiles = revisionFiles;
            currentVersion = version;

            WriteToInfoStream("revisionReady(): currentVersion=" + currentVersion + " currentRevisionFiles=" + currentRevisionFiles);

            // update the segments.gen file
            IndexReplicationHandler.WriteSegmentsGen(taxonomySegmentsFile, taxonomyDirectory);
            IndexReplicationHandler.WriteSegmentsGen(indexSegmentsFile, indexDirectory);

            // Cleanup the index directory from old and unused index files.
            // NOTE: we don't use IndexWriter.deleteUnusedFiles here since it may have
            // side-effects, e.g. if it hits sudden IO errors while opening the index
            // (and can end up deleting the entire index). It is not our job to protect
            // against those errors, app will probably hit them elsewhere.
            IndexReplicationHandler.CleanupOldIndexFiles(indexDirectory, indexSegmentsFile);
            IndexReplicationHandler.CleanupOldIndexFiles(taxonomyDirectory, taxonomySegmentsFile);

            // successfully updated the index, notify the callback that the index is
            // ready.
            if (callback != null) {
              try {
                callback.Invoke();
              } catch (Exception e) {
                throw new IOException(e.Message, e);
              }
            }
        }

        // LUCENENET specific utility method
        private void WriteToInfoStream(params string[] messages)
        {
            if (!InfoStream.IsEnabled(INFO_STREAM_COMPONENT))
                return;

            foreach (string message in messages)
                InfoStream.Message(INFO_STREAM_COMPONENT, message);
        }

        /// <summary>
        /// Gets or sets the <see cref="Util.InfoStream"/> to use for logging messages.
        /// </summary>
        public virtual InfoStream InfoStream
        {
            get => infoStream;
            set => infoStream = value ?? InfoStream.NO_OUTPUT;
        }
    }
}


text:
package wtf.heck.jeelastic;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import wtf.heck.jeelastic.annotations.EsConfig;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;

/**
 * Created by cerias on 08.07.15.
 */

/**
 * Created by cerias on 08.07.15.
 */
@Slf4j
@ApplicationScoped
public class ElasticConfig {
    private static final String PROPERTIES_FILE_NAME = "elasticsearch.conf";
    private PropertiesConfiguration properties = null;

    @PostConstruct
    private void init(){
        log.info("Elasticsearch Config loaded.");
        try {
            properties = new PropertiesConfiguration(PROPERTIES_FILE_NAME);
        } catch (ConfigurationException e) {
            e.printStackTrace();
        }finally {

        }
    }

    @Produces
    @EsConfig
    PropertiesConfiguration getProperties() {
        return properties;
    }
}


text:
#include "bio-pch.h"

#include "bio/application.h"
#include "bio/remo_analysis.h"
USING_BIO_NS

#include <boost/progress.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/archive/binary_oarchive.hpp>
using namespace boost;
namespace po = boost::program_options;
namespace fs = boost::filesystem;

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

struct SeparateReMoExtractionApp : Application
{
	std::string remo_extraction_filename;
	std::string results_prefix;
	unsigned num_parts;

	SeparateReMoExtractionApp()
	{
		get_options().add_options()
			("remo,r", po::value(&remo_extraction_filename)->default_value("remo_extraction.bin"), "remo extraction file")
			("num_parts,n", po::value(&num_parts)->default_value(2), "number of parts to split extraction into")
			("results_prefix,p", po::value(&results_prefix)->default_value("remo_extraction_part"), "prefix for results files")
			;
	}

	int task()
	{
		//deserialise the binary remo archive
		ReMoExtraction::ptr_t remo;
		{
			fs::path
				remo_extraction_archive(
					remo_extraction_filename
				);
			cout << "Deserialising remo extraction from \"" << remo_extraction_archive._BOOST_FS_NATIVE() << "\"\n";
			boost::progress_timer timer;
			remo = ReMoExtraction::deserialise(remo_extraction_archive);
		}

		//the vector that holds each part
		typedef std::vector<ReMoExtraction::ptr_t> extraction_vec_t;
		extraction_vec_t extraction_parts;
		for (unsigned i = 0; num_parts != i; ++i)
		{
			extraction_parts.push_back(ReMoExtraction::ptr_t(new ReMoExtraction));
		}

		//iterate through the extraction
		{
			cout << "Splitting extraction\n";
			boost::progress_display show_progress( remo->sequence_groups.size() );
			boost::progress_timer timer;

			unsigned part_idx = 0;
			for (ReMoSequenceGroup::list_t::const_iterator sg = remo->sequence_groups.begin();
				remo->sequence_groups.end() != sg;
				++sg, ++show_progress, ++part_idx)
			{
				if (num_parts == part_idx)
				{
					part_idx = 0;
				}

				extraction_parts[part_idx]->sequence_groups.push_back(*sg);
			}
		}

		//serialise
		for (unsigned i = 0; num_parts != i; ++i)
		{
			const std::string output_filename = BIO_MAKE_STRING(results_prefix << '_' << i << ".bin");
			cout << "Serialising remo extraction part to \"" << output_filename << "\"\n";
			std::ofstream stream(output_filename.c_str(), std::ios::binary);
			boost::archive::binary_oarchive(stream) << const_cast<const ReMoExtraction &>(*(extraction_parts[i]));
		}

		return 0;
	}
};

int
main(int argc, char * argv[])
{
	return SeparateReMoExtractionApp().main(argc, argv);
}


text:
using Content.Client.Atmos.Overlays;
using Content.Shared.Atmos.EntitySystems;
using Content.Shared.GameTicking;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Utility;

namespace Content.Client.Atmos.EntitySystems
{
    [UsedImplicitly]
    public sealed class GasTileOverlaySystem : SharedGasTileOverlaySystem
    {
        [Dependency] private readonly IResourceCache _resourceCache = default!;
        [Dependency] private readonly IOverlayManager _overlayMan = default!;
        [Dependency] private readonly SpriteSystem _spriteSys = default!;

        private GasTileOverlay _overlay = default!;

        public override void Initialize()
        {
            base.Initialize();
            SubscribeNetworkEvent<GasOverlayUpdateEvent>(HandleGasOverlayUpdate);
            SubscribeLocalEvent<GridRemovalEvent>(OnGridRemoved);

            _overlay = new GasTileOverlay(this, EntityManager, _resourceCache, ProtoMan, _spriteSys);
            _overlayMan.AddOverlay(_overlay);
        }

        public override void Reset(RoundRestartCleanupEvent ev)
        {
            _overlay.TileData.Clear();
        }

        public override void Shutdown()
        {
            base.Shutdown();
            _overlayMan.RemoveOverlay(_overlay);
        }

        private void HandleGasOverlayUpdate(GasOverlayUpdateEvent ev)
        {
            foreach (var (grid, removedIndicies) in ev.RemovedChunks)
            {
                if (!_overlay.TileData.TryGetValue(grid, out var chunks))
                    continue;

                foreach (var index in removedIndicies)
                {
                    chunks.Remove(index);
                }
            }

            foreach (var (grid, gridData) in ev.UpdatedChunks)
            {
                var chunks = _overlay.TileData.GetOrNew(grid);
                foreach (var chunkData in gridData)
                {
                    chunks[chunkData.Index] = chunkData;
                }
            }
        }

        private void OnGridRemoved(GridRemovalEvent ev)
        {
            _overlay.TileData.Remove(ev.EntityUid);
        }
    }
}


text:
package com.inepex.ineFrame.client.async;

import net.customware.gwt.dispatch.client.DispatchAsync;
import net.customware.gwt.dispatch.shared.Action;
import net.customware.gwt.dispatch.shared.Result;

import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;

public class IneDispatch extends IneDispatchBase<Action<? extends Result>> {

    private DispatchAsync dispatcher;

    @Inject
    public IneDispatch(
        DispatchAsync dispatcher,
        AsyncStatusIndicator defaultStatusIndicator,
        EventBus eventBus,
        ConnectionFailedHandler connectionFailedHandler) {
        super(connectionFailedHandler, eventBus);
        this.dispatcher = dispatcher;
        this.defaultStatusIndicator = defaultStatusIndicator;
        this.eventBus = eventBus;
    }

    public DispatchAsync getDispatcher() {
        return dispatcher;
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    @Override
    protected void doExecute(Action action, IneAsyncCallback callback) {
        dispatcher.execute(action, callback);

    }

}


text:
<?php

defined('_JEXEC') or die;

/** @var JDocumentError $this */

$app  = JFactory::getApplication();
$user = JFactory::getUser();

// Getting params from template
$params = $app->getTemplate(true)->params;

// Detecting Active Variables
$option   = $app->input->getCmd('option', '');
$view     = $app->input->getCmd('view', '');
$layout   = $app->input->getCmd('layout', '');
$task     = $app->input->getCmd('task', '');
$itemid   = $app->input->getCmd('Itemid', '');
$sitename = $app->get('sitename');

if ($task ==='edit' || $layout === 'form')
{
	$fullWidth = 1;
}
else
{
	$fullWidth = 0;
}

// Add JavaScript Frameworks
JHtml::_('bootstrap.framework');

// Logo file or site title param
if ($params->get('logoFile'))
{
	$logo = 'get('logoFile') . '" alt="' . $sitename . '" />';
}
elseif ($params->get('sitetitle'))
{
	$logo = '' . htmlspecialchars($params->get('sitetitle')) . '';
}
else
{
	$logo = '' . $sitename . '';
}
?>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">

	<meta charset="utf-8" />
	<title><?php echo $this->title; ?> <?php echo htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8'); ?></title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<?php // Use of Google Font ?>
	<?php if ($params->get('googleFont')) : ?>
		<link href="//fonts.googleapis.com/css?family=<?php echo $params->get('googleFontName'); ?>" rel="stylesheet" />

	<?php endif; ?>
	<link href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/css/template.css" rel="stylesheet" />
	<?php if ($app->get('debug_lang', '0') == '1' || $app->get('debug', '0') == '1') : ?>
		<link href="<?php echo JUri::root(true); ?>/media/cms/css/debug.css" rel="stylesheet" />
	<?php endif; ?>
	<?php // If Right-to-Left ?>
	<?php if ($this->direction === 'rtl') : ?>
		<link href="<?php echo JUri::root(true); ?>/media/jui/css/bootstrap-rtl.css" rel="stylesheet" />
	<?php endif; ?>
	<link href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
	<?php // Template color ?>
	<?php if ($params->get('templateColor')) : ?>

	<?php endif; ?>

<body class="site <?php echo $option
	. ' view-' . $view
	. ($layout ? ' layout-' . $layout : ' no-layout')
	. ($task ? ' task-' . $task : ' no-task')
	. ($itemid ? ' itemid-' . $itemid : '')
	. ($params->get('fluidContainer') ? ' fluid' : '');
?>">

		<div class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">

					<a class="brand pull-left" href="<?php echo $this->baseurl; ?>/">
						<?php echo $logo; ?>

						<?php // Display position-0 modules ?>
						<?php echo $this->getBuffer('modules', 'position-0', array('style' => 'none')); ?>

				<?php // Display position-1 modules ?>
				<?php echo $this->getBuffer('modules', 'position-1', array('style' => 'none')); ?>

				<?php echo $this->getBuffer('modules', 'banner', array('style' => 'xhtml')); ?>

<?php echo JText::_('JERROR_LAYOUT_PAGE_NOT_FOUND'); ?>

<?php echo JText::_('JERROR_LAYOUT_ERROR_HAS_OCCURRED_WHILE_PROCESSING_YOUR_REQUEST'); ?>

<?php echo JText::_('JERROR_LAYOUT_NOT_ABLE_TO_VISIT'); ?>

<?php echo JText::_('JERROR_LAYOUT_AN_OUT_OF_DATE_BOOKMARK_FAVOURITE'); ?>

<?php echo JText::_('JERROR_LAYOUT_MIS_TYPED_ADDRESS'); ?>

<?php echo JText::_('JERROR_LAYOUT_SEARCH_ENGINE_OUT_OF_DATE_LISTING'); ?>

<?php echo JText::_('JERROR_LAYOUT_YOU_HAVE_NO_ACCESS_TO_THIS_PAGE'); ?>

								<?php if (JModuleHelper::getModule('search')) : ?>

<?php echo JText::_('JERROR_LAYOUT_SEARCH'); ?>

<?php echo JText::_('JERROR_LAYOUT_SEARCH_PAGE'); ?>

									<?php echo $this->getBuffer('module', 'search'); ?>
								<?php endif; ?>

<?php echo JText::_('JERROR_LAYOUT_GO_TO_THE_HOME_PAGE'); ?>

<a href="<?php echo $this->baseurl; ?>/index.php" class="btn"> <?php echo JText::_('JERROR_LAYOUT_HOME_PAGE'); ?>

<?php echo JText::_('JERROR_LAYOUT_PLEASE_CONTACT_THE_SYSTEM_ADMINISTRATOR'); ?>

							<?php echo $this->error->getCode(); ?> <?php echo htmlspecialchars($this->error->getMessage(), ENT_QUOTES, 'UTF-8');?>

						<?php if ($this->debug) : ?>

								<?php echo $this->renderBacktrace(); ?>
								<?php // Check if there are more Exceptions and render their data as well ?>
								<?php if ($this->error->getPrevious()) : ?>
									<?php $loop = true; ?>
									<?php // Reference $this->_error here and in the loop as setError() assigns errors to this property and we need this for the backtrace to work correctly ?>
									<?php // Make the first assignment to setError() outside the loop so the loop does not skip Exceptions ?>
									<?php $this->setError($this->_error->getPrevious()); ?>
									<?php while ($loop === true) : ?>

<?php echo JText::_('JERROR_LAYOUT_PREVIOUS_ERROR'); ?>

<?php echo htmlspecialchars($this->_error->getMessage(), ENT_QUOTES, 'UTF-8'); ?>

										<?php echo $this->renderBacktrace(); ?>
										<?php $loop = $this->setError($this->_error->getPrevious()); ?>
									<?php endwhile; ?>
									<?php // Reset the main error object to the base error ?>
									<?php $this->setError($this->error); ?>
								<?php endif; ?>

						<?php endif; ?>

		<div class="container<?php echo ($params->get('fluidContainer') ? '-fluid' : ''); ?>">

			<?php echo $this->getBuffer('modules', 'footer', array('style' => 'none')); ?>

					<?php echo JText::_('TPL_PROTOSTAR_BACKTOTOP'); ?>

				© <?php echo date('Y'); ?> <?php echo $sitename; ?>

	<?php echo $this->getBuffer('modules', 'debug', array('style' => 'none')); ?>


text:
'use strict';

define(['app'], function (app) {
    var injectParams = ['$scope', '$injector'];

    // This is controller for this view
	var dashboardController = function ($scope, $injector) {

		$scope.goBack = function()
		{
			window.history.back();
		};

    };

	// Inject controller's dependencies
	dashboardController.$inject = injectParams;
	// Register/apply controller dynamically
    app.register.controller('dashboardController', dashboardController);

});


text:
package com.tommytony.war.command;

import org.bukkit.command.CommandSender;

import com.tommytony.war.War;

/**
 * Unloads war.
 *
 * @author Tim Düsterhus
 */
public class UnloadWarCommand extends AbstractWarAdminCommand {
	public UnloadWarCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NotWarAdminException {
		super(handler, sender, args);
	}

	@Override
	public boolean handle() {
		if (this.args.length != 0) {
			return false;
		}

		War.war.unloadWar();
		this.msg("War unloaded.");
		return true;
	}
}