text:
using content::BrowserThread;

namespace {

enum GpuFeatureStatus {
    kGpuFeatureEnabled = 0,
    kGpuFeatureBlacklisted = 1,
    kGpuFeatureDisabled = 2,  // disabled by user but not blacklisted
    kGpuFeatureNumStatus
};

struct GpuFeatureInfo {
  std::string name;
  uint32 blocked;
  bool disabled;
  std::string disabled_description;
  bool fallback_to_software;
};

#if defined(OS_MACOSX)
void DisplayReconfigCallback(CGDirectDisplayID display,
                             CGDisplayChangeSummaryFlags flags,
                             void* gpu_data_manager) {
  // TODO(zmo): this logging is temporary for crbug 88008 and will be removed.
  LOG(INFO) << "Display re-configuration: flags = 0x"
            << base::StringPrintf("%04x", flags);
  if (flags & kCGDisplayAddFlag) {
    GpuDataManager* manager =
        reinterpret_cast<GpuDataManager*>(gpu_data_manager);
    DCHECK(manager);
    manager->HandleGpuSwitch();
  }
}
#endif

DictionaryValue* NewDescriptionValuePair(const std::string& desc,
    const std::string& value) {
  DictionaryValue* dict = new DictionaryValue();
  dict->SetString("description", desc);
  dict->SetString("value", value);
  return dict;
}

DictionaryValue* NewDescriptionValuePair(const std::string& desc,
    Value* value) {
  DictionaryValue* dict = new DictionaryValue();
  dict->SetString("description", desc);
  dict->Set("value", value);
  return dict;
}

Value* NewStatusValue(const char* name, const char* status) {
  DictionaryValue* value = new DictionaryValue();
  value->SetString("name", name);
  value->SetString("status", status);
  return value;
}

#if defined(OS_WIN)
enum WinSubVersion {
  kWinOthers = 0,
  kWinXP,
  kWinVista,
  kWin7,
  kNumWinSubVersions
};

// Output DxDiagNode tree as nested array of {description,value} pairs
ListValue* DxDiagNodeToList(const content::DxDiagNode& node) {
  ListValue* list = new ListValue();
  for (std::map<std::string, std::string>::const_iterator it =
      node.values.begin();
      it != node.values.end();
      ++it) {
    list->Append(NewDescriptionValuePair(it->first, it->second));
  }

  for (std::map<std::string, content::DxDiagNode>::const_iterator it =
      node.children.begin();
      it != node.children.end();
      ++it) {
    ListValue* sublist = DxDiagNodeToList(it->second);
    list->Append(NewDescriptionValuePair(it->first, sublist));
  }
  return list;
}

int GetGpuBlacklistHistogramValueWin(GpuFeatureStatus status) {
  static WinSubVersion sub_version = kNumWinSubVersions;
  if (sub_version == kNumWinSubVersions) {
    sub_version = kWinOthers;
    std::string version_str = base::SysInfo::OperatingSystemVersion();
    size_t pos = version_str.find_first_not_of("0123456789.");
    if (pos != std::string::npos)
      version_str = version_str.substr(0, pos);
    scoped_ptr<Version> os_version(Version::GetVersionFromString(version_str));
    if (os_version.get() && os_version->components().size() >= 2) {
      const std::vector<uint16>& version_numbers = os_version->components();
      if (version_numbers[0] == 5)
        sub_version = kWinXP;
      else if (version_numbers[0] == 6 && version_numbers[1] == 0)
        sub_version = kWinVista;
      else if (version_numbers[0] == 6 && version_numbers[1] == 1)
        sub_version = kWin7;
    }
  }
  int entry_index = static_cast<int>(sub_version) * kGpuFeatureNumStatus;
  switch (status) {
    case kGpuFeatureEnabled:
      break;
    case kGpuFeatureBlacklisted:
      entry_index++;
      break;
    case kGpuFeatureDisabled:
      entry_index += 2;
      break;
  }
  return entry_index;
}
#endif  // OS_WIN

}  // namespace anonymous

GpuDataManager::UserFlags::UserFlags()
    : disable_accelerated_2d_canvas_(false),
      disable_accelerated_compositing_(false),
      disable_accelerated_layers_(false),
      disable_experimental_webgl_(false),
      disable_gl_multisampling_(false),
      disable_software_rasterizer_(false),
      ignore_gpu_blacklist_(false),
      skip_gpu_data_loading_(false),
      blacklist_accelerated_compositing_(false),
      blacklist_webgl_(false) {
}

void GpuDataManager::UserFlags::Initialize() {
  const CommandLine& browser_command_line =
      *CommandLine::ForCurrentProcess();

  disable_accelerated_2d_canvas_ = browser_command_line.HasSwitch(
      switches::kDisableAccelerated2dCanvas);
  disable_accelerated_compositing_ = browser_command_line.HasSwitch(
      switches::kDisableAcceleratedCompositing);
  disable_accelerated_layers_ = browser_command_line.HasSwitch(
      switches::kDisableAcceleratedLayers);
  disable_experimental_webgl_ = browser_command_line.HasSwitch(
      switches::kDisableExperimentalWebGL);
  disable_gl_multisampling_ = browser_command_line.HasSwitch(
      switches::kDisableGLMultisampling);
  disable_software_rasterizer_ = browser_command_line.HasSwitch(
      switches::kDisableSoftwareRasterizer);

  ignore_gpu_blacklist_ = browser_command_line.HasSwitch(
      switches::kIgnoreGpuBlacklist);
  skip_gpu_data_loading_ = browser_command_line.HasSwitch(
      switches::kSkipGpuDataLoading);

  blacklist_accelerated_compositing_ = browser_command_line.HasSwitch(
      switches::kBlacklistAcceleratedCompositing);
  blacklist_webgl_ = browser_command_line.HasSwitch(
      switches::kBlacklistWebGL);

  use_gl_ = browser_command_line.GetSwitchValueASCII(switches::kUseGL);

  ApplyPolicies();
}

void GpuDataManager::UserFlags::ApplyPolicies() {
  if (disable_accelerated_compositing_) {
    disable_accelerated_2d_canvas_ = true;
    disable_accelerated_layers_ = true;
  }
}

GpuDataManager::GpuDataManager()
    : complete_gpu_info_already_requested_(false),
      complete_gpu_info_available_(false),
      observer_list_(new GpuDataManagerObserverList),
      software_rendering_(false) {
  Initialize();
}

void GpuDataManager::Initialize() {
  // User flags need to be collected before any further initialization.
  user_flags_.Initialize();

  if (!user_flags_.skip_gpu_data_loading()) {
    content::GPUInfo gpu_info;
    gpu_info_collector::CollectPreliminaryGraphicsInfo(&gpu_info);
    {
      base::AutoLock auto_lock(gpu_info_lock_);
      gpu_info_ = gpu_info;
    }
  }

#if defined(OS_MACOSX)
  CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, this);
#endif
}

GpuDataManager::~GpuDataManager() {
#if defined(OS_MACOSX)
  CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, this);
#endif
}

// static
GpuDataManager* GpuDataManager::GetInstance() {
  return Singleton<GpuDataManager>::get();
}

void GpuDataManager::RequestCompleteGpuInfoIfNeeded() {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

  if (complete_gpu_info_already_requested_ || complete_gpu_info_available_)
    return;
  complete_gpu_info_already_requested_ = true;

  GpuProcessHost::SendOnIO(
      0,
      content::CAUSE_FOR_GPU_LAUNCH_GPUDATAMANAGER_REQUESTCOMPLETEGPUINFOIFNEEDED,
      new GpuMsg_CollectGraphicsInfo());
}

void GpuDataManager::UpdateGpuInfo(const content::GPUInfo& gpu_info) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

  complete_gpu_info_available_ =
      complete_gpu_info_available_ || gpu_info.finalized;
  complete_gpu_info_already_requested_ =
      complete_gpu_info_already_requested_ || gpu_info.finalized;
  {
    base::AutoLock auto_lock(gpu_info_lock_);
    if (!Merge(&gpu_info_, gpu_info))
      return;
    content::GetContentClient()->SetGpuInfo(gpu_info_);
  }

  UpdateGpuFeatureFlags();
  // We have to update GpuFeatureFlags before notify all the observers.
  NotifyGpuInfoUpdate();
}

const content::GPUInfo& GpuDataManager::gpu_info() const {
  base::AutoLock auto_lock(gpu_info_lock_);
  return gpu_info_;
}

Value* GpuDataManager::GetFeatureStatus() {
  bool gpu_access_blocked = !GpuAccessAllowed();

  uint32 flags = GetGpuFeatureFlags().flags();
  DictionaryValue* status = new DictionaryValue();

  const GpuFeatureInfo kGpuFeatureInfo[] = {
      {
          "2d_canvas",
          flags & GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas,
          user_flags_.disable_accelerated_2d_canvas() ||
          !supportsAccelerated2dCanvas(),
          "Accelerated 2D canvas is unavailable: either disabled at the command"
          " line or not supported by the current system.",
          true
      },
      {
          "compositing",
          flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing,
          user_flags_.disable_accelerated_compositing(),
          "Accelerated compositing has been disabled, either via about:flags or"
          " command line. This adversely affects performance of all hardware"
          " accelerated features.",
          true
      },
      {
          "3d_css",
          flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing,
          user_flags_.disable_accelerated_layers(),
          "Accelerated layers have been disabled at the command line.",
          false
      },
      {
          "webgl",
          flags & GpuFeatureFlags::kGpuFeatureWebgl,
          user_flags_.disable_experimental_webgl(),
          "WebGL has been disabled, either via about:flags or command line.",
          false
      },
      {
          "multisampling",
          flags & GpuFeatureFlags::kGpuFeatureMultisampling,
          user_flags_.disable_gl_multisampling(),
          "Multisampling has been disabled, either via about:flags or command"
          " line.",
          false
      }
  };
  const size_t kNumFeatures = sizeof(kGpuFeatureInfo) / sizeof(GpuFeatureInfo);

  // Build the feature_status field.
  {
    ListValue* feature_status_list = new ListValue();

    for (size_t i = 0; i < kNumFeatures; ++i) {
      std::string status;
      if (kGpuFeatureInfo[i].disabled) {
        status = "disabled";
        if (kGpuFeatureInfo[i].fallback_to_software)
          status += "_software";
        else
          status += "_off";
      } else if (software_rendering()) {
        status = "unavailable_software";
      } else if (kGpuFeatureInfo[i].blocked ||
                 gpu_access_blocked) {
        status = "unavailable";
        if (kGpuFeatureInfo[i].fallback_to_software)
          status += "_software";
        else
          status += "_off";
      } else {
        status = "enabled";
        if (kGpuFeatureInfo[i].name == "webgl" &&
            (user_flags_.disable_accelerated_compositing() ||
             (flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing)))
          status += "_readback";
      }
      feature_status_list->Append(
          NewStatusValue(kGpuFeatureInfo[i].name.c_str(), status.c_str()));
    }

    status->Set("featureStatus", feature_status_list);
  }

  // Build the problems list.
  {
    ListValue* problem_list = new ListValue();

    if (gpu_access_blocked) {
      DictionaryValue* problem = new DictionaryValue();
      problem->SetString("description",
          "GPU process was unable to boot. Access to GPU disallowed.");
      problem->Set("crBugs", new ListValue());
      problem->Set("webkitBugs", new ListValue());
      problem_list->Append(problem);
    }

    for (size_t i = 0; i < kNumFeatures; ++i) {
      if (kGpuFeatureInfo[i].disabled) {
        DictionaryValue* problem = new DictionaryValue();
        problem->SetString(
            "description", kGpuFeatureInfo[i].disabled_description);
        problem->Set("crBugs", new ListValue());
        problem->Set("webkitBugs", new ListValue());
        problem_list->Append(problem);
      }
    }

    GpuBlacklist* blacklist = GetGpuBlacklist();
    if (blacklist)
      blacklist->GetBlacklistReasons(problem_list);

    status->Set("problems", problem_list);
  }

  return status;
}

GpuPerformanceStats GpuDataManager::GetPerformanceStats() const {
  return GpuPerformanceStats::RetrieveGpuPerformanceStats();
}

std::string GpuDataManager::GetBlacklistVersion() const {
  GpuBlacklist* blacklist = GetGpuBlacklist();
  if (blacklist != NULL) {
    uint16 version_major, version_minor;
    if (blacklist->GetVersion(&version_major, &version_minor)) {
      std::string version_string =
          base::UintToString(static_cast<unsigned>(version_major)) +
          "." +
          base::UintToString(static_cast<unsigned>(version_minor));
      return version_string;
    }
  }
  return "";
}

void GpuDataManager::AddLogMessage(Value* msg) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  log_messages_.Append(msg);
}

const ListValue& GpuDataManager::log_messages() const {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  return log_messages_;
}

GpuFeatureFlags GpuDataManager::GetGpuFeatureFlags() {
  if (software_rendering_) {
    GpuFeatureFlags flags;

    // Skia's software rendering is probably more efficient than going through
    // software emulation of the GPU, so use that.
    flags.set_flags(GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas);
    return flags;
  }

  return gpu_feature_flags_;
}

bool GpuDataManager::GpuAccessAllowed() {
  if (software_rendering())
    return true;

  // We only need to block GPU process if more features are disallowed other
  // than those in the preliminary gpu feature flags because the latter work
  // through renderer commandline switches.
  uint32 mask = (~(preliminary_gpu_feature_flags_.flags()));
  return (gpu_feature_flags_.flags() & mask) == 0;
}

void GpuDataManager::AddObserver(Observer* observer) {
  observer_list_->AddObserver(observer);
}

void GpuDataManager::RemoveObserver(Observer* observer) {
  observer_list_->RemoveObserver(observer);
}

void GpuDataManager::AppendRendererCommandLine(
    CommandLine* command_line) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  DCHECK(command_line);

  uint32 flags = GpuFeatureFlags().flags();
  if ((flags & GpuFeatureFlags::kGpuFeatureWebgl)) {
    if (!command_line->HasSwitch(switches::kDisableExperimentalWebGL))
      command_line->AppendSwitch(switches::kDisableExperimentalWebGL);
    if (!command_line->HasSwitch(switches::kDisablePepper3dForUntrustedUse))
      command_line->AppendSwitch(switches::kDisablePepper3dForUntrustedUse);
  }
  if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) &&
      !command_line->HasSwitch(switches::kDisableGLMultisampling))
    command_line->AppendSwitch(switches::kDisableGLMultisampling);
  if ((flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) &&
      !command_line->HasSwitch(switches::kDisableAcceleratedCompositing))
    command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
  if ((flags & GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas) &&
      !command_line->HasSwitch(switches::kDisableAccelerated2dCanvas))
    command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
}

void GpuDataManager::AppendGpuCommandLine(
    CommandLine* command_line) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
  DCHECK(command_line);

  uint32 flags = GpuFeatureFlags().flags();
  if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) &&
      !command_line->HasSwitch(switches::kDisableGLMultisampling))
    command_line->AppendSwitch(switches::kDisableGLMultisampling);

  if (software_rendering_) {
    command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader");
    command_line->AppendSwitchPath(switches::kSwiftShaderPath,
                                   swiftshader_path_);
  } else if ((flags & (GpuFeatureFlags::kGpuFeatureWebgl |
                GpuFeatureFlags::kGpuFeatureAcceleratedCompositing |
                GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)) &&
      (user_flags_.use_gl() == "any")) {
    command_line->AppendSwitchASCII(
        switches::kUseGL, gfx::kGLImplementationOSMesaName);
  } else if (!user_flags_.use_gl().empty()) {
    command_line->AppendSwitchASCII(switches::kUseGL, user_flags_.use_gl());
  }

  if (gpu_info().optimus)
    command_line->AppendSwitch(switches::kReduceGpuSandbox);
}

void GpuDataManager::SetGpuBlacklist(GpuBlacklist* gpu_blacklist) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  DCHECK(gpu_blacklist);
  gpu_blacklist_.reset(gpu_blacklist);
  UpdateGpuFeatureFlags();
  preliminary_gpu_feature_flags_ = gpu_feature_flags_;
}

void GpuDataManager::HandleGpuSwitch() {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  content::GPUInfo gpu_info;
  gpu_info_collector::CollectVideoCardInfo(&gpu_info);
  LOG(INFO) << "Switching to use GPU: vendor_id = 0x"
            << base::StringPrintf("%04x", gpu_info.vendor_id)
            << ", device_id = 0x"
            << base::StringPrintf("%04x", gpu_info.device_id);
  // TODO(zmo): update gpu_info_, re-run blacklist logic, maybe close and
  // relaunch GPU process.
}

DictionaryValue* GpuDataManager::GpuInfoAsDictionaryValue() const {
  ListValue* basic_info = new ListValue();
  basic_info->Append(NewDescriptionValuePair(
      "Initialization time",
      base::Int64ToString(gpu_info().initialization_time.InMilliseconds())));
  basic_info->Append(NewDescriptionValuePair(
      "Vendor Id", base::StringPrintf("0x%04x", gpu_info().vendor_id)));
  basic_info->Append(NewDescriptionValuePair(
      "Device Id", base::StringPrintf("0x%04x", gpu_info().device_id)));
  basic_info->Append(NewDescriptionValuePair(
      "Optimus", Value::CreateBooleanValue(gpu_info().optimus)));
  basic_info->Append(NewDescriptionValuePair("Driver vendor",
                                             gpu_info().driver_vendor));
  basic_info->Append(NewDescriptionValuePair("Driver version",
                                             gpu_info().driver_version));
  basic_info->Append(NewDescriptionValuePair("Driver date",
                                             gpu_info().driver_date));
  basic_info->Append(NewDescriptionValuePair("Pixel shader version",
                                             gpu_info().pixel_shader_version));
  basic_info->Append(NewDescriptionValuePair("Vertex shader version",
                                             gpu_info().vertex_shader_version));
  basic_info->Append(NewDescriptionValuePair("GL version",
                                             gpu_info().gl_version));
  basic_info->Append(NewDescriptionValuePair("GL_VENDOR",
                                             gpu_info().gl_vendor));
  basic_info->Append(NewDescriptionValuePair("GL_RENDERER",
                                             gpu_info().gl_renderer));
  basic_info->Append(NewDescriptionValuePair("GL_VERSION",
                                             gpu_info().gl_version_string));
  basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS",
                                             gpu_info().gl_extensions));

  DictionaryValue* info = new DictionaryValue();
  info->Set("basic_info", basic_info);

#if defined(OS_WIN)
  Value* dx_info;
  if (gpu_info().dx_diagnostics.children.size())
    dx_info = DxDiagNodeToList(gpu_info().dx_diagnostics);
  else
    dx_info = Value::CreateNullValue();
  info->Set("diagnostics", dx_info);
#endif

  return info;
}

void GpuDataManager::NotifyGpuInfoUpdate() {
  observer_list_->Notify(&GpuDataManager::Observer::OnGpuInfoUpdate);
}

void GpuDataManager::UpdateGpuFeatureFlags() {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

  GpuBlacklist* gpu_blacklist = GetGpuBlacklist();
  // We don't set a lock around modifying gpu_feature_flags_ since it's just an
  // int.
  if (!gpu_blacklist) {
    gpu_feature_flags_.set_flags(0);
    return;
  }

  {
    base::AutoLock auto_lock(gpu_info_lock_);
    GpuFeatureFlags flags = gpu_blacklist->DetermineGpuFeatureFlags(
        GpuBlacklist::kOsAny, NULL, gpu_info_);

    // Force disable using the GPU for these features, even if they would
    // otherwise be allowed.
    if (user_flags_.blacklist_accelerated_compositing())
      flags.set_flags(flags.flags() |
          GpuFeatureFlags::kGpuFeatureAcceleratedCompositing);
    if (user_flags_.blacklist_webgl())
      flags.set_flags(flags.flags() | GpuFeatureFlags::kGpuFeatureWebgl);
    gpu_feature_flags_ = flags;
  }

  uint32 flags = gpu_feature_flags_.flags();
  uint32 max_entry_id = gpu_blacklist->max_entry_id();
  bool disabled = false;
  if (flags == 0) {
    UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
        0, max_entry_id + 1);
  } else {
    std::vector<uint32> flag_entries;
    gpu_blacklist->GetGpuFeatureFlagEntries(
        GpuFeatureFlags::kGpuFeatureAll, flag_entries, disabled);
    DCHECK_GT(flag_entries.size(), 0u);
    for (size_t i = 0; i < flag_entries.size(); ++i) {
      UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerEntry",
          flag_entries[i], max_entry_id + 1);
    }
  }

  // This counts how many users are affected by a disabled entry - this allows
  // us to understand the impact of an entry before enable it.
  std::vector<uint32> flag_disabled_entries;
  disabled = true;
  gpu_blacklist->GetGpuFeatureFlagEntries(
      GpuFeatureFlags::kGpuFeatureAll, flag_disabled_entries, disabled);
  for (size_t i = 0; i < flag_disabled_entries.size(); ++i) {
    UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry",
        flag_disabled_entries[i], max_entry_id + 1);
  }

  const GpuFeatureFlags::GpuFeatureType kGpuFeatures[] = {
      GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas,
      GpuFeatureFlags::kGpuFeatureAcceleratedCompositing,
      GpuFeatureFlags::kGpuFeatureWebgl
  };
  const std::string kGpuBlacklistFeatureHistogramNames[] = {
      "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas",
      "GPU.BlacklistFeatureTestResults.AcceleratedCompositing",
      "GPU.BlacklistFeatureTestResults.Webgl"
  };
  const bool kGpuFeatureUserFlags[] = {
      user_flags_.disable_accelerated_2d_canvas(),
      user_flags_.disable_accelerated_compositing(),
      user_flags_.disable_experimental_webgl()
  };
#if defined(OS_WIN)
  const std::string kGpuBlacklistFeatureHistogramNamesWin[] = {
      "GPU.BlacklistFeatureTestResultsWindows.Accelerated2dCanvas",
      "GPU.BlacklistFeatureTestResultsWindows.AcceleratedCompositing",
      "GPU.BlacklistFeatureTestResultsWindows.Webgl"
  };
#endif
  const size_t kNumFeatures =
      sizeof(kGpuFeatures) / sizeof(GpuFeatureFlags::GpuFeatureType);
  for (size_t i = 0; i < kNumFeatures; ++i) {
    // We can't use UMA_HISTOGRAM_ENUMERATION here because the same name is
    // expected if the macro is used within a loop.
    GpuFeatureStatus value = kGpuFeatureEnabled;
    if (flags & kGpuFeatures[i])
      value = kGpuFeatureBlacklisted;
    else if (kGpuFeatureUserFlags[i])
      value = kGpuFeatureDisabled;
    base::Histogram* histogram_pointer = base::LinearHistogram::FactoryGet(
        kGpuBlacklistFeatureHistogramNames[i],
        1, kGpuFeatureNumStatus, kGpuFeatureNumStatus + 1,
        base::Histogram::kUmaTargetedHistogramFlag);
    histogram_pointer->Add(value);
#if defined(OS_WIN)
    histogram_pointer = base::LinearHistogram::FactoryGet(
        kGpuBlacklistFeatureHistogramNamesWin[i],
        1, kNumWinSubVersions * kGpuFeatureNumStatus,
        kNumWinSubVersions * kGpuFeatureNumStatus + 1,
        base::Histogram::kUmaTargetedHistogramFlag);
    histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value));
#endif
  }

  EnableSoftwareRenderingIfNecessary();
}

void GpuDataManager::RegisterSwiftShaderPath(FilePath path) {
  swiftshader_path_ = path;
  EnableSoftwareRenderingIfNecessary();
}

void GpuDataManager::EnableSoftwareRenderingIfNecessary() {
  if (!GpuAccessAllowed() ||
      (gpu_feature_flags_.flags() & GpuFeatureFlags::kGpuFeatureWebgl)) {
#if defined(ENABLE_SWIFTSHADER)
    if (!swiftshader_path_.empty() &&
        !user_flags_.disable_software_rasterizer())
      software_rendering_ = true;
#endif
  }
}

bool GpuDataManager::software_rendering() {
  return software_rendering_;
}

GpuBlacklist* GpuDataManager::GetGpuBlacklist() const {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
  if (user_flags_.ignore_gpu_blacklist())
    return NULL;
  // No need to return an empty blacklist.
  if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0)
    return NULL;
  return gpu_blacklist_.get();
}

bool GpuDataManager::Merge(content::GPUInfo* object,
                           const content::GPUInfo& other) {
  if (object->device_id != other.device_id ||
      object->vendor_id != other.vendor_id) {
    *object = other;
    return true;
  }

  bool changed = false;
  if (!object->finalized) {
    object->finalized = other.finalized;
    object->initialization_time = other.initialization_time;
    object->optimus |= other.optimus;

    if (object->driver_vendor.empty()) {
      changed |= object->driver_vendor != other.driver_vendor;
      object->driver_vendor = other.driver_vendor;
    }
    if (object->driver_version.empty()) {
      changed |= object->driver_version != other.driver_version;
      object->driver_version = other.driver_version;
    }
    if (object->driver_date.empty()) {
      changed |= object->driver_date != other.driver_date;
      object->driver_date = other.driver_date;
    }
    if (object->pixel_shader_version.empty()) {
      changed |= object->pixel_shader_version != other.pixel_shader_version;
      object->pixel_shader_version = other.pixel_shader_version;
    }
    if (object->vertex_shader_version.empty()) {
      changed |= object->vertex_shader_version != other.vertex_shader_version;
      object->vertex_shader_version = other.vertex_shader_version;
    }
    if (object->gl_version.empty()) {
      changed |= object->gl_version != other.gl_version;
      object->gl_version = other.gl_version;
    }
    if (object->gl_version_string.empty()) {
      changed |= object->gl_version_string != other.gl_version_string;
      object->gl_version_string = other.gl_version_string;
    }
    if (object->gl_vendor.empty()) {
      changed |= object->gl_vendor != other.gl_vendor;
      object->gl_vendor = other.gl_vendor;
    }
    if (object->gl_renderer.empty()) {
      changed |= object->gl_renderer != other.gl_renderer;
      object->gl_renderer = other.gl_renderer;
    }
    if (object->gl_extensions.empty()) {
      changed |= object->gl_extensions != other.gl_extensions;
      object->gl_extensions = other.gl_extensions;
    }
    object->can_lose_context = other.can_lose_context;
#if defined(OS_WIN)
    if (object->dx_diagnostics.values.size() == 0 &&
        object->dx_diagnostics.children.size() == 0) {
      object->dx_diagnostics = other.dx_diagnostics;
      changed = true;
    }
#endif
  }
  return changed;
}

bool GpuDataManager::supportsAccelerated2dCanvas() const {
  if (gpu_info_.can_lose_context)
    return false;
#if defined(USE_SKIA)
  return true;
#else
  return false;
#endif
}


text:
package com.vmware.vim25;

/**
@author Steve Jin (sjin@vmware.com)
*/

public class NetworkProfileDnsConfigProfile extends ApplyProfile
{
}

redpajama_set_name: RedPajamaGithub


text:
%%% -*-TeX-*-
%%% ====================================================================
%%%  @TeX-file{
%%%     author          = "Tom Rokicki",
%%%     version         = "2.7.4",
%%%     date            = "14 February 2011",
%%%     time            = "15:44:06 MST",
%%%     filename        = "epsf.tex",
%%%     address         = "Tom Rokicki
%%%                        Box 2081
%%%                        Stanford, CA 94309
%%%                        USA",
%%%     telephone       = "+1 415 855 9989",
%%%     checksum        = "29223 653 3100 27123",
%%%     email           = "rokicki@cs.stanford.edu (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     copyright       = "This file is freely redistributable and
%%%                        placed into the public domain by Tomas
%%%                        Rokicki.",
%%%     keywords        = "PostScript, TeX",
%%%     license         = "public domain",
%%%     supported       = "yes",
%%%     abstract        = "This file contains macros to support the
%%%                        inclusion of Encapsulated PostScript files
%%%                        in TeX documents.",
%%%     docstring       = "This file contains TeX macros to include an
%%%                        Encapsulated PostScript graphic.  It works
%%%                        by finding the bounding box comment,
%%%                        calculating the correct scale values, and
%%%                        inserting a vbox of the appropriate size at
%%%                        the current position in the TeX document.
%%%
%%%                        To use, simply use
%%%
%%%                        \input epsf % somewhere early on in your TeX file
%%%
%%%                        % then where you want to insert a vbox for a figure:
%%%                        \epsfbox{filename.ps}
%%%
%%%                        Alternatively, you can supply your own
%%%                        bounding box by
%%%
%%%                        \epsfbox[0 0 30 50]{filename.ps}
%%%
%%%                        This will not read in the file, and will
%%%                        instead use the bounding box you specify.
%%%
%%%                        The effect will be to typeset the figure as
%%%                        a TeX box, at the point of your \epsfbox
%%%                        command. By default, the graphic will have
%%%                        its `natural' width (namely the width of
%%%                        its bounding box, as described in
%%%                        filename.ps). The TeX box will have depth
%%%                        zero.
%%%
%%%                        You can enlarge or reduce the figure by
%%%                        using
%%%
%%%                          \epsfxsize = <dimen> \epsfbox{filename.ps}
%%%                        or
%%%                          \epsfysize = <dimen> \epsfbox{filename.ps}
%%%
%%%                        instead. Then the width of the TeX box will
%%%                        be \epsfxsize and its height will be scaled
%%%                        proportionately (or the height will be
%%%                        \epsfysize and its width will be scaled
%%%                        proportionately).
%%%
%%%                        The width (and height) is restored to zero
%%%                        after each use, so \epsfxsize or \epsfysize
%%%                        must be specified before EACH use of
%%%                        \epsfbox.
%%%
%%%                        A more general facility for sizing is
%%%                        available by defining the \epsfsize macro.
%%%                        Normally you can redefine this macro to do
%%%                        almost anything.  The first parameter is
%%%                        the natural x size of the PostScript
%%%                        graphic, the second parameter is the
%%%                        natural y size of the PostScript graphic.
%%%                        It must return the xsize to use, or 0 if
%%%                        natural scaling is to be used.  Common uses
%%%                        include:
%%%
%%%                           \epsfxsize  % just leave the old value alone
%%%                           0pt         % use the natural sizes
%%%                           #1          % use the natural sizes
%%%                           \hsize      % scale to full width
%%%                           0.5#1       % scale to 50% of natural size
%%%                           \ifnum #1 > \hsize \hsize \else #1\fi
%%%                                       % smaller of natural, hsize
%%%
%%%                        If you want TeX to report the size of the
%%%                        figure (as a message on your terminal when
%%%                        it processes each figure), use
%%%                        `\epsfverbosetrue'.
%%%
%%%                        If you only want to get the bounding box
%%%                        extents, without producing any output boxes
%%%                        or \special{}, then use \epsfgetbb{filename}.
%%%                        The bounding box corner coordinates are saved
%%%                        in the macros \epsfllx, \epsflly, \epsfurx,
%%%                        and \epsfury in PostScript units of big
%%%                        points.
%%%
%%%                        Revision history:
%%%
%%%                        ---------------------------------------------
%%%                        epsf.tex macro file:
%%%                        Originally written by Tomas Rokicki of
%%%                        Radical Eye Software, 29 Mar 1989.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Don Knuth, 3 Jan 1990.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Tomas Rokicki, 18 Jul 1990.
%%%                        Accept bounding boxes with no space after
%%%                        the colon.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 03 Dec 1991 [2.0].
%%%                        Add version number and date typeout.
%%%
%%%                        Use \immediate\write16 instead of \message
%%%                        to ensure output on new line.
%%%
%%%                        Handle nested EPS files.
%%%
%%%                        Handle %%BoundingBox: (atend) lines.
%%%
%%%                        Do not quit when blank lines are found.
%%%
%%%                        Add a few percents to remove generation of
%%%                        spurious blank space.
%%%
%%%                        Move \special output to
%%%                        \epsfspecial{filename} so that other macro
%%%                        packages can input this one, then change
%%%                        the definition of \epsfspecial to match
%%%                        another DVI driver.
%%%
%%%                        Move size computation to \epsfsetsize which
%%%                        can be called by the user; the verbose
%%%                        output of the bounding box and scaled width
%%%                        and height happens here.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 05 May 1992 [2.1].
%%%                        Wrap \leavevmode\hbox{} around \vbox{} with
%%%                        the \special so that \epsffile{} can be
%%%                        used inside \begin{center}...\end{center}
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 09 Dec 1992 [2.2].
%%%                        Introduce \epsfshow{true,false} and
%%%                        \epsfframe{true,false} macros; the latter
%%%                        suppresses the insertion of the PostScript,
%%%                        and instead just creates an empty box,
%%%                        which may be handy for rapid prototyping.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 14 Dec 1992 [2.3].
%%%                        Add \epsfshowfilename{true,false}.  When
%%%                        true, and \epsfshowfalse is specified, the
%%%                        PostScript file name will be displayed
%%%                        centered in the figure box.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 20 June 1993 [2.4].
%%%                        Remove non-zero debug setting of \epsfframemargin,
%%%                        and change margin handling to preserve EPS image
%%%                        size and aspect ratio, so that the actual
%%%                        box is \epsfxsize+\epsfframemargin wide by
%%%                        \epsfysize+\epsfframemargin high.
%%%                        Reduce output of \epsfshowfilenametrue to
%%%                        just the bare file name.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 13 July 1993 [2.5].
%%%                        Add \epsfframethickness for control of
%%%                        \epsfframe frame lines.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 02 July 1996 [2.6]
%%%                        Add missing initialization \epsfatendfalse;
%%%                        the lack of this resulted in the wrong
%%%                        BoundingBox being picked up, mea culpa, sigh...
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 25 October 1996 [2.7]
%%%                        Update to match changes in from dvips 5-600
%%%                        distribution: new user-accessible macros:
%%%                        \epsfclipon, \epsfclipoff, \epsfdrafton,
%%%                        \epsfdraftoff, change \empty to \epsfempty.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 18 May 2002 [2.7.1]
%%%                        Add write statements to echo input file
%%%                        names.  Prior to that change, an error in
%%%                        such a file could be quite hard to track
%%%                        down: a long list of TeX page numbers could
%%%                        suddenly be followed by ``TeX buffer
%%%                        capacity'' exceeded, without any indication
%%%                        of the file that was responsible.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 16 May 2003 [2.7.2]
%%%                        Supply two critical percent characters that
%%%                        were mistakenly omitted in version 2.7.1,
%%%                        and resulted in a small amount of spurious
%%%                        horizontal space.
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, 14 Feb 2011 [2.7.3]
%%%                        Add previously-missing \space in rwi
%%%                        assignments (bug reported 14-Feb-2011 by
%%%                        Stefan Rueger <s.rueger@open.ac.uk>).
%%%
%%%                        ---------------------------------------------
%%%                        Revised by Nelson H. F. Beebe
%%%                        <beebe@math.utah.edu>, Karl Berry
%%%                        <karl@freefriends.org>, and Robin Fairbairns
%%%                        <Robin.Fairbairns@cl.cam.ac.uk>,
%%%                        23 July 2005 [2.7.3]
%%%                        Add critical \hbox{} wrapper in \epsfsetgraph
%%%                        so that \epsfbox{} does not conflict with
%%%                        LaTeX center environment when \epsfbox{} is
%%%                        surrounded by other horizonal objects.
%%%                        Improve macro readability by adding legal,
%%%                        but invisible-in-typeset-output, spaces.
%%%                        Ensure that verbose status reports come
%%%                        inside (filename ...) list.
%%%
%%%                        ---------------------------------------------
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by
%%%                        the equivalent of the standard UNIX wc
%%%                        (word count) utility output of lines,
%%%                        words, and characters.  This is produced by
%%%                        Robert Solovay's checksum utility.",
%%%  }
%%% ====================================================================

%\immediate \write16 {This is `epsf.tex' v2.0 <02 Dec 1991>}%
%\immediate \write16 {This is `epsf.tex' v2.1 <05 May 1992>}%
%\immediate \write16 {This is `epsf.tex' v2.2 <09 Dec 1992>}%
%\immediate \write16 {This is `epsf.tex' v2.3 <14 Dec 1992>}%
%\immediate \write16 {This is `epsf.tex' v2.4 <20 June 1993>}%
%\immediate \write16 {This is `epsf.tex' v2.5 <13 July 1993>}%
%\immediate \write16 {This is `epsf.tex' v2.6 <02 July 1996>}%
%\immediate \write16 {This is `epsf.tex' v2.7 <25 October 1996>}%
%\immediate \write16 {This is `epsf.tex' v2.7.1 <18 May 2002>}%
%\immediate \write16 {This is `epsf.tex' v2.7.2 <16 May 2003>}%
%\immediate \write16 {This is `epsf.tex' v2.7.3 <23 July 2005>}%
\immediate \write16 {This is `epsf.tex' v2.7.4 <14 February 2011>}%
%
\newread \epsffilein    % file to \read
\newif \ifepsfatend     % need to scan to LAST %%BoundingBox comment?
\newif \ifepsfbbfound   % success?
\newif \ifepsfdraft     % use draft mode?
\newif \ifepsffileok    % continue looking for the bounding box?
\newif \ifepsfframe     % frame the bounding box?
\newif \ifepsfshow      % show PostScript file, or just bounding box?
\epsfshowtrue          % default is to display PostScript file
\newif \ifepsfshowfilename % show the file name if \epsfshowfalse specified?
\newif \ifepsfverbose   % report what you're making?
\newdimen \epsfframemargin % margin between box and frame
\newdimen \epsfframethickness % thickness of frame rules
\newdimen \epsfrsize    % vertical size before scaling
\newdimen \epsftmp      % register for arithmetic manipulation
\newdimen \epsftsize    % horizontal size before scaling
\newdimen \epsfxsize    % horizontal size after scaling
\newdimen \epsfysize    % vertical size after scaling
\newdimen \pspoints     % conversion factor
%
\pspoints = 1bp        % Adobe points are `big'
\epsfxsize = 0pt       % default value, means `use natural size'
\epsfysize = 0pt       % ditto
\epsfframemargin = 0pt % default value: frame box flush around picture
\epsfframethickness = 0.4pt % TeX's default rule thickness
%
\def \epsfbox #1{%
    \global \def \epsfllx {72}%
    \global \def \epsflly {72}%
    \global \def \epsfurx {540}%
    \global \def \epsfury {720}%
    \def \lbracket {[}%
    \def \testit {#1}%
    \ifx \testit \lbracket
        \let \next = \epsfgetlitbb
    \else
        \let \next = \epsfnormal
    \fi
    \next{#1}%
}%
%
% We use \epsfgetlitbb if the user specified an explicit bounding box,
% and \epsfnormal otherwise.  Because \epsfgetbb can be called
% separately to retrieve the bounding box, we move the verbose
% printing the bounding box extents and size on the terminal to
% \epsfstatus.  Therefore, when the user provided the bounding box,
% \epsfgetbb will not be called, so we must call \epsfsetsize and
% \epsfstatus ourselves.
%
\def \epsfgetlitbb #1#2 #3 #4 #5]#6{%
   \epsfgrab #2 #3 #4 #5 .\\%
   \epsfsetsize
   \epsfstatus{#6}%
   \epsfsetgraph{#6}%
}%
%
\def \epsfnormal #1{%
    \epsfgetbb{#1}%
    \epsfsetgraph{#1}%
}%
%
\def \epsfgetbb #1{%
%
%   The first thing we need to do is to open the
%   PostScript file, if possible.
%
    \openin\epsffilein=#1
    \immediate \write16 {(#1}%
    \ifeof \epsffilein
        \errmessage{Could not open file #1, ignoring it}%
    \else                       %process the file
        {%                      %start a group to contain catcode changes
            % Make all special characters, except space, to be of type
            % `other' so we process the file in almost verbatim mode
            % (TeXbook, p. 344).
            \chardef \other = 12%
            \def \do ##1{\catcode`##1=\other}%
            \dospecials
            \catcode `\ = 10%
            \epsffileoktrue        %true while we are looping
            \epsfatendfalse        %[02-Jul-1996]: add forgotten initialization
            \loop                  %reading lines from the EPS file
                \read \epsffilein to \epsffileline
                \ifeof \epsffilein %then no more input
                \epsffileokfalse   %so set completion flag
            \else                  %otherwise process one line
                \expandafter \epsfaux \epsffileline :. \\%
            \fi
            \ifepsffileok
            \repeat
            \ifepsfbbfound
            \else
                \ifepsfverbose
                    \immediate \write16 {No BoundingBox comment found in %
                                         file #1; using defaults}%
                \fi
            \fi
        }%                      %end catcode changes
        \closein\epsffilein
    \fi                         %end of file processing
    \epsfsetsize                %compute size parameters
    \epsfstatus{#1}%
    \immediate \write16 {)}%
}%
%
% Clipping control:
\def \epsfclipon  {\def \epsfclipstring { clip}}%
\def \epsfclipoff {\def \epsfclipstring {\ifepsfdraft \space clip\fi}}%
\epsfclipoff % default for dvips is OFF
%
% The special that is emitted by \epsfsetgraph comes from this macro.
% It is defined separately to allow easy customization by other
% packages that first \input epsf.tex, then redefine \epsfspecial.
% This macro is invoked in the lower-left corner of a box of the
% width and height determined from the arguments to \epsffile, or
% from the %%BoundingBox in the EPS file itself.
%
% This version is for dvips:
\def \epsfspecial #1{%
     \epsftmp=10\epsfxsize
     \divide \epsftmp by \pspoints
     \ifnum \epsfrsize = 0%
       \relax
       \special{PSfile=\ifepsfdraft psdraft.ps\else#1\fi\space
		llx=\epsfllx\space
		lly=\epsflly\space
		urx=\epsfurx\space
		ury=\epsfury\space
		rwi=\number\epsftmp\space
		\epsfclipstring
               }%
     \else
       \epsfrsize=10\epsfysize
       \divide \epsfrsize by \pspoints
       \special{PSfile=\ifepsfdraft psdraft.ps\else#1\fi\space
		llx=\epsfllx\space
		lly=\epsflly\space
		urx=\epsfurx\space
		ury=\epsfury\space
		rwi=\number\epsftmp\space
		rhi=\number\epsfrsize
		\epsfclipstring
               }%
     \fi
}%
%
% \epsfframe macro adapted from the TeXbook, exercise 21.3, p. 223, 331.
% but modified to set the box width to the natural width, rather
% than the line width, and to include space for margins and rules
\def \epsfframe #1%
{%
 % method for detecting latex suggested by Robin Fairbairns, May 2005.
  \ifx \documentstyle \epsfundefined
    \relax
  \else
%    \leavevmode                   % so we can put this inside
                                  % a latex centered environment
    % The \leavevmode breaks under plain when this is inside a box,
    % because it forces the figure to be the entire \hsize.  On the
    % other hand, we need the \leavevmode for it to work in LaTeX,
    % because the {center} environment works by adjusting TeX's
    % paragraph parameters.
    %
    % Compare the LaTeX sequence
    % \begin{center}
    %   \epsfbox{tip.eps}q
    % \end{center}
    % (needs the \leavevmode to put the q right next to the image)
    %
    % with the plain TeX sequence:
    % \leftline{\vbox{\epsfbox{tip.eps}}q}
    % (had the q all the way over to the right, when \leavevmode was used)
  \fi
  %
  \setbox0 = \hbox{#1}%
  \dimen0 = \wd0                                % natural width of argument
  \advance \dimen0 by 2\epsfframemargin         % plus width of 2 margins
  \advance \dimen0 by 2\epsfframethickness      % plus width of 2 rule lines
  \relax
  \hbox{%
    \vbox
    {%
      \hrule height \epsfframethickness depth 0pt
      \hbox to \dimen0
      {%
	\hss
	\vrule width \epsfframethickness
	\kern \epsfframemargin
	\vbox {\kern \epsfframemargin \box0 \kern \epsfframemargin }%
	\kern \epsfframemargin
	\vrule width \epsfframethickness
	\hss
      }% end hbox
      \hrule height 0pt depth \epsfframethickness
    }% end vbox
  }% end hbox
  \relax
}%
%
\def \epsfsetgraph #1%
{%
   %
   % Make the vbox and stick in a \special that the DVI driver can
   % parse.  \vfil and \hfil are used to place the \special origin at
   % the lower-left corner of the vbox.  \epsfspecial can be redefined
   % to produce alternate \special syntaxes.
   %
   \ifvmode \leavevmode \fi
   \relax
   \hbox{% so we can put this in \begin{center}...\end{center}
     \ifepsfframe \expandafter \epsfframe \fi
     {\vbox to\epsfysize
     {%
        \ifepsfshow
            % output \special{} at lower-left corner of figure box
            \vfil
            \hbox to \epsfxsize{\epsfspecial{#1}\hfil}%
        \else
            \vfil
            \hbox to\epsfxsize{%
               \hss
               \ifepsfshowfilename
               {%
                  \epsfframemargin=3pt % local change of margin
                  \epsfframe{{\tt #1}}%
               }%
               \fi
               \hss
            }%
            \vfil
        \fi
     }%
   }}%
   \relax
   %
   % Reset \epsfxsize and \epsfysize, as documented above.
   %
   \global \epsfxsize = 0pt
   \global \epsfysize = 0pt
}%
%
%   Now we have to calculate the scale and offset values to use.
%   First we compute the natural sizes.
%
\def \epsfsetsize
{%
   \epsfrsize = \epsfury \pspoints
   \advance \epsfrsize by -\epsflly \pspoints
   \epsftsize = \epsfurx \pspoints
   \advance \epsftsize by -\epsfllx \pspoints
%
%   If `epsfxsize' is 0, we default to the natural size of the picture.
%   Otherwise we scale the graph to be \epsfxsize wide.
%
   \epsfxsize = \epsfsize{\epsftsize}{\epsfrsize}%
   \ifnum \epsfxsize = 0
      \ifnum \epsfysize = 0
	\epsfxsize = \epsftsize
        \epsfysize = \epsfrsize
	\epsfrsize = 0pt
%
%   We have a sticky problem here:  TeX doesn't do floating point arithmetic!
%   Our goal is to compute y = rx/t. The following loop does this reasonably
%   fast, with an error of at most about 16 sp (about 1/4000 pt).
%
      \else
	\epsftmp = \epsftsize
        \divide \epsftmp by \epsfrsize
	\epsfxsize = \epsfysize
        \multiply \epsfxsize by \epsftmp
	\multiply \epsftmp by \epsfrsize
        \advance \epsftsize by -\epsftmp
	\epsftmp = \epsfysize
	\loop
        \advance \epsftsize by \epsftsize
        \divide \epsftmp by 2
	\ifnum \epsftmp > 0
	   \ifnum \epsftsize < \epsfrsize
           \else
	      \advance \epsftsize -\epsfrsize
              \advance \epsfxsize \epsftmp
           \fi
	\repeat
	\epsfrsize = 0pt
      \fi
   \else
     \ifnum \epsfysize = 0
       \epsftmp = \epsfrsize
       \divide \epsftmp by \epsftsize
       \epsfysize = \epsfxsize
       \multiply \epsfysize by \epsftmp
       \multiply \epsftmp by \epsftsize
       \advance \epsfrsize by -\epsftmp
       \epsftmp = \epsfxsize
       \loop
	 \advance \epsfrsize by \epsfrsize
	 \divide \epsftmp by 2
       \ifnum \epsftmp > 0
	  \ifnum \epsfrsize < \epsftsize
          \else
	     \advance \epsfrsize by -\epsftsize
             \advance \epsfysize by \epsftmp
          \fi
       \repeat
       \epsfrsize = 0pt
     \else
       \epsfrsize = \epsfysize
     \fi
   \fi
}%
%
% Issue some status messages if the user requested them
%
\def \epsfstatus #1{% arg = filename
   \ifepsfverbose
     \immediate \write16 {#1: BoundingBox:
			  llx = \epsfllx \space lly = \epsflly \space
			  urx = \epsfurx \space ury = \epsfury \space}%
     \immediate \write16 {#1: scaled width = \the\epsfxsize \space
			  scaled height = \the\epsfysize}%
   \fi
}%
%
%   We still need to define the tricky \epsfaux macro. This requires
%   a couple of magic constants for comparison purposes.
%
{\catcode`\%=12 \global \let \epsfpercent=%\global \def \epsfbblit {%BoundingBox}}%
\global \def \epsfatend{(atend)}%
%
%   So we're ready to check for `%BoundingBox:' and to grab the
%   values if they are found.
%
%   If we find a line
%
%   %%BoundingBox: (atend)
%
%   then we ignore it, but set a flag to force parsing all of the
%   file, so the last %%BoundingBox parsed will be the one used.  This
%   is necessary, because EPS files can themselves contain other EPS
%   files with their own %%BoundingBox comments.
%
%   If we find a line
%
%   %%BoundingBox: llx lly urx ury
%
%   then we save the 4 values in \epsfllx, \epsflly, \epsfurx, \epsfury.
%   Then, if we have not previously parsed an (atend), we flag completion
%   and can stop reading the file.  Otherwise, we must keep on reading
%   to end of file so that we find the values on the LAST %%BoundingBox.
\long \def \epsfaux#1#2:#3\\%
{%
   \def \testit {#2}%           % save second character up to just before colon
   \ifx#1\epsfpercent           % then first char is percent (quick test)
       \ifx \testit \epsfbblit  % then (slow test) we have %%BoundingBox
            \epsfgrab #3 . . . \\%
            \ifx \epsfllx\epsfatend % then ignore %%BoundingBox: (atend)
                \global \epsfatendtrue
            \else               % else found %%BoundingBox: llx lly urx ury
                \ifepsfatend    % then keep parsing ALL %%BoundingBox lines
                \else           % else stop after first one parsed
                    \epsffileokfalse
                \fi
                \global \epsfbbfoundtrue
            \fi
       \fi
   \fi
}%
%
%   Here we grab the values and stuff them in the appropriate definitions.
%
\def \epsfempty {}%
\def \epsfgrab #1 #2 #3 #4 #5\\{%
   \global \def \epsfllx {#1}\ifx \epsfllx\epsfempty
      \epsfgrab #2 #3 #4 #5 .\\\else
   \global \def \epsflly {#2}%
   \global \def \epsfurx {#3}\global \def \epsfury {#4}\fi
}%
%
%   We default the epsfsize macro.
%
\def \epsfsize #1#2{\epsfxsize}%
%
%   Finally, another definition for compatibility with older macros.
%
\let \epsffile = \epsfbox
\endinput


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>hu.unideb.inf.pk</groupId>
	<artifactId>RunDiary</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>
	<licenses>
		<license>
			<name>apache_v2</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0</url>
		</license>
	</licenses>
	<description>Ez a project Programozási környezetek Tárgyhoz beadandó feladatként készült.
	A projekt egy futási naplót valósít meg</description>
	<inceptionYear>2017</inceptionYear>
	<organization>
		<name>Faculty of Informatics, University of
		Debrecen</name>
		<url>http://www.inf.unideb.hu/</url>
	</organization>

	<developers>
		<developer>
			<name>Veress Balázs</name>
			<email>veress.balazs1993@gmail.com</email>
			<organization>Debreceni Egyetem Informatikai Kar</organization>
			<organizationUrl>https://www.inf.unideb.hu/</organizationUrl>
		</developer>
	</developers>
	<scm>
		<connection>scm:svn:https://github.com/veressBalazs/runDiary</connection>
		<developerConnection>scm:svn:https://github.com/veressBalazs/runDiary</developerConnection>
		<url>https://github.com/veressBalazs</url>
	</scm>

	<name>RunDiary</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.5</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.5</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.1</version>
		</dependency>

		<dependency>

			<groupId>org.apache.derby</groupId>
			<artifactId>derby</artifactId>
			<version>10.8.2.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>4.0.1.Final</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.25</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/junit/junit -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
		</dependency>

	</dependencies>

	<build>
		<plugins>

			<plugin>
				<groupId>com.zenjava</groupId>
				<artifactId>javafx-maven-plugin</artifactId>
				<version>8.1.4</version>
				<configuration>
					<mainClass></mainClass>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>1.4.1</version>
				<executions>
					<execution>
						<id>enforce-java</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireJavaVersion>
									<version>1.8.0</version>
								</requireJavaVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>2.10.4</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-report-plugin</artifactId>
				<version>2.20</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.5</version>
			</plugin>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.7.10-SNAPSHOT</version>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>2.17</version>

			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>3.0.0</version>
				<executions>
					<execution>
						<goals>
							<goal>single</goal>
						</goals>
						<phase>package</phase>
						<configuration>
							<archive>
								<manifest>
									<mainClass>hu.unideb.inf.pk.RunDiary.App</mainClass>
								</manifest>
							</archive>
							<descriptorRefs>
								<descriptorRef>jar-with-dependencies</descriptorRef>
							</descriptorRefs>
						</configuration>
					</execution>
				</executions>
			</plugin>

		</plugins>

	</build>
	<reporting>
		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>2.10.4</version>
				<configuration>
					<doclet>org.beigesoft.uml.service.swing.CreatorDoclet</doclet>
					<docletArtifact>
						<groupId>org.beigesoft</groupId>
						<artifactId>beige-uml-swing</artifactId>
						<version>2.1.10</version>
					</docletArtifact>
					<useStandardDocletOptions>true</useStandardDocletOptions>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.5</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>2.17</version>
				<configuration>
					<configLocation>checkstyle.xml</configLocation>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>cobertura-maven-plugin</artifactId>
				<version>2.7</version>
			</plugin>
		</plugins>
	</reporting>
	<profiles>
		<profile>
			<id>jul</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-jdk14</artifactId>
					<version>1.7.25</version>
					<scope>runtime</scope>
				</dependency>
			</dependencies>
		</profile>
	</profiles>
</project>


text:
<?php

namespace Amsgames\LaravelShop;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;

class MigrationCommand extends Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'laravel-shop:migration';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Creates a migration following the LaravelShop specifications.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        $this->laravel->view->addNamespace('laravel-shop', substr(__DIR__, 0, -8).'views');

        $cartTable          = Config::get('shop.cart_table');
        $itemTable          = Config::get('shop.item_table');
        $couponTable        = Config::get('shop.coupon_table');
        $orderStatusTable   = Config::get('shop.order_status_table');
        $orderTable         = Config::get('shop.order_table');
        $transactionTable   = Config::get('shop.transaction_table');

        // Migrations
        $this->line('');
        $this->info( "Tables: $cartTable, $itemTable" );

        $message = "A migration that creates '$cartTable', '$itemTable', '$orderTable'".
        " tables will be created in database/migrations directory";

        $this->comment($message);
        $this->line('');

        if ($this->confirm('Proceed with the migration creation? [Yes|no]', 'Yes')) {

            $this->line('');

            $this->info('Creating migration...');
            if ($this->createMigration(compact(
                    'cartTable',
                    'itemTable',
                    'couponTable',
                    'orderStatusTable',
                    'orderTable',
                    'transactionTable'
                ))
            ) {

                $this->info('Migration successfully created!');
            } else {
                $this->error(
                    "Couldn't create migration.\n Check the write permissions".
                    " within the database/migrations directory."
                );
            }

        }

        // Seeder

        $this->line('');
        $this->info( "Table seeders: $orderStatusTable" );
        $message = "A seeder that seeds '$orderStatusTable' table(s) with data. Will be created in database/seeds directory";

        $this->comment($message);
        $this->line('');

        if ($this->confirm('Proceed with the seeder creation? [Yes|no]', 'Yes')) {

            $this->line('');

            $this->info('Creating seeder...');
            if ($this->createSeeder(compact(
                    'cartTable',
                    'itemTable',
                    'couponTable',
                    'orderStatusTable',
                    'orderTable',
                    'transactionTable'
                ))
            ) {
                $this->info('Seeder successfully created!');
            } else {
                $this->error(
                    "Couldn't create seeder.\n Check the write permissions".
                    " within the database/seeds directory."
                );
            }

        }
    }

    /**
     * Create the migration.
     *
     * @param array $data Data with table names.
     *
     * @return bool
     */
    protected function createMigration($data)
    {
        $migrationFile = base_path('/database/migrations') . '/' . date('Y_m_d_His') . '_shop_setup_tables.php';

        $usersTable  = Config::get('auth.table');
        $userModel   = Config::get('auth.providers.users.model');
        $userKeyName = (new $userModel())->getKeyName();

        $data = array_merge($data, compact('usersTable', 'userKeyName'));

        $output = $this->laravel->view->make('laravel-shop::generators.migration')->with($data)->render();

        if (!file_exists($migrationFile) && $fs = fopen($migrationFile, 'x')) {
            fwrite($fs, $output);
            fclose($fs);
            return true;
        }

        return false;
    }

    /**
     * Create the seeder.
     *
     * @param array $data Data with table names.
     *
     * @return bool
     */
    protected function createSeeder($data)
    {
        $seederFile = base_path('/database/seeds') . '/LaravelShopSeeder.php';

        $output = $this->laravel->view->make('laravel-shop::generators.seeder')->with($data)->render();

        if (!file_exists($seederFile) && $fs = fopen($seederFile, 'x')) {
            fwrite($fs, $output);
            fclose($fs);
            return true;
        }

        return false;
    }
}


text:
NUD=/path/to/nud
ARGS="-testnet"
VOTE_PATH=/path/to/output/vote.json
SIGNATURE_PATH=/path/to/output/vote.json.signature
ADDRESS=S....

$NUD $ARGS getvote >$VOTE_PATH
$NUD $ARGS signmessage $ADDRESS <$VOTE_PATH >$SIGNATURE_PATH


text:
package com.app.nfsclient.generic;

import com.app.nfsclient.AppState;
import com.app.nfsclient.Background;

import com.app.nfsclient.R;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class GenericDialog extends Dialog {
    protected static final String TAG = "GenericDialog";

    protected Context context;
    protected int layoutResid = R.layout.generic_dialog;

    protected LinearLayout dialogLayout;
    protected TextView titleView;
    protected View titleDivider;
    protected LinearLayout messageLayout;
	protected TextView messageView;
	protected LinearLayout bodyLayout;
	protected View view;

	protected Button positiveButton;
	protected int positiveButtonResid = R.id.genericDialogRightButton;
	protected int positiveButtonLabel = R.string.genericApplyButtonLabel;
	protected View.OnClickListener positiveButtonListener;

	protected Button negativeButton;
	protected int negativeButtonResid = R.id.genericDialogLeftButton;
	protected int negativeButtonLabel = R.string.genericCancelButtonLabel;
	protected View.OnClickListener negativeButtonListener;

	protected String titleString;
	protected String messageString;

	public GenericDialog(Context context, String titleString, String messageString, View view) {
		super(context, R.style.notificationDialogTheme);

		this.context = context;
		this.titleString = titleString;
		this.messageString = messageString;
		this.view = view;
	}
	public GenericDialog(Context context, int titleId, int messageId, View view) {
		this(context, context.getString(titleId), context.getString(messageId), view);
	}
	public GenericDialog(Context context, int titleId, String messageString, View view) {
		this(context, context.getString(titleId), messageString, view);
	}
	public GenericDialog(Context context, String titleString, int messageId, View view) {
		this(context, titleString, context.getString(messageId), view);
	}

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AppState.logX(TAG, "onCreate");

        setContentView(layoutResid);
        getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

        LayoutParams params = getWindow().getAttributes();
        params.width = LayoutParams.MATCH_PARENT;
        getWindow().setAttributes((android.view.WindowManager.LayoutParams)params);

        if ((dialogLayout = (LinearLayout)findViewById(R.id.genericDialogLayout)) != null)
            dialogLayout.setBackgroundColor(Background.windowBackgroundGet(context));

        titleView = (TextView)findViewById(R.id.genericDialogTitle);
        titleDivider = (View)findViewById(R.id.genericDialogTitleDivider);

        if ((messageLayout = (LinearLayout)findViewById(R.id.genericDialogMessageLayout)) != null)
            messageLayout.setBackgroundColor(Background.windowBackgroundGet(context));

        messageView = (TextView)findViewById(R.id.genericDialogMessage);
        bodyLayout = (LinearLayout)findViewById(R.id.genericDialogBody);

        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        	positiveButtonResid = R.id.genericDialogLeftButton;
        	negativeButtonResid = R.id.genericDialogRightButton;
        }

        if ((positiveButton = (Button)findViewById(positiveButtonResid)) != null) {
        	positiveButton.setText(positiveButtonLabel);
        	if (positiveButtonListener != null)
        		positiveButton.setOnClickListener(positiveButtonListener);
        	else
        		positiveButton.setOnClickListener(new View.OnClickListener() {
        			public void onClick(View v) {
        				dismiss();
        			}
        		});

        	positiveButton.setTextColor(Background.textColorGet(context));
        	positiveButton.setBackgroundDrawable(Background.positiveButtonSelectorGet(context));
        }

        if ((negativeButton = (Button)findViewById(negativeButtonResid)) != null) {
        	negativeButton.setText(negativeButtonLabel);
        	if (negativeButtonListener != null)
        		negativeButton.setOnClickListener(negativeButtonListener);
        	else
        		negativeButton.setOnClickListener(new View.OnClickListener() {
        			public void onClick(View v) {
        				dismiss();
        			}
        		});

			negativeButton.setTextColor(Background.textColorGet(context));
            negativeButton.setBackgroundDrawable(Background.negativeButtonSelectorGet(context));
        }
	}

	@Override
	protected void onStart() {
		super.onStart();
		AppState.logX(TAG, "onStart");

		titleView.setText(titleString);
		titleView.setTextColor(Background.textColorGet(context));

//      titleDivider.setBackgroundDrawable(AppState.colorThemeSolidListDividerGet(context));
        titleDivider.setBackgroundDrawable(Background.solidListDividerDrawableGet());
        titleDivider.setMinimumHeight((int)context.getResources().getDimension(
        	R.dimen.default_line_spacer_height));

		if (!TextUtils.isEmpty(messageString)) {
		    messageView.setText(messageString);
		    messageView.setTextColor(Background.textColorGet(context));
		} else {
			messageView.setMaxHeight(0);
		}

		if (view != null) {
			view.setBackgroundColor(Background.windowBackgroundGet(context));
		    bodyLayout.addView(view);
		}
	}

	public TextView titleViewGet() {
		return titleView;
	}
	public void titleViewSet(TextView titleView) {
		this.titleView = titleView;
	}

	public View titleDividerGet() {
		return titleDivider;
	}

	public TextView messageViewGet() {
		return messageView;
	}
	public void messageViewSet(TextView messageView) {
		this.messageView = messageView;
	}

	public View viewGet() {
		return view;
	}
	public void viewSet(View view) {
		this.view = view;
	}

	public void positiveButtonListenerSet(int label, View.OnClickListener listener) {
		positiveButtonLabel = label;
		positiveButtonListener = listener;
	}
	public void positiveButtonListenerSet(View.OnClickListener positiveButtonListener) {
		this.positiveButtonListener = positiveButtonListener;
	}

	public void negativeButtonListenerSet(int label, View.OnClickListener listener) {
	    negativeButtonLabel = label;
	    negativeButtonListener = listener;
	}
	public void negativeButtonListenerSet(View.OnClickListener negativeButtonListener) {
		this.negativeButtonListener = negativeButtonListener;
	}

	public GenericDialog dialogShow() {
        AppState.logX(TAG, "dialogShow");

        show();
        return this;
	}
}


text:
pyexcel.formatters.NamedRowFormatter
====================================

.. currentmodule:: pyexcel.formatters

.. autoclass:: NamedRowFormatter

   .. automethod:: __init__

   .. rubric:: Methods

   .. autosummary::

      ~NamedRowFormatter.__init__
      ~NamedRowFormatter.do_format
      ~NamedRowFormatter.is_my_business
      ~NamedRowFormatter.update_index


text:
layout: page
title: Fire Air Seminar
date: 2016-05-24
author: Arthur Yates
tags: weekly links, java
status: published
summary: Sed turpis nunc, rutrum non nisi.
banner: images/banner/leisure-05.jpg
booking:
  startDate: 08/12/2018
  endDate: 08/15/2018
  ctyhocn: NWBMSHX
  groupCode: FAS
published: true
---
Curabitur dapibus, sem ac sagittis fringilla, ligula lacus efficitur erat, et malesuada tortor diam sagittis dolor. Quisque felis nisi, semper sed vulputate vitae, ultrices vitae nunc. Etiam malesuada laoreet felis, eget consectetur metus porttitor id. Nullam in egestas odio, in malesuada ante. Mauris quis arcu dapibus, rutrum est quis, commodo nisi. Integer pretium eros nec purus sollicitudin posuere. Suspendisse auctor lectus a erat tincidunt, et fermentum libero eleifend. Phasellus sed dolor vitae purus gravida commodo. Sed non nisi nec eros eleifend cursus in at nulla. Fusce id enim sollicitudin, pharetra libero in, accumsan risus.

* Sed mattis ipsum sit amet neque consequat commodo in et neque
* Integer ultricies augue vel eros pretium, feugiat tempus neque tempus.

Praesent eu aliquet mauris. Etiam rutrum magna lectus, eu tristique dolor laoreet non. Ut convallis risus tellus, ut interdum felis rhoncus vel. Mauris tempor, elit sit amet pellentesque molestie, ipsum ipsum ullamcorper eros, in mollis massa massa sed dolor. Sed vel eros nec tortor interdum dignissim porttitor eget mi. Duis gravida sem eget facilisis facilisis. Integer pellentesque mauris eu elit sagittis, condimentum aliquet nisl interdum. Aliquam erat volutpat.
Ut dapibus, justo et sodales ultricies, libero tellus elementum nulla, vitae molestie lacus magna at odio. Proin at metus lorem. Curabitur convallis dolor est, eu ultricies justo ornare sit amet. Phasellus in sem hendrerit nibh lobortis consectetur vitae ultrices erat. Proin laoreet non quam non tincidunt. Curabitur interdum velit eu tortor ultricies cursus. Vivamus massa massa, sollicitudin ut cursus a, congue ac enim. Praesent dictum ante in luctus semper. Suspendisse dictum gravida hendrerit. Pellentesque euismod ullamcorper erat fringilla efficitur.


text:
module Mongo
  module Operation
    class ParallelScan

      # A MongoDB parallelscan operation sent as an op message.
      #
      # @api private
      #
      # @since 2.5.2
      class OpMsg < OpMsgBase
        include CausalConsistencySupported
        include ExecutableTransactionLabel
        include PolymorphicResult

        private

        def selector(server)
          sel = { :parallelCollectionScan => coll_name, :numCursors => cursor_count }
          sel[:maxTimeMS] = max_time_ms if max_time_ms
          sel[:readConcern] = read_concern if read_concern
          sel
        end
      end
    end
  end
end


text:
class ResourcesController < ApplicationController
  # TODO: auth

  # GET /resources
  # @param [Integer] infra_id
  def index
    infra_id = params.require(:infra_id)
    infra = Infrastructure.find(infra_id)
    resources = infra.resources_or_create

    # TODO: format
    resp = {
      ec2_instances: resources.ec2,
      rds_instances: resources.rds,
      s3_buckets: resources.s3,
      elb_instances: resources.elb,
    }

    render json: resp and return
  end

  # POST /resources
  # @param [Integer] infra_id
  # @param [String] physical_id
  # @param [String] screen_name Optional
  def create
    infra_id    = params.require(:infra_id)
    physical_id = params.require(:physical_id)
    screen_name = params[:screen_name] || physical_id
    type_name   = 'AWS::EC2::Instance' # XXX: 決め打ち

    infra = Infrastructure.find(infra_id)
    unless infra.create_complete?
      render plain: I18n.t('resources.msg.infrastructure_not_created'), status: :bad_request
      return
    end

    # Infraが所属するRegionにphysical_idのインスタンスが存在しない場合
    unless infra.instance(physical_id).exists?
      render plain: I18n.t('resources.msg.cannot_find', physical_id: physical_id), status: :bad_request
      return
    end

    unless infra.instance(physical_id).describe_keypair == infra.keypairname
      render plain: I18n.t('resources.msg.keypair_dose_not_match', physical_id: physical_id), status: :bad_request
      return
    end

    unless infra.instance(physical_id).status != :terminated
      render plain: I18n.t('resources.msg.if_status_is_terminated', physical_id: physical_id), status: :bad_request
      return
    end

    begin
      instance = infra.instance(physical_id)
      instance.register_in_known_hosts

      Resource.create!(
        infrastructure_id: infra_id,
        physical_id: physical_id,
        screen_name: screen_name,
        type_name: type_name,
      )
    rescue StandardError => ex
      render plain: ex.message, status: :internal_server_error and return
    end

    render plain: I18n.t('resources.msg.created') and return
  end
end


text:
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import * as React from "react";

import CardTitle from "../../../components/CardTitle";
import { ControlledSwitch } from "../../../components/ControlledSwitch";
import { FormSpacer } from "../../../components/FormSpacer";
import i18n from "../../../i18n";

export interface CollectionStatusProps {
  data: {
    isFeatured: boolean;
    isPublished: boolean;
  };
  disabled: boolean;
  onChange: (event: React.ChangeEvent<any>) => void;
}

const CollectionStatus: React.StatelessComponent<CollectionStatusProps> = ({
  data,
  disabled,
  onChange
}) => (
  <Card>
    <CardTitle
      title={i18n.t("Availability", {
        context: "collection status"
      })}
    />
    <CardContent>
      <ControlledSwitch
        checked={data.isPublished}
        disabled={disabled}
        name="isPublished"
        onChange={onChange}
        label={i18n.t("Publish on storefront", {
          context: "button"
        })}
      />
      <FormSpacer />
      <ControlledSwitch
        checked={data.isFeatured}
        disabled={disabled}
        name="isFeatured"
        onChange={onChange}
        label={i18n.t("Feature on Homepage", {
          context: "button"
        })}
      />
    </CardContent>
  </Card>
);
CollectionStatus.displayName = "CollectionStatus";
export default CollectionStatus;


text:
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Grav\\Plugin\\FlexObjects\\' => array($baseDir . '/classes'),
);


text:
import { Component } from '@angular/core';

@Component({
    selector: 'footbar',
    templateUrl: './footbar.component.html'
})
export class FootbarComponent {

}


text:
package org.apache.directory.api.util;

import java.util.NoSuchElementException;

import javax.naming.NamingException;
import javax.naming.NamingEnumeration;

/**
 * An empty NamingEnumeration without any values: meaning
 * hasMore/hasMoreElements() always returns false, and next/nextElement() always
 * throws a NoSuchElementException.
 *
 * @author Apache Directory Project
 */
public class EmptyEnumeration<T> implements NamingEnumeration<T>
{

    /**
     * @see javax.naming.NamingEnumeration#close()
     */
    public void close()
    {
    }

    /**
     * Always returns false.
     *
     * @see javax.naming.NamingEnumeration#hasMore()
     */
    public boolean hasMore() throws NamingException
    {
        return false;
    }

    /**
     * Always throws NoSuchElementException.
     *
     * @see javax.naming.NamingEnumeration#next()
     */
    public T next() throws NamingException
    {
        throw new NoSuchElementException();
    }

    /**
     * Always return false.
     *
     * @see java.util.Enumeration#hasMoreElements()
     */
    public boolean hasMoreElements()
    {
        return false;
    }

    /**
     * Always throws NoSuchElementException.
     *
     * @see java.util.Enumeration#nextElement()
     */
    public T nextElement()
    {
        throw new NoSuchElementException();
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE component SYSTEM "../misc/component.dtd" [
<!ENTITY standard_uicomponent_attributes		SYSTEM "../entities/standard_uicomponent_attributes.xml">
<!ENTITY widget_var_attribute					SYSTEM "../entities/widget_var_attribute.xml">
]>
<component>
	<tag>media</tag>
	<tagClass>org.primefaces.component.media.MediaTag</tagClass>
	<componentClass>org.primefaces.component.media.Media</componentClass>
	<componentType>org.primefaces.component.Media</componentType>
	<componentFamily>org.primefaces.component</componentFamily>
	<rendererType>org.primefaces.component.MediaRenderer</rendererType>
	<rendererClass>org.primefaces.component.media.MediaRenderer</rendererClass>
	<parent>javax.faces.component.UIComponentBase</parent>
    <description>Media component is used for embedding multimedia content such as videos and music to JSF views. Media renders object or embed html tags depending on the user client.</description>
	<attributes>
		&standard_uicomponent_attributes;
		<attribute>
			<name>value</name>
			<required>false</required>
			<type>java.lang.Object</type>
            <description>Media source to play.</description>
		</attribute>
		<attribute>
			<name>player</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Type of the player, possible values are "quicktime","windows","flash","real" and "pdf".</description>
		</attribute>
		<attribute>
			<name>width</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Width of the player.</description>
		</attribute>
		<attribute>
			<name>height</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Height of the player.</description>
		</attribute>
		<attribute>
			<name>style</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Style of the player.</description>
		</attribute>
		<attribute>
			<name>styleClass</name>
			<required>false</required>
			<type>java.lang.String</type>
            <description>Style class of the player.</description>
		</attribute>
        <attribute>
			<name>cache</name>
			<required>false</required>
			<type>java.lang.Boolean</type>
			<defaultValue>true</defaultValue>
            <description>Controls browser caching mode of the resource. Default is true</description>
		</attribute>
	</attributes>
</component>