text:
namespace iphoto {

namespace {

struct PhotoInfo {
  uint64_t id;
  base::FilePath location;
  base::FilePath original_location;
};

struct AlbumInfo {
  std::set<uint64_t> photo_ids;
  std::string name;
  uint64_t id;
};

class PhotosXmlDictReader : public iapps::XmlDictReader {
 public:
  PhotosXmlDictReader(XmlReader* reader, PhotoInfo* photo_info)
    : iapps::XmlDictReader(reader), photo_info_(photo_info) {}

  bool HandleKeyImpl(const std::string& key) override {
    if (key == "ImagePath") {
      std::string value;
      if (!iapps::ReadString(reader_, &value))
        return false;
      photo_info_->location = base::FilePath(value);
    } else if (key == "OriginalPath") {
      std::string value;
      if (!iapps::ReadString(reader_, &value))
        return false;
      photo_info_->original_location = base::FilePath(value);
    } else if (!SkipToNext()) {
      return false;
    }
    return true;
  }

  bool FinishedOk() override { return Found("ImagePath"); }

 private:
  PhotoInfo* photo_info_;
};

// Contents of the album 'KeyList' key are
// <array>
//  <string>1</string>
//  <string>2</string>
//  <string>3</string>
// </array>
bool ReadStringArray(XmlReader* reader, std::set<uint64_t>* photo_ids) {
  if (reader->NodeName() != "array")
    return false;

  // Advance past the array node and into the body of the array.
  if (!reader->Read())
    return false;

  int array_content_depth = reader->Depth();

  while (iapps::SeekToNodeAtCurrentDepth(reader, "string")) {
    if (reader->Depth() != array_content_depth)
      return false;
    std::string photo_id;
    if (!iapps::ReadString(reader, &photo_id))
      continue;
    uint64_t id;
    if (!base::StringToUint64(photo_id, &id))
      continue;
    photo_ids->insert(id);
  }

  return true;
}

class AlbumXmlDictReader : public iapps::XmlDictReader {
 public:
  AlbumXmlDictReader(XmlReader* reader, AlbumInfo* album_info)
    : iapps::XmlDictReader(reader), album_info_(album_info) {}

  bool ShouldLoop() override {
    return !(Found("AlbumId") && Found("AlbumName") && Found("KeyList"));
  }

  bool HandleKeyImpl(const std::string& key) override {
    if (key == "AlbumId") {
      if (!iapps::ReadInteger(reader_, &album_info_->id))
        return false;
    } else if (key == "AlbumName") {
      if (!iapps::ReadString(reader_, &album_info_->name))
        return false;
    } else if (key == "KeyList") {
      if (!iapps::SeekToNodeAtCurrentDepth(reader_, "array"))
        return false;
      if (!ReadStringArray(reader_, &album_info_->photo_ids))
        return false;
    } else if (!SkipToNext()) {
      return false;
    }
    return true;
  }

  bool FinishedOk() override { return !ShouldLoop(); }

 private:
  AlbumInfo* album_info_;
};

// Inside the master image list, we expect photos to be arranged as
//  <dict>
//   <key>$PHOTO_ID</key>
//   <dict>
//     $photo properties
//   </dict>
//   <key>$PHOTO_ID</key>
//   <dict>
//     $photo properties
//   </dict>
//   ...
//  </dict>
// Returns true on success, false on error.
bool ParseAllPhotos(XmlReader* reader,
                    std::set<iphoto::parser::Photo>* all_photos) {
  if (!iapps::SeekToNodeAtCurrentDepth(reader, "dict"))
    return false;
  int photos_dict_depth = reader->Depth() + 1;
  if (!reader->Read())
    return false;

  bool errors = false;
  while (reader->Depth() >= photos_dict_depth) {
    if (!iapps::SeekToNodeAtCurrentDepth(reader, "key"))
      break;

    std::string key;
    if (!reader->ReadElementContent(&key)) {
      errors = true;
      break;
    }
    uint64_t id;
    bool id_valid = base::StringToUint64(key, &id);

    if (!id_valid ||
        reader->Depth() != photos_dict_depth) {
      errors = true;
      break;
    }
    if (!iapps::SeekToNodeAtCurrentDepth(reader, "dict")) {
      errors = true;
      break;
    }

    PhotoInfo photo_info;
    photo_info.id = id;
    // Walk through a dictionary filling in |result| with photo information.
    // Return true if at least the location was found.
    // In either case, the cursor is advanced out of the dictionary.
    PhotosXmlDictReader dict_reader(reader, &photo_info);
    if (!dict_reader.Read()) {
      errors = true;
      break;
    }

    parser::Photo photo(photo_info.id, photo_info.location,
                        photo_info.original_location);
    all_photos->insert(photo);
  }

  return !errors;
}

}  // namespace

IPhotoLibraryParser::IPhotoLibraryParser() {}
IPhotoLibraryParser::~IPhotoLibraryParser() {}

class IPhotoLibraryXmlDictReader : public iapps::XmlDictReader {
 public:
  IPhotoLibraryXmlDictReader(XmlReader* reader, parser::Library* library)
    : iapps::XmlDictReader(reader), library_(library), ok_(true) {}

  bool ShouldLoop() override {
    return !(Found("List of Albums") && Found("Master Image List"));
  }

  bool HandleKeyImpl(const std::string& key) override {
    if (key == "List of Albums") {
      if (!iapps::SeekToNodeAtCurrentDepth(reader_, "array") ||
          !reader_->Read()) {
        return true;
      }
      while (iapps::SeekToNodeAtCurrentDepth(reader_, "dict")) {
        AlbumInfo album_info;
        AlbumXmlDictReader dict_reader(reader_, &album_info);
        if (dict_reader.Read()) {
          parser::Album album;
          album = album_info.photo_ids;
          // Strip / from album name and dedupe any collisions.
          std::string name;
          base::ReplaceChars(album_info.name, "//", " ", &name);
          if (ContainsKey(library_->albums, name))
            name = name + "("+base::Uint64ToString(album_info.id)+")";
          library_->albums[name] = album;
        }
      }
    } else if (key == "Master Image List") {
      if (!ParseAllPhotos(reader_, &library_->all_photos)) {
        ok_ = false;
        return false;
      }
    }
    return true;
  }

  bool FinishedOk() override { return ok_; }

  // The IPhotoLibrary allows duplicate "List of Albums" and
  // "Master Image List" keys (although that seems odd.)
  bool AllowRepeats() override { return true; }

 private:
  parser::Library* library_;

  // The base class bails when we request, and then calls |FinishedOk()|
  // to decide what to return. We need to remember that we bailed because
  // of an error. That's what |ok_| does.
  bool ok_;
};

bool IPhotoLibraryParser::Parse(const std::string& library_xml) {
  XmlReader reader;
  if (!reader.Load(library_xml))
    return false;

  // Find the plist node and then search within that tag.
  if (!iapps::SeekToNodeAtCurrentDepth(&reader, "plist"))
    return false;
  if (!reader.Read())
    return false;

  if (!iapps::SeekToNodeAtCurrentDepth(&reader, "dict"))
    return false;

  IPhotoLibraryXmlDictReader dict_reader(&reader, &library_);
  return dict_reader.Read();
}

}  // namespace iphoto


text:
/* FILE resistor.js */
//= require ./component
/*global sparks */

(function () {

    sparks.circuit.Resistor = function (props, breadBoard) {
      var tolerance, steps;

      // translate the requested resistance (which may be of the form ["uniform", 10, 100] into a real number
      if (typeof props.resistance !== 'undefined') {
        tolerance = props.tolerance || 0.05;
        steps = (tolerance === 0.05) ? sparks.circuit.r_values.r_values4band5pct : sparks.circuit.r_values.r_values4band10pct;
        props.resistance = this.getRequestedImpedance( props.resistance, steps );
      }

      sparks.circuit.Resistor.parentConstructor.call(this, props, breadBoard);

      // if we have colors defined and not resistance
      if ((this.resistance === undefined) && this.colors){
        this.resistance = this.getResistance( this.colors );
      }

      // if we have neither colors nor resistance
      if ((this.resistance === undefined) && !this.colors) {
        var resistor = new sparks.circuit.Resistor4band();
        resistor.randomize(null);
        this.resistance = resistor.getRealValue();
        this.tolerance = resistor.tolerance;
        this.colors = resistor.colors;
      }

      // if we have resistance and no colors
      if (!this.colors){
        this.colors = this.getColors4Band( this.resistance, (!!this.tolerance ? this.tolerance : 0.05));
      }

      // at this point, we must have both real resiatance and colors
      // calculate nominal resistance, unless nominalResistance is defined
      if (!this.nominalResistance){
        this.nominalResistance =  this.getResistance( this.colors );
      }

      // now that everything has been set, if we have a fault set it now
      this.applyFaults();

      if (this.resistance > 0) {
        this.setViewArguments({color: this.colors});
      } else {
        this.setViewArguments({type: "wire", color: "green"});      // represent as wire if resistance is zero
      }
    };

    sparks.extend(sparks.circuit.Resistor, sparks.circuit.Component,
    {
      nominalValueMagnitude: -1,

        colorMap: { '-1': 'gold', '-2': 'silver',
            0 : 'black', 1 : 'brown', 2 : 'red', 3 : 'orange',
            4 : 'yellow', 5 : 'green', 6 : 'blue', 7 : 'violet', 8 : 'grey',
            9 : 'white' },

        toleranceColorMap: { 0.01 : 'brown', 0.02 : 'red', 5e-3 : 'green',
            2.5e-3 : 'blue', 1e-3 : 'violet', 5e-4 : 'gray', 5e-2 : 'gold',
            0.1 : 'silver', 0.2 : 'none' },

        toleranceValues: [ 0.01, 0.02 ],

        init: function (id) {
              this.id = id;
              this.nominalValue = 0.0; //resistance value specified by band colors;
              this.realValue = 0.0; //real resistance value in Ohms
              this.tolerance = 0.0; //tolerance value
              this.colors = []; //colors for each resistor band
        },

        getNumBands: function () {
            return this.numBands;
        },

        getNominalValue: function () {
            return this.nominalValue;
        },

        setNominalValue: function (value) {
            this.nominalValue = value;
        },

        getTolerance: function () {
            return this.tolerance;
        },

        setTolerance: function(value) {
            this.tolerance = value;
        },

        getRealValue: function () {
            return this.realValue;
        },

        setRealValue: function (value) {
            this.realValue = value;
        },

        setResistance: function (value) {
          this.resistance = value;
          this.updateColors();
        },

        updateColors: function (resistance, tolerance) {
            this.colors = this.getColors4Band( this.resistance, (!!this.tolerance ? this.tolerance : 0.05));
            this.setViewArguments({color: this.colors});
        },

        show : function() {
        },

        calcRealValue: function (nominalValue, tolerance) {
            var chance = Math.random();
            if (chance > 0.8) {
                var chance2 = Math.random();
                if (chance2 < 0.5) {
                    return nominalValue + nominalValue * (tolerance + Math.random() * tolerance);
                }
                else {
                    return nominalValue - nominalValue * (tolerance + Math.random() * tolerance);
                }
            }

            // Multiply 0.9 just to be comfortably within tolerance
            var realTolerance = tolerance * 0.9;
            return nominalValue * this.randFloat(1 - realTolerance, 1 + realTolerance);
        },

        randInt: function (min, max) {
            return Math.floor(Math.random() * (max - min + 1)) + min;
        },

        randFloat: function (min, max) {
            return this.randPseudoGaussian(3) * (max - min) + min;
        },

        randPseudoGaussian: function (n) {
            var r = 0.0;
            for (var i = 0; i < n; ++i) {
                r += Math.random();
            }
            return r / n;
        },

        // Filter resistance values according to the requirements of this resistor
        filter: function (in_values) {
            var values = [];
            for (var i = 0; i < in_values.length; ++i) {
                if (in_values[i] >= 10.0 && in_values[i] < 2e6) {
                    values.push(in_values[i]);
                }
            }
            return values;
        },

        getColors4Band: function (ohms, tolerance) {
            var s = ohms.toString(),
                decIx = s.indexOf('.'),
                decLoc = decIx > -1 ? decIx : s.length,
                len, i;
            s = s.replace('.', '');
            len = s.length;
            for (i = 0; i < 2 - len; ++i){ s += '0'; }
            return [ this.colorMap[s.charAt(0)],
                     this.colorMap[s.charAt(1)],
                     this.colorMap[decLoc - 2],
                     this.toleranceColorMap[tolerance]
                   ];
        },

        getColors5Band: function (ohms, tolerance) {
            var s = ohms.toString(),
                decIx = s.indexOf('.'),
                decLoc = decIx > -1 ? decIx : s.length,
                len, i;
            s = s.replace('.', '');
            len = s.length;
            for (i = 0; i < 3 - len; ++i) { s += '0'; }
            return [ this.colorMap[s.charAt(0)],
                     this.colorMap[s.charAt(1)],
                     this.colorMap[s.charAt(2)],
                     this.colorMap[decLoc - 3],
                     this.toleranceColorMap[tolerance]
                   ];
        },

        colorToNumber: function (color) {
          for (var n in this.colorMap) {
            if (this.colorMap[n] == color) { return parseInt(n,10); }
          }
          // alternate spelling...
          if (color == "gray") {
            return 8;
          }
          return null;
        },

        getResistance: function(colors){
          if (typeof(colors)==="string"){
            colors = colors.split(",");
          }
          var resistance = this.colorToNumber(colors[0]);
          for (var i = 1; i < colors.length - 2; i++) {
            resistance = resistance * 10;
            resistance += this.colorToNumber(colors[i]);
          }
          return resistance * Math.pow(10, this.colorToNumber(colors[i]));
        },

        addCiSoComponent: function (ciso) {
          var resistance  = this.resistance || 0,
              nodes       = this.getNodes();
          ciso.addComponent(this.UID, "Resistor", resistance, nodes);
        },

        applyFaults: function() {
          if (!!this.open){
            this.resistance = 1e20;
            this.addThisToFaults();
          } else if (!!this.shorted) {
            this.resistance = 1e-6;
            this.addThisToFaults();
          } else {
            this.open = false;
            this.shorted = false;
          }
        },

        componentTypeName: "Resistor",

        isEditable: true,

        editableProperty: {name: "resistance", units: "\u2126"},

        getEditablePropertyValues: function() {
          resValues = [];
          baseValues = sparks.circuit.r_values.r_values4band10pct;

          for (i = 0; i < 6; i++) {
            for (j = 0; j < baseValues.length; j++) {
              resValues.push(baseValues[j] * Math.pow(10, i));
            }
          }

          return resValues;
        },

        changeEditableValue: function(val) {
          this.setResistance(val);
          sparks.breadboardView.changeResistorColors(this.UID, this.getViewArguments().color);
        }
    });

})();

redpajama_set_name: RedPajamaGithub


text:
/* C99 6.10.8 para 4: None of [the predefined macro names] shall be
   the subject of a #define or an #undef preprocessing directive.  We
   pass -fno-show-column as otherwise dejagnu gets confused.  */

/* { dg-do preprocess } */
/* { dg-options "-fno-show-column" } */

#undef __DATE__		/* { dg-warning "undefining" "__DATE__" } */
#undef __TIME__		/* { dg-warning "undefining" "__TIME__" } */
#undef __FILE__		/* { dg-warning "undefining" "__FILE__" } */
#undef __LINE__		/* { dg-warning "undefining" "__LINE__" } */
#undef __STDC__		/* { dg-warning "undefining" "__STDC__" } */

/* These should be protected from #undef, but aren't, because they
   are set with normal #define commands - and on top of that, some
   of them are library properties, outside our control.  To consider:
   warn about undefining/redefining any identifier beginning with
   __STDC_ .

   __STDC_HOSTED__
   __STDC_VERSION__
   __STDC_IEC_559__
   __STDC_IEC_559_COMPLEX__
   __STDC_ISO_10646__
 */


text:
package org.eclipse.collections.impl.map.mutable.primitive;

import java.util.Random;

import org.eclipse.collections.api.list.primitive.MutableIntList;
import org.eclipse.collections.api.map.primitive.MutableIntLongMap;
import org.eclipse.collections.api.set.primitive.MutableIntSet;
import org.eclipse.collections.impl.SpreadFunctions;
import org.eclipse.collections.impl.list.mutable.primitive.IntArrayList;
import org.eclipse.collections.impl.set.mutable.primitive.IntHashSet;
import org.junit.Assert;
import org.junit.Test;

public class IntLongMapProbeTest
{
    private static final int SMALL_COLLIDING_KEY_COUNT = 500;
    private static final int LARGE_COLLIDING_KEY_COUNT = 40000;

    private int smallMask(int spread)
    {
        return spread & ((1 << 11) - 1);
    }

    private int largeMask(int spread)
    {
        return spread & ((1 << 20) - 1);
    }

    @Test
    public void randomNumbers_get()
    {
        MutableIntLongMap intlongSmallNonPresized = new IntLongHashMap();
        this.testRandomGet(intlongSmallNonPresized, SMALL_COLLIDING_KEY_COUNT);

        MutableIntLongMap intlongSmallPresized = new IntLongHashMap(1_000);
        this.testRandomGet(intlongSmallPresized, SMALL_COLLIDING_KEY_COUNT);

        MutableIntLongMap intlongLargeNonPresized = new IntLongHashMap();
        this.testRandomGet(intlongLargeNonPresized, LARGE_COLLIDING_KEY_COUNT);

        MutableIntLongMap intlongLargePresized = new IntLongHashMap(1_000_000);
        this.testRandomGet(intlongLargePresized, LARGE_COLLIDING_KEY_COUNT);
    }

    @Test
    public void nonRandomNumbers_get()
    {
        MutableIntLongMap intlongMapSmall = new IntLongHashMap(1_000);
        int[] intKeysForSmallMap = this.getSmallCollidingNumbers().toArray();
        this.testNonRandomGet(intlongMapSmall, SMALL_COLLIDING_KEY_COUNT, intKeysForSmallMap);

        MutableIntLongMap intlongMapLarge = new IntLongHashMap(1_000_000);
        int[] intKeysForLargeMap = this.getLargeCollidingNumbers().toArray();
        this.testNonRandomGet(intlongMapLarge, LARGE_COLLIDING_KEY_COUNT, intKeysForLargeMap);
    }

    @Test
    public void nonRandomNumbers_remove()
    {
        MutableIntLongMap intlongMapSmallNonPresized = new IntLongHashMap();
        int[] intKeysForMap = this.getSmallCollidingNumbers().toArray();
        this.testNonRandomRemove(intlongMapSmallNonPresized, SMALL_COLLIDING_KEY_COUNT, intKeysForMap);

        MutableIntLongMap intlongMapSmallPresized = new IntLongHashMap(1_000);
        int[] intKeysForMap2 = this.getSmallCollidingNumbers().toArray();
        this.testNonRandomRemove(intlongMapSmallPresized, SMALL_COLLIDING_KEY_COUNT, intKeysForMap2);

        MutableIntLongMap intlongMapLargeNonPresized = new IntLongHashMap();
        int[] intKeysForMap3 = this.getLargeCollidingNumbers().toArray();
        this.testNonRandomRemove(intlongMapLargeNonPresized, LARGE_COLLIDING_KEY_COUNT, intKeysForMap3);

        MutableIntLongMap intlongMapLargePresized = new IntLongHashMap(1_000_000);
        int[] intKeysForMap4 = this.getLargeCollidingNumbers().toArray();
        this.testNonRandomRemove(intlongMapLargePresized, LARGE_COLLIDING_KEY_COUNT, intKeysForMap4);
    }

    @Test
    public void randomNumbers_remove()
    {
        MutableIntLongMap intlongMapSmallNonPresized = new IntLongHashMap();
        this.testRandomRemove(intlongMapSmallNonPresized, SMALL_COLLIDING_KEY_COUNT);

        MutableIntLongMap intlongMapSmallPresized = new IntLongHashMap(1_000);
        this.testRandomRemove(intlongMapSmallPresized, SMALL_COLLIDING_KEY_COUNT);

        MutableIntLongMap intlongMapLargeNonPresized = new IntLongHashMap();
        this.testRandomRemove(intlongMapLargeNonPresized, LARGE_COLLIDING_KEY_COUNT);

        MutableIntLongMap intlongMapLargePresized = new IntLongHashMap(1_000_000);
        this.testRandomRemove(intlongMapLargePresized, LARGE_COLLIDING_KEY_COUNT);
    }

    private void testNonRandomGet(MutableIntLongMap intlongMap, int keyCount, int[] intKeysForMap)
    {
        Random random = new Random(0x123456789ABCDL);
        this.shuffle(intKeysForMap, random);

        for (int i = 0; i < keyCount; i++)
        {
            intlongMap.put(intKeysForMap[i], (long) (intKeysForMap[i] * 10));
        }

        for (int i = 0; i < intlongMap.size(); i++)
        {
            Assert.assertEquals((long) (intKeysForMap[i] * 10), intlongMap.get(intKeysForMap[i]));
        }
    }

    private void testRandomGet(MutableIntLongMap intlongMap, int keyCount)
    {
        Random random = new Random(0x123456789ABCDL);
        MutableIntSet set = new IntHashSet(keyCount);
        while (set.size() < keyCount)
        {
            set.add(random.nextInt());
        }
        int[] randomNumbersForMap = set.toArray();
        this.shuffle(randomNumbersForMap, random);

        for (int i = 0; i < keyCount; i++)
        {
            intlongMap.put(randomNumbersForMap[i], (long) (randomNumbersForMap[i] * 10));
        }

        for (int i = 0; i < intlongMap.size(); i++)
        {
            Assert.assertEquals((long) (randomNumbersForMap[i] * 10), intlongMap.get(randomNumbersForMap[i]));
        }
    }

    private void testNonRandomRemove(MutableIntLongMap intlongMap, int keyCount, int[] intKeysForMap)
    {
        Random random = new Random(0x123456789ABCDL);
        this.shuffle(intKeysForMap, random);

        for (int i = 0; i < keyCount; i++)
        {
            intlongMap.put(intKeysForMap[i], (long) (intKeysForMap[i] * 10));
        }

        this.shuffle(intKeysForMap, random);
        for (int i = 0; i < intKeysForMap.length; i++)
        {
            intlongMap.remove(intKeysForMap[i]);
            for (int j = i + 1; j < intKeysForMap.length; j++)
            {
                Assert.assertEquals((long) (intKeysForMap[j] * 10), intlongMap.get(intKeysForMap[j]));
            }
        }
    }

    private void testRandomRemove(MutableIntLongMap intlongMap, int keyCount)
    {
        Random random = new Random(0x123456789ABCDL);
        MutableIntSet set = new IntHashSet(keyCount);
        while (set.size() < keyCount)
        {
            set.add(random.nextInt());
        }
        int[] intKeysForMap = set.toArray();
        this.shuffle(intKeysForMap, random);

        for (int i = 0; i < keyCount; i++)
        {
            intlongMap.put(intKeysForMap[i], (long) (intKeysForMap[i] * 10));
        }

        this.shuffle(intKeysForMap, random);
        for (int i = 0; i < intKeysForMap.length; i++)
        {
            intlongMap.remove(intKeysForMap[i]);
            for (int j = i + 1; j < intKeysForMap.length; j++)
            {
                Assert.assertEquals((long) (intKeysForMap[j] * 10), intlongMap.get(intKeysForMap[j]));
            }
        }
    }

    private MutableIntList getSmallCollidingNumbers()
    {
        int lower = Integer.MIN_VALUE;
        int upper = Integer.MAX_VALUE;

        MutableIntList collidingNumbers = new IntArrayList();
        int numberOne = this.smallMask(SpreadFunctions.intSpreadOne(0xABCDEF1));
        int numberTwo = this.smallMask(SpreadFunctions.intSpreadTwo(0xABCDEF1));
        for (int i = lower; i < upper && collidingNumbers.size() < SMALL_COLLIDING_KEY_COUNT; i++)
        {
            if (this.smallMask(SpreadFunctions.intSpreadOne(i)) == numberOne && this.smallMask(SpreadFunctions.intSpreadTwo(i)) == numberTwo)
            {
                collidingNumbers.add(i);
            }
        }
        return collidingNumbers;
    }

    private MutableIntList getLargeCollidingNumbers()
    {
        int lower = Integer.MIN_VALUE;
        int upper = Integer.MAX_VALUE;
        int number = 23;
        MutableIntList collidingNumbers = new IntArrayList();
        for (int i = lower; i < upper && collidingNumbers.size() < LARGE_COLLIDING_KEY_COUNT; i++)
        {
            int index = this.largeMask(SpreadFunctions.intSpreadOne(i));
            if (index >= number && index <= number + 100)
            {
                collidingNumbers.add(i);
            }
        }
        return collidingNumbers;
    }

    public void shuffle(int[] intArray, Random rnd)
    {
        for (int i = intArray.length; i > 1; i--)
        {
            IntLongMapProbeTest.swap(intArray, i - 1, rnd.nextInt(i));
        }
    }

    private static void swap(int[] arr, int i, int j)
    {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
}


text:
<!DOCTYPE html>

    <meta charset='utf-8'>

    <title>Mark & Kate | May 20, 2017</title>
    <meta name='description' content='We are getting married!'>
    <meta name='author' content='Mark Backsmeier'>

    <link href="https://fonts.googleapis.com/css?family=Walter+Turncoat" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Kreon" rel="stylesheet">

    <link rel='stylesheet' href='css/styles.css'>

Mark & Kate

are getting married!

May 20, 2017

Our Story

Details

Wedding Party

Registery

RSVP

At this point, if you know one of us, you likely know both of us; however, you may not know how we met.

It was Spring 2006.

School just let out and Mark was hitching a ride with a friend to avoid riding the bus.

She was in the front seat and he was in the back.

We are excited that you will get to join us 11 years after that day to celebrate our wedding!

Wedding Details

May 20, 2017 @ 4 PM

              Pear Tree Estate

2150 County Road 1000 E

Champaign, IL 61822

Show Map

Getting There

                  By Car

From I-74

Take I74 to Exit 181, Prospect Avenue

Turn left or north on Prospect

Drive 1.5 miles on Prospect (through many stoplights)

Turn left or west at the stoplight on Olympian Drive

Drive .9 miles on Olympian Drive

Turn right or north at the stoplight on Mattis

Drive 2.4 miles on Mattis Avenue

Turn right or east at Pear Tree Estate*

From I-57

Take I57 to Exit 238, Olympian Drive

Turn left or west on Olympian Drive

Turn right or north on Mattis Ave

Drive 2.5 miles on Mattis Avenue

Turn right or east at Pear Tree Estate*

* sign is on the right – it's out in the country and there is a Hindu Temple right before you get to Pear Tree Estate

                  By Plane

Champaign (Willard) Airport (CMI)

Champaign, IL

Located in Champaign

American Airlines

Central Illinois Regional Airport (BMI)

Bloomington, IL

50 minutes from Champaign

American Airlines, Delta Airlines

O'Hare Airport (ORD)

Chicago, IL

2 hours and 15 minutes from Champaign

Most major airlines

Midway Airport (MDW)

Chicago, IL

2 hours and 15 minutes from Champaign

Delta Airlines, Southwest Airlines

Staying There

If you are coming from out of town, and plan to spend the night, we have arranged a block of rooms at the Comfort Inn and Suites.
                The block rate is $104 + tax. To reserve a room, please call the hotel directly at (217) 328-3500 and mention you are apart of the "Backsmeier-Schavey" wedding. Reservations must be booked by April 19 to guarantee block rate.

The hotel will be providing shuttle service to and from the venue. We will provide more details regarding the shuttle when they become available.

Wedding Party

Groomsmen

Nick Schavey

Adam Backsmeier

Ben Backsmeier

Bridesmaids

Rachel Walden

Jennifer Guy

Sam Mager

Melissa Macpherson

Kristina Ramsey

Sam Palen

Registery

Dear friends and family,

We love all of you deeply, and are so blessed that you would want to honor us with gifts to start our new life together.

What we want most for our wedding is to have all of our friends and family in the same room, and so, more than anything, we consider your presence to be our present.

That said, if you really would like to get us something tangible, we have registered at
            Crate and Barrel and
          Kohl's. Alternatively, Mark and Kate are heading to Europe in late July and
          contributions to our travel fund would be greatly appreciated.

All our love,

M & K

RSVP

            If you have misplaced your RSVP card, have questions, or just want someone to email, feel free to reach out!

Made by the groom.


text:
package com.likya.tlossw.core.agents;

import java.util.HashMap;

import com.likya.tlos.model.xmlbeans.agent.SWAgentDocument.SWAgent;
import com.likya.tlossw.TlosSpaceWide;
import com.likya.tlossw.core.cpc.model.RunInfoType;
import com.likya.tlossw.core.cpc.model.SpcInfoType;
import com.likya.tlossw.core.spc.Spc;
import com.likya.tlossw.model.client.resource.ResourceInfoTypeClient;
import com.likya.tlossw.model.tree.resource.ResourceNode;
import com.likya.tlossw.utils.ConstantDefinitions;

public class AgentOperations {

	public static void failJobsForAgent(int agentId) {
		for (String runId : TlosSpaceWide.getSpaceWideRegistry().getRunLookupTable().keySet()) {

			RunInfoType runInfoType = TlosSpaceWide.getSpaceWideRegistry().getRunLookupTable().get(runId);
			HashMap<String, SpcInfoType> spcLookupTable = runInfoType.getSpcLookupTable().getTable();

			for (String spcId : spcLookupTable.keySet()) {
				Spc spc = spcLookupTable.get(spcId).getSpcReferance();
				spc.failAgentJobs(agentId);
			}
		}
	}

	public static HashMap<String, ResourceNode> getResources(HashMap<String, SWAgent> agentCache) {

		HashMap<String, ResourceNode> resourceMap = new HashMap<String, ResourceNode>();

		for (String agentId : agentCache.keySet()) {

			SWAgent swAgent = agentCache.get(agentId);

			String resourceName = swAgent.getResource().getStringValue();

			if (resourceMap.containsKey(resourceName)) {
				if (!resourceMap.get(resourceName).getResourceInfoTypeClient().isActive()) {
					resourceMap.remove(resourceName);
				} else {
					continue;
				}
			}

			ResourceNode resourceNode = new ResourceNode();

			ResourceInfoTypeClient resourceInfoTypeClient = new ResourceInfoTypeClient();
			resourceInfoTypeClient.setResourceName(swAgent.getResource().getStringValue());
			resourceInfoTypeClient.setOsType(swAgent.getOsType().toString());

			if (swAgent.getOutJmxAvailable()) {
				resourceInfoTypeClient.setActive(true);
			}

			if (swAgent.getAgentType().toString().equals(ConstantDefinitions.AGENT_ON_SERVER)) {
				resourceInfoTypeClient.setIncludesServer(true);
			}

			resourceNode.setResourceInfoTypeClient(resourceInfoTypeClient);

			resourceMap.put(resourceName, resourceNode);

		}

		return resourceMap;
	}

}


text:
package com.epam.ta.reportportal.commons.querygen.constant;

/**
 * Search criteria fields for Integration.
 *
 * @author Anton Machulski
 */
public final class IntegrationCriteriaConstant {

	private IntegrationCriteriaConstant() {
		//static only
	}

	public static final String CRITERIA_INTEGRATION_TYPE = "type";
}


text:
package br.eti.archanjo.webcron.constants;

/**
 * Created by fabricio on 02/07/17.
 */
public class PathContants {
    public static final String API = "/api";
    public static final String LOGIN = "/login";
    public static final String LOGOUT = "/logout";
    public static final String CRON = "/cron";
    public static final String JOBS = "/jobs";
    public static final String ALL = "/all";
    public static final String CREATE = "/create";
    public static final String DELETE = "/delete";
    public static final String ME = "/me";
    public static final String USERS = "/users";
    public static final String RESULTS = "/results";
    public static final String LOG = "/log";
    public static final String SYSTEM = "/system";
    public static final String RUNNNING = "/running";
    public static final String STOP = "/stop";
}


text:
package android.support.v7.graphics.drawable;

import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.Drawable;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.view.View;

/**
 * Drawable which delegates all calls to it's wrapped {@link Drawable}.
 *

 * The wrapped {@link Drawable} must be fully released from any {@link View}
 * before wrapping, otherwise internal {@link Drawable.Callback} may be dropped.
 *
 * @hide
 */
public class DrawableWrapper extends Drawable implements Drawable.Callback {

    private Drawable mDrawable;

    public DrawableWrapper(Drawable drawable) {
        setWrappedDrawable(drawable);
    }

    @Override
    public void draw(Canvas canvas) {
        mDrawable.draw(canvas);
    }

    @Override
    protected void onBoundsChange(Rect bounds) {
        mDrawable.setBounds(bounds);
    }

    @Override
    public void setChangingConfigurations(int configs) {
        mDrawable.setChangingConfigurations(configs);
    }

    @Override
    public int getChangingConfigurations() {
        return mDrawable.getChangingConfigurations();
    }

    @Override
    public void setDither(boolean dither) {
        mDrawable.setDither(dither);
    }

    @Override
    public void setFilterBitmap(boolean filter) {
        mDrawable.setFilterBitmap(filter);
    }

    @Override
    public void setAlpha(int alpha) {
        mDrawable.setAlpha(alpha);
    }

    @Override
    public void setColorFilter(ColorFilter cf) {
        mDrawable.setColorFilter(cf);
    }

    @Override
    public boolean isStateful() {
        return mDrawable.isStateful();
    }

    @Override
    public boolean setState(final int[] stateSet) {
        return mDrawable.setState(stateSet);
    }

    @Override
    public int[] getState() {
        return mDrawable.getState();
    }

    public void jumpToCurrentState() {
        DrawableCompat.jumpToCurrentState(mDrawable);
    }

    @Override
    public Drawable getCurrent() {
        return mDrawable.getCurrent();
    }

    @Override
    public boolean setVisible(boolean visible, boolean restart) {
        return super.setVisible(visible, restart) || mDrawable.setVisible(visible, restart);
    }

    @Override
    public int getOpacity() {
        return mDrawable.getOpacity();
    }

    @Override
    public Region getTransparentRegion() {
        return mDrawable.getTransparentRegion();
    }

    @Override
    public int getIntrinsicWidth() {
        return mDrawable.getIntrinsicWidth();
    }

    @Override
    public int getIntrinsicHeight() {
        return mDrawable.getIntrinsicHeight();
    }

    @Override
    public int getMinimumWidth() {
        return mDrawable.getMinimumWidth();
    }

    @Override
    public int getMinimumHeight() {
        return mDrawable.getMinimumHeight();
    }

    @Override
    public boolean getPadding(Rect padding) {
        return mDrawable.getPadding(padding);
    }

    /**
     * {@inheritDoc}
     */
    public void invalidateDrawable(Drawable who) {
        invalidateSelf();
    }

    /**
     * {@inheritDoc}
     */
    public void scheduleDrawable(Drawable who, Runnable what, long when) {
        scheduleSelf(what, when);
    }

    /**
     * {@inheritDoc}
     */
    public void unscheduleDrawable(Drawable who, Runnable what) {
        unscheduleSelf(what);
    }

    @Override
    protected boolean onLevelChange(int level) {
        return mDrawable.setLevel(level);
    }

    @Override
    public void setAutoMirrored(boolean mirrored) {
        DrawableCompat.setAutoMirrored(mDrawable, mirrored);
    }

    @Override
    public boolean isAutoMirrored() {
        return DrawableCompat.isAutoMirrored(mDrawable);
    }

    @Override
    public void setTint(int tint) {
        DrawableCompat.setTint(mDrawable, tint);
    }

    @Override
    public void setTintList(ColorStateList tint) {
        DrawableCompat.setTintList(mDrawable, tint);
    }

    @Override
    public void setTintMode(PorterDuff.Mode tintMode) {
        DrawableCompat.setTintMode(mDrawable, tintMode);
    }

    @Override
    public void setHotspot(float x, float y) {
        DrawableCompat.setHotspot(mDrawable, x, y);
    }

    @Override
    public void setHotspotBounds(int left, int top, int right, int bottom) {
        DrawableCompat.setHotspotBounds(mDrawable, left, top, right, bottom);
    }

    public Drawable getWrappedDrawable() {
        return mDrawable;
    }

    public void setWrappedDrawable(Drawable drawable) {
        if (mDrawable != null) {
            mDrawable.setCallback(null);
        }

        mDrawable = drawable;

        if (drawable != null) {
            drawable.setCallback(this);
        }
    }
}


text:
// Generated by xsd compiler for android/java
// DO NOT CHANGE!
package com.ebay.trading.api;

import java.io.Serializable;
import com.leansoft.nano.annotation.*;
import java.util.List;

/**
 *
 * Type defining the call-specific response fields for the <b>GetSellingManagerAlerts</b>
 * call.
 *
 */
@RootElement(name = "GetSellingManagerAlertsResponse", namespace = "urn:ebay:apis:eBLBaseComponents")
public class GetSellingManagerAlertsResponseType extends AbstractResponseType implements Serializable {

    private static final long serialVersionUID = -1L;

	@Element(name = "Alert")
	@Order(value=0)
	public List<SellingManagerAlertType> alert;

}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Fusaria autographica delineata, Edn 2 no. 461 (1916)

#### Original name
Fusarium candidum Ehrenb., 1818

### Remarks
null


text:
export PATH="$HOME/.local/bin:$PATH"
sudo locale-gen "en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
sudo tee -a /etc/environment > /dev/null << EOT
LC_ALL="en_US.UTF-8"
EOT
#Install clang, nasm, cmake, qemu and bridge-utils
sudo apt install -y clang nasm cmake qemu bridge-utils

#Install pip, conan and python dependencies
sudo apt install -y python3-pip
pip3 install conan pystache antlr4-python3-runtime jsonschema psutil filemagic

#Install conan profiles and remotes
conan config install https://github.com/includeos/conan_config.git
export CONAN_DEFAULT_PROFILE_PATH="$HOME/.conan/profiles/clang-6.0-linux-x86_64"
sudo tee -a /etc/environment > /dev/null << EOT
CONAN_DEFAULT_PROFILE_PATH="$HOME/.conan/profiles/clang-6.0-linux-x86_64"
EOT

cd /IncludeOS
mkdir -p build
git checkout -b dev origin/dev
VERSION=`conan inspect -a version .. | cut -d " " -f 2`
conan editable add . includeos/$VERSION@includeos/latest --layout=etc/layout.txt
conan install -if build .
conan build -bf build .


text:
<resources>
    <string name="app_name">Is Bus Coming?</string>

    <string name="bus_stop_list_title">List of Bus Stops</string>
    <string name="about_title">About the App</string>
    <string name="action_about">About</string>
    <string name="about_appDescription">Save time by adding your frequent bus stops to the list.
        With one click, find out where or how soon that bus is coming.</string>
    <string name="about_appDisclaimer">The app uses SMS features.
        Carrier charges may apply!</string>
    <string name="about_appLicense">The app is open source. Sourcecode is available on GitHub.
        Sourcecode is published under MIT License.</string>
    <string name="about_appDevelopers">Developed by fellow NYC MTA Bus riders.</string>
    <string name="about_appMoreInfo">For more information about MTA Buses visit mta.info.
        Bus times are also available at bustime.mta.info</string>
    <string name="busStopNumber">Number</string>
    <string name="busStopName">Stop Name</string>
    <string name="title_activity_add_bus_stop">AddBusStopActivity</string>

    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="cancel">Cancel</string>
    <string name="busStopInfo">Bus Stop Info</string>
    <string name="add">Add</string>
    <string name="enterBusInfo">Please, enter bus info.</string>
    <string name="statusReceived">Status Update Received</string>
    <string name="status_title">Bus Stop Status</string>
    <string name="lastUpdated">Last updated:</string>
    <string name="deleteMessage">Do you want to delete</string>
    <string name="questionMark">\?</string>
    <string name="deleteTitle">Delete</string>
    <string name="statusLoading">Retrieving status..</string>
</resources>


text:
cmd /c az batch account create --help
cmd /c az batch application create --help
cmd /c az batch application package create --help
cmd /c az batch certificate create --help
cmd /c az batch pool create --help
cmd /c az batch node list --help
cmd /c az batch node file download --help
cmd /c az batch job create --help
cmd /c az batch job-schedule create --help
cmd /c az batch task create --help
cmd /c az batch task file delete --help


text: export { Currency20 as default } from "../../";


text:
author: roberto
comments: false
date: 2011-12-14 12:51:55
layout: post
slug: how-to-use-soundflower-to-capture-audio-on-a-mac
title: 'How to use Soundflower to capture audio on a Mac '
wordpress_id: 381
categories:
- Journal
tags:
- Mac
- Music
- Tips
---

One of the few things I missed when moving from PC to Mac was not being able to record sound from the computer. I didn't want to pay for [Audio Hijack Pro](http://www.rogueamoeba.com/audiohijackpro/) even though it's only $32.

Then I discovered Soundflower, a free application for routing audio. It works pretty well. Here's how I set it up.

  1. Download and install [Soundflower](http://code.google.com/p/soundflower/).
  2. Open [Audacity](http://audacity.sourceforge.net/), the free audio editing software.
  3. Go to Audacity > preferences and in the Audio I/O tab select Soundflower (2ch) as the recording device.
  4. If you are recording from a web browser, you need to set the Mac's general sound setting as well: System Preferences > Sound > Output > Soundflower (2ch). Web browsers inherit these settings from the operating system.
  5. Click record in Audacity.
  6. Press play on your audio.
  7. Whatever is playing in your browser will record now be recorded in Audacity.

That's it. 'Hope you find it useful.


text:
package ftcbootstrap.components.operations.motors;

import com.qualcomm.robotcore.hardware.DcMotor;

import ftcbootstrap.ActiveOpMode;
import ftcbootstrap.components.OpModeComponent;
import ftcbootstrap.components.utils.DriveDirection;
import ftcbootstrap.components.utils.MotorDirection;

/**
 * Operation to assist with Tank Driving
 */

public class TankDrive extends OpModeComponent {

   private DcMotor leftMotor;
   private DcMotor rightMotor;
    private boolean driving;

    private DriveDirection currentDirection;

    /**
     * Constructor for operation
     * Telemetry enabled by default.
     *
     * @param opMode
     * @param leftMotor  DcMotor
     * @param rightMotor DcMotor
     */
    public TankDrive(ActiveOpMode opMode,
                     DcMotor leftMotor,
                     DcMotor rightMotor) {

        super(opMode);
        this.leftMotor = leftMotor;
        this.rightMotor = rightMotor;

    }

    /**
     * @param power
     * @param driveDirection {@link DriveDirection}
     * @throws InterruptedException
     */
    public void drive( double power, DriveDirection driveDirection)
            throws InterruptedException {

        this.driving = true;
        this.currentDirection = driveDirection;

        MotorDirection motorDirection = TankDrive.leftMotorDirectionOn(driveDirection);
        double powerWithDirection = TankDrive.leftPowerWithDirection(motorDirection, driveDirection, power);
        if (getLeftMotor() != null) {

            addTelemetry("Starting left motor", powerWithDirection);

            getLeftMotor().setPower(powerWithDirection);
        }

        motorDirection = TankDrive.rightMotorDirectionOn(driveDirection);
        powerWithDirection = TankDrive.rightPowerWithDirection(motorDirection, driveDirection, power);

        if (driveDirection == DriveDirection.PIVOT_FORWARD_RIGHT || driveDirection == DriveDirection.PIVOT_BACKWARD_RIGHT) {
            powerWithDirection = 0f;
        }

        if (getRightMotor() != null) {
            addTelemetry("Starting right motor", powerWithDirection);

            getRightMotor().setPower(powerWithDirection);
        }
    }

    /**
     * Check if the operation is running.   Do this before calling drive()
     *
     * @return boolean
     */
    public boolean isDriving() {
        return driving;
    }

    /**
     * stop the motors
     */
    public void stop() {

        getLeftMotor().setPower(0.f);
        getRightMotor().setPower(0.f);
        driving = false;

    }

    public DcMotor getLeftMotor() {
        return leftMotor;
    }

    public DcMotor getRightMotor() {
        return rightMotor;
    }

    /**
     * Helper method to derive the left motor direction from the DriveDirection
     *
     * @param driveDirection {@link DriveDirection}
     * @return
     */
    public static MotorDirection leftMotorDirectionOn(DriveDirection driveDirection) {

        MotorDirection motorDirection = MotorDirection.MOTOR_FORWARD;
        if (driveDirection == DriveDirection.DRIVE_BACKWARD ||
                driveDirection == DriveDirection.SPIN_LEFT ||
                driveDirection == DriveDirection.PIVOT_BACKWARD_LEFT) {
            motorDirection = MotorDirection.MOTOR_BACKWARD;
        }
        return motorDirection;
    }

    /**
     * Helper method to derive the right motor direction from the  DriveDirection
     *
     * @param driveDirection {@link DriveDirection}
     * @return MotorDirection {@link MotorDirection}
     */
    public static MotorDirection rightMotorDirectionOn(DriveDirection driveDirection) {

        MotorDirection motorDirection = MotorDirection.MOTOR_FORWARD;
        if (driveDirection == DriveDirection.DRIVE_BACKWARD ||
                driveDirection == DriveDirection.SPIN_RIGHT||
                driveDirection == DriveDirection.PIVOT_BACKWARD_RIGHT) {
            motorDirection = MotorDirection.MOTOR_BACKWARD;
        }
        return motorDirection;
    }

    /**
     * Helper method to derive the left motor power the DriveDirection
     * Based of the vehicle Drive direction, calculate the value of a single motor to see if should move forward
     * backward , remaing in the same direction of the other motor, or come to a stop
     *

     * Examples:
     * Drive Forward = both motors move forward
     * Drive Forward = both motors move backward
     * SPIN = One motor moves forward while the other backward
     * PIVOT = One motor moves is stop  while the other moves
     *
     * @param motorDirection current left motor direction {@link MotorDirection}
     * @param driveDirection current vehicle drive direction {@link DriveDirection}
     * @param power          current absolute power
     * @return double current absolute power as a positive or negative number
     */
    public static double leftPowerWithDirection(MotorDirection motorDirection, DriveDirection driveDirection, double power) {

        double powerWithDirection = (motorDirection == MotorDirection.MOTOR_FORWARD) ? power : -power;
        if (driveDirection == DriveDirection.PIVOT_FORWARD_LEFT || driveDirection == DriveDirection.PIVOT_BACKWARD_LEFT) {
            powerWithDirection = 0f;
        }
        return powerWithDirection;
    }

    /**
     * Helper method to derive the right motor power the DriveDirection
     * Based of the vehicle Drive direction, calculate the value of a single motor to see if should move forward
     * backward , remaing in the same direction of the other motor, or come to a stop
     *

     * Examples:
     * Drive Forward = both motors move forward
     * Drive Forward = both motors move backward
     * SPIN = One motor moves forward while the other backward
     * PIVOT = One motor moves is stop  while the other moves
     *
     * @param motorDirection current right motor direction {@link MotorDirection}
     * @param driveDirection current vehicle drive direction  {@link DriveDirection}
     * @param power          current absolute power
     * @return double current absolute power as a positive or negative number or zero value
     */
    public static double rightPowerWithDirection(MotorDirection motorDirection, DriveDirection driveDirection, double power) {

        double powerWithDirection = (motorDirection == MotorDirection.MOTOR_FORWARD) ? power : -power;
        if (driveDirection == DriveDirection.PIVOT_FORWARD_RIGHT || driveDirection == DriveDirection.PIVOT_BACKWARD_RIGHT) {
            powerWithDirection = 0f;
        }
        return powerWithDirection;
    }

    /**
     * @return DriveDirection current direction of vehicle  {@link DriveDirection}
     */
    public DriveDirection getCurrentDirection() {
        return currentDirection;
    }

    public double getLeftMotorPower() {
        return leftMotor.getPower();
    }

    public double getRightMotorPower() {
        return rightMotor.getPower();
    }

    public void ensureNotRunToPosition() throws InterruptedException {

        DcMotor motor = getLeftMotor();
        boolean modeChanged = false;
        if (motor.getMode() == DcMotor.RunMode.RUN_TO_POSITION ) {
            motor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
            modeChanged = true;
        }
        motor = getRightMotor();
        if (motor.getMode() == DcMotor.RunMode.RUN_TO_POSITION ) {
            motor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
            modeChanged = true;
        }
        if ( modeChanged) {
            getOpMode().sleep(100);
        }
    }

}


text:
class CommentableGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('../templates', __FILE__)
  include Rails::Generators::Migration

  def self.source_root
    @_acts_as_commentable_source_root ||= File.expand_path("../templates", __FILE__)
  end

  def self.next_migration_number(path)
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  end

  def create_model_file
    template "comment.rb", "app/models/#{file_path}.rb"
    migration_template "create_comments.rb", "db/migrate/create_#{plural_table_name}.rb"
  end

end


text:
<?php

class Pagine {
  private $maxrighe;
  private $numrighe;

  public function __construct($maxrighe, $numrighe){
    $this->maxrighe = $maxrighe;
    $this->numrighe = $numrighe;
  }

  public function PagineTotali(){
    if($this->numrighe<=$this->maxrighe) {
      return 1;
    } else {
      if($this->numrighe%$this->maxrighe!=0){
        return floor($this->numrighe/$this->maxrighe)+1;
      } else {
        return floor($this->numrighe/$this->maxrighe);
      }
    }
  }

}

?>


text:
package com.khopa.oneStory.implementation.views.scenes.mainMenu.controllers;

import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.khopa.oneStory.core.controllers.animation.transition.scenes.FadeOutFadeInSceneTransition;
import com.khopa.oneStory.implementation.views.scenes.NovelScene;

public class PlayButtonListener extends ClickListener {

	@Override
	public void clicked(InputEvent event, float x, float y) {
		super.clicked(event, x, y);
		new FadeOutFadeInSceneTransition(new NovelScene(), 1.5f);
	}

}


text:
install influxdb

brew update
brew install influxdb

start influxdb manually in a seperate terminal

influxdb -config=/usr/local/etc/influxdb.conf

manage influxdb from web interface

http://127.0.0.1:8083


text:
ALTER TABLE vcshost
 ADD username varchar(255),
 ADD password varchar(63);


text:
#ifndef TA_LOCALE_TEXTDOMAIN_AGENT_H
#define TA_LOCALE_TEXTDOMAIN_AGENT_H

#include "common/agent.h"

/********************************************************************/
/**                      Agent Initialization                      **/
/********************************************************************/
void register_locale_textdomain_commands(void);

#endif


text:
package com.tle.beans.entity;

import com.tle.common.Check;
import com.tle.common.Check.FieldEquality;
import com.tle.common.i18n.BundleReference;
import java.io.Serializable;

/** @author Nicholas Read */
public class BaseEntityLabel
    implements Serializable, FieldEquality<BaseEntityLabel>, BundleReference {
  private static final long serialVersionUID = 1L;

  private final long id;
  private final long bundleId;
  private final String uuid;
  private final String owner;
  private final boolean systemType;

  private String privType;

  public BaseEntityLabel(long id, String uuid, long bundleId, String owner, boolean systemType) {
    this.id = id;
    this.uuid = uuid;
    this.bundleId = bundleId;
    this.owner = owner;
    this.systemType = systemType;
  }

  public long getId() {
    return id;
  }

  public String getUuid() {
    return uuid;
  }

  @Override
  public long getBundleId() {
    return bundleId;
  }

  public String getOwner() {
    return owner;
  }

  public boolean isSystemType() {
    return systemType;
  }

  public void setPrivType(String privType) {
    this.privType = privType;
  }

  public String getPrivType() {
    return privType;
  }

  @Override
  public boolean equals(Object obj) {
    return Check.commonEquals(this, obj);
  }

  /*
   * (non-Javadoc)
   * @see com.tle.common.Check.FieldEquality#checkFields(java.lang.Object)
   */
  @Override
  public boolean checkFields(BaseEntityLabel rhs) {
    return id == rhs.getId();
  }

  @Override
  public int hashCode() {
    return Long.valueOf(id).hashCode();
  }

  @Override
  public long getIdValue() {
    return id;
  }

  @Override
  public String getValue() {
    return Long.toString(id);
  }
}


text:
class ReturnVariable
  VERSION = "0.0.3"
end


text:
package org.apache.syncope.common.rest.api.batch;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import org.apache.syncope.common.rest.api.RESTHeaders;
import org.apache.syncope.common.rest.api.service.JAXRSService;

public class BatchPayloadLineReader implements AutoCloseable {

    private static final byte CR = '\r';

    private static final byte LF = '\n';

    private static final int EOF = -1;

    private static final int BUFFER_SIZE = 8192;

    private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;

    private final ReadState readState = new ReadState();

    private final InputStream in;

    private final MediaType multipartMixed;

    private final byte[] buffer = new byte[BUFFER_SIZE];

    private Charset currentCharset = DEFAULT_CHARSET;

    private String currentBoundary = null;

    private int offset = 0;

    private int limit = 0;

    public BatchPayloadLineReader(final InputStream in, final MediaType multipartMixed) {
        this.in = in;
        this.multipartMixed = multipartMixed;
    }

    @Override
    public void close() throws IOException {
        in.close();
    }

    private boolean isBoundary(final String currentLine) {
        return (currentBoundary + JAXRSService.CRLF).equals(currentLine)
                || (currentBoundary + JAXRSService.DOUBLE_DASH + JAXRSService.CRLF).equals(currentLine);
    }

    private int fillBuffer() throws IOException {
        limit = in.read(buffer, 0, buffer.length);
        offset = 0;

        return limit;
    }

    private String readLine() throws IOException {
        if (limit == EOF) {
            return null;
        }

        ByteBuffer innerBuffer = ByteBuffer.allocate(BUFFER_SIZE);
        // EOF will be considered as line ending
        boolean foundLineEnd = false;

        while (!foundLineEnd) {
            // Is buffer refill required?
            if (limit == offset && fillBuffer() == EOF) {
                foundLineEnd = true;
            }

            if (!foundLineEnd) {
                byte currentChar = buffer[offset++];
                if (!innerBuffer.hasRemaining()) {
                    innerBuffer.flip();
                    ByteBuffer tmp = ByteBuffer.allocate(innerBuffer.limit() * 2);
                    tmp.put(innerBuffer);
                    innerBuffer = tmp;
                }
                innerBuffer.put(currentChar);

                if (currentChar == LF) {
                    foundLineEnd = true;
                } else if (currentChar == CR) {
                    foundLineEnd = true;

                    // Check next byte. Consume \n if available
                    // Is buffer refill required?
                    if (limit == offset) {
                        fillBuffer();
                    }

                    // Check if there is at least one character
                    if (limit != EOF && buffer[offset] == LF) {
                        innerBuffer.put(LF);
                        offset++;
                    }
                }
            }
        }

        if (innerBuffer.position() == 0) {
            return null;
        } else {
            String currentLine = new String(innerBuffer.array(), 0, innerBuffer.position(),
                    readState.isReadBody() ? currentCharset : DEFAULT_CHARSET);

            if (currentLine.startsWith(HttpHeaders.CONTENT_TYPE)) {
                String charsetString = multipartMixed.getParameters().get(MediaType.CHARSET_PARAMETER);
                currentCharset = Optional.ofNullable(charsetString).map(Charset::forName).orElse(DEFAULT_CHARSET);

                currentBoundary = JAXRSService.DOUBLE_DASH + multipartMixed.getParameters().
                        get(RESTHeaders.BOUNDARY_PARAMETER);
            } else if (JAXRSService.CRLF.equals(currentLine)) {
                readState.foundLinebreak();
            } else if (isBoundary(currentLine)) {
                readState.foundBoundary();
            }

            return currentLine;
        }
    }

    public List<BatchPayloadLine> read() throws IOException {
        List<BatchPayloadLine> result = new ArrayList<>();

        String currentLine = readLine();
        if (currentLine != null) {
            currentBoundary = currentLine.trim();
            int counter = 1;
            result.add(new BatchPayloadLine(currentLine, counter++));

            while ((currentLine = readLine()) != null) {
                result.add(new BatchPayloadLine(currentLine, counter++));
            }
        }

        return result;
    }

    /**
     * Read state indicator (whether currently the {@code body} or {@code header} part is read).
     */
    private static class ReadState {

        private int state = 0;

        public void foundLinebreak() {
            state++;
        }

        public void foundBoundary() {
            state = 0;
        }

        public boolean isReadBody() {
            return state >= 2;
        }

        @Override
        public String toString() {
            return String.valueOf(state);
        }
    }
}


text:
jQuery(document).ready(function ($) {
	function playlistreload() {
		/*
		$("#onair #playlist").load('http://www.wrek.org/wp-content/scripts/recent.php');
		$("#onair #stream-show").load('http://www.wrek.org/wp-content/scripts/now_playing_show.php');
		$("#onair #stream-song").load('http://www.wrek.org/wp-content/scripts/now_playing_song.php');
		$("#hd2 #stream-song").load('http://www.wrek.org/wp-content/scripts/now_playing_song_hd2.php');
		*/
		//testing:
		$("#onair #stream-show").html("Rock, Rhythm, and Roll")
		$("#onair #stream-song").html("\"The Purple Bottle\" by Animal Collective")

	}
	playlistreload();
	setInterval(playlistreload, 60000);
});


text:
package com.intellij.ide.favoritesTreeView.actions;

import com.intellij.ide.IdeBundle;
import com.intellij.ide.favoritesTreeView.FavoritesManager;
import com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.DumbAware;

/**
 * User: anna
 * Date: Feb 23, 2005
 */
public class DeleteAllFavoritesListsButThisAction extends AnAction implements DumbAware {
  public DeleteAllFavoritesListsButThisAction() {
    super(IdeBundle.message("action.delete.all.favorites.lists.but.this",""));
  }

  public void actionPerformed(AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    Project project = PlatformDataKeys.PROJECT.getData(dataContext);
    if (project == null) {
      return;
    }
    FavoritesManager favoritesManager = FavoritesManager.getInstance(project);
    String listName = (String)dataContext.getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME);
    String[] lists = favoritesManager.getAvailableFavoritesLists();
    for (String list : lists) {
      if (!list.equals(listName)) {
        favoritesManager.removeFavoritesList(list);
      }
    }
  }

  public void update(AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    Project project = PlatformDataKeys.PROJECT.getData(dataContext);
    if (project == null){
      e.getPresentation().setEnabled(false);
      return;
    }
    String listName = (String)dataContext.getData(FavoritesTreeViewPanel.FAVORITES_LIST_NAME);
    e.getPresentation().setEnabled(listName != null);
    if (listName != null) {
      e.getPresentation().setText(IdeBundle.message("action.delete.all.favorites.lists.but.this",listName));
      e.getPresentation().setDescription(IdeBundle.message("action.delete.all.favorites.lists.but.this",listName));
    }
  }
}


text:
<?php

namespace PSolr\Request;

/**
 * @see http://wiki.apache.org/solr/CommonQueryParameters
 * @see http://wiki.apache.org/solr/ExtendedDisMax
 *
 * @method \PSolr\Response\SearchResults sendRequest(\PSolr\Request\SolrClient $solr, $headers = null, array $options = array())
 */
class Select extends SolrRequest
{
    const OPERATOR_AND = 'AND';
    const OPERATOR_OR  = 'OR';

    const DEFTYPE_EDISMAX = 'edismax';

    /**
     * @var string
     */
    protected $handlerName = 'select';

    /**
     * $var string
     */
    protected $responseClass = '\PSolr\Response\SearchResults';

    /**
     * Helper function that turns associative arrays into boosted fields.
     *
     * - array('field' => 10.0) = "field^10.0".
     * - array('field' => array(2, 10.0) = "field~2^10.0"
     *
     * @param string|array $fields
     *
     * @see https://wiki.apache.org/solr/DisMaxQParserPlugin#qf_.28Query_Fields.29
     *
     * @todo Rethink this.
     */
    public function buildBoostedFields($fields)
    {
        // Assume strings are pre-formatted.
        if (is_string($fields)) {
            return $fields;
        }

        $processed = array();
        foreach ($fields as $fieldName => $boost) {
            if (!is_array($boost)) {
                $processed[] = $fieldName . '^' . $boost;
            } else {
                $field = $fieldName . '~' . $boost[0];
                if (isset($boost[1])) {
                    $field .= '^' . $boost[1];
                }
                $processed[] = $field;
            }
        }
        return join(',', $processed);
    }

    /**
     * @param string $query
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#q
     */
    public function setQuery($query)
    {
        return $this->set('q', $query);
    }

    /**
     * @param string $sort
     *
     * @return \PSolr\Request\Select
     *
     * @todo Component\Sort.php
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#sort
     */
    public function setSort($sort)
    {
        return $this->set('sort', $sort);
    }

    /**
     * @param int $rows
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#start
     */
    public function setStart($start)
    {
        return $this->set('start', $start);
    }

    /**
     * @param int $rows
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#rows
     */
    public function setRows($rows)
    {
        return $this->set('rows', $rows);
    }

    /**
     * @param int $pageDoc
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#pageDoc_and_pageScore
     */
    public function setPageDoc($pageDoc)
    {
        return $this->set('pageDoc', $pageDoc);
    }

    /**
     * @param float $pageScore
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#pageDoc_and_pageScore
     */
    public function setPageScore($pageScore)
    {
        return $this->set('pageScore', $pageScore);
    }

    /**
     * @param string $fq
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#fq
     */
    public function addFilterQuery($filterQuery)
    {
        return $this->add('fq', $filterQuery);
    }

    /**
     * @param string|array $fieldList
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#fl
     */
    public function setFieldList($fieldList)
    {
        return $this->set('fl', join(',', (array) $fieldList));
    }

    /**
     * @param string $defType
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#defType
     */
    public function setDefType($defType)
    {
        return $this->set('defType', $defType);
    }

    /**
     * @param int $timeAllowed
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#timeAllowed
     */
    public function setTimeAllowed($timeAllowed)
    {
        return $this->set('timeAllowed', $timeAllowed);
    }

    /**
     * @param boolean $omitHeader
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/CommonQueryParameters#omitHeader
     */
    public function omitHeader($omitHeader)
    {
        return $this->set('omitHeader', $omitHeader);
    }

    /**
     * @param string $operator
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/SearchHandler#q.op
     */
    public function setDefaultOperator($operator)
    {
        return $this->set('q.op', $operator);
    }

    /**
     * @param string $field
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/SearchHandler#df
     */
    public function setDefaultField($field)
    {
        return $this->set('df', $field);
    }

    /**
     * @param string $query
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#q.alt
     */
    public function setAlternateQuery($query)
    {
        return $this->set('q.alt', $query);
    }

    /**
     * @param string|array $fields
     *   An associative array of fields to boosts, e.g. array('field' => 2.0);
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#qf_.28Query_Fields.29
     */
    public function setQueryFields($fields)
    {
        return $this->set('qf', $this->buildBoostedFields($fields));
    }

    /**
     * @param string $mm
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#mm_.28Minimum_.27Should.27_Match.29
     */
    public function setMinimumShouldMatch($mm)
    {
        return $this->set('mm', $mm);
    }

    /**
     * @param string $slop
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#qs_.28Query_Phrase_Slop.29
     */
    public function setQueryPhraseSlop($slop)
    {
        return $this->set('qs', $slop);
    }

    /**
     * @param string|array $fields
     *   An associative array of fields to boosts, e.g. array('field' => 2.0).
     *   Pass an array of values to add slop, e.g. array('field', array(2, 10.0)
     *   will render "field~2^10".
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#pf_.28Phrase_Fields.29
     */
    public function setPhraseFields($fields)
    {
        return $this->set('pf', $this->buildBoostedFields($fields));
    }

    /**
     * @param float $slop
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#ps_.28Phrase_Slop.29
     */
    public function setPhraseSlop($slop)
    {
        return $this->set('ps', $slop);
    }

    /**
     * @param string|array $fields
     *   An associative array of fields to boosts, e.g. array('field' => 2.0).
     *   Pass an array of values to add slop, e.g. array('field', array(2, 10.0)
     *   will render "field~2^10".
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#pf2_.28Phrase_bigram_fields.29
     */
    public function setPhraseBigramFields($fields)
    {
        return $this->set('pf2', $this->buildBoostedFields($fields));
    }

    /**
     * @param float $slop
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#ps2_.28Phrase_bigram_slop.29
     */
    public function setPhraseBigramSlop($slop)
    {
        return $this->set('ps2', $slop);
    }

    /**
     * @param string|array $fields
     *   An associative array of fields to boosts, e.g. array('field' => 2.0).
     *   Pass an array of values to add slop, e.g. array('field', array(2, 10.0)
     *   will render "field~2^10".
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#pf3_.28Phrase_trigram_fields.29
     */
    public function setPhraseTrigramFields($fields)
    {
        return $this->set('pf3', $this->buildBoostedFields($fields));
    }

    /**
     * @param float $slop
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#ps3_.28Phrase_trigram_slop.29
     */
    public function setPhraseTrigramSlop($slop)
    {
        return $this->set('ps3', $slop);
    }

    /**
     * @param float $tieBreaker
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#tie_.28Tie_breaker.29
     */
    public function setTieBreaker($tieBreaker)
    {
        return $this->set('tie', $tieBreaker);
    }

    /**
     * @param string $query
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#bq_.28Boost_Query.29
     */
    public function setBoostQuery($query)
    {
        return $this->set('bq', $tieBreaker);
    }

    /**
     * @param string $function
     * @param bool $multiplicative
     *   Defaults to false (additive), pass true for multiplicitive.
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#bf_.28Boost_Function.2C_additive.29
     * @see http://wiki.apache.org/solr/ExtendedDisMax#boost_.28Boost_Function.2C_multiplicative.29
     * @see http://wiki.apache.org/solr/FunctionQuery
     */
    public function addBoostFunction($function, $multiplicative = false)
    {
        $param = $multiplicative ? 'boost' : 'bf';
        return $this->add($param, $function);
    }

    /**
     * @param string|array $fields
     *
     * @return \PSolr\Request\Select
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#uf_.28User_Fields.29
     */
    public function setUserFields($fields)
    {
        return $this->set('uf', join(' ', (array) $fields));
    }

    /**
     * @param bool $interpret
     *
     * @return \Psolr\Component\Facet
     *
     * @see http://wiki.apache.org/solr/ExtendedDisMax#lowercaseOperators
     */
    public function interpretLowercaseOperators($interpret = true)
    {
        return $this->set('lowercaseOperators', (bool) $interpret);
    }
}


text:
package org.apache.cassandra.stress.operations;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List;

import org.apache.cassandra.db.ColumnFamilyType;
import org.apache.cassandra.stress.Session;
import org.apache.cassandra.stress.util.CassandraClient;
import org.apache.cassandra.stress.util.Operation;
import org.apache.cassandra.thrift.Compression;
import org.apache.cassandra.thrift.CqlResult;
import org.apache.cassandra.thrift.CqlRow;
import org.apache.cassandra.utils.ByteBufferUtil;

public class CqlIndexedRangeSlicer extends Operation
{
    private static List<ByteBuffer> values = null;
    private static String cqlQuery = null;

    public CqlIndexedRangeSlicer(Session client, int idx)
    {
        super(client, idx);
    }

    public void run(CassandraClient client) throws IOException
    {
        if (session.getColumnFamilyType() == ColumnFamilyType.Super)
            throw new RuntimeException("Super columns are not implemented for CQL");

        if (values == null)
            values = generateValues();

        if (cqlQuery == null)
        {
            StringBuilder query = new StringBuilder("SELECT FIRST ").append(session.getColumnsPerKey())
                 .append(" ''..'' FROM Standard1 USING CONSISTENCY ").append(session.getConsistencyLevel())
                 .append(" WHERE C1=").append(getUnQuotedCqlBlob(values.get(1).array()))
                 .append(" AND KEY > ? LIMIT ").append(session.getKeysPerCall());

            cqlQuery = query.toString();
        }

        String format = "%0" + session.getTotalKeysLength() + "d";
        String startOffset = String.format(format, 0);

        int expectedPerValue = session.getNumKeys() / values.size(), received = 0;

        while (received < expectedPerValue)
        {
            long start = System.currentTimeMillis();

            boolean success = false;
            String exceptionMessage = null;
            CqlResult results = null;
            String formattedQuery = null;
            List<String> queryParms = Collections.singletonList(getUnQuotedCqlBlob(startOffset));

            for (int t = 0; t < session.getRetryTimes(); t++)
            {
                if (success)
                    break;

                try
                {
                    if (session.usePreparedStatements())
                    {
                        Integer stmntId = getPreparedStatement(client, cqlQuery);
                        results = client.execute_prepared_cql_query(stmntId, queryParamsAsByteBuffer(queryParms));
                    }
                    else
                    {
                        if (formattedQuery ==  null)
                            formattedQuery = formatCqlQuery(cqlQuery, queryParms);
                        results = client.execute_cql_query(ByteBuffer.wrap(formattedQuery.getBytes()), Compression.NONE);
                    }

                    success = (results.rows.size() != 0);
                }
                catch (Exception e)
                {
                    exceptionMessage = getExceptionMessage(e);
                    success = false;
                }
            }

            if (!success)
            {
                error(String.format("Operation [%d] retried %d times - error executing indexed range query with offset %s %s%n",
                                    index,
                                    session.getRetryTimes(),
                                    startOffset,
                                    (exceptionMessage == null) ? "" : "(" + exceptionMessage + ")"));
            }

            received += results.rows.size();

            // convert max key found back to an integer, and increment it
            startOffset = String.format(format, (1 + getMaxKey(results.rows)));

            session.operations.getAndIncrement();
            session.keys.getAndAdd(results.rows.size());
            session.latency.getAndAdd(System.currentTimeMillis() - start);
        }
    }

    /**
     * Get maximum key from CqlRow list
     * @param rows list of the CqlRow objects
     * @return maximum key value of the list
     */
    private int getMaxKey(List<CqlRow> rows)
    {
        int maxKey = ByteBufferUtil.toInt(rows.get(0).key);

        for (CqlRow row : rows)
        {
            int currentKey = ByteBufferUtil.toInt(row.key);
            if (currentKey > maxKey)
                maxKey = currentKey;
        }

        return maxKey;
    }
}