text:
package mongo;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
import de.flapdoodle.embed.mongo.MongodStarter;
import de.flapdoodle.embed.mongo.config.IMongodConfig;
import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.process.runtime.Network;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Created by iurii.dziuban on 09.08.2016.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
        "classpath:mongo/application-context.xml",
        "classpath:mongo/test-context.xml",
        "classpath:mongo/application-context.xml"})
/** Example from https://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo  */
public class SpringBatchEmbeddedMongoTest {

    private static MongodStarter starter = MongodStarter.getDefaultInstance();
    private static MongodExecutable mongodExecutable = null;
    private static MongodProcess mongod = null;

    private static final int DEFAULT_MONGO_DB_PORT = 27017;

    @Autowired
    private JobLauncherTestUtils jobLauncherTestUtils;

    @BeforeClass
    public static void beforeClass() throws Exception {
        int port = DEFAULT_MONGO_DB_PORT;
        /* Mongo 3.2.1 Version.Main.PRODUCTION  Latest version 3.3.0 Version.Main.DEVELOPMENT*/
        IMongodConfig mongodConfig = new MongodConfigBuilder()
                .version(Version.Main.DEVELOPMENT)
                .net(new Net(port, Network.localhostIsIPv6()))
                .build();

        mongodExecutable = starter.prepare(mongodConfig);
        mongod = mongodExecutable.start();
    }

    @Test
    public void testClient() throws Exception {
        MongoClient mongo = new MongoClient("localhost", DEFAULT_MONGO_DB_PORT);
        DB db = mongo.getDB("mongoDB");
        DBCollection col = db.createCollection("testCol", new BasicDBObject());
        col.save(new BasicDBObject("testDoc", new Date()));
    }

    @Test
    public void launchJob() throws Exception {
        JobExecution jobExecution = jobLauncherTestUtils.launchJob();
        assertThat(jobExecution.getStatus()).isEqualTo(BatchStatus.COMPLETED);
    }

    @Test
    public void launchStep() throws Exception {
        JobExecution jobExecution = jobLauncherTestUtils.launchStep("step1");
        assertThat(jobExecution.getStatus()).isEqualTo(BatchStatus.COMPLETED);
    }

    @AfterClass
    public static void afterClass() {
        if (mongod != null) {
            mongod.stop();
        }
        if (mongodExecutable != null) {
            mongodExecutable.stop();
        }
    }
}


text:
'use strict';

// load default configuration
module.exports = require('./configurations/es6');

redpajama_set_name: RedPajamaGithub


text:
How and when to take

Children can take ibuprofen as:

a syrup - from the age of 3 months

tablets - from the age of 6 years

granules – from the age of 12 years

Ibuprofen is usually given 3 or 4 times a day. Your pharmacist or doctor will tell you how often to give it.

If you give it:

3 times a day, leave at least 6 hours between doses

4 times a day, leave at least 4 hours between doses

Ibuprofen syrup dosages for children

      Age
      How much

      3 - 6 months
(weighing more than 5kg)
      2.5ml may be taken 3 times in 24 hours

      6 - 12 months
      2.5ml may be taken 3-4 times in 24 hours

      1 - 3 years
      5ml may be taken 3 times in 24 hours

      4 - 6 years
      7.5ml may be taken 3 times in 24 hours

      7 - 9 years
      10ml may be taken 3 times in 24 hours

      10 - 12 years
      15ml may be taken 3 times in 24 hours

Ibuprofen tablet dosages for children

      Age
      How much

      7 – 10 years
      200 mg 3 times in 24 hours

      10 – 12 years
      300 mg 3 times in 24 hours

      12 – 18 years
      300–400 mg 3–4 times in 24 hours
(up to a max of)
600mg 4 times in 24 hours

      {{ moreinfoHowWhen|default('More information') }}

If your child has pain all the time, your doctor may prescribe slow-release tablets or capsules. These are given once or twice a day. Your doctor will tell you how often to give the medicine.

Give ibuprofen with food or milk to reduce stomach upset.

How much ibuprofen to give

Ibuprofen tablets, capsules, syrup and granules come in a range of strengths. Children need to take a lower dose than adults, depending on their age.

As a general rule, babies and children can have ibuprofen syrup up to age 12 and beyond. While only children aged 6 and older can have tablets.  Granules are only for children aged 12 and older.

If you are not sure how much to give, ask your pharmacist or doctor.

How to give ibuprofen to a child

Syrup

Shake the bottle well and measure out the right amount using a plastic syringe or spoon. These come in the medicine packet. If you don't have a syringe or spoon, ask your pharmacist for one. Do not use a kitchen teaspoon as it will not give the right amount.

To hide the taste of liquid medicine, you can give the child a drink of milk or fruit juice straight after giving the medicine.

Tablets and capsules

Tablets and capsules should be swallowed whole with a glass of water or juice. Tell your child not to chew, break, crush or suck them as this could irritate their mouth or throat.

Granules

Sprinkle or stir the granules into a small amount of soft food (such as yoghurt) or a small drink, or you can mix them with a spoonful of cold water. Do not mix the granules with warm food or liquid. Your child should then swallow the food or drink it straight away, without chewing. Make sure that they take it all. Do not keep the granule/food mixture to give later.

What if I forget to give it?

Give the missed dose as soon as you remember, unless it is almost time for their next dose. In this instance, skip the missed dose and give their next dose as usual.

Never give a double dose to make up for a forgotten one.

What if they take too much?

Giving your child too much ibuprofen by accident can be dangerous.

If you think you may have given your child an extra dose of ibuprofen by mistake, wait at least 12 hours before giving them any more.

If your child has had more than a double dose of ibuprofen, take them to hospital straight away.

It can be helpful to take any remaining medicine and the box or leaflet with you to hospital if you can.


text:
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Constraints</title>

  <style>
    body {
      margin: 0;
    }
  </style>
</head>
<body>
  <canvas id="canvas"></canvas>

  <script src="./js/math/geometry.js"></script>
  <script src="./js/input.js"></script>
  <script src="./js/constraint.js"></script>
  <script src="./js/point.js"></script>
  <script src="js/main-constraint.js"></script>
</body>
</html>


text:
using namespace arangodb;

static uint32_t const PrologueSize =
    encoding::alignedSize<uint32_t>(sizeof(MMFilesPrologueMarker));

/// @brief create the slots
MMFilesWalSlots::MMFilesWalSlots(MMFilesLogfileManager& logfileManager,
                                 size_t numberOfSlots, MMFilesWalSlot::TickType tick)
    : _logfileManager(logfileManager),
      _condition(),
      _lock(),
      _slots(nullptr),
      _numberOfSlots(numberOfSlots),
      _freeSlots(numberOfSlots),
      _waiting(0),
      _handoutIndex(0),
      _recycleIndex(0),
      _logfile(nullptr),
      _lastAssignedTick(0),
      _lastCommittedTick(0),
      _lastCommittedDataTick(0),
      _numEvents(0),
      _numEventsSync(0),
      _lastDatabaseId(0),
      _lastCollectionId(0),
      _shutdown(false) {
  _slots = new MMFilesWalSlot[numberOfSlots];
}

/// @brief destroy the slots
MMFilesWalSlots::~MMFilesWalSlots() { delete[] _slots; }

/// @brief sets a shutdown flag, disabling the request for new logfiles
void MMFilesWalSlots::shutdown() {
  MUTEX_LOCKER(mutexLocker, _lock);
  _shutdown = true;
}

/// @brief get the statistics of the slots
void MMFilesWalSlots::statistics(MMFilesWalSlot::TickType& lastAssignedTick,
                                 MMFilesWalSlot::TickType& lastCommittedTick,
                                 MMFilesWalSlot::TickType& lastCommittedDataTick,
                                 uint64_t& numEvents, uint64_t& numEventsSync) {
  MUTEX_LOCKER(mutexLocker, _lock);
  lastAssignedTick = _lastAssignedTick;
  lastCommittedTick = _lastCommittedTick;
  lastCommittedDataTick = _lastCommittedDataTick;
  numEvents = _numEvents;
  numEventsSync = _numEventsSync;
}

/// @brief initially set the last ticks on start
void MMFilesWalSlots::setLastTick(MMFilesWalSlot::TickType const& tick) {
  MUTEX_LOCKER(mutexLocker, _lock);
  if (tick > _lastAssignedTick) {
    _lastAssignedTick = tick;
  }
  if (tick > _lastCommittedTick) {
    _lastCommittedTick = tick;
  }
  if (tick > _lastCommittedDataTick) {
    _lastCommittedDataTick = tick;
  }
}

/// @brief execute a flush operation
int MMFilesWalSlots::flush(bool waitForSync) {
  MMFilesWalSlot::TickType lastTick = 0;
  bool worked;

  int res = closeLogfile(lastTick, worked);

  if (res == TRI_ERROR_REQUEST_CANCELED) {
    // only happens during shutdown
    res = TRI_ERROR_NO_ERROR;
  }

  if (res == TRI_ERROR_NO_ERROR) {
    _logfileManager.signalSync(true);

    if (waitForSync) {
      // wait until data has been committed to disk
      if (!waitForTick(lastTick)) {
        res = TRI_ERROR_ARANGO_SYNC_TIMEOUT;
      } else if (!worked) {
        res = TRI_ERROR_ARANGO_DATAFILE_EMPTY;
      }
    } else if (!worked) {
      // logfile to flush was still empty and thus not flushed

      // not really an error, but used to indicate the specific condition
      res = TRI_ERROR_ARANGO_DATAFILE_EMPTY;
    }
  }

  return res;
}

/// @brief return the last committed tick
MMFilesWalSlot::TickType MMFilesWalSlots::lastCommittedTick() {
  MUTEX_LOCKER(mutexLocker, _lock);
  return _lastCommittedTick;
}

/// @brief return the next unused slot
MMFilesWalSlotInfo MMFilesWalSlots::nextUnused(uint32_t size) {
  return nextUnused(0, 0, size);
}

/// @brief return the next unused slot
MMFilesWalSlotInfo MMFilesWalSlots::nextUnused(TRI_voc_tick_t databaseId,
                                               TRI_voc_cid_t collectionId, uint32_t size) {
  // we need to use the aligned size for writing
  uint32_t alignedSize = encoding::alignedSize<uint32_t>(size);
  int iterations = 0;
  bool hasWaited = false;
  bool mustWritePrologue = false;

  TRI_ASSERT(size > 0);

  while (++iterations < 1000) {
    {
      MUTEX_LOCKER(mutexLocker, _lock);

      MMFilesWalSlot* slot = &_slots[_handoutIndex];
      TRI_ASSERT(slot != nullptr);

      // check if next slot is free for writing
      // and also is the slot following it is also free for writing
      // this is required because in some cases we need two free slots
      // to write a WAL entry: the first slot for the prologue marker
      // and the second slot for the actual marker
      if (slot->isUnused() && _slots[nextHandoutIndex()].isUnused()) {
        if (hasWaited) {
          CONDITION_LOCKER(guard, _condition);
          TRI_ASSERT(_waiting > 0);
          --_waiting;
        }

        if (databaseId == 0 && collectionId == 0) {
          _lastDatabaseId = 0;
          _lastCollectionId = 0;
        } else if (!mustWritePrologue && databaseId > 0 && collectionId > 0 &&
                   (_lastDatabaseId != databaseId || _lastCollectionId != collectionId)) {
          // write a prologue
          alignedSize = size + PrologueSize;
          mustWritePrologue = true;
        }

        // cycle until we have a valid logfile
        while (_logfile == nullptr ||
               _logfile->freeSize() < static_cast<uint64_t>(alignedSize)) {
          if (_logfile != nullptr) {
            // seal existing logfile by creating a footer marker
            int res = writeFooter(slot);

            if (res != TRI_ERROR_NO_ERROR) {
              return MMFilesWalSlotInfo(res);
            }

            // new datafile. must write a prologue
            if (databaseId > 0 && collectionId > 0 && !mustWritePrologue) {
              alignedSize = size + PrologueSize;
              mustWritePrologue = true;
            }

            // advance to next slot
            slot = &_slots[_handoutIndex];
            _logfileManager.setLogfileSealRequested(_logfile);

            _logfile = nullptr;
          }

          TRI_IF_FAILURE("LogfileManagerGetWriteableLogfile") {
            return MMFilesWalSlotInfo(TRI_ERROR_ARANGO_NO_JOURNAL);
          }

          // fetch the next free logfile (this may create a new one)
          MMFilesWalLogfile::StatusType status;
          int res = newLogfile(alignedSize, status);

          if (res != TRI_ERROR_NO_ERROR) {
            if (res != TRI_ERROR_ARANGO_NO_JOURNAL) {
              return MMFilesWalSlotInfo(res);
            }

            std::this_thread::sleep_for(std::chrono::milliseconds(10));
            // try again in next iteration
          } else {
            TRI_ASSERT(_logfile != nullptr);

            if (status == MMFilesWalLogfile::StatusType::EMPTY) {
              // initialize the empty logfile by writing a header marker
              int res = writeHeader(slot);

              if (res != TRI_ERROR_NO_ERROR) {
                return MMFilesWalSlotInfo(res);
              }

              // new datafile. must write a prologue
              if (databaseId > 0 && collectionId > 0 && !mustWritePrologue) {
                alignedSize = size + PrologueSize;
                mustWritePrologue = true;
              }

              // advance to next slot
              slot = &_slots[_handoutIndex];
              _logfileManager.setLogfileOpen(_logfile);
            } else {
              TRI_ASSERT(status == MMFilesWalLogfile::StatusType::OPEN);
            }
          }
        }

        // if we get here, we got a free slot for the actual data...

        char* mem = _logfile->reserve(alignedSize);

        if (mem == nullptr) {
          LOG_TOPIC("cba38", WARN, arangodb::Logger::ENGINES)
              << "could not find free WAL slot";
          return MMFilesWalSlotInfo(TRI_ERROR_INTERNAL);
        }

        TRI_ASSERT(reinterpret_cast<uintptr_t>(mem) % 8 == 0);

        if (mustWritePrologue) {
          // write prologue...

          // hand out the prologue slot and directly fill it
          int res = writePrologue(slot, mem, databaseId, collectionId);

          if (res != TRI_ERROR_NO_ERROR) {
            return MMFilesWalSlotInfo(res);
          }

          // now return the slot
          mem += PrologueSize;  // advance memory pointer
          TRI_ASSERT(reinterpret_cast<uintptr_t>(mem) % 8 == 0);

          // use following slot for the actual data
          slot = &_slots[_handoutIndex];

          // note database and collection id for next time
          _lastDatabaseId = databaseId;
          _lastCollectionId = collectionId;
        }

        // only in this case we return a valid slot
        slot->setUsed(static_cast<void*>(mem), size, _logfile, handout());

        return MMFilesWalSlotInfo(slot);
      }
    }

    // if we get here, all slots are busy
    CONDITION_LOCKER(guard, _condition);
    if (!hasWaited) {
      ++_waiting;
      _logfileManager.signalSync(true);
      hasWaited = true;
    }

    bool mustWait;
    {
      MUTEX_LOCKER(mutexLocker, _lock);
      mustWait = (_freeSlots < 2);
    }

    if (mustWait) {
      guard.wait(10 * 1000);
    }
  }

  return MMFilesWalSlotInfo(TRI_ERROR_ARANGO_NO_JOURNAL);
}

/// @brief return a used slot, allowing its synchronization
int MMFilesWalSlots::returnUsed(MMFilesWalSlotInfo& slotInfo, bool wakeUpSynchronizer,
                                bool waitForSyncRequested, bool waitUntilSyncDone) {
  TRI_ASSERT(slotInfo.slot != nullptr);
  // waitUntilSyncDone does not make sense without waitForSyncRequested
  TRI_ASSERT(!waitUntilSyncDone || waitForSyncRequested);

  MMFilesWalSlot::TickType tick = slotInfo.slot->tick();
  MMFilesMarker const* marker =
      reinterpret_cast<MMFilesMarker const*>(slotInfo.slot->mem());
  MMFilesWalLogfile const* logfile = slotInfo.logfile;

  TRI_ASSERT(tick > 0);

  {
    MUTEX_LOCKER(mutexLocker, _lock);
    TRI_UpdateTicksDatafile(logfile->df(), marker);
    slotInfo.slot->setReturned(waitForSyncRequested);
    if (waitForSyncRequested) {
      ++_numEventsSync;
    } else {
      ++_numEvents;
    }
  }

  wakeUpSynchronizer |= waitForSyncRequested;
  wakeUpSynchronizer |= waitUntilSyncDone;

  if (wakeUpSynchronizer) {
    _logfileManager.signalSync(waitForSyncRequested);
  }

  if (waitUntilSyncDone) {
    // on shutdown, return early
    if (_logfileManager.server().isStopping()) {
      return TRI_ERROR_SHUTTING_DOWN;
    }

    waitForTick(tick);
  }

  return TRI_ERROR_NO_ERROR;
}

/// @brief get the next synchronizable region
MMFilesWalSyncRegion MMFilesWalSlots::getSyncRegion() {
  bool sealRequested = false;
  MMFilesWalSyncRegion region;

  MUTEX_LOCKER(mutexLocker, _lock);

  size_t slotIndex = _recycleIndex;

  while (true) {
    MMFilesWalSlot const* slot = &_slots[slotIndex];
    TRI_ASSERT(slot != nullptr);

    if (sealRequested && slot->isUnused()) {
      region.canSeal = true;
    }

    if (!slot->isReturned()) {
      // found a slot that is not yet returned
      // if it belongs to another logfile, we can seal the logfile we created
      // the region for
      auto otherId = slot->logfileId();

      if (region.logfileId != 0 && otherId != 0 && otherId != region.logfileId) {
        region.canSeal = true;
      }
      break;
    }

    if (region.logfileId == 0) {
      // first member
      MMFilesWalLogfile::StatusType status;

      region.logfileId = slot->logfileId();
      // the following call also updates status
      region.logfile = _logfileManager.getLogfile(slot->logfileId(), status);
      region.mem = static_cast<char*>(slot->mem());
      region.size = slot->size();
      region.logfileStatus = status;
      region.firstSlotIndex = slotIndex;
      region.lastSlotIndex = slotIndex;
      region.waitForSync = slot->waitForSync();

      if (status == MMFilesWalLogfile::StatusType::SEAL_REQUESTED) {
        sealRequested = true;
      }
    } else {
      if (slot->logfileId() != region.logfileId) {
        // got a different logfile
        region.checkMore = true;
        region.canSeal = true;
        break;
      }

      // this is a group commit!!

      // update the region
      region.size += (uint32_t)(static_cast<char*>(slot->mem()) -
                                (region.mem + region.size) + slot->size());
      region.lastSlotIndex = slotIndex;
      region.waitForSync |= slot->waitForSync();
    }

    if (++slotIndex >= _numberOfSlots) {
      slotIndex = 0;
    }

    if (slotIndex == _recycleIndex) {
      // one full loop
      break;
    }
  }

  return region;
}

/// @brief return a region to the freelist
void MMFilesWalSlots::returnSyncRegion(MMFilesWalSyncRegion const& region) {
  TRI_ASSERT(region.logfileId != 0);

  size_t slotIndex = region.firstSlotIndex;

  {
    MUTEX_LOCKER(mutexLocker, _lock);

    while (true) {
      MMFilesWalSlot* slot = &_slots[slotIndex];
      TRI_ASSERT(slot != nullptr);

      // note last tick
      MMFilesWalSlot::TickType tick = slot->tick();
      TRI_ASSERT(tick >= _lastCommittedTick);
      _lastCommittedTick = tick;

      // update the data tick
      MMFilesMarker const* m = static_cast<MMFilesMarker const*>(slot->mem());
      if (m->getType() != TRI_DF_MARKER_HEADER && m->getType() != TRI_DF_MARKER_FOOTER) {
        _lastCommittedDataTick = tick;
      }

      region.logfile->update(m);

      slot->setUnused();
      ++_freeSlots;

      // update recycle index, too
      if (++_recycleIndex >= _numberOfSlots) {
        _recycleIndex = 0;
      }

      if (slotIndex == region.lastSlotIndex) {
        break;
      }

      if (++slotIndex >= _numberOfSlots) {
        slotIndex = 0;
      }
    }
  }

  // signal that we have done something
  CONDITION_LOCKER(guard, _condition);

  if (_waiting > 0 || region.waitForSync) {
    _condition.broadcast();
  }
}

/// @brief get the current open region of a logfile
/// this uses the slots lock
void MMFilesWalSlots::getActiveLogfileRegion(MMFilesWalLogfile* logfile,
                                             char const*& begin, char const*& end) {
  MUTEX_LOCKER(mutexLocker, _lock);

  MMFilesDatafile* datafile = logfile->df();

  begin = datafile->_data;
  end = begin + datafile->currentSize();
}

/// @brief get the current tick range of a logfile
/// this uses the slots lock
void MMFilesWalSlots::getActiveTickRange(MMFilesWalLogfile* logfile,
                                         TRI_voc_tick_t& tickMin, TRI_voc_tick_t& tickMax) {
  MUTEX_LOCKER(mutexLocker, _lock);

  MMFilesDatafile* datafile = logfile->df();

  tickMin = datafile->_tickMin;
  tickMax = datafile->_tickMax;
}

/// @brief close a logfile
int MMFilesWalSlots::closeLogfile(MMFilesWalSlot::TickType& lastCommittedTick, bool& worked) {
  bool hasWaited = false;
  worked = false;

  double const maxWait = 30.0;
  double const end = TRI_microtime() + maxWait;
  while (true) {
    {
      MUTEX_LOCKER(mutexLocker, _lock);

      lastCommittedTick = _lastCommittedTick;

      MMFilesWalSlot* slot = &_slots[_handoutIndex];
      TRI_ASSERT(slot != nullptr);

      if (slot->isUnused()) {
        if (hasWaited) {
          CONDITION_LOCKER(guard, _condition);
          TRI_ASSERT(_waiting > 0);
          --_waiting;
          hasWaited = false;
        }

        if (_logfile != nullptr) {
          if (_logfile->status() == MMFilesWalLogfile::StatusType::EMPTY) {
            // no need to seal a still-empty logfile
            return TRI_ERROR_NO_ERROR;
          }

          // seal existing logfile by creating a footer marker
          int res = writeFooter(slot);

          if (res != TRI_ERROR_NO_ERROR) {
            LOG_TOPIC("bc339", ERR, arangodb::Logger::ENGINES)
                << "could not write logfile footer: " << TRI_errno_string(res);
            return res;
          }

          _logfileManager.setLogfileSealRequested(_logfile);

          // advance to next slot
          slot = &_slots[_handoutIndex];

          // invalidate the logfile so for the next write we'll use a
          // new one
          _logfile = nullptr;

          // intentionally falls through
        }

        TRI_IF_FAILURE("LogfileManagerGetWriteableLogfile") {
          return TRI_ERROR_ARANGO_NO_JOURNAL;
        }

        TRI_ASSERT(_logfile == nullptr);
        // fetch the next free logfile (this may create a new one)
        // note: as we don't have a real marker to write the size does
        // not matter (we use a size of 1 as it must be > 0)
        MMFilesWalLogfile::StatusType status;
        int res = newLogfile(1, status);

        if (res != TRI_ERROR_NO_ERROR) {
          if (res != TRI_ERROR_ARANGO_NO_JOURNAL) {
            return res;
          }

          std::this_thread::sleep_for(std::chrono::milliseconds(10));
          // try again in next iteration
        } else {
          TRI_ASSERT(_logfile != nullptr);

          if (status == MMFilesWalLogfile::StatusType::EMPTY) {
            // initialize the empty logfile by writing a header marker
            res = writeHeader(slot);

            if (res != TRI_ERROR_NO_ERROR) {
              LOG_TOPIC("9c7f8", ERR, arangodb::Logger::ENGINES)
                  << "could not write logfile header: " << TRI_errno_string(res);
              return res;
            }

            _logfileManager.setLogfileOpen(_logfile);
            worked = true;
          } else {
            TRI_ASSERT(status == MMFilesWalLogfile::StatusType::OPEN);
            worked = false;
          }

          return TRI_ERROR_NO_ERROR;
        }
      }
    }

    // if we get here, all slots are busy
    CONDITION_LOCKER(guard, _condition);
    if (!hasWaited) {
      ++_waiting;
      hasWaited = true;
    }

    bool mustWait;
    {
      MUTEX_LOCKER(mutexLocker, _lock);
      mustWait = (_freeSlots < 2);
    }

    if (mustWait) {
      guard.wait(10 * 1000);
    }

    if (TRI_microtime() >= end) {
      // time's up!
      break;
    }
  }

  return TRI_ERROR_ARANGO_NO_JOURNAL;
}

/// @brief write a header marker
int MMFilesWalSlots::writeHeader(MMFilesWalSlot* slot) {
  TRI_ASSERT(_logfile != nullptr);

  MMFilesDatafileHeaderMarker header = MMFilesDatafileHelper::CreateHeaderMarker(
      static_cast<uint32_t>(_logfile->allocatedSize()),
      static_cast<TRI_voc_fid_t>(_logfile->id()));
  size_t const size = header.base.getSize();

  auto* mem = static_cast<void*>(_logfile->reserve(size));
  TRI_ASSERT(mem != nullptr);
  TRI_ASSERT(_logfile != nullptr);

  slot->setUsed(mem, static_cast<uint32_t>(size), _logfile, handout());
  slot->fill(&header.base, size);
  slot->setReturned(false);  // no sync

  // reset values for next write
  _lastDatabaseId = 0;
  _lastCollectionId = 0;

  return TRI_ERROR_NO_ERROR;
}

/// @brief write a prologue marker
int MMFilesWalSlots::writePrologue(MMFilesWalSlot* slot, void* mem,
                                   TRI_voc_tick_t databaseId, TRI_voc_cid_t collectionId) {
  MMFilesPrologueMarker header =
      MMFilesDatafileHelper::CreatePrologueMarker(databaseId, collectionId);
  size_t const size = header.base.getSize();

  TRI_ASSERT(size == PrologueSize);

  TRI_ASSERT(mem != nullptr);
  TRI_ASSERT(_logfile != nullptr);

  slot->setUsed(mem, static_cast<uint32_t>(size), _logfile, handout());
  slot->fill(&header.base, size);
  slot->setReturned(false);  // no sync

  return TRI_ERROR_NO_ERROR;
}

/// @brief write a footer marker
int MMFilesWalSlots::writeFooter(MMFilesWalSlot* slot) {
  TRI_ASSERT(_logfile != nullptr);

  MMFilesDatafileFooterMarker footer = MMFilesDatafileHelper::CreateFooterMarker();
  size_t const size = footer.base.getSize();

  auto* mem = static_cast<void*>(_logfile->reserve(size));
  TRI_ASSERT(mem != nullptr);
  TRI_ASSERT(_logfile != nullptr);

  slot->setUsed(mem, static_cast<uint32_t>(size), _logfile, handout());
  slot->fill(&footer.base, size);
  slot->setReturned(true);  // sync

  // reset values for next write
  _lastDatabaseId = 0;
  _lastCollectionId = 0;

  return TRI_ERROR_NO_ERROR;
}

/// @brief handout a region and advance the handout index
MMFilesWalSlot::TickType MMFilesWalSlots::handout() {
  TRI_ASSERT(_freeSlots > 0);
  _freeSlots--;

  if (++_handoutIndex == _numberOfSlots) {
    // wrap around
    _handoutIndex = 0;
  }

  _lastAssignedTick = static_cast<MMFilesWalSlot::TickType>(TRI_NewTickServer());
  return _lastAssignedTick;
}

/// @brief return the next slots that would be handed out, without
/// actually handing it out
size_t MMFilesWalSlots::nextHandoutIndex() const {
  size_t handoutIndex = _handoutIndex;
  if (++handoutIndex == _numberOfSlots) {
    handoutIndex = 0;
  }
  return handoutIndex;
}

/// @brief wait until all data has been synced up to a certain marker
bool MMFilesWalSlots::waitForTick(MMFilesWalSlot::TickType tick) {
  static uint64_t const SleepTime = 10000;
  static int const MaxIterations = 30 * 1000 * 1000 / SleepTime;
  int iterations = 0;

  // wait until data has been committed to disk
  do {
    if (lastCommittedTick() >= tick) {
      return true;
    }

    CONDITION_LOCKER(guard, _condition);
    guard.wait(SleepTime);
  } while (++iterations < MaxIterations);

  return false;
}

/// @brief request a new logfile which can satisfy a marker of the
/// specified size
int MMFilesWalSlots::newLogfile(uint32_t size, MMFilesWalLogfile::StatusType& status) {
  TRI_ASSERT(size > 0);

  if (_shutdown) {
    return TRI_ERROR_REQUEST_CANCELED;
  }

  status = MMFilesWalLogfile::StatusType::UNKNOWN;
  MMFilesWalLogfile* logfile = nullptr;
  int res = _logfileManager.getWriteableLogfile(size, status, logfile);

  if (res == TRI_ERROR_NO_ERROR) {
    TRI_ASSERT(logfile != nullptr);
    _logfile = logfile;
  } else if (res == TRI_ERROR_LOCK_TIMEOUT) {
    _logfileManager.logStatus();
  }

  return res;
}


text:
/*!
 * \file
 * \brief iOS Entry Point.
 *//*--------------------------------------------------------------------*/

#import <UIKit/UIKit.h>

int main(int argc, char *argv[])
{
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	int retVal = UIApplicationMain(argc, argv, nil, @"tcuIOSAppDelegate");
	[pool release];
	return retVal;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
    <name>GJ</name>
    <message>
        <location filename="gj.cpp" line="7"/>
        <source>GJXXX</source>
        <translation>GJ360</translation>
    </message>
</context>
<context>
    <name>GJClass</name>
    <message>
        <location filename="gj.ui" line="16"/>
        <source>GJ</source>
        <translation type="unfinished"></translation>
    </message>
</context>
</TS>


text:
#include "py/mpconfig.h"
#if MICROPY_PY_UTIME

#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <math.h>

#include "py/runtime.h"
#include "py/smallint.h"
#include "py/mphal.h"

#ifdef _WIN32
static inline int msec_sleep_tv(struct timeval *tv) {
    msec_sleep(tv->tv_sec * 1000.0 + tv->tv_usec / 1000.0);
    return 0;
}
#define sleep_select(a,b,c,d,e) msec_sleep_tv((e))
#else
#define sleep_select select
#endif

// mingw32 defines CLOCKS_PER_SEC as ((clock_t)<somevalue>) but preprocessor does not handle casts
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
#define MP_REMOVE_BRACKETSA(x)
#define MP_REMOVE_BRACKETSB(x) MP_REMOVE_BRACKETSA x
#define MP_REMOVE_BRACKETSC(x) MP_REMOVE_BRACKETSB x
#define MP_CLOCKS_PER_SEC MP_REMOVE_BRACKETSC(CLOCKS_PER_SEC)
#else
#define MP_CLOCKS_PER_SEC CLOCKS_PER_SEC
#endif

#if defined(MP_CLOCKS_PER_SEC)
#define CLOCK_DIV (MP_CLOCKS_PER_SEC / 1000.0F)
#else
#error Unsupported clock() implementation
#endif

STATIC mp_obj_t mod_time_time(void) {
#if MICROPY_PY_BUILTINS_FLOAT
    struct timeval tv;
    gettimeofday(&tv, NULL);
    mp_float_t val = tv.tv_sec + (mp_float_t)tv.tv_usec / 1000000;
    return mp_obj_new_float(val);
#else
    return mp_obj_new_int((mp_int_t)time(NULL));
#endif
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_time_time_obj, mod_time_time);

STATIC mp_obj_t mod_time_ticks_us(void) {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    mp_uint_t us = tv.tv_sec * 1000000 + tv.tv_usec;
    return MP_OBJ_NEW_SMALL_INT(us & MP_SMALL_INT_POSITIVE_MASK);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_time_ticks_us_obj, mod_time_ticks_us);

STATIC mp_obj_t mod_time_ticks_ms(void) {
    struct timeval tv;
    gettimeofday(&tv, NULL);
    mp_uint_t ms = tv.tv_sec * 1000 + tv.tv_usec / 1000;
    return MP_OBJ_NEW_SMALL_INT(ms & MP_SMALL_INT_POSITIVE_MASK);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_time_ticks_ms_obj, mod_time_ticks_ms);

STATIC mp_obj_t mod_time_ticks_diff(mp_obj_t oldval, mp_obj_t newval) {
    mp_uint_t old = MP_OBJ_SMALL_INT_VALUE(oldval);
    mp_uint_t new = MP_OBJ_SMALL_INT_VALUE(newval);
    return MP_OBJ_NEW_SMALL_INT((new - old) & MP_SMALL_INT_POSITIVE_MASK);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_time_ticks_diff_obj, mod_time_ticks_diff);

// Note: this is deprecated since CPy3.3, but pystone still uses it.
STATIC mp_obj_t mod_time_clock(void) {
#if MICROPY_PY_BUILTINS_FLOAT
    // float cannot represent full range of int32 precisely, so we pre-divide
    // int to reduce resolution, and then actually do float division hoping
    // to preserve integer part resolution.
    return mp_obj_new_float((float)(clock() / 1000) / CLOCK_DIV);
#else
    return mp_obj_new_int((mp_int_t)clock());
#endif
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_time_clock_obj, mod_time_clock);

STATIC mp_obj_t mod_time_sleep(mp_obj_t arg) {
#if MICROPY_PY_BUILTINS_FLOAT
    struct timeval tv;
    mp_float_t val = mp_obj_get_float(arg);
    double ipart;
    tv.tv_usec = round(modf(val, &ipart) * 1000000);
    tv.tv_sec = ipart;
    int res;
    while (1) {
        res = sleep_select(0, NULL, NULL, NULL, &tv);
        #if MICROPY_SELECT_REMAINING_TIME
        // TODO: This assumes Linux behavior of modifying tv to the remaining
        // time.
        if (res != -1 || errno != EINTR) {
            break;
        }
        if (MP_STATE_VM(mp_pending_exception) != MP_OBJ_NULL) {
            return mp_const_none;
        }
        //printf("select: EINTR: %ld:%ld\n", tv.tv_sec, tv.tv_usec);
        #else
        break;
        #endif
    }
    RAISE_ERRNO(res, errno);
#else
    // TODO: Handle EINTR
    sleep(mp_obj_get_int(arg));
#endif
    return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_time_sleep_obj, mod_time_sleep);

STATIC mp_obj_t mod_time_sleep_ms(mp_obj_t arg) {
    usleep(mp_obj_get_int(arg) * 1000);
    return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_time_sleep_ms_obj, mod_time_sleep_ms);

STATIC mp_obj_t mod_time_sleep_us(mp_obj_t arg) {
    usleep(mp_obj_get_int(arg));
    return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_time_sleep_us_obj, mod_time_sleep_us);

STATIC mp_obj_t mod_time_strftime(size_t n_args, const mp_obj_t *args) {
    time_t t;
    if (n_args == 1) {
        t = time(NULL);
    } else {
        // CPython requires passing struct tm, but we allow to pass time_t
        // (and don't support struct tm so far).
        t = mp_obj_get_int(args[1]);
    }
    struct tm *tm = localtime(&t);
    char buf[32];
    size_t sz = strftime(buf, sizeof(buf), mp_obj_str_get_str(args[0]), tm);
    return mp_obj_new_str(buf, sz, false);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_time_strftime_obj, 1, 2, mod_time_strftime);

STATIC const mp_rom_map_elem_t mp_module_time_globals_table[] = {
    { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utime) },
    { MP_ROM_QSTR(MP_QSTR_clock), MP_ROM_PTR(&mod_time_clock_obj) },
    { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mod_time_sleep_obj) },
    { MP_ROM_QSTR(MP_QSTR_sleep_ms), MP_ROM_PTR(&mod_time_sleep_ms_obj) },
    { MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&mod_time_sleep_us_obj) },
    { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mod_time_time_obj) },
    { MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&mod_time_ticks_ms_obj) },
    { MP_ROM_QSTR(MP_QSTR_ticks_us), MP_ROM_PTR(&mod_time_ticks_us_obj) },
    { MP_ROM_QSTR(MP_QSTR_ticks_diff), MP_ROM_PTR(&mod_time_ticks_diff_obj) },
    { MP_ROM_QSTR(MP_QSTR_strftime), MP_ROM_PTR(&mod_time_strftime_obj) },
};

STATIC MP_DEFINE_CONST_DICT(mp_module_time_globals, mp_module_time_globals_table);

const mp_obj_module_t mp_module_time = {
    .base = { &mp_type_module },
    .name = MP_QSTR_utime,
    .globals = (mp_obj_dict_t*)&mp_module_time_globals,
};

#endif // MICROPY_PY_UTIME


text:
@interface REDListBooksFactory : REDDictionary2ModelFactory

@end


text:
<?php

defined('_JEXEC') or die;

JLoader::register('UsersController', JPATH_COMPONENT . '/controller.php');

/**
 * Profile controller class for Users.
 *
 * @since  1.6
 */
class UsersControllerProfile extends UsersController
{
	/**
	 * Method to check out a user for editing and redirect to the edit form.
	 *
	 * @return  boolean
	 *
	 * @since   1.6
	 */
	public function edit()
	{
		$app         = JFactory::getApplication();
		$user        = JFactory::getUser();
		$loginUserId = (int) $user->get('id');

		// Get the previous user id (if any) and the current user id.
		$previousId = (int) $app->getUserState('com_users.edit.profile.id');
		$userId     = $this->input->getInt('user_id', null, 'array');

		// Check if the user is trying to edit another users profile.
		if ($userId != $loginUserId)
		{
			$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
			$app->setHeader('status', 403, true);

			return false;
		}

		$cookieLogin = $user->get('cookieLogin');

		// Check if the user logged in with a cookie
		if (!empty($cookieLogin))
		{
			// If so, the user must login to edit the password and other data.
			$app->enqueueMessage(JText::_('JGLOBAL_REMEMBER_MUST_LOGIN'), 'message');
			$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));

			return false;
		}

		// Set the user id for the user to edit in the session.
		$app->setUserState('com_users.edit.profile.id', $userId);

		// Get the model.
		$model = $this->getModel('Profile', 'UsersModel');

		// Check out the user.
		if ($userId)
		{
			$model->checkout($userId);
		}

		// Check in the previous user.
		if ($previousId)
		{
			$model->checkin($previousId);
		}

		// Redirect to the edit screen.
		$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit', false));

		return true;
	}

	/**
	 * Method to save a user's profile data.
	 *
	 * @return  void
	 *
	 * @since   1.6
	 */
	public function save()
	{
		// Check for request forgeries.
		JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

		$app    = JFactory::getApplication();
		$model  = $this->getModel('Profile', 'UsersModel');
		$user   = JFactory::getUser();
		$userId = (int) $user->get('id');

		// Get the user data.
		$requestData = $app->input->post->get('jform', array(), 'array');

		// Force the ID to this user.
		$requestData['id'] = $userId;

		// Validate the posted data.
		$form = $model->getForm();

		if (!$form)
		{
			JError::raiseError(500, $model->getError());

			return false;
		}

		// Validate the posted data.
		$data = $model->validate($form, $requestData);

		// Check for errors.
		if ($data === false)
		{
			// Get the validation messages.
			$errors = $model->getErrors();

			// Push up to three validation messages out to the user.
			for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
			{
				if ($errors[$i] instanceof Exception)
				{
					$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
				}
				else
				{
					$app->enqueueMessage($errors[$i], 'warning');
				}
			}

			// Unset the passwords.
			unset($requestData['password1']);
			unset($requestData['password2']);

			// Save the data in the session.
			$app->setUserState('com_users.edit.profile.data', $requestData);

			// Redirect back to the edit screen.
			$userId = (int) $app->getUserState('com_users.edit.profile.id');
			$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id=' . $userId, false));

			return false;
		}

		// Attempt to save the data.
		$return = $model->save($data);

		// Check for errors.
		if ($return === false)
		{
			// Save the data in the session.
			$app->setUserState('com_users.edit.profile.data', $data);

			// Redirect back to the edit screen.
			$userId = (int) $app->getUserState('com_users.edit.profile.id');
			$this->setMessage(JText::sprintf('COM_USERS_PROFILE_SAVE_FAILED', $model->getError()), 'warning');
			$this->setRedirect(JRoute::_('index.php?option=com_users&view=profile&layout=edit&user_id=' . $userId, false));

			return false;
		}

		// Redirect the user and adjust session state based on the chosen task.
		switch ($this->getTask())
		{
			case 'apply':
				// Check out the profile.
				$app->setUserState('com_users.edit.profile.id', $return);
				$model->checkout($return);

				// Redirect back to the edit screen.
				$this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS'));

				$redirect = $app->getUserState('com_users.edit.profile.redirect');

				// Don't redirect to an external URL.
				if (!JUri::isInternal($redirect))
				{
					$redirect = null;
				}

				if (!$redirect)
				{
					$redirect = 'index.php?option=com_users&view=profile&layout=edit&hidemainmenu=1';
				}

				$this->setRedirect(JRoute::_($redirect, false));
				break;

			default:
				// Check in the profile.
				$userId = (int) $app->getUserState('com_users.edit.profile.id');

				if ($userId)
				{
					$model->checkin($userId);
				}

				// Clear the profile id from the session.
				$app->setUserState('com_users.edit.profile.id', null);

				$redirect = $app->getUserState('com_users.edit.profile.redirect');

				// Don't redirect to an external URL.
				if (!JUri::isInternal($redirect))
				{
					$redirect = null;
				}

				if (!$redirect)
				{
					$redirect = 'index.php?option=com_users&view=profile&user_id=' . $return;
				}

				// Redirect to the list screen.
				$this->setMessage(JText::_('COM_USERS_PROFILE_SAVE_SUCCESS'));
				$this->setRedirect(JRoute::_($redirect, false));
				break;
		}

		// Flush the data from the session.
		$app->setUserState('com_users.edit.profile.data', null);
	}

	/**
	 * Function that allows child controller access to model data after the data has been saved.
	 *
	 * @param   JModelLegacy  $model      The data model object.
	 * @param   array         $validData  The validated data.
	 *
	 * @return  void
	 *
	 * @since   3.1
	 */
	protected function postSaveHook(JModelLegacy $model, $validData = array())
	{
		$item = $model->getData();
		$tags = $validData['tags'];

		if ($tags)
		{
			$item->tags = new JHelperTags;
			$item->tags->getTagIds($item->id, 'com_users.user');
			$item->metadata['tags'] = $item->tags;
		}
	}
}


text:
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: soc2013/dpl/head/lib/libc/gen/fmtmsg.c 245288 2012-12-10 17:56:51Z jilles $");

#include <fmtmsg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Default value for MSGVERB. */
#define	DFLT_MSGVERB	"label:severity:text:action:tag"

/* Maximum valid size for a MSGVERB. */
#define	MAX_MSGVERB	sizeof(DFLT_MSGVERB)

static char	*printfmt(char *, long, const char *, int, const char *,
		    const char *, const char *);
static char	*nextcomp(const char *);
static const char
		*sevinfo(int);
static int	 validmsgverb(const char *);

int
fmtmsg(long class, const char *label, int sev, const char *text,
    const char *action, const char *tag)
{
	FILE *fp;
	char *env, *msgverb, *output;

	if (class & MM_PRINT) {
		if ((env = getenv("MSGVERB")) != NULL && *env != '\0' &&
		    strlen(env) <= strlen(DFLT_MSGVERB)) {
			if ((msgverb = strdup(env)) == NULL)
				return (MM_NOTOK);
			else if (validmsgverb(msgverb) == 0) {
				free(msgverb);
				goto def;
			}
		} else {
def:
			if ((msgverb = strdup(DFLT_MSGVERB)) == NULL)
				return (MM_NOTOK);
		}
		output = printfmt(msgverb, class, label, sev, text, action,
		    tag);
		if (output == NULL) {
			free(msgverb);
			return (MM_NOTOK);
		}
		if (*output != '\0')
			fprintf(stderr, "%s", output);
		free(msgverb);
		free(output);
	}
	if (class & MM_CONSOLE) {
		output = printfmt(DFLT_MSGVERB, class, label, sev, text,
		    action, tag);
		if (output == NULL)
			return (MM_NOCON);
		if (*output != '\0') {
			if ((fp = fopen("/dev/console", "ae")) == NULL) {
				free(output);
				return (MM_NOCON);
			}
			fprintf(fp, "%s", output);
			fclose(fp);
		}
		free(output);
	}
	return (MM_OK);
}

#define INSERT_COLON							\
	if (*output != '\0')						\
		strlcat(output, ": ", size)
#define INSERT_NEWLINE							\
	if (*output != '\0')						\
		strlcat(output, "\n", size)
#define INSERT_SPACE							\
	if (*output != '\0')						\
		strlcat(output, " ", size)

/*
 * Returns NULL on memory allocation failure, otherwise returns a pointer to
 * a newly malloc()'d output buffer.
 */
static char *
printfmt(char *msgverb, long class, const char *label, int sev,
    const char *text, const char *act, const char *tag)
{
	size_t size;
	char *comp, *output;
	const char *sevname;

	size = 32;
	if (label != MM_NULLLBL)
		size += strlen(label);
	if ((sevname = sevinfo(sev)) != NULL)
		size += strlen(sevname);
	if (text != MM_NULLTXT)
		size += strlen(text);
	if (act != MM_NULLACT)
		size += strlen(act);
	if (tag != MM_NULLTAG)
		size += strlen(tag);

	if ((output = malloc(size)) == NULL)
		return (NULL);
	*output = '\0';
	while ((comp = nextcomp(msgverb)) != NULL) {
		if (strcmp(comp, "label") == 0 && label != MM_NULLLBL) {
			INSERT_COLON;
			strlcat(output, label, size);
		} else if (strcmp(comp, "severity") == 0 && sevname != NULL) {
			INSERT_COLON;
			strlcat(output, sevinfo(sev), size);
		} else if (strcmp(comp, "text") == 0 && text != MM_NULLTXT) {
			INSERT_COLON;
			strlcat(output, text, size);
		} else if (strcmp(comp, "action") == 0 && act != MM_NULLACT) {
			INSERT_NEWLINE;
			strlcat(output, "TO FIX: ", size);
			strlcat(output, act, size);
		} else if (strcmp(comp, "tag") == 0 && tag != MM_NULLTAG) {
			INSERT_SPACE;
			strlcat(output, tag, size);
		}
	}
	INSERT_NEWLINE;
	return (output);
}

/*
 * Returns a component of a colon delimited string.  NULL is returned to
 * indicate that there are no remaining components.  This function must be
 * called until it returns NULL in order for the local state to be cleared.
 */
static char *
nextcomp(const char *msgverb)
{
	static char lmsgverb[MAX_MSGVERB], *state;
	char *retval;

	if (*lmsgverb == '\0') {
		strlcpy(lmsgverb, msgverb, sizeof(lmsgverb));
		retval = strtok_r(lmsgverb, ":", &state);
	} else {
		retval = strtok_r(NULL, ":", &state);
	}
	if (retval == NULL)
		*lmsgverb = '\0';
	return (retval);
}

static const char *
sevinfo(int sev)
{

	switch (sev) {
	case MM_HALT:
		return ("HALT");
	case MM_ERROR:
		return ("ERROR");
	case MM_WARNING:
		return ("WARNING");
	case MM_INFO:
		return ("INFO");
	default:
		return (NULL);
	}
}

/*
 * Returns 1 if the msgverb list is valid, otherwise 0.
 */
static int
validmsgverb(const char *msgverb)
{
	const char *validlist = "label\0severity\0text\0action\0tag\0";
	char *msgcomp;
	size_t len1, len2;
	const char *p;
	int equality;

	equality = 0;
	while ((msgcomp = nextcomp(msgverb)) != NULL) {
		equality--;
		len1 = strlen(msgcomp);
		for (p = validlist; (len2 = strlen(p)) != 0; p += len2 + 1) {
			if (len1 == len2 && memcmp(msgcomp, p, len1) == 0)
				equality++;
		}
	}
	return (!equality);
}


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

<title>GossipingPropertyFileSnitch</title>
<meta name="date" content="2015-05-16">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.locator

Class GossipingPropertyFileSnitch

java.lang.Object

org.apache.cassandra.locator.AbstractEndpointSnitch

org.apache.cassandra.locator.AbstractNetworkTopologySnitch

org.apache.cassandra.locator.GossipingPropertyFileSnitch

All Implemented Interfaces:

IEndpointSnitch

public class GossipingPropertyFileSnitch
extends AbstractNetworkTopologySnitch

Constructor Summary

Constructors

Constructor and Description

GossipingPropertyFileSnitch()

GossipingPropertyFileSnitch(int refreshPeriodInSeconds)

Method Summary

Methods

Modifier and Type
Method and Description

java.lang.String
getDatacenter(java.net.InetAddress endpoint)

Return the data center for which an endpoint resides in

java.lang.String
getRack(java.net.InetAddress endpoint)

Return the rack for which an endpoint resides in

void
gossiperStarting()

called after Gossiper instance exists immediately before it starts gossiping

Methods inherited from class org.apache.cassandra.locator.AbstractNetworkTopologySnitch

compareEndpoints

Methods inherited from class org.apache.cassandra.locator.AbstractEndpointSnitch

getSortedListByProximity, isWorthMergingForRangeQuery, sortByProximity

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

GossipingPropertyFileSnitch

public GossipingPropertyFileSnitch()
                            throws ConfigurationException

Throws:

ConfigurationException

GossipingPropertyFileSnitch

public GossipingPropertyFileSnitch(int refreshPeriodInSeconds)
                            throws ConfigurationException

Throws:

ConfigurationException

Method Detail

getDatacenter

public java.lang.String getDatacenter(java.net.InetAddress endpoint)

Return the data center for which an endpoint resides in

Specified by:

getDatacenter in interface IEndpointSnitch

Specified by:

getDatacenter in class AbstractNetworkTopologySnitch

Parameters:

endpoint - the endpoint to process

Returns:

string of data center

getRack

public java.lang.String getRack(java.net.InetAddress endpoint)

Return the rack for which an endpoint resides in

Specified by:

getRack in interface IEndpointSnitch

Specified by:

getRack in class AbstractNetworkTopologySnitch

Parameters:

endpoint - the endpoint to process

Returns:

string of rack

gossiperStarting

public void gossiperStarting()

Description copied from interface: IEndpointSnitch

called after Gossiper instance exists immediately before it starts gossiping

Specified by:

gossiperStarting in interface IEndpointSnitch

Overrides:

gossiperStarting in class AbstractEndpointSnitch

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?php

use Cake\Routing\RouteBuilder;
use Cake\Routing\Router;

Router::reload();

Router::scope('/', function(RouteBuilder $routes) {
	$routes->fallbacks();
});


text:
<?php

namespace VGMdb\Component\Doctrine;

use VGMdb\Component\Doctrine\DBAL\Logging\SQLDebugLogger;
use Silex\Application;
use Silex\Provider\DoctrineServiceProvider as BaseDoctrineServiceProvider;
use Doctrine\DBAL\Logging\LoggerChain;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\Annotations\FileCacheReader;
use Doctrine\Common\Cache\ApcCache;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\FilesystemCache;

/**
 * Doctrine DBAL and ORM Provider.
 *
 * @author Gigablah <gigablah@vgmdb.net>
 */
class DoctrineServiceProvider extends BaseDoctrineServiceProvider
{
    public function register(Application $app)
    {
        parent::register($app);

        $app['dbs.options'] = $app->share(function ($app) {
            return $app['doctrine.dbs.options'];
        });

        $app['entity_managers'] = $app->share(function ($app) {
            $entityManagers = array();

            if (!isset($app['doctrine.orm.cache_dir'])) {
                throw new \RuntimeException('The doctrine.orm.cache_dir path is not set.');
            }
            if (!isset($app['doctrine.orm.entity_dir'])) {
                throw new \RuntimeException('The doctrine.orm.entity_dir path is not set.');
            }
            if (!isset($app['doctrine.orm.proxy_dir'])) {
                throw new \RuntimeException('The doctrine.orm.proxy_dir path is not set.');
            }
            if (!isset($app['doctrine.orm.proxy_namespace'])) {
                throw new \RuntimeException('The doctrine.orm.proxy_namespace path is not set.');
            }

            $metadataCache = ($app['debug'] || !extension_loaded('apc'))
                ? new FilesystemCache($app['doctrine.orm.cache_dir'])
                : new ApcCache();

            $queryCache = ($app['debug'] || !extension_loaded('apc'))
                ? new FilesystemCache($app['doctrine.orm.cache_dir'])
                : new ApcCache();

            $driver = new AnnotationDriver(
                new FileCacheReader(new AnnotationReader(), $app['doctrine.orm.cache_dir'], $app['debug']),
                (array) $app['doctrine.orm.entity_dir']
            );

            AnnotationReader::addGlobalIgnoredName('implements');

            foreach ($app['doctrine.orm.entity_managers'] as $name => $options) {
                $app['entity_manager.' . $name] = $app->share(function ($app) use ($options, $metadataCache, $queryCache, $driver) {
                    $config = new Configuration();
                    $config->setMetadataCacheImpl($metadataCache);
                    $config->setMetadataDriverImpl($driver);
                    $config->setQueryCacheImpl($queryCache);
                    $config->setProxyDir($app['doctrine.orm.proxy_dir']);
                    $config->setProxyNamespace($app['doctrine.orm.proxy_namespace']);
                    $config->setAutoGenerateProxyClasses($app['debug']);

                    $connections = $app['dbs'];
                    $entityManager = EntityManager::create($connections[$options['connection']], $config);

                    return $entityManager;
                });

                $entityManagers[$name] = 'entity_manager.' . $name;
            }

            return $entityManagers;
        });

        $app['entity_manager'] = $app->share(function ($app) {
            $entityManagers = $app['entity_managers'];
            $defaultManager = reset($entityManagers);

            return $app[$defaultManager];
        });

        $app['doctrine'] = $app->share(function ($app) {
            $dbs = $app['dbs'];
            $connections = array();
            foreach (array_keys($app['dbs.options']) as $name) {
                $app['doctrine.dbal.' . $name] = $dbs[$name];
                $connections[$name] = 'doctrine.dbal.' . $name;
            }

            return new Registry(
                $app,
                $connections,
                $app['entity_managers'],
                $app['doctrine.dbal.default_connection'],
                $app['doctrine.orm.default_entity_manager']
            );
        });

        $app['db.logger'] = $app->share(function ($app) {
            return new LoggerChain();
        });
    }

    public function boot(Application $app)
    {
        // force Doctrine annotations to be loaded
        $ref = new \ReflectionClass('Doctrine\\ORM\\Configuration');
        AnnotationRegistry::registerFile(dirname($ref->getFilename()) . '/Mapping/Driver/DoctrineAnnotations.php');

        // autoload Doctrine proxies. Not PSR-0 compliant!
        if (isset($app['doctrine.orm.proxy_dir'])) {
            $namespace = $app['doctrine.orm.proxy_namespace'];
            $dir = $app['doctrine.orm.proxy_dir'];
            spl_autoload_register(function ($class) use ($namespace, $dir) {
                if (0 === strpos($class, $namespace)) {
                    $className = str_replace('\\', '', substr($class, strlen($namespace) + 1));
                    $file = $dir.DIRECTORY_SEPARATOR.$className.'.php';
                    if (file_exists($file)) {
                        require $file;
                    }
                }
            });
        }

        $app['db.config']->setSQLLogger($app['db.logger']);
    }
}


text:
<?php

namespace Sonata\UserBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sonata\UserBundle\Entity\Address;
use Sonata\UserBundle\Form\AddressType;

/**
 * Address controller.
 *
 * @Route("/address")
 */
class AddressController extends Controller {

    /**
     * Creates a new Address entity.
     *
     * @Route("/create/{userID}/{userName}", requirements={"userID" = "\d+"}, defaults={"userName" = null}, name="address_create")
     * @Method({"GET", "POST"})
     * @Template("SonataUserBundle:Address:new.html.twig")
     */
    public function createAction(Request $request, $userID, $userName) {
        $em = $this->getDoctrine()->getManager();

        $address = new Address();

        $country = $em->getRepository('SonataUserBundle:Country')->findOneByCode('US');

        $form = $this->createForm(new AddressType(), $address);
        $form->bind($request);

        if ($form->isValid()) {
            // Add Address to User
            $user = $em->getRepository('SonataUserBundle:User')->find($userID);
            $user->setAddress($address);
            $address->setUser($user);

            $em->persist($address);
            $em->persist($user);
            $em->flush();

            return $this->redirect($this->generateUrl('address_show', array('userID' => $userID, 'userName' => $userName, 'id' => $address->getId())));
        }

        return array(
            'userName' => $userName,
            'userID' => $userID,
            'entity' => $address,
            'form' => $form->createView(),
        );
    }

    /**
     * Displays a form to create a new Address entity.
     *
     * @Route("/new/{userID}/{userName}", requirements={"userID" = "\d+"}, defaults={"userName" = null}, name="address_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction($userID, $userName) {
        $em = $this->getDoctrine()->getManager();

        $address = new Address();

        // Set default country to United States
        $country = $em->getRepository('SonataUserBundle:Country')->findOneByCode('US');
        $address->setCountry($country);

        $form = $this->createForm(new AddressType(), $address, array());

        return array(
            'userName' => $userName,
            'userID' => $userID,
            'entity' => $address,
            'form' => $form->createView(),
        );
    }

    /**
     * Finds and displays a Address entity.
     *
     * @Route("/show/{id}/{userID}/{userName}", requirements={"id" = "\d+", "userID" = "\d+"}, defaults={"userName" = null}, name="address_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id, $userID, $userName) {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SonataUserBundle:Address')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Address entity.');
        }

        return array(
            'userID' => $userID,
            'userName' => $userName,
            'entity' => $entity,
        );
    }

    /**
     * Displays a form to edit an existing Address entity.
     *
     * @Route("/edit/{id}/{userID}/{userName}", requirements={"userID" = "\d+", "id" = "\d+"}, defaults={"userName" = null}, name="address_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id, $userID, $userName) {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('SonataUserBundle:Address')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Address entity.');
        }

        $country = $em->getRepository('SonataUserBundle:Country')->findOneByCode('US');

        $editForm = $this->createForm(new AddressType(), $entity);

        return array(
            'userID' => $userID,
            'userName' => $userName,
            'entity' => $entity,
            'edit_form' => $editForm->createView(),
        );
    }

    /**
     * Edits an existing Address entity.
     *
     * @Route("/update/{id}/{userID}/{userName}", requirements={"userID" = "\d+", "id" = "\d+"}, defaults={"userName" = null}, name="address_update")
     * @Method("PUT")
     * @Template("SonataUserBundle:Address:edit.html.twig")
     */
    public function updateAction(Request $request, $id, $userID, $userName) {
        $em = $this->getDoctrine()->getManager();

        $address = $em->getRepository('SonataUserBundle:Address')->find($id);

        if (!$address) {
            throw $this->createNotFoundException('Unable to find Address entity.');
        }

        $country = $em->getRepository('SonataUserBundle:Country')->findOneByCode('US');

        $editForm = $this->createForm(new AddressType(), $address);
        $editForm->bind($request);

        if ($editForm->isValid()) {
            // Add Address to User
            $user = $em->getRepository('SonataUserBundle:User')->find($userID);
            $user->setAddress($address);
            $address->setUser($user);

            $em->persist($address);
            $em->persist($user);
            $em->flush();

            return $this->redirect($this->generateUrl('address_show', array('userID' => $userID, 'userName' => $userName, 'id' => $address->getId())));
        }

        return array(
            'userID' => $userID,
            'userName' => $userName,
            'entity' => $address,
            'edit_form' => $editForm->createView(),
        );
    }

}


text:
#ifndef _SELF_MONITOR_H_
#define _SELF_MONITOR_H_

#include "condor_common.h"
#include "condor_debug.h"
#include "MyString.h"
#include "condor_classad.h"

/*
 * An instantiation of this class is meant to be included in
 * DaemonCore It can be used by a daemon to do monitoring.  In
 * daemon_core_main.C, we currently automatically enable monitoring
 * for a few daemons and others can turn it on if they wish.
 *
 */
class SelfMonitorData
{
public:
    SelfMonitorData();
    ~SelfMonitorData();

    // Turn on periodic monitoring
    void EnableMonitoring(void);
    // Turn off periodic monitoring.
    void DisableMonitoring(void);

    /* This is called to collect data. Normally it is called by a
       DaemonCore timer, which is set up by EnableMonitoring() */
    void CollectData(void);
    /* If you want to put the monitoring ClassAd, just call this
       function with your ClassAd, and we'll drop in the data for
       you. */
    bool ExportData(ClassAd *ad);

    /* Below is the data that we collect. Feel free to look at it
       directly if you don't want to put it into a ClassAd wtih
       ExportData() */

    // When we last called CollectData, as an epoch time
    time_t        last_sample_time;

    // How much CPU we are using, as a percentage. (from ProcAPI)
    double        cpu_usage;
    // How big the total image size of this program is (from ProcAPI)
    unsigned long image_size;
    // How much actual RAM we are using (resident set size) (from ProcAPI)
    unsigned long rs_size;
    // How long this program has been alive, in seconds (from ProcAPI)
    long          age;
	// How many sockets are registered in daemonCore
	int           registered_socket_count;
	// How many security sessions exist in the cache
	int           cached_security_sessions;

private:
    int           _timer_id;
    bool          _monitoring_is_on;
};

#endif


text:
class SkPicture;

namespace blink {

class FloatRect;

// Matches if the picture draws exactly one rectangle, which (after accounting
// for the total transformation matrix) matches the rect provided, and whose
// paint has the color requested.
::testing::Matcher<const SkPicture&> drawsRectangle(const FloatRect&, Color);

} // namespace blink

#endif // PictureMatchers_h


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

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title>Main Menu</title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="1265.21">

Main Menu

DIScover Browser menu options vary depending on task and the current state of the Browser. Options that are not available appear as inactive or grey, while active menu options are in black.


text:
# Group By

###### Input

```css
/* css/style.css */
.circle { background: url(images/shapes/circle.png) no-repeat 0 0; }
.square { background: url(images/shapes/square.png) no-repeat 0 0; }

.logo { background: url(images/logo.png) no-repeat 0 0; }
```

```javascript
var postcss = require('postcss');
var sprites = require('postcss-sprites');
var opts = {
	stylesheetPath: './css',
	spritePath: './css/images/',
	groupBy: function(image) {
		if (image.url.indexOf('shapes') === -1) {
			return Promise.reject(new Error('Not a shape image.'));
		}

		return Promise.resolve('shapes');
	}
}
```

----

###### Output

```css
.circle { background-image: url(images/sprite.shapes.png); background-position: 0 0; }
.square { background-image: url(images/sprite.shapes.png); background-position: -20px 0; }

.logo { background-image: url(images/sprite.png); background-position: 0 0; }
```


text:
#ifndef IOSS_Ioss_TriShell4_h
#define IOSS_Ioss_TriShell4_h

#include <Ioss_CodeTypes.h>       // for IntVector
#include <Ioss_ElementTopology.h> // for ElementTopology

// STL Includes

namespace Ioss {
  class TriShell4 : public Ioss::ElementTopology
  {

  public:
    static constexpr auto name = "trishell4";

    static void factory();
    ~TriShell4() override;

    ElementShape shape() const override { return ElementShape::TRI; }
    int          spatial_dimension() const override;
    int          parametric_dimension() const override;
    bool         is_element() const override { return true; }
    int          order() const override;

    int number_corner_nodes() const override;
    int number_nodes() const override;
    int number_edges() const override;
    int number_faces() const override;

    int number_nodes_edge(int edge = 0) const override;
    int number_nodes_face(int face = 0) const override;
    int number_edges_face(int face = 0) const override;

    Ioss::IntVector edge_connectivity(int edge_number) const override;
    Ioss::IntVector face_connectivity(int face_number) const override;
    Ioss::IntVector element_connectivity() const override;

    Ioss::IntVector face_edge_connectivity(int face_number) const override;

    Ioss::ElementTopology *face_type(int face_number = 0) const override;
    Ioss::ElementTopology *edge_type(int edge_number = 0) const override;

  protected:
    TriShell4();

  private:
    static TriShell4 instance_;

    TriShell4(const TriShell4 &) = delete;
  };
} // namespace Ioss
#endif // IOSS_Ioss_TriShell4_h


text:
#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using System.Diagnostics;
using PetShop.Business;
using PetShop.Data;

#endregion

namespace PetShop.Data.Bases
{
	///<summary>
	/// This class is the base class for any <see cref="ProductProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class ProductProviderBase : ProductProviderBaseCore
	{
	} // end class
} // end namespace


text:
. ./common.sh

PATH=../src/flac:$PATH
PATH=../src/metaflac:$PATH
PATH=../src/test_seeking:$PATH
PATH=../src/test_streams:$PATH
PATH=../objs/$BUILD/bin:$PATH

if [ x"$FLAC__TEST_LEVEL" = x ] ; then
	FLAC__TEST_LEVEL=1
fi

flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
metaflac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable"

run_flac ()
{
	if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
		echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_seeking.valgrind.log
		valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac${EXE} --no-error-on-compression-fail $* 4>>test_seeking.valgrind.log
	else
		flac${EXE} --no-error-on-compression-fail $*
	fi
}

run_metaflac ()
{
	if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
		echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_seeking.valgrind.log
		valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 4>>test_seeking.valgrind.log
	else
		metaflac${EXE} $*
	fi
}

run_test_seeking ()
{
	if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
		echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_seeking $*" >>test_seeking.valgrind.log
		valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_seeking $* 4>>test_seeking.valgrind.log
	else
		test_seeking${EXE} $*
	fi
}

echo $ECHO_N "Checking for --ogg support in flac ... " $ECHO_C
if flac${EXE} --ogg --no-error-on-compression-fail --silent --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then
	has_ogg=yes;
else
	has_ogg=no;
fi
echo ${has_ogg}

echo "Generating streams..."
if [ ! -f noise.raw ] ; then
	test_streams || die "ERROR during test_streams"
fi

echo "generating FLAC files for seeking:"
run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 -S- --output-name=tiny.flac noise8m32.raw || die "ERROR generating FLAC file"
run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 -S- --output-name=small.flac noise.raw || die "ERROR generating FLAC file"
run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 -S10x --output-name=tiny-s.flac noise8m32.raw || die "ERROR generating FLAC file"
run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 -S10x --output-name=small-s.flac noise.raw || die "ERROR generating FLAC file"

tiny_samples=`metaflac${EXE} --show-total-samples tiny.flac`
small_samples=`metaflac${EXE} --show-total-samples small.flac`

tiny_seek_count=100
if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
	small_seek_count=10000
else
	small_seek_count=100
fi

for suffix in '' '-s' ; do
	echo "testing tiny$suffix.flac:"
	if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
		die "ERROR: during test_seeking"
	fi

	echo "testing small$suffix.flac:"
	if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
		die "ERROR: during test_seeking"
	fi

	echo "removing sample count from tiny$suffix.flac and small$suffix.flac:"
	if run_metaflac --no-filename --set-total-samples=0 tiny$suffix.flac small$suffix.flac ; then : ; else
		die "ERROR: during metaflac"
	fi

	echo "testing tiny$suffix.flac with total_samples=0:"
	if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
		die "ERROR: during test_seeking"
	fi

	echo "testing small$suffix.flac with total_samples=0:"
	if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else
		die "ERROR: during test_seeking"
	fi
done

if [ $has_ogg = "yes" ] ; then

	echo "generating Ogg FLAC files for seeking:"
	run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 --output-name=tiny.oga --ogg noise8m32.raw || die "ERROR generating Ogg FLAC file"
	run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 --output-name=small.oga --ogg noise.raw || die "ERROR generating Ogg FLAC file"
	# seek tables are not used in Ogg FLAC

	echo "testing tiny.oga:"
	if run_test_seeking tiny.oga $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else
		die "ERROR: during test_seeking"
	fi

	echo "testing small.oga:"
	if run_test_seeking small.oga $small_seek_count $small_samples noise.raw ; then : ; else
		die "ERROR: during test_seeking"
	fi

fi

rm -f tiny.flac tiny.oga small.flac small.oga tiny-s.flac small-s.flac


text:
using System;
using TableTranslator.Exceptions;

namespace TableTranslator.Model.ColumnConfigurations.NonIdentity
{
    internal sealed class SimpleValueColumnConfiguration : NonIdentityColumnConfiguration
    {
        private readonly string _columnName;
        private readonly object _value;
        private readonly Type _columnDataType;

        internal SimpleValueColumnConfiguration(object value, Type columnDataType, int ordinal, string columnName, object nullReplacement)
            : base(ordinal, nullReplacement)
        {
            this._value = value;
            this._columnName = columnName;
            this._columnDataType = columnDataType;

            ValidateInput();
        }

        public override string ColumnName => !string.IsNullOrEmpty(this._columnName) ? this._columnName : base.OrdinalColumnName;
        public override Type ColumnDataType => this._columnDataType;

        internal override object GetValueFromObject(object obj)
        {
            return this._value;
        }

        internal override void ValidateInput()
        {
            if (this._columnDataType == null)
            {
                throw new ArgumentNullException("outputType");
            }

            if (this._value != null && this._value.GetType() != this._columnDataType)
            {
                throw new TableTranslatorConfigurationException("The output type must be of the same type as the value provided.");
            }

            if (base.NullReplacement != null && base.NullReplacement != DBNull.Value && base.NullReplacement.GetType() != this._columnDataType)
            {
                throw new TableTranslatorConfigurationException("Null replacement for simple value must be either of the same type as the value provided, null, or DBNull.");
            }
        }
    }
}


text:
package com.outbrain.aletheia.datum.type;

import com.outbrain.aletheia.datum.DatumType;
import org.joda.time.DateTime;
import org.joda.time.Instant;

@DatumType(datumTypeId = "sample_domain_class",
           timestampExtractor = SampleDomainClass.SampleDomainClassTimestampSelector.class)
public class SampleDomainClass {

  public static class SampleDomainClassTimestampSelector implements DatumType.TimestampSelector<SampleDomainClass> {
    @Override
    public DateTime extractDatumDateTime(final SampleDomainClass domainObject) {
      return domainObject.getEventTimestamp().toDateTime();
    }
  }

  private int id;
  private double myNumber;
  private String myString;
  private Instant eventTimestamp;
  private boolean discarded;

  private SampleDomainClass() {
  }

  public SampleDomainClass(final int id,
                           final double myNumber,
                           final String myString,
                           final Instant eventTimestamp,
                           final boolean discarded) {
    this.id = id;
    this.myNumber = myNumber;
    this.myString = myString;
    this.eventTimestamp = eventTimestamp;
    this.discarded = discarded;
  }

  public int getId() {
    return id;
  }

  public void setId(final int id) {
    this.id = id;
  }

  public double getMyNumber() {
    return myNumber;
  }

  public void setMyNumber(final double myNumber) {
    this.myNumber = myNumber;
  }

  public String getMyString() {
    return myString;
  }

  public void setMyString(final String myString) {
    this.myString = myString;
  }

  public Instant getEventTimestamp() {
    return eventTimestamp;
  }

  public void setEventTimestamp(final Instant eventTimestamp) {
    this.eventTimestamp = eventTimestamp;
  }

  public boolean isDiscarded() {
    return discarded;
  }

  public void setDiscarded(final boolean discarded) {
    this.discarded = discarded;
  }

  @Override
  public boolean equals(final Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    final SampleDomainClass that = (SampleDomainClass) o;

    if (id != that.id) return false;
    if (Double.compare(that.myNumber, myNumber) != 0) return false;
    if (discarded != that.discarded) return false;
    if (!eventTimestamp.equals(that.eventTimestamp)) return false;
    if (!myString.equals(that.myString)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result;
    long temp;
    result = id;
    temp = Double.doubleToLongBits(myNumber);
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    result = 31 * result + myString.hashCode();
    result = 31 * result + eventTimestamp.hashCode();
    result = 31 * result + (discarded ? 1 : 0);
    return result;
  }
}


text:
{% extends "fieldsight/fieldsight_base.html" %}
{% load i18n %}

{% block page-title %}{% trans 'Assign'  %} {% trans 'Multi'  %} {% trans 'User'  %}

{% endblock %}

{% block head %}

{% endblock %}

{% block content %}

{% if type == "site" %}

 <input style="display:none;" type="button" id="getnextlist" onclick="" value="load more">

  <input type="radio" name="group" id="group" value="Reviewer" checked>{% trans 'Reviewer' %}

  <input type="radio" name="group" id="group" value="Site Supervisor"> {% trans 'Site' %} {% trans 'Supervisor' %}

<input style="display:none;" type="button" id="getnextproj_site_list" onclick="" value="load more">

{% elif type == "project" %}

 <input style="display:none;" type="button" id="getnextlist" onclick="" value="load more">
 <input type="radio" style="display:none;" name="group" id="group" value="Project Manager" checked> {% trans 'Project' %} {% trans 'Manager' %}

 <input style="display:none;" type="button" id="getnextproj_site_list" onclick="" value="load more">
{% else %}

{% trans 'Permission' %} {% trans 'denied.' %}

{% endif %}
<input type="button" name="submit" onclick="assignusers()">

{% endblock %}