text:
namespace v8 {
namespace internal {

const double DoubleConstant::min_int = kMinInt;
const double DoubleConstant::one_half = 0.5;
const double DoubleConstant::minus_zero = -0.0;
const double DoubleConstant::uint8_max_value = 255;
const double DoubleConstant::zero = 0.0;
const double DoubleConstant::canonical_non_hole_nan = OS::nan_value();
const double DoubleConstant::the_hole_nan = BitCast<double>(kHoleNanInt64);
const double DoubleConstant::negative_infinity = -V8_INFINITY;
const char* const RelocInfo::kFillerCommentString = "DEOPTIMIZATION PADDING";

// -----------------------------------------------------------------------------
// Implementation of AssemblerBase

AssemblerBase::AssemblerBase(Isolate* isolate)
    : isolate_(isolate),
      jit_cookie_(0) {
  if (FLAG_mask_constants_with_cookie && isolate != NULL)  {
    jit_cookie_ = V8::RandomPrivate(isolate);
  }
}

// -----------------------------------------------------------------------------
// Implementation of Label

int Label::pos() const {
  if (pos_ < 0) return -pos_ - 1;
  if (pos_ > 0) return  pos_ - 1;
  UNREACHABLE();
  return 0;
}

// -----------------------------------------------------------------------------
// Implementation of RelocInfoWriter and RelocIterator
//
// Relocation information is written backwards in memory, from high addresses
// towards low addresses, byte by byte.  Therefore, in the encodings listed
// below, the first byte listed it at the highest address, and successive
// bytes in the record are at progressively lower addresses.
//
// Encoding
//
// The most common modes are given single-byte encodings.  Also, it is
// easy to identify the type of reloc info and skip unwanted modes in
// an iteration.
//
// The encoding relies on the fact that there are fewer than 14
// different non-compactly encoded relocation modes.
//
// The first byte of a relocation record has a tag in its low 2 bits:
// Here are the record schemes, depending on the low tag and optional higher
// tags.
//
// Low tag:
//   00: embedded_object:      [6-bit pc delta] 00
//
//   01: code_target:          [6-bit pc delta] 01
//
//   10: short_data_record:    [6-bit pc delta] 10 followed by
//                             [6-bit data delta] [2-bit data type tag]
//
//   11: long_record           [2-bit high tag][4 bit middle_tag] 11
//                             followed by variable data depending on type.
//
//  2-bit data type tags, used in short_data_record and data_jump long_record:
//   code_target_with_id: 00
//   position:            01
//   statement_position:  10
//   comment:             11 (not used in short_data_record)
//
//  Long record format:
//    4-bit middle_tag:
//      0000 - 1100 : Short record for RelocInfo::Mode middle_tag + 2
//         (The middle_tag encodes rmode - RelocInfo::LAST_COMPACT_ENUM,
//          and is between 0000 and 1100)
//        The format is:
//                              00 [4 bit middle_tag] 11 followed by
//                              00 [6 bit pc delta]
//
//      1101: not used (would allow one more relocation mode to be added)
//      1110: long_data_record
//        The format is:       [2-bit data_type_tag] 1110 11
//                             signed intptr_t, lowest byte written first
//                             (except data_type code_target_with_id, which
//                             is followed by a signed int, not intptr_t.)
//
//      1111: long_pc_jump
//        The format is:
//          pc-jump:             00 1111 11,
//                               00 [6 bits pc delta]
//        or
//          pc-jump (variable length):
//                               01 1111 11,
//                               [7 bits data] 0
//                                  ...
//                               [7 bits data] 1
//               (Bits 6..31 of pc delta, with leading zeroes
//                dropped, and last non-zero chunk tagged with 1.)

const int kMaxRelocModes = 14;

const int kTagBits = 2;
const int kTagMask = (1 << kTagBits) - 1;
const int kExtraTagBits = 4;
const int kLocatableTypeTagBits = 2;
const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits;

const int kEmbeddedObjectTag = 0;
const int kCodeTargetTag = 1;
const int kLocatableTag = 2;
const int kDefaultTag = 3;

const int kPCJumpExtraTag = (1 << kExtraTagBits) - 1;

const int kSmallPCDeltaBits = kBitsPerByte - kTagBits;
const int kSmallPCDeltaMask = (1 << kSmallPCDeltaBits) - 1;
const int RelocInfo::kMaxSmallPCDelta = kSmallPCDeltaMask;

const int kVariableLengthPCJumpTopTag = 1;
const int kChunkBits = 7;
const int kChunkMask = (1 << kChunkBits) - 1;
const int kLastChunkTagBits = 1;
const int kLastChunkTagMask = 1;
const int kLastChunkTag = 1;

const int kDataJumpExtraTag = kPCJumpExtraTag - 1;

const int kCodeWithIdTag = 0;
const int kNonstatementPositionTag = 1;
const int kStatementPositionTag = 2;
const int kCommentTag = 3;

uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) {
  // Return if the pc_delta can fit in kSmallPCDeltaBits bits.
  // Otherwise write a variable length PC jump for the bits that do
  // not fit in the kSmallPCDeltaBits bits.
  if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta;
  WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag);
  uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits;
  ASSERT(pc_jump > 0);
  // Write kChunkBits size chunks of the pc_jump.
  for (; pc_jump > 0; pc_jump = pc_jump >> kChunkBits) {
    byte b = pc_jump & kChunkMask;
    *--pos_ = b << kLastChunkTagBits;
  }
  // Tag the last chunk so it can be identified.
  *pos_ = *pos_ | kLastChunkTag;
  // Return the remaining kSmallPCDeltaBits of the pc_delta.
  return pc_delta & kSmallPCDeltaMask;
}

void RelocInfoWriter::WriteTaggedPC(uint32_t pc_delta, int tag) {
  // Write a byte of tagged pc-delta, possibly preceded by var. length pc-jump.
  pc_delta = WriteVariableLengthPCJump(pc_delta);
  *--pos_ = pc_delta << kTagBits | tag;
}

void RelocInfoWriter::WriteTaggedData(intptr_t data_delta, int tag) {
  *--pos_ = static_cast<byte>(data_delta << kLocatableTypeTagBits | tag);
}

void RelocInfoWriter::WriteExtraTag(int extra_tag, int top_tag) {
  *--pos_ = static_cast<int>(top_tag << (kTagBits + kExtraTagBits) |
                             extra_tag << kTagBits |
                             kDefaultTag);
}

void RelocInfoWriter::WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag) {
  // Write two-byte tagged pc-delta, possibly preceded by var. length pc-jump.
  pc_delta = WriteVariableLengthPCJump(pc_delta);
  WriteExtraTag(extra_tag, 0);
  *--pos_ = pc_delta;
}

void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) {
  WriteExtraTag(kDataJumpExtraTag, top_tag);
  for (int i = 0; i < kIntSize; i++) {
    *--pos_ = static_cast<byte>(data_delta);
    // Signed right shift is arithmetic shift.  Tested in test-utils.cc.
    data_delta = data_delta >> kBitsPerByte;
  }
}

void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) {
  WriteExtraTag(kDataJumpExtraTag, top_tag);
  for (int i = 0; i < kIntptrSize; i++) {
    *--pos_ = static_cast<byte>(data_delta);
    // Signed right shift is arithmetic shift.  Tested in test-utils.cc.
    data_delta = data_delta >> kBitsPerByte;
  }
}

void RelocInfoWriter::Write(const RelocInfo* rinfo) {
#ifdef DEBUG
  byte* begin_pos = pos_;
#endif
  ASSERT(rinfo->pc() - last_pc_ >= 0);
  ASSERT(RelocInfo::NUMBER_OF_MODES - RelocInfo::LAST_COMPACT_ENUM <=
         kMaxRelocModes);
  // Use unsigned delta-encoding for pc.
  uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
  RelocInfo::Mode rmode = rinfo->rmode();

  // The two most common modes are given small tags, and usually fit in a byte.
  if (rmode == RelocInfo::EMBEDDED_OBJECT) {
    WriteTaggedPC(pc_delta, kEmbeddedObjectTag);
  } else if (rmode == RelocInfo::CODE_TARGET) {
    WriteTaggedPC(pc_delta, kCodeTargetTag);
    ASSERT(begin_pos - pos_ <= RelocInfo::kMaxCallSize);
  } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
    // Use signed delta-encoding for id.
    ASSERT(static_cast<int>(rinfo->data()) == rinfo->data());
    int id_delta = static_cast<int>(rinfo->data()) - last_id_;
    // Check if delta is small enough to fit in a tagged byte.
    if (is_intn(id_delta, kSmallDataBits)) {
      WriteTaggedPC(pc_delta, kLocatableTag);
      WriteTaggedData(id_delta, kCodeWithIdTag);
    } else {
      // Otherwise, use costly encoding.
      WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
      WriteExtraTaggedIntData(id_delta, kCodeWithIdTag);
    }
    last_id_ = static_cast<int>(rinfo->data());
  } else if (RelocInfo::IsPosition(rmode)) {
    // Use signed delta-encoding for position.
    ASSERT(static_cast<int>(rinfo->data()) == rinfo->data());
    int pos_delta = static_cast<int>(rinfo->data()) - last_position_;
    int pos_type_tag = (rmode == RelocInfo::POSITION) ? kNonstatementPositionTag
                                                      : kStatementPositionTag;
    // Check if delta is small enough to fit in a tagged byte.
    if (is_intn(pos_delta, kSmallDataBits)) {
      WriteTaggedPC(pc_delta, kLocatableTag);
      WriteTaggedData(pos_delta, pos_type_tag);
    } else {
      // Otherwise, use costly encoding.
      WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
      WriteExtraTaggedIntData(pos_delta, pos_type_tag);
    }
    last_position_ = static_cast<int>(rinfo->data());
  } else if (RelocInfo::IsComment(rmode)) {
    // Comments are normally not generated, so we use the costly encoding.
    WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
    WriteExtraTaggedData(rinfo->data(), kCommentTag);
    ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize);
  } else {
    ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM);
    int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM;
    // For all other modes we simply use the mode as the extra tag.
    // None of these modes need a data component.
    ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag);
    WriteExtraTaggedPC(pc_delta, saved_mode);
  }
  last_pc_ = rinfo->pc();
#ifdef DEBUG
  ASSERT(begin_pos - pos_ <= kMaxSize);
#endif
}

inline int RelocIterator::AdvanceGetTag() {
  return *--pos_ & kTagMask;
}

inline int RelocIterator::GetExtraTag() {
  return (*pos_ >> kTagBits) & ((1 << kExtraTagBits) - 1);
}

inline int RelocIterator::GetTopTag() {
  return *pos_ >> (kTagBits + kExtraTagBits);
}

inline void RelocIterator::ReadTaggedPC() {
  rinfo_.pc_ += *pos_ >> kTagBits;
}

inline void RelocIterator::AdvanceReadPC() {
  rinfo_.pc_ += *--pos_;
}

void RelocIterator::AdvanceReadId() {
  int x = 0;
  for (int i = 0; i < kIntSize; i++) {
    x |= static_cast<int>(*--pos_) << i * kBitsPerByte;
  }
  last_id_ += x;
  rinfo_.data_ = last_id_;
}

void RelocIterator::AdvanceReadPosition() {
  int x = 0;
  for (int i = 0; i < kIntSize; i++) {
    x |= static_cast<int>(*--pos_) << i * kBitsPerByte;
  }
  last_position_ += x;
  rinfo_.data_ = last_position_;
}

void RelocIterator::AdvanceReadData() {
  intptr_t x = 0;
  for (int i = 0; i < kIntptrSize; i++) {
    x |= static_cast<intptr_t>(*--pos_) << i * kBitsPerByte;
  }
  rinfo_.data_ = x;
}

void RelocIterator::AdvanceReadVariableLengthPCJump() {
  // Read the 32-kSmallPCDeltaBits most significant bits of the
  // pc jump in kChunkBits bit chunks and shift them into place.
  // Stop when the last chunk is encountered.
  uint32_t pc_jump = 0;
  for (int i = 0; i < kIntSize; i++) {
    byte pc_jump_part = *--pos_;
    pc_jump |= (pc_jump_part >> kLastChunkTagBits) << i * kChunkBits;
    if ((pc_jump_part & kLastChunkTagMask) == 1) break;
  }
  // The least significant kSmallPCDeltaBits bits will be added
  // later.
  rinfo_.pc_ += pc_jump << kSmallPCDeltaBits;
}

inline int RelocIterator::GetLocatableTypeTag() {
  return *pos_ & ((1 << kLocatableTypeTagBits) - 1);
}

inline void RelocIterator::ReadTaggedId() {
  int8_t signed_b = *pos_;
  // Signed right shift is arithmetic shift.  Tested in test-utils.cc.
  last_id_ += signed_b >> kLocatableTypeTagBits;
  rinfo_.data_ = last_id_;
}

inline void RelocIterator::ReadTaggedPosition() {
  int8_t signed_b = *pos_;
  // Signed right shift is arithmetic shift.  Tested in test-utils.cc.
  last_position_ += signed_b >> kLocatableTypeTagBits;
  rinfo_.data_ = last_position_;
}

static inline RelocInfo::Mode GetPositionModeFromTag(int tag) {
  ASSERT(tag == kNonstatementPositionTag ||
         tag == kStatementPositionTag);
  return (tag == kNonstatementPositionTag) ?
         RelocInfo::POSITION :
         RelocInfo::STATEMENT_POSITION;
}

void RelocIterator::next() {
  ASSERT(!done());
  // Basically, do the opposite of RelocInfoWriter::Write.
  // Reading of data is as far as possible avoided for unwanted modes,
  // but we must always update the pc.
  //
  // We exit this loop by returning when we find a mode we want.
  while (pos_ > end_) {
    int tag = AdvanceGetTag();
    if (tag == kEmbeddedObjectTag) {
      ReadTaggedPC();
      if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return;
    } else if (tag == kCodeTargetTag) {
      ReadTaggedPC();
      if (SetMode(RelocInfo::CODE_TARGET)) return;
    } else if (tag == kLocatableTag) {
      ReadTaggedPC();
      Advance();
      int locatable_tag = GetLocatableTypeTag();
      if (locatable_tag == kCodeWithIdTag) {
        if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) {
          ReadTaggedId();
          return;
        }
      } else {
        // Compact encoding is never used for comments,
        // so it must be a position.
        ASSERT(locatable_tag == kNonstatementPositionTag ||
               locatable_tag == kStatementPositionTag);
        if (mode_mask_ & RelocInfo::kPositionMask) {
          ReadTaggedPosition();
          if (SetMode(GetPositionModeFromTag(locatable_tag))) return;
        }
      }
    } else {
      ASSERT(tag == kDefaultTag);
      int extra_tag = GetExtraTag();
      if (extra_tag == kPCJumpExtraTag) {
        int top_tag = GetTopTag();
        if (top_tag == kVariableLengthPCJumpTopTag) {
          AdvanceReadVariableLengthPCJump();
        } else {
          AdvanceReadPC();
        }
      } else if (extra_tag == kDataJumpExtraTag) {
        int locatable_tag = GetTopTag();
        if (locatable_tag == kCodeWithIdTag) {
          if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) {
            AdvanceReadId();
            return;
          }
          Advance(kIntSize);
        } else if (locatable_tag != kCommentTag) {
          ASSERT(locatable_tag == kNonstatementPositionTag ||
                 locatable_tag == kStatementPositionTag);
          if (mode_mask_ & RelocInfo::kPositionMask) {
            AdvanceReadPosition();
            if (SetMode(GetPositionModeFromTag(locatable_tag))) return;
          } else {
            Advance(kIntSize);
          }
        } else {
          ASSERT(locatable_tag == kCommentTag);
          if (SetMode(RelocInfo::COMMENT)) {
            AdvanceReadData();
            return;
          }
          Advance(kIntptrSize);
        }
      } else {
        AdvanceReadPC();
        int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM;
        if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return;
      }
    }
  }
  done_ = true;
}

RelocIterator::RelocIterator(Code* code, int mode_mask) {
  rinfo_.host_ = code;
  rinfo_.pc_ = code->instruction_start();
  rinfo_.data_ = 0;
  // Relocation info is read backwards.
  pos_ = code->relocation_start() + code->relocation_size();
  end_ = code->relocation_start();
  done_ = false;
  mode_mask_ = mode_mask;
  last_id_ = 0;
  last_position_ = 0;
  if (mode_mask_ == 0) pos_ = end_;
  next();
}

RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) {
  rinfo_.pc_ = desc.buffer;
  rinfo_.data_ = 0;
  // Relocation info is read backwards.
  pos_ = desc.buffer + desc.buffer_size;
  end_ = pos_ - desc.reloc_size;
  done_ = false;
  mode_mask_ = mode_mask;
  last_id_ = 0;
  last_position_ = 0;
  if (mode_mask_ == 0) pos_ = end_;
  next();
}

// -----------------------------------------------------------------------------
// Implementation of RelocInfo

#ifdef ENABLE_DISASSEMBLER
const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
  switch (rmode) {
    case RelocInfo::NONE:
      return "no reloc";
    case RelocInfo::EMBEDDED_OBJECT:
      return "embedded object";
    case RelocInfo::CONSTRUCT_CALL:
      return "code target (js construct call)";
    case RelocInfo::CODE_TARGET_CONTEXT:
      return "code target (context)";
    case RelocInfo::DEBUG_BREAK:
#ifndef ENABLE_DEBUGGER_SUPPORT
      UNREACHABLE();
#endif
      return "debug break";
    case RelocInfo::CODE_TARGET:
      return "code target";
    case RelocInfo::CODE_TARGET_WITH_ID:
      return "code target with id";
    case RelocInfo::GLOBAL_PROPERTY_CELL:
      return "global property cell";
    case RelocInfo::RUNTIME_ENTRY:
      return "runtime entry";
    case RelocInfo::JS_RETURN:
      return "js return";
    case RelocInfo::COMMENT:
      return "comment";
    case RelocInfo::POSITION:
      return "position";
    case RelocInfo::STATEMENT_POSITION:
      return "statement position";
    case RelocInfo::EXTERNAL_REFERENCE:
      return "external reference";
    case RelocInfo::INTERNAL_REFERENCE:
      return "internal reference";
    case RelocInfo::DEBUG_BREAK_SLOT:
#ifndef ENABLE_DEBUGGER_SUPPORT
      UNREACHABLE();
#endif
      return "debug break slot";
    case RelocInfo::NUMBER_OF_MODES:
      UNREACHABLE();
      return "number_of_modes";
  }
  return "unknown relocation type";
}

void RelocInfo::Print(FILE* out) {
  PrintF(out, "%p  %s", pc_, RelocModeName(rmode_));
  if (IsComment(rmode_)) {
    PrintF(out, "  (%s)", reinterpret_cast<char*>(data_));
  } else if (rmode_ == EMBEDDED_OBJECT) {
    PrintF(out, "  (");
    target_object()->ShortPrint(out);
    PrintF(out, ")");
  } else if (rmode_ == EXTERNAL_REFERENCE) {
    ExternalReferenceEncoder ref_encoder;
    PrintF(out, " (%s)  (%p)",
           ref_encoder.NameOfAddress(*target_reference_address()),
           *target_reference_address());
  } else if (IsCodeTarget(rmode_)) {
    Code* code = Code::GetCodeFromTargetAddress(target_address());
    PrintF(out, " (%s)  (%p)", Code::Kind2String(code->kind()),
           target_address());
    if (rmode_ == CODE_TARGET_WITH_ID) {
      PrintF(" (id=%d)", static_cast<int>(data_));
    }
  } else if (IsPosition(rmode_)) {
    PrintF(out, "  (%" V8_PTR_PREFIX "d)", data());
  } else if (rmode_ == RelocInfo::RUNTIME_ENTRY &&
             Isolate::Current()->deoptimizer_data() != NULL) {
    // Depotimization bailouts are stored as runtime entries.
    int id = Deoptimizer::GetDeoptimizationId(
        target_address(), Deoptimizer::EAGER);
    if (id != Deoptimizer::kNotDeoptimizationEntry) {
      PrintF(out, "  (deoptimization bailout %d)", id);
    }
  }

  PrintF(out, "\n");
}
#endif  // ENABLE_DISASSEMBLER

#ifdef DEBUG
void RelocInfo::Verify() {
  switch (rmode_) {
    case EMBEDDED_OBJECT:
      Object::VerifyPointer(target_object());
      break;
    case GLOBAL_PROPERTY_CELL:
      Object::VerifyPointer(target_cell());
      break;
    case DEBUG_BREAK:
#ifndef ENABLE_DEBUGGER_SUPPORT
      UNREACHABLE();
      break;
#endif
    case CONSTRUCT_CALL:
    case CODE_TARGET_CONTEXT:
    case CODE_TARGET_WITH_ID:
    case CODE_TARGET: {
      // convert inline target address to code object
      Address addr = target_address();
      ASSERT(addr != NULL);
      // Check that we can find the right code object.
      Code* code = Code::GetCodeFromTargetAddress(addr);
      Object* found = HEAP->FindCodeObject(addr);
      ASSERT(found->IsCode());
      ASSERT(code->address() == HeapObject::cast(found)->address());
      break;
    }
    case RUNTIME_ENTRY:
    case JS_RETURN:
    case COMMENT:
    case POSITION:
    case STATEMENT_POSITION:
    case EXTERNAL_REFERENCE:
    case INTERNAL_REFERENCE:
    case DEBUG_BREAK_SLOT:
    case NONE:
      break;
    case NUMBER_OF_MODES:
      UNREACHABLE();
      break;
  }
}
#endif  // DEBUG

// -----------------------------------------------------------------------------
// Implementation of ExternalReference

ExternalReference::ExternalReference(Builtins::CFunctionId id, Isolate* isolate)
  : address_(Redirect(isolate, Builtins::c_function_address(id))) {}

ExternalReference::ExternalReference(
    ApiFunction* fun,
    Type type = ExternalReference::BUILTIN_CALL,
    Isolate* isolate = NULL)
  : address_(Redirect(isolate, fun->address(), type)) {}

ExternalReference::ExternalReference(Builtins::Name name, Isolate* isolate)
  : address_(isolate->builtins()->builtin_address(name)) {}

ExternalReference::ExternalReference(Runtime::FunctionId id,
                                     Isolate* isolate)
  : address_(Redirect(isolate, Runtime::FunctionForId(id)->entry)) {}

ExternalReference::ExternalReference(const Runtime::Function* f,
                                     Isolate* isolate)
  : address_(Redirect(isolate, f->entry)) {}

ExternalReference ExternalReference::isolate_address() {
  return ExternalReference(Isolate::Current());
}

ExternalReference::ExternalReference(const IC_Utility& ic_utility,
                                     Isolate* isolate)
  : address_(Redirect(isolate, ic_utility.address())) {}

#ifdef ENABLE_DEBUGGER_SUPPORT
ExternalReference::ExternalReference(const Debug_Address& debug_address,
                                     Isolate* isolate)
  : address_(debug_address.address(isolate)) {}
#endif

ExternalReference::ExternalReference(StatsCounter* counter)
  : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {}

ExternalReference::ExternalReference(Isolate::AddressId id, Isolate* isolate)
  : address_(isolate->get_address_from_id(id)) {}

ExternalReference::ExternalReference(const SCTableReference& table_ref)
  : address_(table_ref.address()) {}

ExternalReference ExternalReference::
    incremental_marking_record_write_function(Isolate* isolate) {
  return ExternalReference(Redirect(
      isolate,
      FUNCTION_ADDR(IncrementalMarking::RecordWriteFromCode)));
}

ExternalReference ExternalReference::
    incremental_evacuation_record_write_function(Isolate* isolate) {
  return ExternalReference(Redirect(
      isolate,
      FUNCTION_ADDR(IncrementalMarking::RecordWriteForEvacuationFromCode)));
}

ExternalReference ExternalReference::
    store_buffer_overflow_function(Isolate* isolate) {
  return ExternalReference(Redirect(
      isolate,
      FUNCTION_ADDR(StoreBuffer::StoreBufferOverflow)));
}

ExternalReference ExternalReference::flush_icache_function(Isolate* isolate) {
  return ExternalReference(Redirect(isolate, FUNCTION_ADDR(CPU::FlushICache)));
}

ExternalReference ExternalReference::perform_gc_function(Isolate* isolate) {
  return
      ExternalReference(Redirect(isolate, FUNCTION_ADDR(Runtime::PerformGC)));
}

ExternalReference ExternalReference::fill_heap_number_with_random_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(
      isolate,
      FUNCTION_ADDR(V8::FillHeapNumberWithRandom)));
}

ExternalReference ExternalReference::delete_handle_scope_extensions(
    Isolate* isolate) {
  return ExternalReference(Redirect(
      isolate,
      FUNCTION_ADDR(HandleScope::DeleteExtensions)));
}

ExternalReference ExternalReference::random_uint32_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random)));
}

ExternalReference ExternalReference::transcendental_cache_array_address(
    Isolate* isolate) {
  return ExternalReference(
      isolate->transcendental_cache()->cache_array_address());
}

ExternalReference ExternalReference::new_deoptimizer_function(
    Isolate* isolate) {
  return ExternalReference(
      Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New)));
}

ExternalReference ExternalReference::compute_output_frames_function(
    Isolate* isolate) {
  return ExternalReference(
      Redirect(isolate, FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames)));
}

ExternalReference ExternalReference::keyed_lookup_cache_keys(Isolate* isolate) {
  return ExternalReference(isolate->keyed_lookup_cache()->keys_address());
}

ExternalReference ExternalReference::keyed_lookup_cache_field_offsets(
    Isolate* isolate) {
  return ExternalReference(
      isolate->keyed_lookup_cache()->field_offsets_address());
}

ExternalReference ExternalReference::roots_array_start(Isolate* isolate) {
  return ExternalReference(isolate->heap()->roots_array_start());
}

ExternalReference ExternalReference::address_of_stack_limit(Isolate* isolate) {
  return ExternalReference(isolate->stack_guard()->address_of_jslimit());
}

ExternalReference ExternalReference::address_of_real_stack_limit(
    Isolate* isolate) {
  return ExternalReference(isolate->stack_guard()->address_of_real_jslimit());
}

ExternalReference ExternalReference::address_of_regexp_stack_limit(
    Isolate* isolate) {
  return ExternalReference(isolate->regexp_stack()->limit_address());
}

ExternalReference ExternalReference::new_space_start(Isolate* isolate) {
  return ExternalReference(isolate->heap()->NewSpaceStart());
}

ExternalReference ExternalReference::store_buffer_top(Isolate* isolate) {
  return ExternalReference(isolate->heap()->store_buffer()->TopAddress());
}

ExternalReference ExternalReference::new_space_mask(Isolate* isolate) {
  return ExternalReference(reinterpret_cast<Address>(
      isolate->heap()->NewSpaceMask()));
}

ExternalReference ExternalReference::new_space_allocation_top_address(
    Isolate* isolate) {
  return ExternalReference(isolate->heap()->NewSpaceAllocationTopAddress());
}

ExternalReference ExternalReference::heap_always_allocate_scope_depth(
    Isolate* isolate) {
  Heap* heap = isolate->heap();
  return ExternalReference(heap->always_allocate_scope_depth_address());
}

ExternalReference ExternalReference::new_space_allocation_limit_address(
    Isolate* isolate) {
  return ExternalReference(isolate->heap()->NewSpaceAllocationLimitAddress());
}

ExternalReference ExternalReference::handle_scope_level_address() {
  return ExternalReference(HandleScope::current_level_address());
}

ExternalReference ExternalReference::handle_scope_next_address() {
  return ExternalReference(HandleScope::current_next_address());
}

ExternalReference ExternalReference::handle_scope_limit_address() {
  return ExternalReference(HandleScope::current_limit_address());
}

ExternalReference ExternalReference::scheduled_exception_address(
    Isolate* isolate) {
  return ExternalReference(isolate->scheduled_exception_address());
}

ExternalReference ExternalReference::address_of_min_int() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::min_int)));
}

ExternalReference ExternalReference::address_of_one_half() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::one_half)));
}

ExternalReference ExternalReference::address_of_minus_zero() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::minus_zero)));
}

ExternalReference ExternalReference::address_of_zero() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::zero)));
}

ExternalReference ExternalReference::address_of_uint8_max_value() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::uint8_max_value)));
}

ExternalReference ExternalReference::address_of_negative_infinity() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::negative_infinity)));
}

ExternalReference ExternalReference::address_of_canonical_non_hole_nan() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::canonical_non_hole_nan)));
}

ExternalReference ExternalReference::address_of_the_hole_nan() {
  return ExternalReference(reinterpret_cast<void*>(
      const_cast<double*>(&DoubleConstant::the_hole_nan)));
}

#ifndef V8_INTERPRETED_REGEXP

ExternalReference ExternalReference::re_check_stack_guard_state(
    Isolate* isolate) {
  Address function;
#ifdef V8_TARGET_ARCH_X64
  function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState);
#elif V8_TARGET_ARCH_IA32
  function = FUNCTION_ADDR(RegExpMacroAssemblerIA32::CheckStackGuardState);
#elif V8_TARGET_ARCH_ARM
  function = FUNCTION_ADDR(RegExpMacroAssemblerARM::CheckStackGuardState);
#elif V8_TARGET_ARCH_MIPS
  function = FUNCTION_ADDR(RegExpMacroAssemblerMIPS::CheckStackGuardState);
#else
  UNREACHABLE();
#endif
  return ExternalReference(Redirect(isolate, function));
}

ExternalReference ExternalReference::re_grow_stack(Isolate* isolate) {
  return ExternalReference(
      Redirect(isolate, FUNCTION_ADDR(NativeRegExpMacroAssembler::GrowStack)));
}

ExternalReference ExternalReference::re_case_insensitive_compare_uc16(
    Isolate* isolate) {
  return ExternalReference(Redirect(
      isolate,
      FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16)));
}

ExternalReference ExternalReference::re_word_character_map() {
  return ExternalReference(
      NativeRegExpMacroAssembler::word_character_map_address());
}

ExternalReference ExternalReference::address_of_static_offsets_vector(
    Isolate* isolate) {
  return ExternalReference(
      OffsetsVector::static_offsets_vector_address(isolate));
}

ExternalReference ExternalReference::address_of_regexp_stack_memory_address(
    Isolate* isolate) {
  return ExternalReference(
      isolate->regexp_stack()->memory_address());
}

ExternalReference ExternalReference::address_of_regexp_stack_memory_size(
    Isolate* isolate) {
  return ExternalReference(isolate->regexp_stack()->memory_size_address());
}

#endif  // V8_INTERPRETED_REGEXP

static double add_two_doubles(double x, double y) {
  return x + y;
}

static double sub_two_doubles(double x, double y) {
  return x - y;
}

static double mul_two_doubles(double x, double y) {
  return x * y;
}

static double div_two_doubles(double x, double y) {
  return x / y;
}

static double mod_two_doubles(double x, double y) {
  return modulo(x, y);
}

static double math_sin_double(double x) {
  return sin(x);
}

static double math_cos_double(double x) {
  return cos(x);
}

static double math_tan_double(double x) {
  return tan(x);
}

static double math_log_double(double x) {
  return log(x);
}

ExternalReference ExternalReference::math_sin_double_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(math_sin_double),
                                    BUILTIN_FP_CALL));
}

ExternalReference ExternalReference::math_cos_double_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(math_cos_double),
                                    BUILTIN_FP_CALL));
}

ExternalReference ExternalReference::math_tan_double_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(math_tan_double),
                                    BUILTIN_FP_CALL));
}

ExternalReference ExternalReference::math_log_double_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(math_log_double),
                                    BUILTIN_FP_CALL));
}

// Helper function to compute x^y, where y is known to be an
// integer. Uses binary decomposition to limit the number of
// multiplications; see the discussion in "Hacker's Delight" by Henry
// S. Warren, Jr., figure 11-6, page 213.
double power_double_int(double x, int y) {
  double m = (y < 0) ? 1 / x : x;
  unsigned n = (y < 0) ? -y : y;
  double p = 1;
  while (n != 0) {
    if ((n & 1) != 0) p *= m;
    m *= m;
    if ((n & 2) != 0) p *= m;
    m *= m;
    n >>= 2;
  }
  return p;
}

double power_double_double(double x, double y) {
  // The checks for special cases can be dropped in ia32 because it has already
  // been done in generated code before bailing out here.
  if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) return OS::nan_value();
  return pow(x, y);
}

ExternalReference ExternalReference::power_double_double_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(power_double_double),
                                    BUILTIN_FP_FP_CALL));
}

ExternalReference ExternalReference::power_double_int_function(
    Isolate* isolate) {
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(power_double_int),
                                    BUILTIN_FP_INT_CALL));
}

static int native_compare_doubles(double y, double x) {
  if (x == y) return EQUAL;
  return x < y ? LESS : GREATER;
}

bool EvalComparison(Token::Value op, double op1, double op2) {
  ASSERT(Token::IsCompareOp(op));
  switch (op) {
    case Token::EQ:
    case Token::EQ_STRICT: return (op1 == op2);
    case Token::NE: return (op1 != op2);
    case Token::LT: return (op1 < op2);
    case Token::GT: return (op1 > op2);
    case Token::LTE: return (op1 <= op2);
    case Token::GTE: return (op1 >= op2);
    default:
      UNREACHABLE();
      return false;
  }
}

ExternalReference ExternalReference::double_fp_operation(
    Token::Value operation, Isolate* isolate) {
  typedef double BinaryFPOperation(double x, double y);
  BinaryFPOperation* function = NULL;
  switch (operation) {
    case Token::ADD:
      function = &add_two_doubles;
      break;
    case Token::SUB:
      function = &sub_two_doubles;
      break;
    case Token::MUL:
      function = &mul_two_doubles;
      break;
    case Token::DIV:
      function = &div_two_doubles;
      break;
    case Token::MOD:
      function = &mod_two_doubles;
      break;
    default:
      UNREACHABLE();
  }
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(function),
                                    BUILTIN_FP_FP_CALL));
}

ExternalReference ExternalReference::compare_doubles(Isolate* isolate) {
  return ExternalReference(Redirect(isolate,
                                    FUNCTION_ADDR(native_compare_doubles),
                                    BUILTIN_COMPARE_CALL));
}

#ifdef ENABLE_DEBUGGER_SUPPORT
ExternalReference ExternalReference::debug_break(Isolate* isolate) {
  return ExternalReference(Redirect(isolate, FUNCTION_ADDR(Debug_Break)));
}

ExternalReference ExternalReference::debug_step_in_fp_address(
    Isolate* isolate) {
  return ExternalReference(isolate->debug()->step_in_fp_addr());
}
#endif

void PositionsRecorder::RecordPosition(int pos) {
  ASSERT(pos != RelocInfo::kNoPosition);
  ASSERT(pos >= 0);
  state_.current_position = pos;
#ifdef ENABLE_GDB_JIT_INTERFACE
  if (gdbjit_lineinfo_ != NULL) {
    gdbjit_lineinfo_->SetPosition(assembler_->pc_offset(), pos, false);
  }
#endif
}

void PositionsRecorder::RecordStatementPosition(int pos) {
  ASSERT(pos != RelocInfo::kNoPosition);
  ASSERT(pos >= 0);
  state_.current_statement_position = pos;
#ifdef ENABLE_GDB_JIT_INTERFACE
  if (gdbjit_lineinfo_ != NULL) {
    gdbjit_lineinfo_->SetPosition(assembler_->pc_offset(), pos, true);
  }
#endif
}

bool PositionsRecorder::WriteRecordedPositions() {
  bool written = false;

  // Write the statement position if it is different from what was written last
  // time.
  if (state_.current_statement_position != state_.written_statement_position) {
    EnsureSpace ensure_space(assembler_);
    assembler_->RecordRelocInfo(RelocInfo::STATEMENT_POSITION,
                                state_.current_statement_position);
    state_.written_statement_position = state_.current_statement_position;
    written = true;
  }

  // Write the position if it is different from what was written last time and
  // also different from the written statement position.
  if (state_.current_position != state_.written_position &&
      state_.current_position != state_.written_statement_position) {
    EnsureSpace ensure_space(assembler_);
    assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
    state_.written_position = state_.current_position;
    written = true;
  }

  // Return whether something was written.
  return written;
}

} }  // namespace v8::internal


text:
pathconf="-conf ./job_config.xml -input /home/test/input/* -output /home/test/output/"
hadoop pipes $pathconf  -program /home/test/mr_word_count

redpajama_set_name: RedPajamaGithub


text:
var module = angular.module('writer.controllers');

module.controller('PostCtrl', function($scope, $state, $timeout, PostService, CommentService, LocalStorageService) {
    $scope.newComment = false;
    $scope.comment = {};
    $scope.ui = {
        editing: {
            active: false,
            post: 0
        }
    };

    $scope.toggleEdit = function(post) {
        if (!$scope.ui.editing.active) {
            $scope.ui.editing.active = true;
            $scope.ui.editing.post = post._id;
        } else {
            $scope.ui.editing.active = false;
            $scope.ui.editing.post = 0;
        }
    }

    $scope.showCommentForm = function() {
        $scope.newComment = true;
    }

    $scope.hideCommentForm = function() {
        $scope.newComment = false;
    }

    $scope.likePost = function(post) {
        PostService.likePost(post._id).success(function(response) {
            post.likes++;
            LocalStorageService.markPostAsLiked(post._id);
            post.hasLiked = true;
        }).error(function(err) {
            Materialize.toast('Det går inte gilla inlägget just nu!', 2000);
        });
    }

    $scope.updatePost = function(post) {
        PostService.updatePost(post).success(function(response) {
            Materialize.toast('Inlägget är uppdaterat!', 2000);
            post.editing = false;
            $scope.ui.editing = {
                active: false,
                post: 0
            };
        }).error(function(err) {
            console.log(err);
            Materialize.toast('Inlägget kunde inte uppdateras!', 2000);
        });
    }

    $scope.submitComment = function(post) {
        $scope.comment.post = post._id;
        CommentService.submitComment($scope.comment).success(function(response) {
            post.comments.unshift(response);
            Materialize.toast('Din kommentar har postats!', 2000);
            $scope.newComment = false;
            $scope.comment = {};
        }).error(function(err) {
            Materialize.toast('Din kommentar kunde inte postas!', 2000);
        });
    }
});


text:
package com.webuml.projectmanager.controller.metamodel.classes;

import org.springframework.hateoas.Link;
import org.springframework.hateoas.Resource;

class ClassResource extends Resource<com.webuml.projectmanager.domain.metamodel.Class> {

  public ClassResource(com.webuml.projectmanager.domain.metamodel.Class content, Link... links) {
    super(content, links);
  }

  public ClassResource(com.webuml.projectmanager.domain.metamodel.Class content, Iterable<Link> links) {
    super(content, links);
  }
}


text:
Some weeks ago I made a pull request for HTML5Boilerplate which should update jQuery to the latest version available on the Google CDN. How ever I copied the old version of minified jQuery because the uncompressed version was available but the minified wasn't. Stupid thing!

That's why I created Is Mothereffin' jQuery up? The service checks three major CDNs for the availability of the latest jQuery version.

View Is Mothereffin' jQuery up?

## How to Check if the File is up

I had some difficulties to find the right method how to detect if a file is already available with JavaScript. If you don't have to deal with cross-domain requests this is not a big thing and done pretty easy. But I need cross-domain requests.

If a file is not available on a server, the request dies with an error 404 and no callback will be called. See this Fiddle for a test-case. Even a try-catch-expression does not help.

I decided to check all files for availability and if the request ends up in an error nothing will happen. The script will check if all files are available after three seconds and will otherwise "tell" the user that it's not. This is not a bullet-proof method as it could take more then three seconds to request all files. If you have a better idea please let me know.

For the moment the resources will be labeled as "available" when they are loaded even if they were labeled "not available" before. So you will not end up with wrong result, it just may take a second more to show you that.

## The Styles

The project was build "mobile-first". It makes use of the CSS3 Flexible Box Model instead of float and all the other stuff.

I'm not supporting IE in any way because I think most web-developer don't use Internet Explorer.

## Todo

Support more libraries such as Mootools, Dojo, Prototype, ExtJS and YUI

Let users submit other CDN via a form

Link buttons to their libraryDone with this commit – suggestion by Mathias

Let me know if you want some other features.

## Contribute via GitHub

I've put this project up on GutHub. Feel free to contribute or just watch it.

Feature requests can also be placed in the issue-tracker there.


text:
/* tslint:disable */
/* eslint-disable */

import { ConcreteRequest } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";
export type AuctionTimerQueryVariables = {
    saleID: string;
};
export type AuctionTimerQueryResponse = {
    readonly sale: {
        readonly " $fragmentRefs": FragmentRefs<"AuctionTimer_sale">;
    } | null;
};
export type AuctionTimerQuery = {
    readonly response: AuctionTimerQueryResponse;
    readonly variables: AuctionTimerQueryVariables;
};

/*
query AuctionTimerQuery(
  $saleID: String!
) {
  sale(id: $saleID) {
    ...AuctionTimer_sale
    id
  }
}

fragment AuctionTimer_sale on Sale {
  liveStartAt
  endAt
}
*/

const node: ConcreteRequest = (function(){
var v0 = [
  {
    "defaultValue": null,
    "kind": "LocalArgument",
    "name": "saleID",
    "type": "String!"
  }
],
v1 = [
  {
    "kind": "Variable",
    "name": "id",
    "variableName": "saleID"
  }
];
return {
  "fragment": {
    "argumentDefinitions": (v0/*: any*/),
    "kind": "Fragment",
    "metadata": null,
    "name": "AuctionTimerQuery",
    "selections": [
      {
        "alias": null,
        "args": (v1/*: any*/),
        "concreteType": "Sale",
        "kind": "LinkedField",
        "name": "sale",
        "plural": false,
        "selections": [
          {
            "args": null,
            "kind": "FragmentSpread",
            "name": "AuctionTimer_sale"
          }
        ],
        "storageKey": null
      }
    ],
    "type": "Query"
  },
  "kind": "Request",
  "operation": {
    "argumentDefinitions": (v0/*: any*/),
    "kind": "Operation",
    "name": "AuctionTimerQuery",
    "selections": [
      {
        "alias": null,
        "args": (v1/*: any*/),
        "concreteType": "Sale",
        "kind": "LinkedField",
        "name": "sale",
        "plural": false,
        "selections": [
          {
            "alias": null,
            "args": null,
            "kind": "ScalarField",
            "name": "liveStartAt",
            "storageKey": null
          },
          {
            "alias": null,
            "args": null,
            "kind": "ScalarField",
            "name": "endAt",
            "storageKey": null
          },
          {
            "alias": null,
            "args": null,
            "kind": "ScalarField",
            "name": "id",
            "storageKey": null
          }
        ],
        "storageKey": null
      }
    ]
  },
  "params": {
    "id": null,
    "metadata": {},
    "name": "AuctionTimerQuery",
    "operationKind": "query",
    "text": "query AuctionTimerQuery(\n  $saleID: String!\n) {\n  sale(id: $saleID) {\n    ...AuctionTimer_sale\n    id\n  }\n}\n\nfragment AuctionTimer_sale on Sale {\n  liveStartAt\n  endAt\n}\n"
  }
};
})();
(node as any).hash = '67de4ea3de2f4ebe608f8bd2df2d6b88';
export default node;


text:
Make sure you have installed all these prerequisites on your development machine.
* Node.js - [Download & Install Node.js](http://www.nodejs.org/download/) and the npm package manager, if you encounter any problems, you can also use this [Github Gist](https://gist.github.com/isaacs/579814) to install Node.js.
* MongoDB - [Download & Install MongoDB](http://www.mongodb.org/downloads), and make sure it's running on the default port (27017).
* Bower - You're going to use the [Bower Package Manager](http://bower.io/) to manage your front-end packages, in order to install it make sure you've installed Node.js and npm, then install bower globally using npm:

```
$ npm install -g bower
```

* Grunt - You're going to use the [Grunt Task Runner](http://gruntjs.com/) to automate your development process, in order to install it make sure you've installed Node.js and npm, then install grunt globally using npm:

```
$ sudo npm install -g grunt-cli
```

### Cloning The GitHub Repository
You can also use Git to directly clone the MEAN.JS repository:
```
$ git clone https://github.com/galyamichevp/bex bex
```
This will clone the latest version of the MEAN.JS repository to a **meanjs** folder.

## Quick Install
Once you've downloaded the boilerplate and installed all the prerequisites, you're just a few steps away from starting to develop you MEAN application.

The first thing you should do is install the Node.js dependencies. The boilerplate comes pre-bundled with a package.json file that contains the list of modules you need to start your application, to learn more about the modules installed visit the NPM & Package.json section.

To install Node.js dependencies you're going to use npm again, in the application folder run this in the command-line:

```
$ npm install
```

This command does a few things:
* First it will install the dependencies needed for the application to run.
* If you're running in a development environment, it will then also install development dependencies needed for testing and running your application.
* Finally, when the install process is over, npm will initiate a bower installcommand to install all the front-end modules needed for the application

## Running Your Application
After the install process is over, you'll be able to run your application using Grunt, just run grunt default task:

```
$ grunt
```

Your application should run on the 3000 port so in your browser just go to [http://localhost:3000](http://localhost:3000)

That's it! your application should be running by now, to proceed with your development check the other sections in this documentation.
If you encounter any problem try the Troubleshooting section.

## Development and deployment With Docker

* Install [Docker](http://www.docker.com/)
* Install [Fig](https://github.com/orchardup/fig)

* Local development and testing with fig:
```bash
$ fig up
```

* Local development and testing with just Docker:
```bash
$ docker build -t mean .
$ docker run -p 27017:27017 -d --name db mongo
$ docker run -p 3000:3000 --link db:db_1 mean
$
```

* To enable live reload forward 35729 port and mount /app and /public as volumes:
```bash
$ docker run -p 3000:3000 -p 35729:35729 -v /Users/mdl/workspace/mean-stack/mean/public:/home/mean/public -v /Users/mdl/workspa/mean-stack/mean/app:/home/mean/app --link db:db_1 mean
```

## License
(The MIT License)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


text:
<webscript>
  <shortname>Get rule</shortname>
  <description>Get the details of a rule. The details returned are fully expanded, including child actions (if composite action), conditions and compensating actions.</description>
  <url>/api/node/{store_type}/{store_id}/{id}/ruleset/rules/{rule_id}</url>
  <format default="json">argument</format>
  <authentication>user</authentication>
  <transaction allow="readonly">required</transaction>
</webscript>


text:
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const Twilio = require('twilio');
const client = new Twilio(accountSid, authToken);

client.api.calls
  .create({
    url: 'http://demo.twilio.com/docs/voice.xml',
    to: '+14155551212',
    from: '+18668675309',
    statusCallback: 'https://www.myapp.com/events',
    statusCallbackMethod: 'POST',
    statusCallbackEvent: ['initiated', 'ringing', 'answered', 'completed'],
    method: 'GET',
  })
  .then(call => console.log(call.sid))
  .done();


text:
/*
 * Created on 29/03/2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package br.com.dlp.framework.util.converter;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Date;
import java.util.ResourceBundle;

/**
 * @author PLDarcio
 *
 *         TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
 */
public class QualquerObjetoParaString extends AbstractConverter {

	public QualquerObjetoParaString(ResourceBundle resourceBundle) {
		super(resourceBundle);
	}

	private String getFormatoPadrao(Object objetoOrigem) {
		String retorno = "";

		ResourceBundle resourceBundle = getResourceBundle();

		if (retorno != null) {

			if (objetoOrigem instanceof String) {
				retorno = "";

			} else if (objetoOrigem instanceof Short) {
				retorno = resourceBundle.getString(PROPERTY_FORMATO_SHORT);

			} else if (objetoOrigem instanceof Integer) {
				retorno = resourceBundle.getString(PROPERTY_FORMATO_INTEGER);

			} else if (objetoOrigem instanceof Long) {
				retorno = resourceBundle.getString(PROPERTY_FORMATO_LONG);

			} else if (objetoOrigem instanceof Float) {
				retorno = resourceBundle.getString(PROPERTY_FORMATO_FLOAT);

			} else if (objetoOrigem instanceof Double) {
				retorno = resourceBundle.getString(PROPERTY_FORMATO_DOUBLE);

			}
		}
		return retorno;
	}

	public Object convert(Class arg0, Object valorOrigem) {

		try {
			String returnValue = null;

			if (valorOrigem instanceof String) {
				returnValue = (String) valorOrigem;

			} else if (valorOrigem instanceof Date) {
				returnValue = (String) (new DateParaStringConverter(getResourceBundle()).convert(arg0, valorOrigem));

			} else if (valorOrigem instanceof Number) {

				DecimalFormatSymbols decimalFormatSymbols = getDecimalFormatSymbols();

				DecimalFormat decimalFormat = new DecimalFormat(getFormatoPadrao(valorOrigem), decimalFormatSymbols);

				if (valorOrigem instanceof Short) {
					returnValue = decimalFormat.format(((Short) valorOrigem).shortValue());

				} else if (valorOrigem instanceof Integer) {
					returnValue = decimalFormat.format(((Integer) valorOrigem).intValue());

				} else if (valorOrigem instanceof Long) {
					returnValue = decimalFormat.format(((Long) valorOrigem).longValue());

				} else if (valorOrigem instanceof Float) {
					returnValue = decimalFormat.format(((Float) valorOrigem).floatValue());

				} else if (valorOrigem instanceof Double) {
					returnValue = decimalFormat.format(((Double) valorOrigem).doubleValue());

				}
			}
			return returnValue;

		} catch (Exception e) {
			logger.error("Erro ao tentar converter o objeto '" + valorOrigem + "'!", e);
			e.printStackTrace();
			throw new RuntimeException("Erro ao tentar converter o objeto '" + valorOrigem + "'!", e);

		}
	}

}


text:
<export><workspace name="Suppliers"><query name="Supplier" focus="false" listorder="1" taborder="2" active="true" database="12450102741220167768" server="309628398882601242" database-name="entity-services-examples-content" server-name="entity-services-examples" mode="sql">SELECT *
FROM SP.Supplier</query><query name="Part" focus="false" listorder="2" taborder="3" active="true" database="12450102741220167768" server="309628398882601242" database-name="entity-services-examples-content" server-name="entity-services-examples" mode="sql">SELECT *
FROM SP.Part
ORDER By pName
LIMIT 100</query><query name="Shipment" focus="false" listorder="3" taborder="4" active="true" database="12450102741220167768" server="309628398882601242" database-name="entity-services-examples-content" server-name="entity-services-examples" mode="sql">SELECT *
FROM
SP.Shipment
LIMIT 100</query><query name="Join" focus="false" listorder="4" taborder="5" active="true" database="12450102741220167768" server="309628398882601242" database-name="entity-services-examples-content" server-name="entity-services-examples" mode="sql">SELECT sName, pName, color, qty
from
SP.Supplier s,
SP.Part p,
SP.Shipment sh
WHERE s.sid = sh.sid
AND p.pid = sh.pid
AND qty > 60
ORDER BY qty
LIMIT 10</query><query name="Optic SJS Join" focus="false" listorder="5" taborder="6" active="true" database="12450102741220167768" server="309628398882601242" database-name="entity-services-examples-content" server-name="entity-services-examples" mode="javascript">var op = require("/MarkLogic/optic");

op.fromView("SP", "Shipment")
  .joinInner(op.fromView("SP", "Part"), op.on( op.schemaCol("SP", "Part", "pid") , op.schemaCol("SP", "Shipment", "pid") ))
  .joinInner(op.fromView("SP", "Supplier"), op.on( op.schemaCol("SP", "Shipment","sid"), op.schemaCol("SP", "Supplier", "sid") ) )
  .select( ["sName", "pName", "color", "qty"] )
  .where( op.gt(op.col("qty"), 60))
  .limit(10)
  .orderBy( op.col("qty"))
  .result()</query><query name="Optic XQ Join" focus="false" listorder="6" taborder="7" active="true" database="12450102741220167768" server="309628398882601242" database-name="entity-services-examples-content" server-name="entity-services-examples" mode="xquery">import module namespace op = "http://marklogic.com/optic" at "/MarkLogic/optic.xqy";

op:from-view("SP", "Shipment")
  =>op:join-inner(op:from-view("SP", "Part"), op:on( op:schema-col("SP", "Part", "pid") , op:schema-col("SP", "Shipment", "pid") ))
  =>op:join-inner(op:from-view("SP", "Supplier"), op:on( op:schema-col("SP", "Shipment","sid"), op:schema-col("SP", "Supplier", "sid") ) )
  =>op:select( ("sName", "pName", "color", "qty") )
  =>op:where( op:gt(op:col("qty"), 60))
  =>op:limit(10)
  =>op:order-by( op:col("qty"))
  =>op:result()</query><query name="README" focus="true" listorder="7" taborder="1" active="true" database="12450102741220167768" server="309628398882601242" database-name="entity-services-examples-content" server-name="entity-services-examples" mode="xquery">(:
 : This workspace contains reports and examples about an Entity Services scenario.
 : It's designed with simplicity in mind, not real business data.
 : Once you have run the Examples Loader ('./gradlew runExampleSuppliers') you can step
 : through these tabs to see what happened.
 : The Suppliers example reproduces a common pedagogical database schema.
 : The tabs in this workspace demonstrate how to build SQL and Optic API queries
 : against relations defined by Entity Services extraction templates.
 :)</query></workspace></export>


text:
import java.util.HashMap;
import java.util.List;

public interface ResultProcess {
	public void setThreshold(double threshold);
	public List<String> getResult(HashMap<String,Double> map);
}


text:
<!DOCTYPE html>

    <title>submergence.Authentication.Configuration.three days~details documentation</title>
    <link rel="stylesheet" type="text/css" href="../../../../../../../../../../index.css" />
    <link rel="stylesheet" type="text/css" href="../../../../../../../../../../highlight.css" />

            spare

                :submergence:Authentication.Configuration.three days~details

Maximum time (milliseonds) since the user's last period of activity until a new session token
can no longer be generated. The Client will be idle until setActive is
called.

        This document was generated with
        doczar
        at 3:03pm on 8/11/2015


text:
require 'seth/resource/script'

class Seth
  class Resource
    class Csh < Seth::Resource::Script

      def initialize(name, run_context=nil)
        super
        @resource_name = :csh
        @interpreter = "csh"
      end

    end
  end
end


text:
'use strict';

angular
  .module('adf.widget.github')
  .controller('GithubEventsController', GithubEventsController);

function GithubEventsController(config, events) {
  var vm = this;

  vm.events = events;
}


text:
"use strict";
(function (Metric) {
    Metric[Metric["RESPONSE_TIME"] = 'response-time'] = "RESPONSE_TIME";
    Metric[Metric["CPU_USAGE"] = 'proc.cpu_usage'] = "CPU_USAGE";
})(exports.Metric || (exports.Metric = {}));
var Metric = exports.Metric;


text:
"use strict";

var dtLimits, dtBreaches;

var getUrl = function(e){
    console.debug(e);
    // return the right suffic fr the metric
    var baseUrl = 'api/totalportfolio/';

    // find out the selected metric from the dropdown / sessionStorage
    // add it to the baseUrl
    var metric = sessionStorage.getItem('limitMetric_') || 'CE';
    return baseUrl + metric.toLowerCase();
};

var flipTable = function(evt) {
    if (isNullOrUndefined(evt))
        return;

    evt = evt || window.event;
    var target = evt.target || evt.srcElement;
    // update the metric and redraw the limits table
    sessionStorage.setItem(target.name, target.value);
    dtLimits.ajax.url(getUrl()).load();
};

var filterOnDate = function(evt){
    if (isNullOrUndefined(evt))
        return;

    evt = evt || window.event;
    var target = evt.target || evt.srcElement;
    sessionStorage.setItem(target.name, target.value);
    // dtLimits.draw();
    $(".dt-responsive:visible").each(function (e) {
        $(this).DataTable().draw();
    });

};

$.fn.dataTable.ext.search.push(
    function( settings, data, dataIndex ) {
        var val_  = document.getElementById('businessDates').value;
        if (val_ == '19700101') return true;
        return data[7] == moment(val_,'YYYYMMDD').format('DD-MMM-YYYY');
    }
);

var limitLoad_ = function() {
    // load the page
    // attach change event handlers to the dropdown controls
    console.log('[INFO] ORE Limit Table.init');

    var pCcy_ = chartManager.setBaseCcy();
    var pDates_ = chartManager.populateBusinessDates();

    return Promise.all([pCcy_, pDates_]).then(function (values) {
        console.log('[INFO] bus date calls and base ccy complete');
        // when the bus date and base ccy rest calls have resolved
        // reset the page defaults and init the charts
        document.getElementById('businessDates').options[0].text = '- All Dates -';
        console.debug(sessionStorage);
        return 'done';
    }).then(function (res) {
        console.log('[INFO] init limits table complete');

        // for each selector, populate the choices list
        // and add a change event handler
        [].forEach.call(document.getElementsByClassName('selectpicker-bg'), function (e) {
            chartManager.populateBarGraphMetricList(e);
            sessionStorage.setItem('limitMetric_','CE');
            _AttachEvent(e, 'change', flipTable);
        });

        [].forEach.call(document.getElementsByClassName('selectpicker'), function (e) {
            _AttachEvent(e, 'change', filterOnDate);
        });

        return 'done';

    }).catch(function (error) {
        console.error(new Error(error));
    });
}

$(document).ready(function() {

    $("a[data-toggle=\"tab\"]").on("shown.bs.tab", function (e) {
        var $newTab = $(e.target);

        if ($.inArray("limits-tab", $newTab.parent().get(0).classList) >= 0) {
            $(".limits-tab").addClass("active");
            $(".breaches-tab").removeClass("active");
            document.getElementById('limitMetric_').disabled = false;
            document.getElementById('limitMetric_').value = sessionStorage.getItem('limitMetric_');
        } else {
            $(".breaches-tab").addClass("active");
            $(".limits-tab").removeClass("active");
            document.getElementById('limitMetric_').disabled = true;
            document.getElementById('limitMetric_').value = '--';
        }

        $(".dt-responsive:visible").each(function (e) {
           $(this).DataTable().scroller.measure();
           $(this).DataTable().columns.adjust().responsive.recalc();
        });
    });

    var massageJson = function(json){
        var ret_ = [];
        [].forEach.call(json, function(e){
            var row_ = {};
            row_.creditRating = e.creditRating;
            row_.counterParty = e.counterParty;
            row_.nettingSet = e.nettingSet;
            row_.trade = e.trade;
            row_.metric = e.metric;
            row_.limit = e.limit;
            var cons = e.consumptions;
            [].forEach.call(cons, function(el){
                var new_row = JSON.parse(JSON.stringify(row_));
                new_row.value = el.value;
                new_row.date = el.date;
                new_row.consumption = el.consumption;
                ret_.push(new_row);
            })
        })
        return ret_;
    };

    // table definition common to both tables
    var tableDef = {
        "createdRow": function( row, data, dataIndex ) {
            if ( data.consumption > 75 ) {
                $(row).addClass( 'warning' );
            }
            if ( data.consumption > 100 ) {
                $(row).addClass( 'danger' );
            }
        },
        "columnDefs" : [{
            "className" : "text-right", "targets" : [5,6,8]
        }],
        "columns": [
            { title: "Credit Rating", data : "creditRating" },
            { title: "Counterparty", data : "counterParty"},
            { title: "Netting Set", data: "nettingSet" },
            { title: "Trade", data: "trade" },
            { title: "Metric", data: "metric" , render: function (data, type, row) {
                return data.toUpperCase();
            }},
            { title: "Limit Value", data: "limit"
                , render: $.fn.dataTable.render.number( ',', '.', 0, chartManager.getBaseCcy())
            },
            { title: "Consumption Value", data: "value"
                , render: $.fn.dataTable.render.number( ',', '.', 0, chartManager.getBaseCcy())
            },
            { title: "Date", data: "date"
                , render: function ( data, type, row ) {
                // If display or filter data is requested, format the date
                // if ( type === 'display' || type === 'filter' ) {
                //     var rowvalue = row["Date"];
                    return (moment(data, 'YYYYMMDD').format('DD-MMM-YYYY'));
                    // return data;
                // }
                // Otherwise the data type requested (`type`) is type detection or
                // sorting data, for which we want to use the raw date value, so just return
                // that, unaltered
                // return data;
            }
            },
            { title: " Cons %", data: "consumption"
                , render: $.fn.dataTable.render.number( ',', '.', 2, '','%')
            }
        ],
        deferRender: true,
        scrollY: 380,
        scrollCollapse: true,
        scroller: true,
        dom: 'Bfrtip',
        buttons: [
            {
                extend: "copy",
                className: "btn-sm"
            },
            {
                extend: "csv",
                className: "btn-sm"
            },
            {
                extend: "excel",
                className: "btn-sm"
            },
            {
                extend: "pdfHtml5",
                className: "btn-sm"
            },
            {
                extend: "print",
                className: "btn-sm"
            }
        ]
    };

    // all records - find the right metric
    dtLimits = $('#datatable-responsive').DataTable(
        tableDef,
        tableDef.ajax = {url: getUrl(this), dataSrc: massageJson}
    );

    // limitBreach table
    dtBreaches = $('#datatable-responsive2').DataTable(
        tableDef,
        tableDef.ajax = {url: "api/limitbreaches", dataSrc: massageJson}
    );

});


text:
/*
 * File:   InversePinchingMove.h
 * Author: bruijl
 *
 * Created on October 15, 2012, 1:33 PM
 */

#ifndef INVERSEPINCHINGMOVE_H
#define	INVERSEPINCHINGMOVE_H

#include "Move.h"

class InversePinchingMove : public Move {
private:
    Vertex* v;
    Triangle *t, *s;
    bool left; // orientation of the asymmetric expansion
    bool isTimelike;
public:

    InversePinchingMove(bool isTimelike);

    double getTransitionProbability(std::vector<Vertex*>& vertices);

    bool isMovePossible(std::vector<Vertex*>& vertices);

    Move* generateRandomMove(Simulation& simulation);

    double getInverseTransitionProbability(std::vector<Vertex*>& vertices);

    void execute(std::vector<Vertex*>& vertices);
    std::string printID();
};

#endif	/* INVERSEPINCHINGMOVE_H */


text:
#ifndef PBL_CPP_TRAITS_MAKE_SIGNED_H
#define PBL_CPP_TRAITS_MAKE_SIGNED_H

#ifndef CPP11
#include "config/arch.h"

namespace cpp11
{
// std::make_signed
template< typename T >
struct make_signed
{
};

template< >
struct make_signed< char >
{
	typedef signed char type;
};

template< >
struct make_signed< signed char >
{
	typedef signed char type;
};

template< >
struct make_signed< unsigned char >
{
	typedef signed char type;
};

template< >
struct make_signed< signed short int >
{
	typedef signed short int type;
};

template< >
struct make_signed< unsigned short int >
{
	typedef signed short int type;
};

template< >
struct make_signed< signed int >
{
	typedef signed int type;
};

template< >
struct make_signed< unsigned int >
{
	typedef signed int type;
};

template< >
struct make_signed< signed long int >
{
	typedef signed long int type;
};

template< >
struct make_signed< unsigned long int >
{
	typedef signed long int type;
};

#ifdef HAS_LONG_LONG
template< >
struct make_signed< signed long long int >
{
	typedef signed long long int type;
};

template< >
struct make_signed< unsigned long long int >
{
	typedef signed long long int type;
};
#endif

// const -----------------------------------------------------------------------
template< >
struct make_signed< const char >
{
	typedef const signed char type;
};

template< >
struct make_signed< const signed char >
{
	typedef const signed char type;
};

template< >
struct make_signed< const unsigned char >
{
	typedef const signed char type;
};

template< >
struct make_signed< const signed short int >
{
	typedef const signed short int type;
};

template< >
struct make_signed< const unsigned short int >
{
	typedef const signed short int type;
};

template< >
struct make_signed< const signed int >
{
	typedef const signed int type;
};

template< >
struct make_signed< const unsigned int >
{
	typedef const signed int type;
};

template< >
struct make_signed< const signed long int >
{
	typedef const signed long int type;
};

template< >
struct make_signed< const unsigned long int >
{
	typedef const signed long int type;
};

#ifdef HAS_LONG_LONG
template< >
struct make_signed< const signed long long int >
{
	typedef const signed long long int type;
};

template< >
struct make_signed< const unsigned long long int >
{
	typedef const signed long long int type;
};
#endif

// volatile --------------------------------------------------------------------
template< >
struct make_signed< volatile char >
{
	typedef volatile signed char type;
};

template< >
struct make_signed< volatile signed char >
{
	typedef volatile signed char type;
};

template< >
struct make_signed< volatile unsigned char >
{
	typedef volatile signed char type;
};

template< >
struct make_signed< volatile signed short int >
{
	typedef volatile signed short int type;
};

template< >
struct make_signed< volatile unsigned short int >
{
	typedef volatile signed short int type;
};

template< >
struct make_signed< volatile signed int >
{
	typedef volatile signed int type;
};

template< >
struct make_signed< volatile unsigned int >
{
	typedef volatile signed int type;
};

template< >
struct make_signed< volatile signed long int >
{
	typedef volatile signed long int type;
};

template< >
struct make_signed< volatile unsigned long int >
{
	typedef volatile signed long int type;
};

#ifdef HAS_LONG_LONG
template< >
struct make_signed< volatile signed long long int >
{
	typedef volatile signed long long int type;
};

template< >
struct make_signed< volatile unsigned long long int >
{
	typedef volatile signed long long int type;
};
#endif

// const volatile --------------------------------------------------------------
template< >
struct make_signed< const volatile char >
{
	typedef const volatile signed char type;
};

template< >
struct make_signed< const volatile signed char >
{
	typedef const volatile signed char type;
};

template< >
struct make_signed< const volatile unsigned char >
{
	typedef const volatile signed char type;
};

template< >
struct make_signed< const volatile signed short int >
{
	typedef const volatile signed short int type;
};

template< >
struct make_signed< const volatile unsigned short int >
{
	typedef const volatile signed short int type;
};

template< >
struct make_signed< const volatile signed int >
{
	typedef const volatile signed int type;
};

template< >
struct make_signed< const volatile unsigned int >
{
	typedef const volatile signed int type;
};

template< >
struct make_signed< const volatile signed long int >
{
	typedef const volatile signed long int type;
};

template< >
struct make_signed< const volatile unsigned long int >
{
	typedef const volatile signed long int type;
};

#ifdef HAS_LONG_LONG
template< >
struct make_signed< const volatile signed long long int >
{
	typedef const volatile signed long long int type;
};

template< >
struct make_signed< const volatile unsigned long long int >
{
	typedef const volatile signed long long int type;
};
#endif
}

#else
#ifndef CPP14
namespace cpp14
{
template< class T >
using make_signed_t = typename std::make_signed< T >::type;
}
#endif
#endif // ifndef CPP11
#endif // PBL_CPP_TRAITS_MAKE_SIGNED_H


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Arundinaria nitida Mitford

### Remarks
null


text:
\documentclass[manual-fr.tex]{subfiles}
\begin{document}

\begin{itemize}
    \item[] \textbf{description}
        \begin{itemize}
            \item[]
        \end{itemize}
    \item[] \textbf{arguments}
        \begin{itemize}
            \item[]
                \begin{itemize}
                    \item[]
                \end{itemize}
        \end{itemize}
    \item[] \textbf{options}
        \begin{itemize}
            \item[] --help ou -h : switch
                \begin{itemize}
                    \item[] affiche l'aide
                \end{itemize}
            \item[]
                \begin{itemize}
                    \item[]
                \end{itemize}
            \item[] --input-encoding : string
                \begin{itemize}
                    \item[] définit l'encodage du fichier d'entrée. Prioritaire sur la valeur de --encoding (défaut : --encoding).
                \end{itemize}
            \item[] --output-encoding : string
                \begin{itemize}
                    \item[] définit l'encodage du fichier de sortie. Prioritaire sur la valeur de --encoding (défaut : --encoding).
                \end{itemize}
            \item[] --encoding : string
                \begin{itemize}
                    \item[] définit l'encodage du fichier d'entrée et de sortie. Si un encodage est fourni pour un fichier,
                        cette valeur est surchargée (défaut : UTF-8).
                \end{itemize}
            \item[] --log ou -l : string
                \begin{itemize}
                    \item[] définit le niveau de log : info, warn ou critical (défaut : critical).
                \end{itemize}
            \item[] --log-file : fichier
                \begin{itemize}
                    \item[] le fichier où écrire le log (défaut : sortie terminal).
                \end{itemize}
        \end{itemize}
\end{itemize}

\end{document}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Flora, Jena 45: 487 (1862)

#### Original name
Lecidea erythrocarpia (Pers.) Ach.

### Remarks
null


text:
require 'spec_helper'

describe PayXML::Message do
 it 'creates a valid xml string' do
   message = PayXML::Message.new( '10011013800', 'test' )
   xml_doc  = Nokogiri::XML(message.xml_string)
   expect(xml_doc.xpath("//protocol").first['ver']).to eq('4.0')
   expect(xml_doc.xpath("//protocol").first['pgid']).to eq('10011013800')
   expect(xml_doc.xpath("//protocol").first['pwd']).to eq('test')
 end

 it 'parses an xml string' do
   message = PayXML::Message.allocate
   message.parse( '<protocol ver="4.0" pgid="10011013800" pwd="test">' )
   expect(message.paygate_id).to eq('10011013800')
   expect(message.paygate_password).to eq('test')
 end
end


text:
'use strict';

const ColorPropType = require('ColorPropType');
const EdgeInsetsPropType = require('EdgeInsetsPropType');
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
const React = require('React');
const PropTypes = require('prop-types');
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const StyleSheetPropType = require('StyleSheetPropType');
const TextStylePropTypes = require('TextStylePropTypes');
const Touchable = require('Touchable');

const createReactClass = require('create-react-class');
const createReactNativeComponentClass = require('createReactNativeComponentClass');
const mergeFast = require('mergeFast');
const processColor = require('processColor');

const stylePropType = StyleSheetPropType(TextStylePropTypes);

const viewConfig = {
  validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
    isHighlighted: true,
    numberOfLines: true,
    ellipsizeMode: true,
    allowFontScaling: true,
    disabled: true,
    selectable: true,
    selectionColor: true,
    adjustsFontSizeToFit: true,
    minimumFontScale: true,
    textBreakStrategy: true,
  }),
  uiViewClassName: 'RCTText',
};

/**
 * A React component for displaying text.
 *
 * `Text` supports nesting, styling, and touch handling.
 *
 * In the following example, the nested title and body text will inherit the
 * `fontFamily` from `styles.baseText`, but the title provides its own
 * additional styles.  The title and body will stack on top of each other on
 * account of the literal newlines:
 *
 * ```ReactNativeWebPlayer
 * import React, { Component } from 'react';
 * import { AppRegistry, Text, StyleSheet } from 'react-native';
 *
 * export default class TextInANest extends Component {
 *   constructor(props) {
 *     super(props);
 *     this.state = {
 *       titleText: "Bird's Nest",
 *       bodyText: 'This is not really a bird nest.'
 *     };
 *   }
 *
 *   render() {
 *     return (
 *       <Text style={styles.baseText}>
 *         <Text style={styles.titleText} onPress={this.onPressTitle}>
 *           {this.state.titleText}{'\n'}{'\n'}
 *         </Text>
 *         <Text numberOfLines={5}>
 *           {this.state.bodyText}
 *         </Text>
 *       </Text>
 *     );
 *   }
 * }
 *
 * const styles = StyleSheet.create({
 *   baseText: {
 *     fontFamily: 'Cochin',
 *   },
 *   titleText: {
 *     fontSize: 20,
 *     fontWeight: 'bold',
 *   },
 * });
 *
 * // skip this line if using Create React Native App
 * AppRegistry.registerComponent('TextInANest', () => TextInANest);
 * ```
 *
 * ## Nested text
 *
 * Both iOS and Android allow you to display formatted text by annotating
 * ranges of a string with specific formatting like bold or colored text
 * (`NSAttributedString` on iOS, `SpannableString` on Android). In practice,
 * this is very tedious. For React Native, we decided to use web paradigm for
 * this where you can nest text to achieve the same effect.
 *
 *
 * ```ReactNativeWebPlayer
 * import React, { Component } from 'react';
 * import { AppRegistry, Text } from 'react-native';
 *
 * export default class BoldAndBeautiful extends Component {
 *   render() {
 *     return (
 *       <Text style={{fontWeight: 'bold'}}>
 *         I am bold
 *         <Text style={{color: 'red'}}>
 *           and red
 *         </Text>
 *       </Text>
 *     );
 *   }
 * }
 *
 * // skip this line if using Create React Native App
 * AppRegistry.registerComponent('AwesomeProject', () => BoldAndBeautiful);
 * ```
 *
 * Behind the scenes, React Native converts this to a flat `NSAttributedString`
 * or `SpannableString` that contains the following information:
 *
 * ```javascript
 * "I am bold and red"
 * 0-9: bold
 * 9-17: bold, red
 * ```
 *
 * ## Nested views (iOS only)
 *
 * On iOS, you can nest views within your Text component. Here's an example:
 *
 * ```ReactNativeWebPlayer
 * import React, { Component } from 'react';
 * import { AppRegistry, Text, View } from 'react-native';
 *
 * export default class BlueIsCool extends Component {
 *   render() {
 *     return (
 *       <Text>
 *         There is a blue square
 *         <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
 *         in between my text.
 *       </Text>
 *     );
 *   }
 * }
 *
 * // skip this line if using Create React Native App
 * AppRegistry.registerComponent('AwesomeProject', () => BlueIsCool);
 * ```
 *
 * > In order to use this feature, you must give the view a `width` and a `height`.
 *
 * ## Containers
 *
 * The `<Text>` element is special relative to layout: everything inside is no
 * longer using the flexbox layout but using text layout. This means that
 * elements inside of a `<Text>` are no longer rectangles, but wrap when they
 * see the end of the line.
 *
 * ```javascript
 * <Text>
 *   <Text>First part and </Text>
 *   <Text>second part</Text>
 * </Text>
 * // Text container: all the text flows as if it was one
 * // |First part |
 * // |and second |
 * // |part       |
 *
 * <View>
 *   <Text>First part and </Text>
 *   <Text>second part</Text>
 * </View>
 * // View container: each text is its own block
 * // |First part |
 * // |and        |
 * // |second part|
 * ```
 *
 * ## Limited Style Inheritance
 *
 * On the web, the usual way to set a font family and size for the entire
 * document is to take advantage of inherited CSS properties like so:
 *
 * ```css
 * html {
 *   font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
 *   font-size: 11px;
 *   color: #141823;
 * }
 * ```
 *
 * All elements in the document will inherit this font unless they or one of
 * their parents specifies a new rule.
 *
 * In React Native, we are more strict about it: **you must wrap all the text
 * nodes inside of a `<Text>` component**. You cannot have a text node directly
 * under a `<View>`.
 *
 *
 * ```javascript
 * // BAD: will raise exception, can't have a text node as child of a <View>
 * <View>
 *   Some text
 * </View>
 *
 * // GOOD
 * <View>
 *   <Text>
 *     Some text
 *   </Text>
 * </View>
 * ```
 *
 * You also lose the ability to set up a default font for an entire subtree.
 * The recommended way to use consistent fonts and sizes across your
 * application is to create a component `MyAppText` that includes them and use
 * this component across your app. You can also use this component to make more
 * specific components like `MyAppHeaderText` for other kinds of text.
 *
 * ```javascript
 * <View>
 *   <MyAppText>Text styled with the default font for the entire application</MyAppText>
 *   <MyAppHeaderText>Text styled as a header</MyAppHeaderText>
 * </View>
 * ```
 *
 * Assuming that `MyAppText` is a component that simply renders out its
 * children into a `Text` component with styling, then `MyAppHeaderText` can be
 * defined as follows:
 *
 * ```javascript
 * class MyAppHeaderText extends Component {
 *   render() {
 *     <MyAppText>
 *       <Text style={{fontSize: 20}}>
 *         {this.props.children}
 *       </Text>
 *     </MyAppText>
 *   }
 * }
 * ```
 *
 * Composing `MyAppText` in this way ensures that we get the styles from a
 * top-level component, but leaves us the ability to add / override them in
 * specific use cases.
 *
 * React Native still has the concept of style inheritance, but limited to text
 * subtrees. In this case, the second part will be both bold and red.
 *
 * ```javascript
 * <Text style={{fontWeight: 'bold'}}>
 *   I am bold
 *   <Text style={{color: 'red'}}>
 *     and red
 *   </Text>
 * </Text>
 * ```
 *
 * We believe that this more constrained way to style text will yield better
 * apps:
 *
 * - (Developer) React components are designed with strong isolation in mind:
 * You should be able to drop a component anywhere in your application,
 * trusting that as long as the props are the same, it will look and behave the
 * same way. Text properties that could inherit from outside of the props would
 * break this isolation.
 *
 * - (Implementor) The implementation of React Native is also simplified. We do
 * not need to have a `fontFamily` field on every single element, and we do not
 * need to potentially traverse the tree up to the root every time we display a
 * text node. The style inheritance is only encoded inside of the native Text
 * component and doesn't leak to other components or the system itself.
 *
 */

const Text = createReactClass({
  displayName: 'Text',
  propTypes: {
    /**
     * When `numberOfLines` is set, this prop defines how text will be truncated.
     * `numberOfLines` must be set in conjunction with this prop.
     *
     * This can be one of the following values:
     *
     * - `head` - The line is displayed so that the end fits in the container and the missing text
     * at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
     * - `middle` - The line is displayed so that the beginning and end fit in the container and the
     * missing text in the middle is indicated by an ellipsis glyph. "ab...yz"
     * - `tail` - The line is displayed so that the beginning fits in the container and the
     * missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..."
     * - `clip` - Lines are not drawn past the edge of the text container.
     *
     * The default is `tail`.
     *
     * > `clip` is working only for iOS
     */
    ellipsizeMode: PropTypes.oneOf(['head', 'middle', 'tail', 'clip']),
    /**
     * Used to truncate the text with an ellipsis after computing the text
     * layout, including line wrapping, such that the total number of lines
     * does not exceed this number.
     *
     * This prop is commonly used with `ellipsizeMode`.
     */
    numberOfLines: PropTypes.number,
    /**
     * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced`
     * The default value is `highQuality`.
     * @platform android
     */
    textBreakStrategy: PropTypes.oneOf(['simple', 'highQuality', 'balanced']),
    /**
     * Invoked on mount and layout changes with
     *
     *   `{nativeEvent: {layout: {x, y, width, height}}}`
     */
    onLayout: PropTypes.func,
    /**
     * This function is called on press.
     *
     * e.g., `onPress={() => console.log('1st')}`
     */
    onPress: PropTypes.func,
    /**
     * This function is called on long press.
     *
     * e.g., `onLongPress={this.increaseSize}>`
     */
    onLongPress: PropTypes.func,
    /**
     * When the scroll view is disabled, this defines how far your touch may
     * move off of the button, before deactivating the button. Once deactivated,
     * try moving it back and you'll see that the button is once again
     * reactivated! Move it back and forth several times while the scroll view
     * is disabled. Ensure you pass in a constant to reduce memory allocations.
     */
    pressRetentionOffset: EdgeInsetsPropType,
    /**
     * Lets the user select text, to use the native copy and paste functionality.
     */
    selectable: PropTypes.bool,
    /**
     * The highlight color of the text.
     * @platform android
     */
    selectionColor: ColorPropType,
    /**
     * When `true`, no visual change is made when text is pressed down. By
     * default, a gray oval highlights the text on press down.
     * @platform ios
     */
    suppressHighlighting: PropTypes.bool,
    style: stylePropType,
    /**
     * Used to locate this view in end-to-end tests.
     */
    testID: PropTypes.string,
    /**
     * Used to locate this view from native code.
     */
    nativeID: PropTypes.string,
    /**
     * Specifies whether fonts should scale to respect Text Size accessibility settings. The
     * default is `true`.
     */
    allowFontScaling: PropTypes.bool,
    /**
     * When set to `true`, indicates that the view is an accessibility element. The default value
     * for a `Text` element is `true`.
     *
     * See the
     * [Accessibility guide](docs/accessibility.html#accessible-ios-android)
     * for more information.
     */
    accessible: PropTypes.bool,
    /**
     * Specifies whether font should be scaled down automatically to fit given style constraints.
     * @platform ios
     */
    adjustsFontSizeToFit: PropTypes.bool,

    /**
     * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
     * @platform ios
     */
    minimumFontScale: PropTypes.number,
    /**
     * Specifies the disabled state of the text view for testing purposes
     * @platform android
     */
    disabled: PropTypes.bool,
  },
  getDefaultProps(): Object {
    return {
      accessible: true,
      allowFontScaling: true,
      ellipsizeMode: 'tail',
    };
  },
  getInitialState: function(): Object {
    return mergeFast(Touchable.Mixin.touchableGetInitialState(), {
      isHighlighted: false,
    });
  },
  mixins: [NativeMethodsMixin],
  viewConfig: viewConfig,
  getChildContext(): Object {
    return {isInAParentText: true};
  },
  childContextTypes: {
    isInAParentText: PropTypes.bool
  },
  contextTypes: {
    isInAParentText: PropTypes.bool
  },
  /**
   * Only assigned if touch is needed.
   */
  _handlers: (null: ?Object),
  _hasPressHandler(): boolean {
    return !!this.props.onPress || !!this.props.onLongPress;
  },
  /**
   * These are assigned lazily the first time the responder is set to make plain
   * text nodes as cheap as possible.
   */
  touchableHandleActivePressIn: (null: ?Function),
  touchableHandleActivePressOut: (null: ?Function),
  touchableHandlePress: (null: ?Function),
  touchableHandleLongPress: (null: ?Function),
  touchableGetPressRectOffset: (null: ?Function),
  render(): React.Element<any> {
    let newProps = this.props;
    if (this.props.onStartShouldSetResponder || this._hasPressHandler()) {
      if (!this._handlers) {
        this._handlers = {
          onStartShouldSetResponder: (): bool => {
            const shouldSetFromProps = this.props.onStartShouldSetResponder &&
                // $FlowFixMe(>=0.41.0)
                this.props.onStartShouldSetResponder();
            const setResponder = shouldSetFromProps || this._hasPressHandler();
            if (setResponder && !this.touchableHandleActivePressIn) {
              // Attach and bind all the other handlers only the first time a touch
              // actually happens.
              for (const key in Touchable.Mixin) {
                if (typeof Touchable.Mixin[key] === 'function') {
                  (this: any)[key] = Touchable.Mixin[key].bind(this);
                }
              }
              this.touchableHandleActivePressIn = () => {
                if (this.props.suppressHighlighting || !this._hasPressHandler()) {
                  return;
                }
                this.setState({
                  isHighlighted: true,
                });
              };

              this.touchableHandleActivePressOut = () => {
                if (this.props.suppressHighlighting || !this._hasPressHandler()) {
                  return;
                }
                this.setState({
                  isHighlighted: false,
                });
              };

              this.touchableHandlePress = (e: SyntheticEvent<>) => {
                this.props.onPress && this.props.onPress(e);
              };

              this.touchableHandleLongPress = (e: SyntheticEvent<>) => {
                this.props.onLongPress && this.props.onLongPress(e);
              };

              this.touchableGetPressRectOffset = function(): RectOffset {
                return this.props.pressRetentionOffset || PRESS_RECT_OFFSET;
              };
            }
            return setResponder;
          },
          onResponderGrant: function(e: SyntheticEvent<>, dispatchID: string) {
            this.touchableHandleResponderGrant(e, dispatchID);
            this.props.onResponderGrant &&
              this.props.onResponderGrant.apply(this, arguments);
          }.bind(this),
          onResponderMove: function(e: SyntheticEvent<>) {
            this.touchableHandleResponderMove(e);
            this.props.onResponderMove &&
              this.props.onResponderMove.apply(this, arguments);
          }.bind(this),
          onResponderRelease: function(e: SyntheticEvent<>) {
            this.touchableHandleResponderRelease(e);
            this.props.onResponderRelease &&
              this.props.onResponderRelease.apply(this, arguments);
          }.bind(this),
          onResponderTerminate: function(e: SyntheticEvent<>) {
            this.touchableHandleResponderTerminate(e);
            this.props.onResponderTerminate &&
              this.props.onResponderTerminate.apply(this, arguments);
          }.bind(this),
          onResponderTerminationRequest: function(): bool {
            // Allow touchable or props.onResponderTerminationRequest to deny
            // the request
            var allowTermination = this.touchableHandleResponderTerminationRequest();
            if (allowTermination && this.props.onResponderTerminationRequest) {
              allowTermination = this.props.onResponderTerminationRequest.apply(this, arguments);
            }
            return allowTermination;
          }.bind(this),
        };
      }
      newProps = {
        ...this.props,
        ...this._handlers,
        isHighlighted: this.state.isHighlighted,
      };
    }
    if (newProps.selectionColor != null) {
      newProps = {
        ...newProps,
        selectionColor: processColor(newProps.selectionColor)
      };
    }
    if (Touchable.TOUCH_TARGET_DEBUG && newProps.onPress) {
      newProps = {
        ...newProps,
        style: [this.props.style, {color: 'magenta'}],
      };
    }
    if (this.context.isInAParentText) {
      return <RCTVirtualText {...newProps} />;
    } else {
      return <RCTText {...newProps} />;
    }
  },
});

type RectOffset = {
  top: number,
  left: number,
  right: number,
  bottom: number,
}

var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};

var RCTText = createReactNativeComponentClass(
  viewConfig.uiViewClassName,
  () => viewConfig
);
var RCTVirtualText = RCTText;

if (Platform.OS === 'android') {
  RCTVirtualText = createReactNativeComponentClass('RCTVirtualText', () => ({
    validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
      isHighlighted: true,
    }),
    uiViewClassName: 'RCTVirtualText',
  }));
}

module.exports = Text;


text:
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;

namespace Capgemini.CommonObjectUtils.Tests.EnumerableTests
{
    [TestClass]
    public class AnEmptyEnumerable
    {
        [TestMethod]
        public void DoesNotCallTheForEachAction()
        {
            var action = MockRepository.GenerateMock<Action<string>>();

            GivenAnEmptyEnumerable().ForEach(action);

            action.AssertWasNotCalled(a => a.Invoke(Arg<string>.Is.Anything));
        }

        private static IEnumerable<string> GivenAnEmptyEnumerable()
        {
            return new string[0];
        }
    }
}


text:
<?php
session_start();
ini_set('display_errors', 'Off');
ini_set('display_startup_errors', 'Off');
error_reporting(0);

include("../class/mysql.class.php");

function username_from_id($id)
{
	 $db1 = new MySQL(true);
	 if ($db1->Error()) $db1->Kill();
	 $db1->Open();
	 $sql = "select username from users where iduser ='".$id."'";
	// echo $sql."
";
	 $results = $db1->QueryArray($sql);
	return $results[0]['username'];
}

function filename_from_ut($ut)
{
	 $db1 = new MySQL(true);
	 if ($db1->Error()) $db1->Kill();
	 $db1->Open();
	 $sql = "select filename from crypted where uploadticket ='".$ut."'";
	// echo $sql."
";
	 $results = $db1->QueryArray($sql);
	return basename($results[0]['filename']);
}

function view_notify()
{
 $db1 = new MySQL(true);
 if ($db1->Error()) $db1->Kill();
 $db1->Open();
 $sql = "select idnotification,title, text,from_not,not_date,status from notification where iduser = '".$_SESSION['iduser']."' order by not_date desc";
 //echo $sql."
";
 $results = $db1->QueryArray($sql);
 $db1->Close();
 $res = "

Elimina

Mittente

Data

Titolo

Testo

Stato

";
 for ($i=0;$i<count($results);$i++)
  {
	  $res .= "

".$results[$i]['from_not']."

".$results[$i]['not_date']."

".$results[$i]['title']."

".$results[$i]['text']."

".$results[$i]['status']."

";
  }
return $res . "
";
}

echo view_notify();
?>


text:
PlaylistsEXT
============

An extended playlists for YouTube.

> This project is a META-Project in pre-alpha version, contributions are very welcome!

# Using draft
Visit [PlaylistsEXT](http://edineisc.com.br/PlaylistsEXT/) example the id of this [video](https://www.youtube.com/watch?v=D4ZKlT1EvCA) is this example the id is D4ZKlT1EvCA

Create a test for [Selenium](http://www.seleniumhq.org/) to facilitate this in [tests/](https://github.com/neiesc/PlaylistsEXT/tree/gh-pages/tests).


text:
#ifndef MUSICINDICATOR_H
#define MUSICINDICATOR_H

#include <QDBusServiceWatcher>
#include <QString>
#include <QStringList>

class MusicServiceProxy;

class MusicIndicator : public QObject
{
    Q_OBJECT;
    Q_PROPERTY(QString state READ state NOTIFY stateChanged);

public:
    explicit MusicIndicator(QObject *parent = NULL);
    ~MusicIndicator();

    QString state() const;

signals:
    void stateChanged();

private:
    bool innerIsValid() const;
    MusicServiceProxy *m_innerMI;
    QDBusServiceWatcher *m_serviceWatcher;

private slots:
    void serviceRegistered();
    void serviceUnregistered();
};

#endif // MUSICINDICATOR_H


text:
"use strict";

System.register([], function (_export, _context) {
    "use strict";

    var _createClass, SetTenantEditionWindow;

    function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) {
            throw new TypeError("Cannot call a class as a function");
        }
    }

    return {
        setters: [],
        execute: function () {
            _createClass = function () {
                function defineProperties(target, props) {
                    for (var i = 0; i < props.length; i++) {
                        var descriptor = props[i];
                        descriptor.enumerable = descriptor.enumerable || false;
                        descriptor.configurable = true;
                        if ("value" in descriptor) descriptor.writable = true;
                        Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }

                return function (Constructor, protoProps, staticProps) {
                    if (protoProps) defineProperties(Constructor.prototype, protoProps);
                    if (staticProps) defineProperties(Constructor, staticProps);
                    return Constructor;
                };
            }();

            _export("SetTenantEditionWindow", SetTenantEditionWindow = function () {
                function SetTenantEditionWindow() {
                    _classCallCheck(this, SetTenantEditionWindow);
                }

                _createClass(SetTenantEditionWindow, [{
                    key: "load",
                    value: function load() {
                        $(document).ready(function () {
                            var tenantService = abp.services.app.tenant;
                            var $form = $("#setTenantEdition");

                            $form.on("submit", function (e) {

                                e.preventDefault();

                                var editionId = $('input[name=edition]:checked', "#setTenantEdition").val();
                                var tenantId = $("#TenantId").val();
                                var data = {
                                    tenantId: tenantId,
                                    editionId: editionId
                                };

                                abp.ui.setBusy($form, tenantService.setTenantEdition(data).done(function () {

                                    periModal.close();
                                }));
                            });
                        });
                    }
                }]);

                return SetTenantEditionWindow;
            }());

            _export("SetTenantEditionWindow", SetTenantEditionWindow);
        }
    };
});