text:
using blink::WebAudioBus;
using blink::WebCookie;
using blink::WebData;
using blink::WebLocalizedString;
using blink::WebPluginListBuilder;
using blink::WebString;
using blink::WebSocketStreamHandle;
using blink::WebURL;
using blink::WebURLError;
using blink::WebURLLoader;
using blink::WebVector;

namespace {

// A simple class to cache the memory usage for a given amount of time.
class MemoryUsageCache {
 public:
  // Retrieves the Singleton.
  static MemoryUsageCache* GetInstance() {
    return Singleton<MemoryUsageCache>::get();
  }

  MemoryUsageCache() : memory_value_(0) { Init(); }
  ~MemoryUsageCache() {}

  void Init() {
    const unsigned int kCacheSeconds = 1;
    cache_valid_time_ = base::TimeDelta::FromSeconds(kCacheSeconds);
  }

  // Returns true if the cached value is fresh.
  // Returns false if the cached value is stale, or if |cached_value| is NULL.
  bool IsCachedValueValid(size_t* cached_value) {
    base::AutoLock scoped_lock(lock_);
    if (!cached_value)
      return false;
    if (base::Time::Now() - last_updated_time_ > cache_valid_time_)
      return false;
    *cached_value = memory_value_;
    return true;
  };

  // Setter for |memory_value_|, refreshes |last_updated_time_|.
  void SetMemoryValue(const size_t value) {
    base::AutoLock scoped_lock(lock_);
    memory_value_ = value;
    last_updated_time_ = base::Time::Now();
  }

 private:
  // The cached memory value.
  size_t memory_value_;

  // How long the cached value should remain valid.
  base::TimeDelta cache_valid_time_;

  // The last time the cached value was updated.
  base::Time last_updated_time_;

  base::Lock lock_;
};

}  // anonymous namespace

namespace webkit_glue {

static int ToMessageID(WebLocalizedString::Name name) {
  switch (name) {
    case WebLocalizedString::AXAMPMFieldText:
      return IDS_AX_AM_PM_FIELD_TEXT;
    case WebLocalizedString::AXButtonActionVerb:
      return IDS_AX_BUTTON_ACTION_VERB;
    case WebLocalizedString::AXCheckedCheckBoxActionVerb:
      return IDS_AX_CHECKED_CHECK_BOX_ACTION_VERB;
    case WebLocalizedString::AXDateTimeFieldEmptyValueText:
      return IDS_AX_DATE_TIME_FIELD_EMPTY_VALUE_TEXT;
    case WebLocalizedString::AXDayOfMonthFieldText:
      return IDS_AX_DAY_OF_MONTH_FIELD_TEXT;
    case WebLocalizedString::AXHeadingText:
      return IDS_AX_ROLE_HEADING;
    case WebLocalizedString::AXHourFieldText:
      return IDS_AX_HOUR_FIELD_TEXT;
    case WebLocalizedString::AXImageMapText:
      return IDS_AX_ROLE_IMAGE_MAP;
    case WebLocalizedString::AXLinkActionVerb:
      return IDS_AX_LINK_ACTION_VERB;
    case WebLocalizedString::AXLinkText:
      return IDS_AX_ROLE_LINK;
    case WebLocalizedString::AXListMarkerText:
      return IDS_AX_ROLE_LIST_MARKER;
    case WebLocalizedString::AXMediaDefault:
      return IDS_AX_MEDIA_DEFAULT;
    case WebLocalizedString::AXMediaAudioElement:
      return IDS_AX_MEDIA_AUDIO_ELEMENT;
    case WebLocalizedString::AXMediaVideoElement:
      return IDS_AX_MEDIA_VIDEO_ELEMENT;
    case WebLocalizedString::AXMediaMuteButton:
      return IDS_AX_MEDIA_MUTE_BUTTON;
    case WebLocalizedString::AXMediaUnMuteButton:
      return IDS_AX_MEDIA_UNMUTE_BUTTON;
    case WebLocalizedString::AXMediaPlayButton:
      return IDS_AX_MEDIA_PLAY_BUTTON;
    case WebLocalizedString::AXMediaPauseButton:
      return IDS_AX_MEDIA_PAUSE_BUTTON;
    case WebLocalizedString::AXMediaSlider:
      return IDS_AX_MEDIA_SLIDER;
    case WebLocalizedString::AXMediaSliderThumb:
      return IDS_AX_MEDIA_SLIDER_THUMB;
    case WebLocalizedString::AXMediaRewindButton:
      return IDS_AX_MEDIA_REWIND_BUTTON;
    case WebLocalizedString::AXMediaReturnToRealTime:
      return IDS_AX_MEDIA_RETURN_TO_REALTIME_BUTTON;
    case WebLocalizedString::AXMediaCurrentTimeDisplay:
      return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY;
    case WebLocalizedString::AXMediaTimeRemainingDisplay:
      return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY;
    case WebLocalizedString::AXMediaStatusDisplay:
      return IDS_AX_MEDIA_STATUS_DISPLAY;
    case WebLocalizedString::AXMediaEnterFullscreenButton:
      return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON;
    case WebLocalizedString::AXMediaExitFullscreenButton:
      return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON;
  case WebLocalizedString::AXMediaSeekForwardButton:
    return IDS_AX_MEDIA_SEEK_FORWARD_BUTTON;
    case WebLocalizedString::AXMediaSeekBackButton:
      return IDS_AX_MEDIA_SEEK_BACK_BUTTON;
    case WebLocalizedString::AXMediaShowClosedCaptionsButton:
      return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON;
    case WebLocalizedString::AXMediaHideClosedCaptionsButton:
      return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON;
    case WebLocalizedString::AXMediaAudioElementHelp:
      return IDS_AX_MEDIA_AUDIO_ELEMENT_HELP;
    case WebLocalizedString::AXMediaVideoElementHelp:
      return IDS_AX_MEDIA_VIDEO_ELEMENT_HELP;
    case WebLocalizedString::AXMediaMuteButtonHelp:
      return IDS_AX_MEDIA_MUTE_BUTTON_HELP;
    case WebLocalizedString::AXMediaUnMuteButtonHelp:
      return IDS_AX_MEDIA_UNMUTE_BUTTON_HELP;
    case WebLocalizedString::AXMediaPlayButtonHelp:
      return IDS_AX_MEDIA_PLAY_BUTTON_HELP;
    case WebLocalizedString::AXMediaPauseButtonHelp:
      return IDS_AX_MEDIA_PAUSE_BUTTON_HELP;
    case WebLocalizedString::AXMediaSliderHelp:
      return IDS_AX_MEDIA_SLIDER_HELP;
    case WebLocalizedString::AXMediaSliderThumbHelp:
      return IDS_AX_MEDIA_SLIDER_THUMB_HELP;
    case WebLocalizedString::AXMediaRewindButtonHelp:
      return IDS_AX_MEDIA_REWIND_BUTTON_HELP;
    case WebLocalizedString::AXMediaReturnToRealTimeHelp:
      return IDS_AX_MEDIA_RETURN_TO_REALTIME_BUTTON_HELP;
    case WebLocalizedString::AXMediaCurrentTimeDisplayHelp:
      return IDS_AX_MEDIA_CURRENT_TIME_DISPLAY_HELP;
    case WebLocalizedString::AXMediaTimeRemainingDisplayHelp:
      return IDS_AX_MEDIA_TIME_REMAINING_DISPLAY_HELP;
    case WebLocalizedString::AXMediaStatusDisplayHelp:
      return IDS_AX_MEDIA_STATUS_DISPLAY_HELP;
    case WebLocalizedString::AXMediaEnterFullscreenButtonHelp:
      return IDS_AX_MEDIA_ENTER_FULL_SCREEN_BUTTON_HELP;
    case WebLocalizedString::AXMediaExitFullscreenButtonHelp:
      return IDS_AX_MEDIA_EXIT_FULL_SCREEN_BUTTON_HELP;
  case WebLocalizedString::AXMediaSeekForwardButtonHelp:
    return IDS_AX_MEDIA_SEEK_FORWARD_BUTTON_HELP;
    case WebLocalizedString::AXMediaSeekBackButtonHelp:
      return IDS_AX_MEDIA_SEEK_BACK_BUTTON_HELP;
    case WebLocalizedString::AXMediaShowClosedCaptionsButtonHelp:
      return IDS_AX_MEDIA_SHOW_CLOSED_CAPTIONS_BUTTON_HELP;
    case WebLocalizedString::AXMediaHideClosedCaptionsButtonHelp:
      return IDS_AX_MEDIA_HIDE_CLOSED_CAPTIONS_BUTTON_HELP;
    case WebLocalizedString::AXMillisecondFieldText:
      return IDS_AX_MILLISECOND_FIELD_TEXT;
    case WebLocalizedString::AXMinuteFieldText:
      return IDS_AX_MINUTE_FIELD_TEXT;
    case WebLocalizedString::AXMonthFieldText:
      return IDS_AX_MONTH_FIELD_TEXT;
    case WebLocalizedString::AXRadioButtonActionVerb:
      return IDS_AX_RADIO_BUTTON_ACTION_VERB;
    case WebLocalizedString::AXSecondFieldText:
      return IDS_AX_SECOND_FIELD_TEXT;
    case WebLocalizedString::AXTextFieldActionVerb:
      return IDS_AX_TEXT_FIELD_ACTION_VERB;
    case WebLocalizedString::AXUncheckedCheckBoxActionVerb:
      return IDS_AX_UNCHECKED_CHECK_BOX_ACTION_VERB;
    case WebLocalizedString::AXWebAreaText:
      return IDS_AX_ROLE_WEB_AREA;
    case WebLocalizedString::AXWeekOfYearFieldText:
      return IDS_AX_WEEK_OF_YEAR_FIELD_TEXT;
    case WebLocalizedString::AXYearFieldText:
      return IDS_AX_YEAR_FIELD_TEXT;
    case WebLocalizedString::CalendarClear:
      return IDS_FORM_CALENDAR_CLEAR;
    case WebLocalizedString::CalendarToday:
      return IDS_FORM_CALENDAR_TODAY;
    case WebLocalizedString::DateFormatDayInMonthLabel:
      return IDS_FORM_DATE_FORMAT_DAY_IN_MONTH;
    case WebLocalizedString::DateFormatMonthLabel:
      return IDS_FORM_DATE_FORMAT_MONTH;
    case WebLocalizedString::DateFormatYearLabel:
      return IDS_FORM_DATE_FORMAT_YEAR;
    case WebLocalizedString::DetailsLabel:
      return IDS_DETAILS_WITHOUT_SUMMARY_LABEL;
    case WebLocalizedString::FileButtonChooseFileLabel:
      return IDS_FORM_FILE_BUTTON_LABEL;
    case WebLocalizedString::FileButtonChooseMultipleFilesLabel:
      return IDS_FORM_MULTIPLE_FILES_BUTTON_LABEL;
    case WebLocalizedString::FileButtonNoFileSelectedLabel:
      return IDS_FORM_FILE_NO_FILE_LABEL;
    case WebLocalizedString::InputElementAltText:
      return IDS_FORM_INPUT_ALT;
    case WebLocalizedString::KeygenMenuHighGradeKeySize:
      return IDS_KEYGEN_HIGH_GRADE_KEY;
    case WebLocalizedString::KeygenMenuMediumGradeKeySize:
      return IDS_KEYGEN_MED_GRADE_KEY;
    case WebLocalizedString::MissingPluginText:
      return IDS_PLUGIN_INITIALIZATION_ERROR;
    case WebLocalizedString::MultipleFileUploadText:
      return IDS_FORM_FILE_MULTIPLE_UPLOAD;
    case WebLocalizedString::OtherColorLabel:
      return IDS_FORM_OTHER_COLOR_LABEL;
    case WebLocalizedString::OtherDateLabel:
        return IDS_FORM_OTHER_DATE_LABEL;
    case WebLocalizedString::OtherMonthLabel:
      return IDS_FORM_OTHER_MONTH_LABEL;
    case WebLocalizedString::OtherTimeLabel:
      return IDS_FORM_OTHER_TIME_LABEL;
    case WebLocalizedString::OtherWeekLabel:
      return IDS_FORM_OTHER_WEEK_LABEL;
    case WebLocalizedString::PlaceholderForDayOfMonthField:
      return IDS_FORM_PLACEHOLDER_FOR_DAY_OF_MONTH_FIELD;
    case WebLocalizedString::PlaceholderForMonthField:
      return IDS_FORM_PLACEHOLDER_FOR_MONTH_FIELD;
    case WebLocalizedString::PlaceholderForYearField:
      return IDS_FORM_PLACEHOLDER_FOR_YEAR_FIELD;
    case WebLocalizedString::ResetButtonDefaultLabel:
      return IDS_FORM_RESET_LABEL;
    case WebLocalizedString::SearchableIndexIntroduction:
      return IDS_SEARCHABLE_INDEX_INTRO;
    case WebLocalizedString::SearchMenuClearRecentSearchesText:
      return IDS_RECENT_SEARCHES_CLEAR;
    case WebLocalizedString::SearchMenuNoRecentSearchesText:
      return IDS_RECENT_SEARCHES_NONE;
    case WebLocalizedString::SearchMenuRecentSearchesText:
      return IDS_RECENT_SEARCHES;
    case WebLocalizedString::SubmitButtonDefaultLabel:
      return IDS_FORM_SUBMIT_LABEL;
    case WebLocalizedString::ThisMonthButtonLabel:
      return IDS_FORM_THIS_MONTH_LABEL;
    case WebLocalizedString::ThisWeekButtonLabel:
      return IDS_FORM_THIS_WEEK_LABEL;
    case WebLocalizedString::ValidationBadInputForDateTime:
      return IDS_FORM_VALIDATION_BAD_INPUT_DATETIME;
    case WebLocalizedString::ValidationBadInputForNumber:
      return IDS_FORM_VALIDATION_BAD_INPUT_NUMBER;
    case WebLocalizedString::ValidationPatternMismatch:
      return IDS_FORM_VALIDATION_PATTERN_MISMATCH;
    case WebLocalizedString::ValidationRangeOverflow:
      return IDS_FORM_VALIDATION_RANGE_OVERFLOW;
    case WebLocalizedString::ValidationRangeOverflowDateTime:
      return IDS_FORM_VALIDATION_RANGE_OVERFLOW_DATETIME;
    case WebLocalizedString::ValidationRangeUnderflow:
      return IDS_FORM_VALIDATION_RANGE_UNDERFLOW;
    case WebLocalizedString::ValidationRangeUnderflowDateTime:
      return IDS_FORM_VALIDATION_RANGE_UNDERFLOW_DATETIME;
    case WebLocalizedString::ValidationStepMismatch:
      return IDS_FORM_VALIDATION_STEP_MISMATCH;
    case WebLocalizedString::ValidationStepMismatchCloseToLimit:
      return IDS_FORM_VALIDATION_STEP_MISMATCH_CLOSE_TO_LIMIT;
    case WebLocalizedString::ValidationTooLong:
      return IDS_FORM_VALIDATION_TOO_LONG;
    case WebLocalizedString::ValidationTypeMismatch:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH;
    case WebLocalizedString::ValidationTypeMismatchForEmail:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL;
    case WebLocalizedString::ValidationTypeMismatchForEmailEmpty:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY;
    case WebLocalizedString::ValidationTypeMismatchForEmailEmptyDomain:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_DOMAIN;
    case WebLocalizedString::ValidationTypeMismatchForEmailEmptyLocal:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_LOCAL;
    case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDomain:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOMAIN;
    case WebLocalizedString::ValidationTypeMismatchForEmailInvalidDots:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOTS;
    case WebLocalizedString::ValidationTypeMismatchForEmailInvalidLocal:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_LOCAL;
    case WebLocalizedString::ValidationTypeMismatchForEmailNoAtSign:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_NO_AT_SIGN;
    case WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL;
    case WebLocalizedString::ValidationTypeMismatchForURL:
      return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL;
    case WebLocalizedString::ValidationValueMissing:
      return IDS_FORM_VALIDATION_VALUE_MISSING;
    case WebLocalizedString::ValidationValueMissingForCheckbox:
      return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX;
    case WebLocalizedString::ValidationValueMissingForFile:
      return IDS_FORM_VALIDATION_VALUE_MISSING_FILE;
    case WebLocalizedString::ValidationValueMissingForMultipleFile:
      return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE;
    case WebLocalizedString::ValidationValueMissingForRadio:
      return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO;
    case WebLocalizedString::ValidationValueMissingForSelect:
      return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT;
    case WebLocalizedString::WeekFormatTemplate:
      return IDS_FORM_INPUT_WEEK_TEMPLATE;
    case WebLocalizedString::WeekNumberLabel:
      return IDS_FORM_WEEK_NUMBER_LABEL;
    // This "default:" line exists to avoid compile warnings about enum
    // coverage when we add a new symbol to WebLocalizedString.h in WebKit.
    // After a planned WebKit patch is landed, we need to add a case statement
    // for the added symbol here.
    default:
      break;
  }
  return -1;
}

WebKitPlatformSupportImpl::WebKitPlatformSupportImpl()
    : main_loop_(base::MessageLoop::current()),
      shared_timer_func_(NULL),
      shared_timer_fire_time_(0.0),
      shared_timer_fire_time_was_set_while_suspended_(false),
      shared_timer_suspended_(0) {}

WebKitPlatformSupportImpl::~WebKitPlatformSupportImpl() {
}

WebURLLoader* WebKitPlatformSupportImpl::createURLLoader() {
  return new WebURLLoaderImpl(this);
}

WebSocketStreamHandle* WebKitPlatformSupportImpl::createSocketStreamHandle() {
  return new WebSocketStreamHandleImpl(this);
}

WebString WebKitPlatformSupportImpl::userAgent(const WebURL& url) {
  return WebString::fromUTF8(webkit_glue::GetUserAgent(url));
}

WebData WebKitPlatformSupportImpl::parseDataURL(
    const WebURL& url,
    WebString& mimetype_out,
    WebString& charset_out) {
  std::string mime_type, char_set, data;
  if (net::DataURL::Parse(url, &mime_type, &char_set, &data)
      && net::IsSupportedMimeType(mime_type)) {
    mimetype_out = WebString::fromUTF8(mime_type);
    charset_out = WebString::fromUTF8(char_set);
    return data;
  }
  return WebData();
}

WebURLError WebKitPlatformSupportImpl::cancelledError(
    const WebURL& unreachableURL) const {
  return WebURLLoaderImpl::CreateError(unreachableURL, net::ERR_ABORTED);
}

void WebKitPlatformSupportImpl::decrementStatsCounter(const char* name) {
  base::StatsCounter(name).Decrement();
}

void WebKitPlatformSupportImpl::incrementStatsCounter(const char* name) {
  base::StatsCounter(name).Increment();
}

void WebKitPlatformSupportImpl::histogramCustomCounts(
    const char* name, int sample, int min, int max, int bucket_count) {
  // Copied from histogram macro, but without the static variable caching
  // the histogram because name is dynamic.
  base::HistogramBase* counter =
      base::Histogram::FactoryGet(name, min, max, bucket_count,
          base::HistogramBase::kUmaTargetedHistogramFlag);
  DCHECK_EQ(name, counter->histogram_name());
  counter->Add(sample);
}

void WebKitPlatformSupportImpl::histogramEnumeration(
    const char* name, int sample, int boundary_value) {
  // Copied from histogram macro, but without the static variable caching
  // the histogram because name is dynamic.
  base::HistogramBase* counter =
      base::LinearHistogram::FactoryGet(name, 1, boundary_value,
          boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag);
  DCHECK_EQ(name, counter->histogram_name());
  counter->Add(sample);
}

void WebKitPlatformSupportImpl::histogramSparse(const char* name, int sample) {
  // For sparse histograms, we can use the macro, as it does not incorporate a
  // static.
  UMA_HISTOGRAM_SPARSE_SLOWLY(name, sample);
}

const unsigned char* WebKitPlatformSupportImpl::getTraceCategoryEnabledFlag(
    const char* category_group) {
  return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group);
}

long* WebKitPlatformSupportImpl::getTraceSamplingState(
    const unsigned thread_bucket) {
  switch (thread_bucket) {
    case 0:
      return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(0));
    case 1:
      return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(1));
    case 2:
      return reinterpret_cast<long*>(&TRACE_EVENT_API_THREAD_BUCKET(2));
    default:
      NOTREACHED() << "Unknown thread bucket type.";
  }
  return NULL;
}

COMPILE_ASSERT(
    sizeof(blink::Platform::TraceEventHandle) ==
        sizeof(base::debug::TraceEventHandle),
    TraceEventHandle_types_must_be_same_size);

blink::Platform::TraceEventHandle WebKitPlatformSupportImpl::addTraceEvent(
    char phase,
    const unsigned char* category_group_enabled,
    const char* name,
    unsigned long long id,
    int num_args,
    const char** arg_names,
    const unsigned char* arg_types,
    const unsigned long long* arg_values,
    unsigned char flags) {
  base::debug::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT(
      phase, category_group_enabled, name, id,
      num_args, arg_names, arg_types, arg_values, NULL, flags);
  blink::Platform::TraceEventHandle result;
  memcpy(&result, &handle, sizeof(result));
  return result;
}

void WebKitPlatformSupportImpl::updateTraceEventDuration(
    const unsigned char* category_group_enabled,
    const char* name,
    TraceEventHandle handle) {
  base::debug::TraceEventHandle traceEventHandle;
  memcpy(&traceEventHandle, &handle, sizeof(handle));
  TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
      category_group_enabled, name, traceEventHandle);
}

namespace {

WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform,
                                        const char* name) {
#ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE
  if (!strcmp(name, "Composite")) {
    base::StringPiece resource =
        platform->GetDataResource(IDR_AUDIO_SPATIALIZATION_COMPOSITE,
                                  ui::SCALE_FACTOR_NONE);
    return WebData(resource.data(), resource.size());
  }
#endif

#ifdef IDR_AUDIO_SPATIALIZATION_T000_P000
  const size_t kExpectedSpatializationNameLength = 31;
  if (strlen(name) != kExpectedSpatializationNameLength) {
    return WebData();
  }

  // Extract the azimuth and elevation from the resource name.
  int azimuth = 0;
  int elevation = 0;
  int values_parsed =
      sscanf(name, "IRC_Composite_C_R0195_T%3d_P%3d", &azimuth, &elevation);
  if (values_parsed != 2) {
    return WebData();
  }

  // The resource index values go through the elevations first, then azimuths.
  const int kAngleSpacing = 15;

  // 0 <= elevation <= 90 (or 315 <= elevation <= 345)
  // in increments of 15 degrees.
  int elevation_index =
      elevation <= 90 ? elevation / kAngleSpacing :
      7 + (elevation - 315) / kAngleSpacing;
  bool is_elevation_index_good = 0 <= elevation_index && elevation_index < 10;

  // 0 <= azimuth < 360 in increments of 15 degrees.
  int azimuth_index = azimuth / kAngleSpacing;
  bool is_azimuth_index_good = 0 <= azimuth_index && azimuth_index < 24;

  const int kNumberOfElevations = 10;
  const int kNumberOfAudioResources = 240;
  int resource_index = kNumberOfElevations * azimuth_index + elevation_index;
  bool is_resource_index_good = 0 <= resource_index &&
      resource_index < kNumberOfAudioResources;

  if (is_azimuth_index_good && is_elevation_index_good &&
      is_resource_index_good) {
    const int kFirstAudioResourceIndex = IDR_AUDIO_SPATIALIZATION_T000_P000;
    base::StringPiece resource =
        platform->GetDataResource(kFirstAudioResourceIndex + resource_index,
                                  ui::SCALE_FACTOR_NONE);
    return WebData(resource.data(), resource.size());
  }
#endif  // IDR_AUDIO_SPATIALIZATION_T000_P000

  NOTREACHED();
  return WebData();
}

struct DataResource {
  const char* name;
  int id;
  ui::ScaleFactor scale_factor;
};

const DataResource kDataResources[] = {
  { "missingImage", IDR_BROKENIMAGE, ui::SCALE_FACTOR_100P },
  { "missingImage@2x", IDR_BROKENIMAGE, ui::SCALE_FACTOR_200P },
  { "mediaplayerPause", IDR_MEDIAPLAYER_PAUSE_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerPauseHover",
    IDR_MEDIAPLAYER_PAUSE_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerPauseDown",
    IDR_MEDIAPLAYER_PAUSE_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerPlay", IDR_MEDIAPLAYER_PLAY_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerPlayHover",
    IDR_MEDIAPLAYER_PLAY_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerPlayDown",
    IDR_MEDIAPLAYER_PLAY_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerPlayDisabled",
    IDR_MEDIAPLAYER_PLAY_BUTTON_DISABLED, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel3",
    IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel3Hover",
    IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel3Down",
    IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel2",
    IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel2Hover",
    IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel2Down",
    IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel1",
    IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel1Hover",
    IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel1Down",
    IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel0",
    IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel0Hover",
    IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundLevel0Down",
    IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerSoundDisabled",
    IDR_MEDIAPLAYER_SOUND_DISABLED, ui::SCALE_FACTOR_100P },
  { "mediaplayerSliderThumb",
    IDR_MEDIAPLAYER_SLIDER_THUMB, ui::SCALE_FACTOR_100P },
  { "mediaplayerSliderThumbHover",
    IDR_MEDIAPLAYER_SLIDER_THUMB_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerSliderThumbDown",
    IDR_MEDIAPLAYER_SLIDER_THUMB_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerVolumeSliderThumb",
    IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB, ui::SCALE_FACTOR_100P },
  { "mediaplayerVolumeSliderThumbHover",
    IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerVolumeSliderThumbDown",
    IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerVolumeSliderThumbDisabled",
    IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DISABLED, ui::SCALE_FACTOR_100P },
  { "mediaplayerClosedCaption",
    IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerClosedCaptionHover",
    IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerClosedCaptionDown",
    IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerClosedCaptionDisabled",
    IDR_MEDIAPLAYER_CLOSEDCAPTION_BUTTON_DISABLED, ui::SCALE_FACTOR_100P },
  { "mediaplayerFullscreen",
    IDR_MEDIAPLAYER_FULLSCREEN_BUTTON, ui::SCALE_FACTOR_100P },
  { "mediaplayerFullscreenHover",
    IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_HOVER, ui::SCALE_FACTOR_100P },
  { "mediaplayerFullscreenDown",
    IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DOWN, ui::SCALE_FACTOR_100P },
  { "mediaplayerFullscreenDisabled",
    IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DISABLED, ui::SCALE_FACTOR_100P },
#if defined(OS_ANDROID)
  { "mediaplayerOverlayPlay",
    IDR_MEDIAPLAYER_OVERLAY_PLAY_BUTTON, ui::SCALE_FACTOR_100P },
#endif
#if defined(OS_MACOSX)
  { "overhangPattern", IDR_OVERHANG_PATTERN, ui::SCALE_FACTOR_100P },
  { "overhangShadow", IDR_OVERHANG_SHADOW, ui::SCALE_FACTOR_100P },
#endif
  { "panIcon", IDR_PAN_SCROLL_ICON, ui::SCALE_FACTOR_100P },
  { "searchCancel", IDR_SEARCH_CANCEL, ui::SCALE_FACTOR_100P },
  { "searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED, ui::SCALE_FACTOR_100P },
  { "searchMagnifier", IDR_SEARCH_MAGNIFIER, ui::SCALE_FACTOR_100P },
  { "searchMagnifierResults",
    IDR_SEARCH_MAGNIFIER_RESULTS, ui::SCALE_FACTOR_100P },
  { "textAreaResizeCorner", IDR_TEXTAREA_RESIZER, ui::SCALE_FACTOR_100P },
  { "textAreaResizeCorner@2x", IDR_TEXTAREA_RESIZER, ui::SCALE_FACTOR_200P },
  { "inputSpeech", IDR_INPUT_SPEECH, ui::SCALE_FACTOR_100P },
  { "inputSpeechRecording", IDR_INPUT_SPEECH_RECORDING, ui::SCALE_FACTOR_100P },
  { "inputSpeechWaiting", IDR_INPUT_SPEECH_WAITING, ui::SCALE_FACTOR_100P },
  { "americanExpressCC", IDR_AUTOFILL_CC_AMEX, ui::SCALE_FACTOR_100P },
  { "dinersCC", IDR_AUTOFILL_CC_DINERS, ui::SCALE_FACTOR_100P },
  { "discoverCC", IDR_AUTOFILL_CC_DISCOVER, ui::SCALE_FACTOR_100P },
  { "genericCC", IDR_AUTOFILL_CC_GENERIC, ui::SCALE_FACTOR_100P },
  { "jcbCC", IDR_AUTOFILL_CC_JCB, ui::SCALE_FACTOR_100P },
  { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD, ui::SCALE_FACTOR_100P },
  { "visaCC", IDR_AUTOFILL_CC_VISA, ui::SCALE_FACTOR_100P },
  { "generatePassword", IDR_PASSWORD_GENERATION_ICON, ui::SCALE_FACTOR_100P },
  { "generatePasswordHover",
    IDR_PASSWORD_GENERATION_ICON_HOVER, ui::SCALE_FACTOR_100P },
  { "syntheticTouchCursor",
    IDR_SYNTHETIC_TOUCH_CURSOR, ui::SCALE_FACTOR_100P },
};

}  // namespace

WebData WebKitPlatformSupportImpl::loadResource(const char* name) {
  // Some clients will call into this method with an empty |name| when they have
  // optional resources.  For example, the PopupMenuChromium code can have icons
  // for some Autofill items but not for others.
  if (!strlen(name))
    return WebData();

  // Check the name prefix to see if it's an audio resource.
  if (StartsWithASCII(name, "IRC_Composite", true) ||
      StartsWithASCII(name, "Composite", true))
    return loadAudioSpatializationResource(this, name);

  // TODO(flackr): We should use a better than linear search here, a trie would
  // be ideal.
  for (size_t i = 0; i < arraysize(kDataResources); ++i) {
    if (!strcmp(name, kDataResources[i].name)) {
      base::StringPiece resource =
          GetDataResource(kDataResources[i].id,
                          kDataResources[i].scale_factor);
      return WebData(resource.data(), resource.size());
    }
  }

  NOTREACHED() << "Unknown image resource " << name;
  return WebData();
}

WebString WebKitPlatformSupportImpl::queryLocalizedString(
    WebLocalizedString::Name name) {
  int message_id = ToMessageID(name);
  if (message_id < 0)
    return WebString();
  return GetLocalizedString(message_id);
}

WebString WebKitPlatformSupportImpl::queryLocalizedString(
    WebLocalizedString::Name name, int numeric_value) {
  return queryLocalizedString(name, base::IntToString16(numeric_value));
}

WebString WebKitPlatformSupportImpl::queryLocalizedString(
    WebLocalizedString::Name name, const WebString& value) {
  int message_id = ToMessageID(name);
  if (message_id < 0)
    return WebString();
  return ReplaceStringPlaceholders(GetLocalizedString(message_id), value, NULL);
}

WebString WebKitPlatformSupportImpl::queryLocalizedString(
    WebLocalizedString::Name name,
    const WebString& value1,
    const WebString& value2) {
  int message_id = ToMessageID(name);
  if (message_id < 0)
    return WebString();
  std::vector<base::string16> values;
  values.reserve(2);
  values.push_back(value1);
  values.push_back(value2);
  return ReplaceStringPlaceholders(
      GetLocalizedString(message_id), values, NULL);
}

double WebKitPlatformSupportImpl::currentTime() {
  return base::Time::Now().ToDoubleT();
}

double WebKitPlatformSupportImpl::monotonicallyIncreasingTime() {
  return base::TimeTicks::Now().ToInternalValue() /
      static_cast<double>(base::Time::kMicrosecondsPerSecond);
}

void WebKitPlatformSupportImpl::cryptographicallyRandomValues(
    unsigned char* buffer, size_t length) {
  base::RandBytes(buffer, length);
}

void WebKitPlatformSupportImpl::setSharedTimerFiredFunction(void (*func)()) {
  shared_timer_func_ = func;
}

void WebKitPlatformSupportImpl::setSharedTimerFireInterval(
    double interval_seconds) {
  shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime();
  if (shared_timer_suspended_) {
    shared_timer_fire_time_was_set_while_suspended_ = true;
    return;
  }

  // By converting between double and int64 representation, we run the risk
  // of losing precision due to rounding errors. Performing computations in
  // microseconds reduces this risk somewhat. But there still is the potential
  // of us computing a fire time for the timer that is shorter than what we
  // need.
  // As the event loop will check event deadlines prior to actually firing
  // them, there is a risk of needlessly rescheduling events and of
  // needlessly looping if sleep times are too short even by small amounts.
  // This results in measurable performance degradation unless we use ceil() to
  // always round up the sleep times.
  int64 interval = static_cast<int64>(
      ceil(interval_seconds * base::Time::kMillisecondsPerSecond)
      * base::Time::kMicrosecondsPerMillisecond);

  if (interval < 0)
    interval = 0;

  shared_timer_.Stop();
  shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval),
                      this, &WebKitPlatformSupportImpl::DoTimeout);
  OnStartSharedTimer(base::TimeDelta::FromMicroseconds(interval));
}

void WebKitPlatformSupportImpl::stopSharedTimer() {
  shared_timer_.Stop();
}

void WebKitPlatformSupportImpl::callOnMainThread(
    void (*func)(void*), void* context) {
  main_loop_->PostTask(FROM_HERE, base::Bind(func, context));
}

base::PlatformFile WebKitPlatformSupportImpl::databaseOpenFile(
    const blink::WebString& vfs_file_name, int desired_flags) {
  return base::kInvalidPlatformFileValue;
}

int WebKitPlatformSupportImpl::databaseDeleteFile(
    const blink::WebString& vfs_file_name, bool sync_dir) {
  return -1;
}

long WebKitPlatformSupportImpl::databaseGetFileAttributes(
    const blink::WebString& vfs_file_name) {
  return 0;
}

long long WebKitPlatformSupportImpl::databaseGetFileSize(
    const blink::WebString& vfs_file_name) {
  return 0;
}

long long WebKitPlatformSupportImpl::databaseGetSpaceAvailableForOrigin(
    const blink::WebString& origin_identifier) {
  return 0;
}

blink::WebString WebKitPlatformSupportImpl::signedPublicKeyAndChallengeString(
    unsigned key_size_index,
    const blink::WebString& challenge,
    const blink::WebURL& url) {
  return blink::WebString("");
}

static scoped_ptr<base::ProcessMetrics> CurrentProcessMetrics() {
  using base::ProcessMetrics;
#if defined(OS_MACOSX)
  return scoped_ptr<ProcessMetrics>(
      // The default port provider is sufficient to get data for the current
      // process.
      ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle(),
                                           NULL));
#else
  return scoped_ptr<ProcessMetrics>(
      ProcessMetrics::CreateProcessMetrics(base::GetCurrentProcessHandle()));
#endif
}

static size_t getMemoryUsageMB(bool bypass_cache) {
  size_t current_mem_usage = 0;
  MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::GetInstance();
  if (!bypass_cache &&
      mem_usage_cache_singleton->IsCachedValueValid(&current_mem_usage))
    return current_mem_usage;

  current_mem_usage = MemoryUsageKB() >> 10;
  mem_usage_cache_singleton->SetMemoryValue(current_mem_usage);
  return current_mem_usage;
}

size_t WebKitPlatformSupportImpl::memoryUsageMB() {
  return getMemoryUsageMB(false);
}

size_t WebKitPlatformSupportImpl::actualMemoryUsageMB() {
  return getMemoryUsageMB(true);
}

size_t WebKitPlatformSupportImpl::physicalMemoryMB() {
  return static_cast<size_t>(base::SysInfo::AmountOfPhysicalMemoryMB());
}

size_t WebKitPlatformSupportImpl::numberOfProcessors() {
  return static_cast<size_t>(base::SysInfo::NumberOfProcessors());
}

void WebKitPlatformSupportImpl::startHeapProfiling(
  const blink::WebString& prefix) {
  // FIXME(morrita): Make this built on windows.
#if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
  HeapProfilerStart(prefix.utf8().data());
#endif
}

void WebKitPlatformSupportImpl::stopHeapProfiling() {
#if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
  HeapProfilerStop();
#endif
}

void WebKitPlatformSupportImpl::dumpHeapProfiling(
  const blink::WebString& reason) {
#if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
  HeapProfilerDump(reason.utf8().data());
#endif
}

WebString WebKitPlatformSupportImpl::getHeapProfile() {
#if !defined(NO_TCMALLOC) && defined(USE_TCMALLOC) && !defined(OS_WIN)
  char* data = GetHeapProfile();
  WebString result = WebString::fromUTF8(std::string(data));
  free(data);
  return result;
#else
  return WebString();
#endif
}

bool WebKitPlatformSupportImpl::processMemorySizesInBytes(
    size_t* private_bytes,
    size_t* shared_bytes) {
  return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes);
}

bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* size) {
  return base::allocator::GetAllocatorWasteSize(size);
}

size_t WebKitPlatformSupportImpl::maxDecodedImageBytes() {
#if defined(OS_ANDROID)
  if (base::android::SysUtils::IsLowEndDevice()) {
    // Limit image decoded size to 3M pixels on low end devices.
    // 4 is maximum number of bytes per pixel.
    return 3 * 1024 * 1024 * 4;
  }
  // For other devices, limit decoded image size based on the amount of physical
  // memory. For a device with 2GB physical memory the limit is 16M pixels.
  return base::SysInfo::AmountOfPhysicalMemory() / 32;
#else
  return noDecodedImageByteLimit;
#endif
}

void WebKitPlatformSupportImpl::SuspendSharedTimer() {
  ++shared_timer_suspended_;
}

void WebKitPlatformSupportImpl::ResumeSharedTimer() {
  // The shared timer may have fired or been adjusted while we were suspended.
  if (--shared_timer_suspended_ == 0 &&
      (!shared_timer_.IsRunning() ||
       shared_timer_fire_time_was_set_while_suspended_)) {
    shared_timer_fire_time_was_set_while_suspended_ = false;
    setSharedTimerFireInterval(
        shared_timer_fire_time_ - monotonicallyIncreasingTime());
  }
}

}  // namespace webkit_glue


text:
        <title>Coverage for Doctrine_Connection_Oracle</title>

Coverage for Doctrine_Connection_Oracle

Back to coverage report

1
<?php

2

21
Doctrine::autoload('Doctrine_Connection');

22
/**

23
 * Doctrine_Connection_Oracle

24
 *

25
 * @package     Doctrine

26
 * @subpackage  Connection

27
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL

28
 * @link        www.phpdoctrine.org

29
 * @since       1.0

30
 * @version     $Revision: 4037 $

31
 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>

32
 */

33
class Doctrine_Connection_Oracle extends Doctrine_Connection

34
{

35
    /**

36
     * @var string $driverName                  the name of this connection driver

37
     */

38
    protected $driverName = 'Oracle';

39

40
    public function __construct(Doctrine_Manager $manager, $adapter)

41
    {

42
        $this->supported = array(

43
                          'sequences'            => true,

44
                          'indexes'              => true,

45
                          'summary_functions'    => true,

46
                          'order_by_text'        => true,

47
                          'current_id'           => true,

48
                          'affected_rows'        => true,

49
                          'transactions'         => true,

50
                          'savepoints'           => true,

51
                          'limit_queries'        => true,

52
                          'LOBs'                 => true,

53
                          'replace'              => 'emulated',

54
                          'sub_selects'          => true,

55
                          'auto_increment'       => false, // implementation is broken

56
                          'primary_key'          => true,

57
                          'result_introspection' => true,

58
                          'prepared_statements'  => true,

59
                          'identifier_quoting'   => true,

60
                          'pattern_escaping'     => true,

61
                          );

62

63
        parent::__construct($manager, $adapter);

64
    }

65

66
    /**

67
     * Sets up the date/time format

68
     *

69
     */

70
    public function setDateFormat($format = 'YYYY-MM-DD HH24:MI:SS')

71
    {

72
      $this->exec('ALTER SESSION SET NLS_DATE_FORMAT = "' . $format . '"');

73
    }

74

75
    /**

76
     * Adds an driver-specific LIMIT clause to the query

77
     *

78
     * @param string $query         query to modify

79
     * @param integer $limit        limit the number of rows

80
     * @param integer $offset       start reading from given offset

81
     * @return string               the modified query

82
     */

83
    public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false)

84
    {

85
        $limit = (int) $limit;

86
        $offset = (int) $offset;

87
        if (preg_match('/^\s*SELECT/i', $query)) {

88
            if ( ! preg_match('/\sFROM\s/i', $query)) {

89
                $query .= " FROM dual";

90
            }

91
            if ($limit > 0) {

92
                // taken from http://svn.ez.no/svn/ezcomponents/packages/Database

93
                $max = $offset + $limit;

94
                if ($offset > 0) {

95
                    $min = $offset + 1;

96
                    $query = 'SELECT * FROM (SELECT a.*, ROWNUM dctrn_rownum FROM (' . $query

97
                           . ') a WHERE ROWNUM <= ' . $max . ') WHERE dctrn_rownum >= ' . $min;

98
                } else {

99
                    $query = 'SELECT a.* FROM (' . $query .') a WHERE ROWNUM <= ' . $max;

100
                }

101
            }

102
        }

103
        return $query;

104
    }

105
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:background="@color/colorBlack"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/ll_top_container"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:background="#222222"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/iv_back2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/back2"/>
    </LinearLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorBlack">

        <include
            layout="@layout/layout_loading"/>

        <include layout="@layout/layout_error"/>

        <FrameLayout
            android:id="@+id/content_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <android.support.v4.view.ViewPager
                android:id="@+id/vp_image_detail_frag"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

            <RelativeLayout
                android:layout_marginTop="460dp"
                android:id="@+id/rl_container"
                android:layout_width="match_parent"
                android:layout_height="261dp"
                android:layout_marginLeft="5dp"
                android:background="@drawable/image_detail_gradient">

                <TextView
                    android:id="@+id/tv_page_no"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/colorRed"
                    android:textSize="18sp"/>

                <TextView
                    android:id="@+id/tv_page_count"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="3dp"
                    android:layout_toRightOf="@id/tv_page_no"
                    android:textColor="@color/colorWhite"
                    android:textSize="18sp"/>

                <TextView
                    android:id="@+id/tv_note_image_detail"
                    android:layout_width="300dp"
                    android:layout_height="wrap_content"
                    android:lines="7"
                    android:layout_below="@id/tv_page_no"
                    android:textColor="@color/colorWhite"/>
            </RelativeLayout>
        </FrameLayout>
    </FrameLayout>
</LinearLayout>


text:
This is an open source implementation of one of the most classic games ever: Pong, where I'll try to use most techniques I've learned in some years using the Unity engine.

The main purpose of this project is an educational one - I've learned game development so much with the help of the community at large and by myself, and I feel I should give back to this same community something - as a programmer and game designer (most the former than the latter) I can give back some coding and game design techniques that I hope would be useful to someone, somewhere.

Maybe this game will be always a work in progress, expanding as I learn new things and new ways to do stuff, but the purpose will stay the same.

WebGL build: https://baraujo.net/games/pong/

Go to the wiki to learn more about this project!


text:
function printPurpose() {
  return ["<div>","An AEM clientlib will create a script.js by default,",
    "this file is a stub for the auto-generated script and should act as a ",
    "starting point for creating customized client scripts","</div>"
  ].join("");
}


text:
<?php
date_default_timezone_set("Europe/Amsterdam");

$path = \Parable\DI\Container::get(\Parable\Filesystem\Path::class);
$path->setBaseDir(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'));

/*
 * And load and register the framework's autoloader
 */
$autoloader = \Parable\DI\Container::get(\Parable\Framework\Autoloader::class);
$autoloader->addLocation($path->getDir("tests/TestClasses"));
$autoloader->register();


text:
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Instances;

namespace Quarks.FluentNHibernate.Conventions.Hibernate
{
	class NotAutoImport : IHibernateMappingConvention
	{
		public void Apply(IHibernateMappingInstance instance)
		{
			instance.Not.AutoImport(); // Required in order to have entity classes with same name under different namespaces
		}
	}
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.kafka;

import com.facebook.presto.spi.ColumnHandle;
import com.facebook.presto.spi.ConnectorPartition;
import com.facebook.presto.spi.HostAddress;
import com.facebook.presto.spi.TupleDomain;
import com.google.common.collect.ImmutableList;

import java.util.List;

import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Kafka specific partition representation. Each partition maps to a topic partition and is split along segment boundaries.
 */
public class KafkaPartition
        implements ConnectorPartition
{
    private final String topicName;
    private final int partitionId;
    private final HostAddress partitionLeader;
    private final List<HostAddress> partitionNodes;

    public KafkaPartition(String topicName,
            int partitionId,
            HostAddress partitionLeader,
            List<HostAddress> partitionNodes)
    {
        this.topicName = checkNotNull(topicName, "schema name is null");
        this.partitionId = partitionId;
        this.partitionLeader = checkNotNull(partitionLeader, "partitionLeader is null");
        this.partitionNodes = ImmutableList.copyOf(checkNotNull(partitionNodes, "partitionNodes is null"));
    }

    @Override
    public String getPartitionId()
    {
        return Integer.toString(partitionId);
    }

    public String getTopicName()
    {
        return topicName;
    }

    public int getPartitionIdAsInt()
    {
        return partitionId;
    }

    public HostAddress getPartitionLeader()
    {
        return partitionLeader;
    }

    public List<HostAddress> getPartitionNodes()
    {
        return partitionNodes;
    }

    @Override
    public TupleDomain<ColumnHandle> getTupleDomain()
    {
        return TupleDomain.all();
    }

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .add("topicName", topicName)
                .add("partitionId", partitionId)
                .add("partitionLeader", partitionLeader)
                .add("partitionNodes", partitionNodes)
                .toString();
    }
}


text:
[![Heroku](http://heroku-badge.herokuapp.com/?app=elsyser&style=flat&root=/static/default.png)](https://elsyser.herokuapp.com/api/register)
[![GitHub stars](https://img.shields.io/github/stars/pu6ki/elsyser.svg?style=flat-square)](https://github.com/pu6ki/elsyser/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/pu6ki/elsyser.svg?style=flat-square)](https://github.com/pu6ki/elsyser/network)
[![GitHub issues](https://img.shields.io/github/issues/pu6ki/elsyser.svg?style=flat-square)](https://github.com/pu6ki/elsyser/issues)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/pu6ki/elsyser/master/LICENSE)
[![Requires.io](https://img.shields.io/requires/github/pu6ki/elsyser.svg?style=flat-square)](https://raw.githubusercontent.com/pu6ki/elsyser/master/requirements.txt)

[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](http://forthebadge.com)
[![forthebadge](http://forthebadge.com/images/badges/made-with-python.svg)](http://forthebadge.com)

![Logo](https://raw.githubusercontent.com/pu6ki/elsyser/master/static/tues_building_with_logo.jpg)

# [elsyser](https://elsyser.herokuapp.com/api/register/)

**elsyser** is a *RESTful API*, written in *Django*. This is part of a school platform that makes communication and resource sharing between students themselves and between students and their teachers easier.

## Project aims
- Making communication between students and teachers easier
- Do not miss a thing:
    - **Exams** - scheduling, details
    - **Homeworks** - details, deadlines, submissions
    - **Materials** - documents that will help students study easier and find more interesting things
    - **News** - notifying things that are important, plan things
    - **Grades** - keep track of your grades as a student and assign grades as a teacher
- Mainly we want to fend off the problem with forgotten exams and homeworks, misunderstood things in school and missing important school-related notifications.

## Prerequisites

- [Python v3.5+](https://www.python.org/downloads/)
- [pip v9.0.1+](https://pypi.python.org/pypi/pip)

## Tech

**elsyser** uses a number of open-source projects to work properly:

* [Django](https://github.com/django/django) - A really nice high-level Python web framework
* [Django REST Framework](https://github.com/tomchristie/django-rest-framework) - Framework for building REST APIs in Django
* [django-cors-headers](https://github.com/ottoyiu/django-cors-headers) - Django app for handling the server headers required for Cross-Origin Resource Sharing (CORS)
* [drf-nested-routers](https://github.com/alanjds/drf-nested-routers) - Nested routing for DRF
* [drf-word-filter](https://github.com/trollknurr/django-rest-framework-word-search-filter) - Word search filter for DRF
* [djoser](https://github.com/sunscrapers/djoser) - REST implementation of Django authentication system
* [drf-docs](https://github.com/manosim/django-rest-framework-docs) - Document Web APIs made with Django REST Framework
* [Visual Studio Code](https://github.com/Microsoft/vscode) - A really nice text editor

## Getting started

How to copy this project to your local machine and run it:

1. Download a copy from GitHub:

    ```
    $ git clone https://github.com/pu6ki/elsyser.git
    $ cd elsyser/
    ```

2. Setup Django requirements:

    ```
    $ pip3 install -r requirements.txt
    $ python3 manage.py makemigrations
    $ python3 manage.py migrate
    ```

3. Create a superuser:

    ```
    $ python3 manage.py createsuperuser
    ```

4. Run the tests:

    ```
    $ python3 manage.py test
    ```

5. Run the server locally:

    ```
    $ python3 manage.py runserver
    ```

## Tutorial

1. `$ python3 manage.py runserver`
2. Visit `http://127.0.0.1:8000/api/register`
3. Create your school account.
4. Then visit `http://127.0.0.1:8000/api/login` and log in with your credentials.
    - Here you will receive your authentication token, which you should pass as authentication header for further requests.
    ![Postman example](https://raw.githubusercontent.com/pu6ki/elsyser/master/static/authorization-example.png)
5. Enjoy! :D

## API Endpoints

### Students app:

- *POST* `/api/register/` - Create new account.
- *PUT* `/api/activate/:activation_key/` - Activate your account (via email).
- *POST* `/api/login/` - Log in.
- *PUT* `/api/password/change/` - Change your password
- *POST* `/api/password/reset/` - Reset your password via email
- *POST* `/api/password/reset/confirm` - Confirm your new password (You should visit this point via the reset email)
- `/api/profile/:user_id/`
    - *GET* - Personal info about the user.
    - *UPDATE* - Update profile info.
- *GET* `/api/subjects/` - List of all subjects in the database.
- *GET* `/api/classes?class_number=arg` - List of all classes (with class number filter).
- *GET* `/api/grades/:subject_id/` - Get list of grades for a certain subject.
- `/api/grades/:subject_id/:user_id/`
    - *GET* - List of grades for a certain user.
    - *POST* - Add a new grade for this user. **(only for teachers)**
- *GET* `/api/students?class_letter=arg1&class_number=arg2&search=arg3` - List of all students in a certain class (with class letter and number filters).
    - You can search by *student's username*.

### Exams app:

- `/api/exams?search=arg`
    - *GET*: List upcoming exams.
        - *Student acc*: Filters exams only for your class.
        - *Teacher acc*: Filters exams posted by this teacher.
        - You can search exams by *topic*
    - *POST*: Schedule an exam. **(only for teachers)**

- `/api/exams/:id/`
    - *GET*: Show certain exam details.
    - *UPDATE*: Edit exam details. **(only for teachers)**
    - *DELETE*: Destroy an exam. **(only for teachers)**

### News app:

- **Common urls**:

***
- `/api/news/*/?search=arg`
    - *GET* - Get news list for a certain group.
    - *POST* - Create a new post.
    - You can search by *title*.
- `/api/news/*/:id/`
    - *GET* - Details about a certain post.
    - *UPDATE* - Update news' details.
    - *DELETE* - Destroy a news.
- `/api/news/*/:id/comments/`
    - *GET* - List comments linked with this news.
    - *POST* - Post a new comment linked with this post.
- `/api/news/*/:id/comments/:comment_id/`
    - *GET* - Show a certain comment.
    - *UPDATE* - Update comment's content.
    - *DELETE* - Destroy a comment.
***

- `/api/news/students`
    - **only accessible by students**
    - All urls correspond the common ones above.
    - You can search by *teacher's username* too.

- `/api/news/teachers/`
    - **only accessible by teachers**
    - *GET* - List news posted by the current teacher.
- `/api/news/teachers/:class_number/`
    - *GET* - Get a list of the news posted by the current teacher for this class.
    - *POST* - Add news for all the classes with this class number.
- `/api/news/teachers/:class_number/:class_letter/`
    - All urls correspond to the common ones above.

### Homeworks app:

- `/api/homeworks?search=arg`
    - *GET* - List current homeworks.
        - *Student acc*: Homeworks about you.
        - *Teacher acc*: Homeworks, posted by you.
    - *POST* - Add a new homework **(only for teachers)**
    - You can search by *subject's title* and *teacher's username*.

- `/api/homeworks/:id/`
    - *GET* - Detailed information about a homework.
    - *UPDATE* - Update homework's info. **(only for teachers)**
    - *DELETE* - Destroy a homework. **(only for teachers)**

- `/api/homeworks/:id/submissions?search=arg`
    - *GET* - Get list of submissions that are not checked yet.
        - *Student acc*: Filters your submissions for this homework.
        - *Teacher acc*: Get submissions from all students.
    - *POST* - Submit a submission for a certain homework. **(only for students)**
    - You can search by *student's username*.

- `/api/homeworks/:id/submissions/:submission_id/`
    - *GET* - Detailed information about a submission.
        - *Student acc*: Only if the submission is posted by you.
    - *UPDATE* - Update submission's details. **(only for students)**

### Materials app:

- `/api/materials?search=arg` - List of useful materials.
    - *Student acc*: Filters materials only linked with your class.
    - *Teacher acc*: Filters materials only linked with your subject.
    - You can search by *title* and *section*.

- `/api/materials/:subject_id/` - Materials linked with a certain subject.
    - *GET* - List of these materials.
    - *POST* - Add a new material for your subject. **(only for teachers)**
    - *UPDATE* - Update material's content. **(only for teachers)**
    - *DELETE* - Remove a material. **(only for teachers)**

## The admin site

1. `$ python3 manage.py runserver`
2. Visit `http://127.0.0.1:8000/admin/`
3. Log in with your superuser data.
4. Here you can add, update and remove your entries.

## Author

- [wencakisa](https://github.com/wencakisa) - Developer of the ELSYSER Platform API
- [matir8](https://github.com/pu6ki/elsyser-web-client) - Developer of the ELSYSER Platform Client

### License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.


text:
<?php
namespace Neos\Flow\Cli;

/**
 * Represents a CommandArgumentDefinition
 *
 */
class CommandArgumentDefinition
{
    /**
     * @var string
     */
    protected $name = '';

    /**
     * @var boolean
     */
    protected $required = false;

    /**
     * @var string
     */
    protected $description = '';

    /**
     * Constructor
     *
     * @param string $name name of the command argument (= parameter name)
     * @param boolean $required defines whether this argument is required or optional
     * @param string $description description of the argument
     */
    public function __construct(string $name, bool $required, string $description)
    {
        $this->name = $name;
        $this->required = $required;
        $this->description = $description;
    }

    /**
     * @return string
     */
    public function getName(): string
    {
        return $this->name;
    }

    /**
     * Returns the lowercased name with dashes as word separator
     *
     * @return string
     */
    public function getDashedName(): string
    {
        $dashedName = ucfirst($this->name);
        $dashedName = preg_replace('/([A-Z][a-z0-9]+)/', '$1-', $dashedName);
        return '--' . strtolower(substr($dashedName, 0, -1));
    }

    /**
     * @return string
     */
    public function getDescription(): string
    {
        return $this->description;
    }

    /**
     * @return bool
     */
    public function isRequired(): bool
    {
        return $this->required;
    }
}


text:
Template::Template(const Scope* scope, const FunctionCallNode* def)
    : closure_(scope->MakeClosure()),
      definition_(def) {
}

Template::Template(scoped_ptr<Scope> scope, const FunctionCallNode* def)
    : closure_(scope.Pass()),
      definition_(def) {
}

Template::~Template() {
}

Value Template::Invoke(Scope* scope,
                       const FunctionCallNode* invocation,
                       const std::vector<Value>& args,
                       BlockNode* block,
                       Err* err) const {
  // Don't allow templates to be executed from imported files. Imports are for
  // simple values only.
  if (!EnsureNotProcessingImport(invocation, scope, err))
    return Value();

  // First run the invocation's block. Need to allocate the scope on the heap
  // so we can pass ownership to the template.
  scoped_ptr<Scope> invocation_scope(new Scope(scope));
  if (!FillTargetBlockScope(scope, invocation,
                            invocation->function().value().as_string(),
                            block, args, invocation_scope.get(), err))
    return Value();
  block->Execute(invocation_scope.get(), err);
  if (err->has_error())
    return Value();

  // Set up the scope to run the template and set the current directory for the
  // template (which ScopePerFileProvider uses to base the target-related
  // variables target_gen_dir and target_out_dir on) to be that of the invoker.
  // This way, files don't have to be rebased and target_*_dir works the way
  // people expect (otherwise its to easy to be putting generated files in the
  // gen dir corresponding to an imported file).
  Scope template_scope(closure_.get());
  template_scope.set_source_dir(scope->GetSourceDir());

  ScopePerFileProvider per_file_provider(&template_scope, true);

  // Targets defined in the template go in the collector for the invoking file.
  template_scope.set_item_collector(scope->GetItemCollector());

  // We jump through some hoops to avoid copying the invocation scope when
  // setting it in the template scope (since the invocation scope may have
  // large lists of source files in it and could be expensive to copy).
  //
  // Scope.SetValue will copy the value which will in turn copy the scope, but
  // if we instead create a value and then set the scope on it, the copy can
  // be avoided.
  const char kInvoker[] = "invoker";
  template_scope.SetValue(kInvoker, Value(nullptr, scoped_ptr<Scope>()),
                          invocation);
  Value* invoker_value = template_scope.GetMutableValue(kInvoker, false);
  invoker_value->SetScopeValue(invocation_scope.Pass());
  template_scope.set_source_dir(scope->GetSourceDir());

  const base::StringPiece target_name("target_name");
  template_scope.SetValue(target_name,
                          Value(invocation, args[0].string_value()),
                          invocation);

  // Actually run the template code.
  Value result =
      definition_->block()->Execute(&template_scope, err);
  if (err->has_error()) {
    // If there was an error, append the caller location so the error message
    // displays a stack trace of how it got here.
    err->AppendSubErr(Err(invocation, "whence it was called."));
    return Value();
  }

  // Check for unused variables in the invocation scope. This will find typos
  // of things the caller meant to pass to the template but the template didn't
  // read out.
  //
  // This is a bit tricky because it's theoretically possible for the template
  // to overwrite the value of "invoker" and free the Scope owned by the
  // value. So we need to look it up again and don't do anything if it doesn't
  // exist.
  invoker_value = template_scope.GetMutableValue(kInvoker, false);
  if (invoker_value && invoker_value->type() == Value::SCOPE) {
    if (!invoker_value->scope_value()->CheckForUnusedVars(err))
      return Value();
  }

  // Check for unused variables in the template itself.
  if (!template_scope.CheckForUnusedVars(err))
    return Value();

  return result;
}

LocationRange Template::GetDefinitionRange() const {
  return definition_->GetRange();
}


text:
<!DOCTYPE html>

	<title></title>
	<link rel="stylesheet" type="text/css" href="./style.css">

				Shipper's Name and Address
				Shipper's Account Number

 Not Negoiable

Air waybill

Issued by

Copies 1,2 and 3 of this Air Waybill are originals and have the same validity

				condigree's Name and Address
				condigree's Account Number

				It is agreed that the goods described herin are accepted in apparent good order and condition (except as noted) for carriage SUBJECT TO THE CONDITIOUS OF CONTRACT ON THE REVERSE HEREOF. ALL GOODS MAY BE CARRIED BY ANY OTHER MEANS INCUDING ROAD OR ANY OTHER CARRIER UNLESS SPECIFIC CONTRARY INSTRUCTIONS ARE GIVEN HEREON BY THE SHIPPER AND SHIPPER AGREES THAT THE SHIPMENT MAY BE CARRIED VIA INTERMEDATE STOPPING PLACES WHICH THE CARRIER DEEMS APPROPRIATE. THE SHIPPERS ATTENDION IS DRAWN TO THE NOTICE CONCERNING CARRIER'S LIMITATION OF LIABILITY. Shipper amy increase such limitation of liability by declaring a higher value for carriage and paying a supplemental charge if required.

Issuing Carrier's Agebt Name and City

						Agent's IATA Code

						Account No.

Air port of Departure(Addr. of first Carrier) and regestered Routing

				Accounting Information

To

						By First Carrier

							For Carrier Use Only

to

by

to

by

Curreny

CHGS

WT/VAL

PPD

COLL

Other

PPD

COLL

Declared Value for Carriage

Declared Value for Customs

 Airport of Destination

						Flight/Date

							For Carrier Use Only

 Flight/Date

Amount of Insurance

Insurance- if carrier other insurance, and such insurance is requested in accordance with the conditions the real. indicate amount to be insured in figures in box marked "Amount of Insurance"

				Handling Information
				SCI

No. of places RCP

Cross Weight

Kg
 Ib

Rate Class

commodity item No.

Chargeable Weight

Rate
Charge

Total

Natuire and Quantity of Goods
 (incl. Dimenstions or Volume)

					Prepaid

					Weight Charge

					Collect

					Valation Charge

					Tax

Other Charges

					Total Other Charges Due Agent

					Total Other Charges Due Carrier

				Shipper cerifies that particulars on the face here of are correct and that insofar as any part of the consignment contains dangerous goods, such part is property described by name and is in proper condition for carriage by air according to the applicable Dangerous Goods Regulations.

				Signature of Shipper or his Agent

						total Prepaid

						total collect

						currency conversation Rates

						CC Charges in Dept. Currency

				excuted on (date)
				at (place)
				Signature of issuing Carrier or its Agent

				charges at Destinations

				Total Collect Charges


text:
module ActiveShipping
  class BenchmarkCarrier < Carrier
    cattr_reader :name
    @@name = "Benchmark Carrier"

    def find_rates(origin, destination, packages, options = {})
      origin = Location.from(origin)
      destination = Location.from(destination)
      packages = Array(packages)

      delay_time = generate_simulated_lag

      bogus_estimate = RateEstimate.new(
        origin, destination, @@name,
        "Free Benchmark Shipping", :total_price => 0, :currency => 'USD',
                                   :packages => packages, :delivery_range => [Time.now.utc.strftime("%Y-%d-%m"), Time.now.utc.strftime("%Y-%d-%m")]
        )
      RateResponse.new(true, "Success (delayed #{delay_time} seconds)", {:rate => 'free'}, :rates => [bogus_estimate], :xml => "<rate>free</rate>")
    end

    private

    def generate_simulated_lag(max_delay = 30)
      sleep Random.rand * max_delay
    end
  end
end


text:
import React from 'react';

import assign from 'object-assign'
import classnames from 'classnames';

import { View }  from   "./View.js"

import Config from   "./common/Config.js"
import Utils from   "./common/Utils.js"

import { HLayout }  from   "../components/HLayout.js"

export class Radio extends React.Component {

    static propTypes = {
        fontSize: React.PropTypes.string,       // 字体大小
        fontColor: React.PropTypes.string,      // 字体颜色
        iconColor: React.PropTypes.string,      // 背景颜色
        iconedColor: React.PropTypes.string,    // 选中背景颜色
        label: React.PropTypes.string,          // 点击后颜色
        space:React.PropTypes.string,           // 间隔
        checked:React.PropTypes.bool,           // 是否被选中
        icon:React.PropTypes.func,             // icon图片
        iconed:React.PropTypes.func             // icon 选中图片
    };

    static defaultProps = {
        fontSize: Config.RadioFontSize,       // 字体大小
        fontColor: Config.RadioFontColor,      // 字体颜色
        iconColor:Config.RadioIconColor,       // 颜色
        iconedColor:Config.RadioIconedColor,       // 颜色
        label: '',      // 点击后颜色
        space:'',      // 间隔
        h:Config.RadioHeight,
        checked:false,     // 是否被选中
        icon:Config.RadioIcon,
        iconed:Config.RadioIconed
    };

    constructor(props) {

        super(props);
        const {
            fontSize,
            fontColor,
            iconColor,
            iconedColor,
            icon,
            iconed,
            label,
            space,
            checked,
            h
            } = this.props;

        this.state = {
            fontSize: fontSize,
            fontColor: fontColor,
            iconColor: iconColor,
            iconedColor:iconedColor,
            label: label,
            space: space,
            icon: icon,
            iconed: iconed,
            h: h,
            checked :checked
        };
    };

    onTouchTap(e) {

        this.setState({checked: !this.state.checked});
        var onTouchTap = this.props.onTouchTap;
        if (onTouchTap) {
            onTouchTap(e);
        }
        e.preventDefault();

    }

    render() {
        const {
            h,
            fontSize,
            fontColor,
            iconColor,       // 背景颜色
            label,           // 文字
            space,           // 图片文字间隔
            ...props
            } = this.props;

        var IOCheckIcon = this.state.icon;
        var iconColorTemp = this.state.iconColor;
        if (this.state.checked == true) {

            IOCheckIcon = this.state.iconed;
            iconColorTemp = this.state.iconedColor;
        }

        return (

            <HLayout flexDirection="row" justifyContent="flex-start"  {...props} onTouchTap={this.onTouchTap.bind(this)}>
                <IOCheckIcon color={iconColorTemp} size={Utils.sizeUnit(this.state.h)}/>
                <View ml={this.state.space} h={this.state.h} fontSize = {this.state.fontSize} fontColor={this.state.fontColor}> {this.state.label}  </View>
            </HLayout >

        );
    }
}


text:
/*
 sgd.go

 Implementation of Stochastic Gradient Descent (SGD).

 author: Timothy A. Mann
 date: August 28, 2014
*/

package goml

import (
	"fmt"
	mat "github.com/skelterjohn/go.matrix"
	"math/rand"
)

const (
	L1_PENALTY = 0
	L2_PENALTY = 1
)

/*
SGD performs Stochastic Gradient Descent.
*/
type SGD struct {
	/*
		The penalty type to apply (L1_PENALTY or L2_PENALTY).
	*/
	PenaltyType int
	/*
		The regularization parameter.
	*/
	Lambda float64
	/*
		The number of iterations to train for.
	*/
	NumIterations int
	/*
		The learning rate used during training.
	*/
	LearningRate float64

	/*
		The number of dimensions of a valid input vector.
	*/
	inputDims int

	/*
		The activation function to apply.
	*/
	afunc ActivationFunction

	/*
		A LinearFunction.
	*/
	f *LinearFunction
}

/*
NewSGD constructs a new SGD instance.

Input
=====
penaltyType : the type of regularization penalty to user during fitting (either L1_PENALTY or L2_PENALTY)
lambda : the regularization parameter (should >= 0)
numIterations : the number of iterations to run during fitting. One iteration corresponds to updating with a single sample.
learningRate : the constant learning rate parameter to use during training
afunc : the activation function to apply to output (nil is interpreted as the identity function)

Returns
=======
a pointer to a new (untrained) SGD instance or an error
*/
func NewSGD(penaltyType int, lambda float64, numIterations int, learningRate float64, afunc ActivationFunction) (*SGD, error) {
	var f *SGD = new(SGD)
	if penaltyType != L1_PENALTY && penaltyType != L2_PENALTY {
		return nil, fmt.Errorf("Invalid regularization penalty type. Valid types are L1_PENALTY or L2_PENALTY.")
	}
	f.PenaltyType = penaltyType
	if lambda < 0.0 {
		return nil, fmt.Errorf("Regularization parameter cannot be negative.")
	}
	f.Lambda = lambda
	if numIterations < 1 {
		return nil, fmt.Errorf("numIterations must be positive.")
	}
	f.NumIterations = numIterations
	f.LearningRate = learningRate

	f.afunc = afunc

	f.inputDims = 0
	f.f = nil
	return f, nil
}

/*
NewCopy returns a new instance of *SGD with the same parameters as this instance,
but it does not copy any weights. So the new instance can be trained with any
(x, y) training samples.

Returns
=======
a new instance of *SGD with the same parameters as this instance
*/
func (self *SGD) NewCopy() (*SGD, error) {
	return NewSGD(self.PenaltyType, self.Lambda, self.NumIterations, self.LearningRate, self.afunc)
}

func (self *SGD) Fit(x mat.MatrixRO, y mat.MatrixRO) error {
	if x.Rows() != y.Rows() {
		return fmt.Errorf("The number of rows in x (%d) does not match the number of rows in y (%d). The matrix x should contain one input vector per row and the vector y should be a column vector containing labels for each input vector.", x.Rows(), y.Rows())
	}
	if y.Cols() != 1 {
		return fmt.Errorf("y must be a column vector.")
	}

	// The number of samples in the data set
	n := x.Rows()
	// Get a dense version of the input matrix
	dx := x.DenseMatrix()

	// If there is no LinearModel yet, then we add one.
	if self.f == nil {
		self.inputDims = x.Cols()
		self.f = new(LinearFunction)
		self.f.Weights = *mat.Zeros(self.inputDims+1, 1)
		self.f.AFunc = self.afunc
	} else if self.inputDims != x.Cols() {
		// If there is an existing linear model, then we only train on
		// additional samples if they match the dimensionality of the previous
		// training data.
		return fmt.Errorf("The number of columns in matrix x does not match the dimension of previous training data. Please construct a new SGD instance.")
	}

	for i := 0; i < self.NumIterations; i++ {
		index := rand.Intn(n)
		xrow := dx.GetRowVector(index)
		xrowb := self.addBiasToMatrix(xrow)
		yhat, err := self.f.Predict(xrowb)
		if err != nil {
			return fmt.Errorf("Error while predicting with internal linear model. %v", err)
		}

		// Compute the activation function's derivative
		yhatPrime := 0.0
		if self.afunc != nil {
			yNoAct, err := xrowb.Times(&self.f.Weights)
			if err != nil {
				return fmt.Errorf("Error while predicting before applying the activation function. %v", err)
			}
			yhatPrime = self.afunc.Deriv(yNoAct.Get(0, 0))
		} else {
			yhatPrime = 1
		}

		diff := y.Get(index, 0) - yhat
		for j := 0; j < self.inputDims+1; j++ {
			// Get the old weight value
			oldw := self.f.Weights.Get(j, 0)
			// Calculate the gradient of the squared error
			grad := 0.0
			if j < self.inputDims {
				grad = (diff * yhatPrime * -xrow.Get(0, j))
			} else {
				// Gradient for the bias
				grad = -diff * yhatPrime
			}

			// Calculate the gradient of the regularization penalty
			gpen := 0.0
			if self.PenaltyType == L1_PENALTY {
				gpen = self.Lambda * signum(oldw)
			} else {
				gpen = self.Lambda * oldw
			}
			// Calculate the change in weight
			alpha := self.LearningRate / float64(self.inputDims)
			deltaw := alpha * (grad + gpen)
			neww := oldw - deltaw
			// Set the new weight
			self.f.Weights.Set(j, 0, neww)
		}
	}

	return nil
}

func (self SGD) addBiasToMatrix(x mat.MatrixRO) *mat.DenseMatrix {
	xb := mat.Ones(x.Rows(), self.InputDims()+1)
	for r := 0; r < x.Rows(); r++ {
		for i := 0; i < self.InputDims(); i++ {
			xb.Set(r, i, x.Get(r, i))
		}
	}
	return xb
}

func (self SGD) Predict(x mat.MatrixRO) (float64, error) {
	if self.f != nil {
		if x.Cols() != self.InputDims() {
			return 0, fmt.Errorf("x has %d columns. Expected %d.", x.Cols(), self.InputDims())
		}
		// Add a bias to the input vector
		xb := self.addBiasToMatrix(x)
		// Make a prediction
		return self.f.Predict(xb)
	} else {
		return 0, fmt.Errorf("Cannot predict before running Fit().")
	}
}

func (self SGD) PredictM(x mat.MatrixRO) (mat.MatrixRO, error) {
	if self.f != nil {
		if x.Cols() != self.InputDims() {
			return nil, fmt.Errorf("x has %d columns. Expected %d.", x.Cols(), self.InputDims())
		}
		// Add biases to the input matrix
		xb := self.addBiasToMatrix(x)
		// Make predictions for each row
		return self.f.PredictM(xb)
	} else {
		return nil, fmt.Errorf("Cannot predict before running Fit().")
	}
}

func (self SGD) InputDims() int {
	return self.inputDims
}

/*
Weights returns the weight vector obtained during the fitting process. If Fit()
has not been executed yet, then the behavior of this method is undefined.

Returns
=======
a column vector of weights (including an additional weight for the bias)
*/
func (self SGD) Weights() mat.DenseMatrix {
	if self.f != nil {
		return self.f.Weights
	} else {
		return *mat.Zeros(1, 1)
	}
}

/*
SqError computes the squared difference between two scalar values a and b.

Input
=====
a : a scalar value
b : a scalar value

Returns
=======
the squared difference between a and b
*/
func SqError(a, b float64) float64 {
	diff := a - b
	return diff * diff
}

/*
signum returns the sign of a float64 as -1, 0, or 1.
*/
func signum(a float64) float64 {
	switch {
	case a < 0:
		return -1.0
	case a > 0:
		return +1.0
	}
	return 0.0
}


text:
Drupal.behaviors.comment = function (context) {
  var parts = new Array("name", "homepage", "mail");
  var cookie = '';
  for (i=0;i<3;i++) {
    cookie = Drupal.comment.getCookie('comment_info_' + parts[i]);
    if (cookie != '') {
      $("#comment-form input[name=" + parts[i] + "]:not(.comment-processed)", context)
        .val(cookie)
        .addClass('comment-processed');
    }
  }
};

Drupal.comment = {};

Drupal.comment.getCookie = function(name) {
  var search = name + '=';
  var returnValue = '';

  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    if (offset != -1) {
      offset += search.length;
      var end = document.cookie.indexOf(';', offset);
      if (end == -1) {
        end = document.cookie.length;
      }
      returnValue = decodeURIComponent(document.cookie.substring(offset, end).replace(/\+/g, '%20'));
    }
  }

  return returnValue;
};


text:
/**
 l10n.js - meant to be used like so:

     require(['l10n!/some/url'], ...

  Depends on text.js plugin.
  **/
define( [ 'text' ], function ( text ) {
  return {
    load: function(name, req, onLoad, config) {
      // Do not bother with the work if a build and text will
      // not be inlined.
      if ( config.isBuild ) {
        onLoad();
        return;
      }
      name = name.replace( /{{lang}}/, 'en-US');
      text.load(name, req, onLoad, config);
    }
  };
});


text:
package bonsai.runtime.synchronous.interfaces;

import bonsai.runtime.synchronous.env.Layer;

public interface BModule
{
  /// Initialize the UIDs of field variables.
  public void __init();
  /// Wrap the process `proc` into variable declarations (such as `SingleSpaceVarDecl`) representing the fields of the class.
  /// If the current module is root (directly passed to `SpaceMachine`), then the reference fields are treated as normal fields.
  public Statement __wrap_process(boolean isRoot, Statement proc);
}


text:
class AddApiIds < ActiveRecord::Migration
  def self.up
    add_column :surveys, :api_id, :string
    add_column :questions, :api_id, :string
    add_column :answers, :api_id, :string
  end

  def self.down
    remove_column :surveys, :api_id
    remove_column :questions, :api_id
    remove_column :answers, :api_id
  end
end


text:
![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)

DroidVoice é um aplicativo para gerar a voz do Google Tradutor no aplicativo, podendo baixa-lo e enviar para qualquer aplicativo.
### Funcionamento

Seu funcionamento é básico, e usa o TTS do google tradutor.
Alén da classe Main, temos a TextToVoice onde se encontra todo a parte para conversão do texto em voz.

License
----

Copyright (c) 2015 droidvoice

Licensed under the MIT license (see LICENSE file)

**Free Software, Hell Yeah!**


text:
"""
common.py

Common routines run throughout ARTView.
"""

# Load the needed packages
from .core import QtGui, QtCore
import numpy as np

########################
# Dialog methods #
########################

def ShowWarning(msg):
    '''
    Show a warning message.

    Parameters::
    ----------
    msg - string
        Message to display in MessageBox.
    '''
    Dialog = QtGui.QDialog()
    flags = QtGui.QMessageBox.StandardButton()
    response = QtGui.QMessageBox.warning(Dialog, "Warning!", msg, flags)
    if response == 0:
        print(msg)
    else:
        print("Warning Discarded!")

    return response

def ShowQuestion(msg):
    '''
    Show a Question message.

    Parameters::
    ----------
    msg - string
        Message to display in MessageBox.
    '''
    Dialog = QtGui.QDialog()
    response = QtGui.QMessageBox.question(
        Dialog, "Question", msg,
        QtGui.QMessageBox.Ok, QtGui.QMessageBox.Cancel)
    if response == QtGui.QMessageBox.Ok:
        print(msg)
    else:
        print("Warning Discarded!")

    return response

def ShowLongText(msg, modal=True, set_html=False):
    '''
    Show a Long message with QTextEdit.

    Parameters::
    ----------
    msg - string
        Message to display in MessageBox.
    '''
    Dialog = QtGui.QDialog()
    Dialog.resize(600, 400)
    layout = QtGui.QGridLayout(Dialog)
    text = QtGui.QTextEdit("")
    layout.addWidget(text, 0, 0)
    text.setAcceptRichText(True)
    text.setReadOnly(True)
    if set_html:
        text.setHtml(msg)
    else:
        text.setText(msg)
    if modal is True:
        response = Dialog.exec_()
        return response
    else:
        response = Dialog.show()
        return Dialog, response

def ShowLongTextHyperlinked(msg, modal=True):
    '''
    Show a Long message with QLabel that will display
    hyperlinks and take user to website.

    Parameters::
    ----------
    msg - string
        Message to display in MessageBox.
    '''
    Dialog = QtGui.QDialog()
#    Dialog.resize(600, 400)
    layout = QtGui.QGridLayout(Dialog)
    text = QtGui.QLabel("")
    text.setText(msg)
    text.setOpenExternalLinks(True)
    layout.addWidget(text)
    if modal is True:
        response = Dialog.exec_()
        return response
    else:
        response = Dialog.show()
        return Dialog, response

def string_dialog(stringIn, title, msg):
    '''
    Show a Dialog box.

    Parameters::
    ----------
    stringIn - string
        Input string to fill box initially.
    title - string
        Title of the dialog box.
    msg - string
        Message to display in box.

    Notes::
    -----
    This box displays an initial value that can be changed.
    The value that is then entered is returned via the
    stringOut and entry variables.
    '''
    Dialog = QtGui.QDialog()
    if stringIn is None:
        old_val = ''
    else:
        old_val = stringIn
    stringOut, entry = QtGui.QInputDialog.getText(
        Dialog, title, msg, 0, old_val)

    return stringOut, entry

def string_dialog_with_reset(stringIn, title, msg, reset=None):
    '''
    Show a Dialog box.

    Parameters::
    ----------
    stringIn - string
        Input string to fill box initially.
    title - string
        Title of the dialog box.
    msg - string
        Message to display in box.
    reset - default value

    Notes::
    -----
    This box displays an initial value that can be changed. The value that is
    then entered is returned via the stringOut and entry variables.
    '''
    if stringIn is None:
        old_val = ''
    else:
        old_val = stringIn

    # start dialog
    Dialog = QtGui.QDialog()
    Dialog.setWindowTitle(title)
    gridLayout = QtGui.QGridLayout(Dialog)
    # add mensage and edit line
    gridLayout.addWidget(QtGui.QLabel(msg), 0, 0, 1, 1)
    lineEdit = QtGui.QLineEdit(old_val, Dialog)
    gridLayout.addWidget(lineEdit, 1, 0, 1, 1)
    # add buttons
    buttonBox = QtGui.QDialogButtonBox(Dialog)
    buttonBox.setOrientation(QtCore.Qt.Horizontal)
    if reset is not None:
        buttons = (QtGui.QDialogButtonBox.Reset |
                   QtGui.QDialogButtonBox.Cancel |
                   QtGui.QDialogButtonBox.Ok)
    else:
        buttons = (QtGui.QDialogButtonBox.Cancel |
                   QtGui.QDialogButtonBox.Ok)
    buttonBox.setStandardButtons(buttons)
    gridLayout.addWidget(buttonBox, 2, 0, 1, 1)

    # handel click signal
    def handleClick(button):
        enum = buttonBox.standardButton(button)
        if enum == QtGui.QDialogButtonBox.Reset:
            lineEdit.setText(reset)
        elif enum == QtGui.QDialogButtonBox.Cancel:
            Dialog.done(0)
        elif enum == QtGui.QDialogButtonBox.Ok:
            Dialog.done(1)
    buttonBox.clicked.connect(handleClick)

    # run dialog
    entry = Dialog.exec_()
    if entry == 1:
        entry = True
    else:
        entry = False
    # get result
    stringOut = lineEdit.text()

    return stringOut, entry

########################
# Start methods #
########################

class _SimplePluginStart(QtGui.QDialog):
    '''
    Dialog Class for graphical Start of Display,
    to be used in guiStart.
    '''

    def __init__(self, name):
        '''Initialize the class to create the interface.'''
        super(_SimplePluginStart, self).__init__()
        self.result = {}
        self.layout = QtGui.QGridLayout(self)
        self._name = name
        self.setWindowTitle(name)
        # set window as modal
        self.setWindowModality(QtCore.Qt.ApplicationModal)

        self.setupUi()

    def setupUi(self):
        self.layout.addWidget(QtGui.QLabel("Name"), 0, 0)
        self.name = QtGui.QLineEdit(self._name)
        self.layout.addWidget(self.name, 0, 1)

        self.independent = QtGui.QCheckBox("Independent Window")
        self.independent.setChecked(True)
        self.layout.addWidget(self.independent, 1, 1, 1, 1)

        self.closeButton = QtGui.QPushButton("Start")
        self.closeButton.clicked.connect(self.closeDialog)
        self.layout.addWidget(self.closeButton, 2, 0, 1, 2)

    def closeDialog(self):
        self.done(QtGui.QDialog.Accepted)

    def startDisplay(self):
        self.exec_()

        self.result['name'] = str(self.name.text())

        return self.result, self.independent.isChecked()

########################
#    Table methods     #
########################

class CreateTable(QtGui.QTableWidget):
    """Creates a custom table widget."""
    def __init__(self, points, name="Table",
                 textcolor="black", bgcolor="gray", parent=None, *args):
        QtGui.QTableWidget.__init__(self, *args)
        self.points = points
        self.setSelectionMode(self.ContiguousSelection)
        self.setGeometry(0, 0, 700, 400)
        self.setShowGrid(True)
        self.textcolor = textcolor
        self.bgcolor = bgcolor

    def display(self):
        """Reads in data from a 2D array and formats and displays it in
            the table."""

        if self.points is None:
            data = ["No data for selected."]
            nrows = 0
            ncols = 0
        else:
            nrows = self.points.npoints
            colnames = self.points.axes.keys() + self.points.fields.keys()
            ncols = len(colnames)

        self.setRowCount(nrows)
        self.setColumnCount(ncols)
        colnames = self.points.axes.keys() + self.points.fields.keys()
        self.setHorizontalHeaderLabels(colnames)

        for i in xrange(nrows):
            # Set each cell to be a QTableWidgetItem from _process_row method
            for j, name in enumerate(colnames):
                if name in self.points.axes:
                    item = QtGui.QTableWidgetItem(
                        "%8.3f" % self.points.axes[name]['data'][i])
                else:
                    item = QtGui.QTableWidgetItem(
                        "%8.3f" % self.points.fields[name]['data'][i])

                item.setBackgroundColor = QtGui.QColor(self.bgcolor)
                item.setTextColor = QtGui.QColor(self.textcolor)
                self.setItem(i, j, item)

        # Format column width
        self.resizeColumnsToContents()

        return

########################
#  Arithmetic methods  #
########################

def _array_stats(data):
    """Return a dictionary of statistics from a Numpy array"""
    statdict = {}
    statdict['Minimum'] = np.ma.min(data)
    statdict['Maximum'] = np.ma.max(data)
    statdict['Mean'] = np.ma.mean(data)
    statdict['Median'] = np.ma.median(data)
    statdict['Standard_Deviation'] = np.ma.std(data)
    statdict['Variance'] = np.ma.var(data)

    return statdict


text:
<?php
# import the CSV

$row = 1;
$logFile = "data/log.csv";

$_SESSION['logEntries'] = array();

if (($handle = fopen($logFile, "r")) !== FALSE) {
  while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
    if ($data[0] === "Date"){
      // header row, skip it
    } else {
      $logEntry = array(
        "Date"=>$data[0],
        "Model"=>$data[1],
        "Aircraft ID"=>$data[2],
        "Route"=>$data[3],
        "User ID"=>$data[4],
        "T/O"=>$data[5],
        "Day Ldgs"=>$data[6],
        "Ngt Ldgs"=>$data[7],
        "IAP"=>$data[8],
        "SE"=>$data[9],
        "ME"=>$data[10],
        "Complex"=>$data[11],
        "Turbine"=>$data[12],
        "Rotorcraft"=>$data[13],
        "Flt Sim"=>$data[14],
        "X/C"=>$data[15],
        "IMC"=>$data[16],
        "Sim Inst"=>$data[17],
        "Flt Time"=>$data[18],
        "Night"=>$data[19],
        "PIC"=>$data[20],
        "SIC"=>$data[21],
        "Dual Recd"=>$data[22],
        "Dual Given"=>$data[23],
        "Remarks"=>$data[24],
      );
      array_push($_SESSION['logEntries'], $logEntry);
    }
  }
  fclose($handle);

}

function GetAirportCounts() {

  $results = array();
  // get all route positions into a string
  foreach ($_SESSION['logEntries'] as $flight) {
    $routePositions .= $flight["Route"]." ";
  }

  $sortedRoutePositions = array_count_values(str_word_count($routePositions, 1));
  // discard anything that's not an aerodrome (4 letters)
  foreach (array_keys($sortedRoutePositions) as $sortedRoutePosition) {
    if (strlen($sortedRoutePosition) == 4) {
      // location is an AD, add it to the array
      $results[$sortedRoutePosition] = $sortedRoutePositions[$sortedRoutePosition];
    } else {
      // location is not an AD, probably, so ignore it.
    }
  }

  return $results;

}

function GetAdLatLong($ad) {
  # import the CSV

  $dataFile = "data/ads.csv";
  $result = "0, 0";

  if (($handle = fopen($dataFile, "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
      if ($data[0] == $ad) {
        $result = $data[2].", ".$data[3];
      }
    }
  fclose($handle);
  }
  return $result;
}

 function strendswith($haystack, $needle) {
    return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
  }

  // GetAerodromes returns an array of ADs visited by a particular flight.
  // It uses the Remarks section to evaluate anything not stored in the Zululog flight plan
  // as Zululog doesn't have all ALAs.
  function GetAerodromes($flight) {
    if (strlen($flight['Route']) == 4) {
      // if the route is only one four character string, it was probably circuits or a local flight
      return array($flight['Route']);
    } else {
      $ads = array();
      // add the first element to the list
      array_push($ads,explode(" ", $flight['Route'])[0]);
      // add the last element to the list
      array_push($ads,end(explode(" ", $flight['Route'])));
      foreach (explode(" ", $flight['Remarks']) as $waypoint) {
        // Split the route into bits
        if (strendswith($waypoint,'/')) {
          // If the waypoint ends with one or more slashes, it was a landing
          array_push($ads,str_replace('/','',$waypoint));
        }
      }
      return array_unique($ads);
    }
  }

  function GetAllAerodromes($logEntries) {
    $ads = array();
    foreach ($logEntries as $flight) {
      foreach (GetAerodromes($flight) as $ad) {
        array_push($ads,$ad);
      }
    }
    return array_unique($ads);
  }
?>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Income Distribution</title>
    <link rel="stylesheet" type="text/css" href="static/css/income-distribution.css" />
    <link rel="stylesheet" href="//rawgithub.com/Caged/d3-tip/master/examples/example-styles.css">

    <link rel="stylesheet" type="text/css" href="static/css/theme.min.css" />

2000

2005 - 2009

2010 - 2014

            Source: Census.gov


text:
<?php
class common
{
	function execQuery($strQuery)
	{
		$con=new mysqli("localhost","root","","qlsv");

		mysqli_query($con,$strQuery);
		mysqli_close($con);
	}
	function getQuery($strGet)
	{
		$con=new mysqli("localhost","root","","qlsv");
		mysqli_set_charset($con,'utf8');
		$result=mysqli_query($con,$strGet);
		mysqli_close($con);
		return $result;
	}
}
?>


text:
myTags ({{filteredCount}}/{{totalCount}})

updatingTags
{{updateStatus}}

doNotCloseBrowser

				hideLogs
				showLogs

				copyLogs

{{logs}}

loadingTags

updatingApp

doNotCloseBrowser

noTagsFound

				<audio-player audio-src="tag.previewUrl" />

{{tag.name}}

{{tag.artist}}

	      {{pagination.page+1}}/{{pagination.nbPages()}}

	    <select ng-model="pagination.limitString" ng-change="pagination.limitChanged()" class="pagination-limit">
	    	<option value="10">10 / page</option>
	    	<option value="25">25 / page</option>
	    	<option value="50">50 / page</option>
	    	<option value="100">100 / page</option>
	    	<option value="200">200 / page</option>
	    	<option value="0">all ({{filteredCount}})</option>
	    </select>

changeTrackSearch

trackNotFound

		<form ng-submit="newSearch.send()">

trackField

			<input type="text" ng-model="newSearch.query.track">

artistField

			<input type="text" ng-model="newSearch.query.artist">

<button type="submit" class="pure-button pure-button-primary" chrome-translate analytics-on analytics-event="Start search" analytics-category="Retry search modal">searchTrackButton</button>cancel

{{newSearch.error}}

		</form>

 0">

searchResults

searchResultsPleaseSelect

notFound

notFoundText

						<audio-player audio-src="track.previewUrl" />

{{track.name}}

{{track.artist}}


text:
<?php

namespace Gedmo\Tree;

use Gedmo\Mapping\Event\AdapterInterface;

interface Strategy
{
    /**
     * NestedSet strategy
     */
    const NESTED = 'nested';

    /**
     * Closure strategy
     */
    const CLOSURE = 'closure';

    /**
     * Materialized Path strategy
     */
    const MATERIALIZED_PATH = 'materializedPath';

    /**
     * Get the name of strategy
     *
     * @return string
     */
    function getName();

    /**
     * Initialize strategy with tree listener
     *
     * @param TreeListener $listener
     * @return void
     */
    function __construct(TreeListener $listener);

    /**
     * Operations after metadata is loaded
     *
     * @param object $om
     * @param object $meta
     */
    function processMetadataLoad($om, $meta);

    /**
     * Operations on tree node insertion
     *
     * @param object $om - object manager
     * @param object $object - node
     * @param AdapterInterface $ea - event adapter
     * @return void
     */
    function processScheduledInsertion($om, $object, AdapterInterface $ea);

    /**
     * Operations on tree node updates
     *
     * @param object $om - object manager
     * @param object $object - node
     * @param AdapterInterface $ea - event adapter
     * @return void
     */
    function processScheduledUpdate($om, $object, AdapterInterface $ea);

    /**
     * Operations on tree node delete
     *
     * @param object $om - object manager
     * @param object $object - node
     * @return void
     */
    function processScheduledDelete($om, $object);

    /**
     * Operations on tree node removal
     *
     * @param object $om - object manager
     * @param object $object - node
     * @return void
     */
    function processPreRemove($om, $object);

    /**
     * Operations on tree node persist
     *
     * @param object $om - object manager
     * @param object $object - node
     * @return void
     */
    function processPrePersist($om, $object);

    /**
     * Operations on tree node update
     *
     * @param object $om - object manager
     * @param object $object - node
     * @return void
     */
    function processPreUpdate($om, $object);

    /**
     * Operations on tree node insertions
     *
     * @param object $om - object manager
     * @param object $object - node
     * @param AdapterInterface $ea - event adapter
     * @return void
     */
    function processPostPersist($om, $object, AdapterInterface $ea);

    /**
     * Operations on tree node updates
     *
     * @param object $om - object manager
     * @param object $object - node
     * @param AdapterInterface $ea - event adapter
     * @return void
     */
    function processPostUpdate($om, $object, AdapterInterface $ea);

    /**
     * Operations on tree node removals
     *
     * @param object $om - object manager
     * @param object $object - node
     * @param AdapterInterface $ea - event adapter
     * @return void
     */
    function processPostRemove($om, $object, AdapterInterface $ea);

    /**
     * Operations on the end of flush process
     *
     * @param object $om - object manager
     * @param AdapterInterface $ea - event adapter
     * @return void
     */
    function onFlushEnd($om, AdapterInterface $ea);
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

  <title>CSS 2.1 Test Suite: Counter scope and nesting</title>
  <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#scope"/>
  <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#counters"/>
  <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#propdef-content"/>
  <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#counter"/>

1 1 R1.1 1.1