text:
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/updater/app/app_install.h"

#include <memory>
#include <string>
#include <tuple>
#include <vector>

#include <shldisp.h>
#include <shlobj.h>
#include <wrl/client.h>

#include "base/callback.h"
#include "base/check.h"
#include "base/check_op.h"
#include "base/files/file_path.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/process/launch.h"
#include "base/sequence_checker.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread_checker.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "base/win/atl.h"
#include "base/win/registry.h"
#include "base/win/scoped_bstr.h"
#include "base/win/scoped_variant.h"
#include "base/win/shlwapi.h"
#include "chrome/updater/registration_data.h"
#include "chrome/updater/service_proxy_factory.h"
#include "chrome/updater/update_service.h"
#include "chrome/updater/update_service_internal.h"
#include "chrome/updater/updater_branding.h"
#include "chrome/updater/updater_scope.h"
#include "chrome/updater/util/util.h"
#include "chrome/updater/win/install_progress_observer.h"
#include "chrome/updater/win/manifest_util.h"
#include "chrome/updater/win/scoped_impersonation.h"
#include "chrome/updater/win/user_info.h"
#include "chrome/updater/win/win_constants.h"
#include "chrome/updater/util/win_util.h"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-braces"
#include "chrome/updater/win/ui/l10n_util.h"
#include "chrome/updater/win/ui/progress_wnd.h"
#include "chrome/updater/win/ui/resources/updater_installer_strings.h"
#include "chrome/updater/win/ui/splash_screen.h"
#include "chrome/updater/win/ui/ui_util.h"
#pragma clang diagnostic pop

#include "third_party/abseil-cpp/absl/types/optional.h"

namespace updater {
namespace {

class InstallProgressSilentObserver : public InstallProgressObserver {
 public:
  explicit InstallProgressSilentObserver(ui::OmahaWndEvents* events_sink);
  ~InstallProgressSilentObserver() override = default;

  // Overrides for InstallProgressObserver.
  // These functions are called on the thread which owns this class.
  void OnCheckingForUpdate() override;
  void OnUpdateAvailable(const std::u16string& app_id,
                         const std::u16string& app_name,
                         const std::u16string& version_string) override;
  void OnWaitingToDownload(const std::u16string& app_id,
                           const std::u16string& app_name) override;
  void OnDownloading(const std::u16string& app_id,
                     const std::u16string& app_name,
                     int time_remaining_ms,
                     int pos) override;
  void OnWaitingRetryDownload(const std::u16string& app_id,
                              const std::u16string& app_name,
                              const base::Time& next_retry_time) override;
  void OnWaitingToInstall(const std::u16string& app_id,
                          const std::u16string& app_name,
                          bool* can_start_install) override;
  void OnInstalling(const std::u16string& app_id,
                    const std::u16string& app_name,
                    int time_remaining_ms,
                    int pos) override;
  void OnPause() override;
  void OnComplete(const ObserverCompletionInfo& observer_info) override;

 private:
  THREAD_CHECKER(thread_checker_);

  // Event sink must out-live this observer.
  raw_ptr<ui::OmahaWndEvents> events_sink_ = nullptr;
};

InstallProgressSilentObserver::InstallProgressSilentObserver(
    ui::OmahaWndEvents* events_sink)
    : events_sink_(events_sink) {
  DCHECK(events_sink_);
}

void InstallProgressSilentObserver::OnCheckingForUpdate() {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnUpdateAvailable(
    const std::u16string& app_id,
    const std::u16string& app_name,
    const std::u16string& version_string) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnWaitingToDownload(
    const std::u16string& app_id,
    const std::u16string& app_name) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnDownloading(
    const std::u16string& app_id,
    const std::u16string& app_name,
    int time_remaining_ms,
    int pos) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnWaitingRetryDownload(
    const std::u16string& app_id,
    const std::u16string& app_name,
    const base::Time& next_retry_time) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnWaitingToInstall(
    const std::u16string& app_id,
    const std::u16string& app_name,
    bool* can_start_install) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnInstalling(const std::u16string& app_id,
                                                 const std::u16string& app_name,
                                                 int time_remaining_ms,
                                                 int pos) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnPause() {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
}

void InstallProgressSilentObserver::OnComplete(
    const ObserverCompletionInfo& observer_info) {
  DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
  DCHECK(events_sink_);
  VLOG(1) << __func__;

  // TODO(crbug.com/1286580): Launch `post_install_launch_command_line` for
  // each app if needed.

  events_sink_->DoExit();
}

// Implements a simple inter-thread communication protocol based on Windows
// messages exchanged between the application installer and its UI.
//
// Since the installer code and the UI code execute on different threads, the
// installer can't invoke directly functions exposed by the UI.
class InstallProgressObserverIPC : public InstallProgressObserver {
 public:
  // Used as an inter-thread communication mechanism between the installer and
  // UI threads.
  static constexpr unsigned int WM_PROGRESS_WINDOW_IPC = WM_APP + 1;

  InstallProgressObserverIPC(InstallProgressObserver* observer,
                             DWORD observer_thread_id)
      : observer_(observer), observer_thread_id_(observer_thread_id) {
    DCHECK(observer);
  }

  InstallProgressObserverIPC(const InstallProgressObserverIPC&) = delete;
  InstallProgressObserverIPC& operator=(const InstallProgressObserverIPC&) =
      delete;
  ~InstallProgressObserverIPC() override = default;

  // Called by the window proc when a specific application message is processed
  // by the progress window. This call always occurs in the context of the
  // thread which owns the window.
  void Invoke(WPARAM wparam, LPARAM lparam) {
    DCHECK_EQ(observer_thread_id_, ::GetCurrentThreadId());
    DCHECK_NE(lparam, 0);
    DCHECK_EQ(wparam, WPARAM{0});
    std::unique_ptr<base::OnceClosure> callback_wrapper(
        reinterpret_cast<base::OnceClosure*>(lparam));
    std::move(*callback_wrapper).Run();
  }

  // Overrides for InstallProgressObserver.
  // Called by the application installer code on the main updater thread.
  void OnCheckingForUpdate() override {
    DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
    DCHECK(observer_);
    PostClosure(base::BindOnce(&InstallProgressObserver::OnUpdateAvailable,
                               base::Unretained(observer_), std::u16string(),
                               std::u16string(), std::u16string()));
  }

  void OnUpdateAvailable(const std::u16string& app_id,
                         const std::u16string& app_name,
                         const std::u16string& version_string) override {
    DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
    DCHECK(observer_);
    PostClosure(base::BindOnce(&InstallProgressObserver::OnUpdateAvailable,
                               base::Unretained(observer_), app_id, app_name,
                               version_string));
  }

  void OnWaitingToDownload(const std::u16string& app_id,
                           const std::u16string& app_name) override {
    NOTREACHED();
  }

  void OnDownloading(const std::u16string& app_id,
                     const std::u16string& app_name,
                     int time_remaining_ms,
                     int pos) override {
    DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
    DCHECK(observer_);
    PostClosure(base::BindOnce(&InstallProgressObserver::OnDownloading,
                               base::Unretained(observer_), app_id, app_name,
                               time_remaining_ms, pos));
  }

  void OnWaitingRetryDownload(const std::u16string& app_id,
                              const std::u16string& app_name,
                              const base::Time& next_retry_time) override {
    NOTREACHED();
  }

  void OnWaitingToInstall(const std::u16string& app_id,
                          const std::u16string& app_name,
                          bool* can_start_install) override {
    DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
    DCHECK(observer_);

    // TODO(crbug.com/1014591): handle `can_start_install`.
    PostClosure(base::BindOnce(&InstallProgressObserver::OnWaitingToInstall,
                               base::Unretained(observer_), app_id, app_name,
                               nullptr));
  }

  void OnInstalling(const std::u16string& app_id,
                    const std::u16string& app_name,
                    int time_remaining_ms,
                    int pos) override {
    DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
    DCHECK(observer_);

    // TODO(crbug.com/1014594): implement progress.
    PostClosure(base::BindOnce(&InstallProgressObserver::OnInstalling,
                               base::Unretained(observer_), app_id, app_name,
                               time_remaining_ms, pos));
  }

  void OnPause() override { NOTREACHED(); }

  void OnComplete(const ObserverCompletionInfo& observer_info) override {
    DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
    DCHECK(observer_);
    PostClosure(base::BindOnce(&InstallProgressObserver::OnComplete,
                               base::Unretained(observer_), observer_info));
  }

 private:
  void PostClosure(base::OnceClosure closure) {
    DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
    std::unique_ptr<base::OnceClosure> closure_wrapper =
        std::make_unique<base::OnceClosure>(std::move(closure));
    ::PostThreadMessage(observer_thread_id_, WM_PROGRESS_WINDOW_IPC, 0,
                        reinterpret_cast<LPARAM>(closure_wrapper.release()));
  }

  THREAD_CHECKER(thread_checker_);

  // This member is not owned by this class.
  raw_ptr<InstallProgressObserver> observer_ = nullptr;

  // The thread id of the thread which creates the `observer_`. The thread
  // must have a message queue to enable this IPC class to post messages to it.
  DWORD observer_thread_id_ = 0;
};

void SetUsageStats(UpdaterScope scope,
                   const std::string& app_id,
                   bool usage_stats_enabled) {
  const LONG result =
      base::win::RegKey(
          scope == UpdaterScope::kUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
          base::StrCat({scope == UpdaterScope::kUser ? CLIENT_STATE_KEY
                                                     : CLIENT_STATE_MEDIUM_KEY,
                        base::SysUTF8ToWide(app_id)})
              .c_str(),
          Wow6432(KEY_WRITE))
          .WriteValue(L"usagestats", usage_stats_enabled ? 1 : 0);
  VLOG_IF(1, result != ERROR_SUCCESS)
      << "Error writing usage stats for " << app_id << ":" << result;
}

// Implements installing a single application by invoking the code in
// |UpdateService|, listening to |UpdateService| and UI events, and
// driving the UI code by calling the functions exposed by
// |InstallProgressObserver|. This class receives state changes for an install
// and it notifies the UI, which is an observer of this class.
//
// The UI code can't run in a thread where the message loop is an instance of
// |base::MessageLoop|. |base::MessageLoop| does not handle all the messages
// needed by the UI, since the UI is written in terms of WTL, and it requires
// a |WTL::MessageLoop| to work, for example, accelerators, dialog messages,
// TAB key, etc are all handled by WTL. Therefore, the UI code runs on its own
// thread. This thread owns all the UI objects, which must be created and
// destroyed on this thread. The rest of the code in this class runs on
// the updater main thread.
//
// This class controls the lifetime of the UI thread. Once the UI thread is
// created, it is going to run a message loop until the main thread initiates
// its teardown by posting a WM_QUIT message to it. This makes the UI message
// loop exit, and after that, the execution flow returns to the scheduler task,
// which has been running the UI message loop. Upon its completion, the task
// posts a reply to the main thread, which makes the main thread exit its run
// loop, and then the main thread returns to the destructor of this class,
// and destructs its class members.
class AppInstallControllerImpl : public AppInstallController,
                                 public ui::ProgressWndEvents,
                                 public WTL::CMessageFilter {
 public:
  explicit AppInstallControllerImpl(
      bool is_silent_install,
      scoped_refptr<UpdateService> update_service);
  AppInstallControllerImpl();

  AppInstallControllerImpl(const AppInstallControllerImpl&) = delete;
  AppInstallControllerImpl& operator=(const AppInstallControllerImpl&) = delete;

  // Override for AppInstallController.
  void InstallApp(const std::string& app_id,
                  const std::string& app_name,
                  base::OnceCallback<void(int)> callback) override;

  void InstallAppOffline(const std::string& app_id,
                         const std::string& app_name,
                         base::OnceCallback<void(int)> callback) override;

 private:
  friend class base::RefCountedThreadSafe<AppInstallControllerImpl>;

  ~AppInstallControllerImpl() override;

  // Overrides for OmahaWndEvents. These functions are called on the UI thread.
  void DoClose() override {}
  void DoExit() override;

  // Overrides for CompleteWndEvents. This function is called on the UI thread.
  bool DoLaunchBrowser(const std::string& url) override;

  // Overrides for ProgressWndEvents. These functions are called on the UI
  // thread.
  bool DoRestartBrowser(bool restart_all_browsers,
                        const std::vector<std::u16string>& urls) override;
  bool DoReboot() override;
  void DoCancel() override;

  // Overrides for WTL::CMessageFilter.
  BOOL PreTranslateMessage(MSG* msg) override;

  // These functions are called on the UI thread.
  void InitializeUI();
  void RunUI();

  // These functions are called on the main updater thread.
  void DoInstallApp();
  void DoInstallAppOffline(const base::FilePath& installer_path,
                           const std::string& install_args,
                           const std::string& install_data);
  void HandleOsNotSupported();
  void InstallComplete(UpdateService::Result result);

  [[nodiscard]] static ObserverCompletionInfo HandleInstallResult(
      const UpdateService::UpdateState& update_state);

  // Returns the thread id of the thread which owns the progress window.
  DWORD GetUIThreadID() const;

  // Receives the state changes during handling of the Install function call.
  void StateChange(const UpdateService::UpdateState& update_state);

  SEQUENCE_CHECKER(sequence_checker_);

  // Provides an execution environment for the updater main thread.
  scoped_refptr<base::SequencedTaskRunner> main_task_runner_;

  // Provides an execution environment for the UI code. Typically, it runs
  // a single task which is the UI run loop.
  scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;

  // The application ID and the associated application name. The application
  // name is displayed by the UI and it must be localized.
  std::string app_id_;
  std::u16string app_name_;

  // The out-of-process service used for making RPC calls to install the app.
  scoped_refptr<UpdateService> update_service_;

  // The message loop associated with the UI.
  std::unique_ptr<WTL::CMessageLoop> ui_message_loop_;

  std::unique_ptr<InstallProgressObserver> observer_;
  DWORD ui_thread_id_ = 0u;

  // The adapter for the inter-thread calls between the updater main thread
  // and the UI thread.
  std::unique_ptr<InstallProgressObserverIPC> install_progress_observer_ipc_;

  // Contains the result of installing the application. This is populated
  // by the `StateChangeCallback` or the completion callback, if the
  // former callback was not posted.
  absl::optional<ObserverCompletionInfo> observer_completion_info_;

  // Called when InstallApp is done.
  base::OnceCallback<void(int)> callback_;

  const bool is_silent_install_ = false;
};

// TODO(crbug.com/1296931): fix the hardcoding of the application name.
AppInstallControllerImpl::AppInstallControllerImpl(
    bool is_silent_install,
    scoped_refptr<UpdateService> update_service)
    : main_task_runner_(base::SequencedTaskRunner::GetCurrentDefault()),
      ui_task_runner_(base::ThreadPool::CreateSingleThreadTaskRunner(
          {base::TaskPriority::USER_BLOCKING,
           base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
          base::SingleThreadTaskRunnerThreadMode::DEDICATED)),
      update_service_(update_service),
      is_silent_install_(is_silent_install) {}
AppInstallControllerImpl::~AppInstallControllerImpl() = default;

void AppInstallControllerImpl::InstallApp(
    const std::string& app_id,
    const std::string& app_name,
    base::OnceCallback<void(int)> callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  app_id_ = app_id;
  app_name_ = base::UTF8ToUTF16(app_name);
  callback_ = std::move(callback);

  ui_task_runner_->PostTaskAndReply(
      FROM_HERE, base::BindOnce(&AppInstallControllerImpl::InitializeUI, this),
      base::BindOnce(&AppInstallControllerImpl::DoInstallApp, this));
}

void AppInstallControllerImpl::DoInstallApp() {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  // At this point, the UI has been initialized, which means the UI can be
  // used from now on as an observer of the application install. The task
  // below runs the UI message loop for the UI until it exits, because
  // a WM_QUIT message has been posted to it.
  ui_task_runner_->PostTask(
      FROM_HERE, base::BindOnce(&AppInstallControllerImpl::RunUI, this));

  // The UI thread runs the observer.
  install_progress_observer_ipc_ = std::make_unique<InstallProgressObserverIPC>(
      observer_.get(), ui_thread_id_);

  RegistrationRequest request;
  request.app_id = app_id_;
  absl::optional<tagging::AppArgs> app_args = GetAppArgs(app_id_);
  absl::optional<tagging::TagArgs> tag_args = GetTagArgs().tag_args;
  if (app_args)
    request.ap = app_args->ap;
  if (tag_args)
    request.brand_code = tag_args->brand_code;

  base::ThreadPool::PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&SetUsageStats, GetUpdaterScope(), app_id_,
                     tag_args && tag_args->usage_stats_enable &&
                         *tag_args->usage_stats_enable),
      base::BindOnce(
          &UpdateService::Install, update_service_, request,
          GetDecodedInstallDataFromAppArgs(app_id_),
          GetInstallDataIndexFromAppArgs(app_id_),
          UpdateService::Priority::kForeground,
          base::BindRepeating(&AppInstallControllerImpl::StateChange, this),
          base::BindOnce(&AppInstallControllerImpl::InstallComplete, this)));
}

void AppInstallControllerImpl::InstallAppOffline(
    const std::string& app_id,
    const std::string& app_name,
    base::OnceCallback<void(int)> callback) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);

  app_id_ = app_id;
  app_name_ = base::UTF8ToUTF16(app_name);
  callback_ = std::move(callback);

  ui_task_runner_->PostTaskAndReply(
      FROM_HERE, base::BindOnce(&AppInstallControllerImpl::InitializeUI, this),
      base::BindOnce(
          [](scoped_refptr<AppInstallControllerImpl> self) {
            base::ThreadPool::PostTaskAndReplyWithResult(
                FROM_HERE, {base::MayBlock()},
                base::BindOnce(
                    [](const std::string& app_id) {
                      const base::CommandLine cmd_line =
                          GetCommandLineLegacyCompatible();
                      // Parse the offline manifest to get the install
                      // command and install data.
                      update_client::ProtocolParser::Results results;
                      base::FilePath installer_path;
                      std::string install_args;
                      std::string install_data;
                      ReadInstallCommandFromManifest(
                          cmd_line.GetSwitchValuePath(kOfflineDirSwitch),
                          app_id,
                          GetInstallDataIndexFromAppArgsForCommandLine(cmd_line,
                                                                       app_id),
                          results, installer_path, install_args, install_data);

                      const std::string client_install_data =
                          GetDecodedInstallDataFromAppArgsForCommandLine(
                              cmd_line, app_id);
                      return std::make_tuple(
                          results, installer_path, install_args,
                          client_install_data.empty() ? install_data
                                                      : client_install_data);
                    },
                    self->app_id_),
                base::BindOnce(
                    [](scoped_refptr<AppInstallControllerImpl> self,
                       const std::tuple<
                           update_client::ProtocolParser::Results /*results*/,
                           base::FilePath /*installer_path*/,
                           std::string /*arguments*/,
                           std::string /*install_data*/>& result) {
                      if (!IsOsSupported(std::get<0>(result))) {
                        self->HandleOsNotSupported();
                        return;
                      }

                      self->DoInstallAppOffline(std::get<1>(result),
                                                std::get<2>(result),
                                                std::get<3>(result));
                    },
                    self));
          },
          base::WrapRefCounted(this)));
}

void AppInstallControllerImpl::DoInstallAppOffline(
    const base::FilePath& installer_path,
    const std::string& install_args,
    const std::string& install_data) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  // At this point, the UI has been initialized, which means the UI can be
  // used from now on as an observer of the application install. The task
  // below runs the UI message loop until it exits, because a WM_QUIT message
  // has been posted to it.
  ui_task_runner_->PostTask(
      FROM_HERE, base::BindOnce(&AppInstallControllerImpl::RunUI, this));

  // The UI thread runs the observer.
  install_progress_observer_ipc_ = std::make_unique<InstallProgressObserverIPC>(
      observer_.get(), ui_thread_id_);

  // TODO(crbug.com/1286581): fine-tune installation behavior by serializing
  // other related command line options, such as "/sessionid <sid>" into
  // `install_settings`.
  base::CommandLine cmd_line = GetCommandLineLegacyCompatible();
  base::Value::Dict install_settings_dict;
  install_settings_dict.Set(kEnterpriseSwitch,
                            cmd_line.HasSwitch(kEnterpriseSwitch));
  install_settings_dict.Set(kSessionIdSwitch,
                            cmd_line.GetSwitchValueASCII(kSessionIdSwitch));

  std::string install_settings;
  if (!JSONStringValueSerializer(&install_settings)
           .Serialize(install_settings_dict)) {
    VLOG(1) << "Failed to serialize install settings.";
  }

  absl::optional<tagging::TagArgs> tag_args =
      GetTagArgsForCommandLine(cmd_line).tag_args;
  RegistrationRequest request;
  request.app_id = app_id_;

  absl::optional<tagging::AppArgs> app_args =
      GetAppArgsForCommandLine(cmd_line, app_id_);
  if (app_args)
    request.ap = app_args->ap;
  if (tag_args)
    request.brand_code = tag_args->brand_code;

  base::ThreadPool::PostTaskAndReply(
      FROM_HERE,
      base::BindOnce(&SetUsageStats, GetUpdaterScope(), app_id_,
                     tag_args && tag_args->usage_stats_enable &&
                         *tag_args->usage_stats_enable),
      base::BindOnce(
          &UpdateService::RegisterApp, update_service_, request,
          base::BindOnce(
              [](scoped_refptr<AppInstallControllerImpl> self,
                 const base::FilePath& installer_path,
                 const std::string& install_args,
                 const std::string& install_data,
                 const std::string& install_settings, int result) {
                if (result != kRegistrationSuccess &&
                    result != kRegistrationAlreadyRegistered) {
                  VLOG(1) << "Registration failed: " << result;
                  self->InstallComplete(UpdateService::Result::kServiceFailed);
                  return;
                }
                self->update_service_->RunInstaller(
                    self->app_id_, installer_path, install_args, install_data,
                    install_settings,
                    base::BindRepeating(&AppInstallControllerImpl::StateChange,
                                        self),
                    base::BindOnce(&AppInstallControllerImpl::InstallComplete,
                                   self));
              },
              base::WrapRefCounted(this), installer_path, install_args,
              install_data, install_settings)));
}

void AppInstallControllerImpl::HandleOsNotSupported() {
  UpdateService::UpdateState update_state;
  update_state.app_id = app_id_;
  update_state.state = UpdateService::UpdateState::State::kUpdateError;
  update_state.error_category = UpdateService::ErrorCategory::kInstall;
  update_state.error_code = UNSUPPORTED_WINDOWS_VERSION;
  observer_completion_info_ = HandleInstallResult(update_state);
  observer_completion_info_->completion_text =
      GetLocalizedString(IDS_INSTALL_OS_NOT_SUPPORTED_BASE);
  InstallComplete(UpdateService::Result::kInstallFailed);
}

// TODO(crbug.com/1218219) - propagate error code in case of errors.
void AppInstallControllerImpl::InstallComplete(UpdateService::Result result) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  VLOG(1) << __func__;
  if (result == UpdateService::Result::kServiceFailed) {
    UpdateService::UpdateState update_state;
    update_state.app_id = app_id_;
    update_state.state = UpdateService::UpdateState::State::kUpdateError;
    update_state.error_category = UpdateService::ErrorCategory::kService;
    update_state.error_code = -1;
    observer_completion_info_ = HandleInstallResult(update_state);
  }
  update_service_ = nullptr;
  CHECK(observer_completion_info_.has_value());
  install_progress_observer_ipc_->OnComplete(observer_completion_info_.value());
}

void AppInstallControllerImpl::StateChange(
    const UpdateService::UpdateState& update_state) {
  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  DCHECK(install_progress_observer_ipc_);

  CHECK_EQ(app_id_, update_state.app_id);

  const auto app_id = base::ASCIIToUTF16(app_id_);
  switch (update_state.state) {
    case UpdateService::UpdateState::State::kCheckingForUpdates:
      install_progress_observer_ipc_->OnCheckingForUpdate();
      break;

    case UpdateService::UpdateState::State::kUpdateAvailable:
      install_progress_observer_ipc_->OnUpdateAvailable(
          app_id, app_name_,
          base::ASCIIToUTF16(update_state.next_version.GetString()));
      break;

    case UpdateService::UpdateState::State::kDownloading: {
      // TODO(sorin): handle time remaining https://crbug.com/1014590.
      const auto pos = GetDownloadProgress(update_state.downloaded_bytes,
                                           update_state.total_bytes);
      install_progress_observer_ipc_->OnDownloading(app_id, app_name_, -1,
                                                    pos != -1 ? pos : 0);
    } break;

    case UpdateService::UpdateState::State::kInstalling: {
      // TODO(crbug.com/1014591): handle the install cancellation.
      bool can_start_install = false;
      install_progress_observer_ipc_->OnWaitingToInstall(app_id, app_name_,
                                                         &can_start_install);
      const int pos = update_state.install_progress;
      install_progress_observer_ipc_->OnInstalling(app_id, app_name_, 0,
                                                   pos != -1 ? pos : 0);
      break;
    }

    case UpdateService::UpdateState::State::kUpdated:
    case UpdateService::UpdateState::State::kNoUpdate:
    case UpdateService::UpdateState::State::kUpdateError:
      observer_completion_info_ = HandleInstallResult(update_state);
      break;

    case UpdateService::UpdateState::State::kUnknown:
    case UpdateService::UpdateState::State::kNotStarted:
      break;
  }
}

ObserverCompletionInfo AppInstallControllerImpl::HandleInstallResult(
    const UpdateService::UpdateState& update_state) {
  CompletionCodes completion_code = CompletionCodes::COMPLETION_CODE_ERROR;
  std::wstring completion_text;
  switch (update_state.state) {
    case UpdateService::UpdateState::State::kUpdated:
      VLOG(1) << "Update success.";
      completion_code = CompletionCodes::COMPLETION_CODE_SUCCESS;
      completion_text =
          GetLocalizedString(IDS_BUNDLE_INSTALLED_SUCCESSFULLY_BASE);
      break;
    case UpdateService::UpdateState::State::kNoUpdate:
      VLOG(1) << "No updates.";
      completion_code = CompletionCodes::COMPLETION_CODE_ERROR;
      completion_text = GetLocalizedString(IDS_NO_UPDATE_RESPONSE_BASE);
      break;
    case UpdateService::UpdateState::State::kUpdateError:
      VLOG(1) << "Updater error: " << update_state.error_code << ".";
      completion_code = CompletionCodes::COMPLETION_CODE_ERROR;
      completion_text = GetLocalizedString(IDS_INSTALL_UPDATER_FAILED_BASE);
      break;
    default:
      NOTREACHED();
      break;
  }

  ObserverCompletionInfo observer_info;
  observer_info.completion_code = completion_code;
  observer_info.completion_text = completion_text;
  observer_info.help_url = base::StringPrintf(
      "%s?product=%s&error=%d", HELP_CENTER_URL,
      base::EscapeUrlEncodedData(update_state.app_id, false).c_str(),
      update_state.error_code);

  AppCompletionInfo app_info;
  if (update_state.state != UpdateService::UpdateState::State::kNoUpdate) {
    app_info.app_id = base::ASCIIToUTF16(update_state.app_id);
    app_info.completion_message =
        base::ASCIIToUTF16(update_state.installer_text);
    app_info.error_code = update_state.error_code;
    app_info.extra_code1 = update_state.extra_code1;
    app_info.post_install_launch_command_line =
        base::SysUTF8ToWide(update_state.installer_cmd_line);
    VLOG(1) << app_info.app_id << " installation completed: error_code["
            << app_info.error_code << "], extra_code1[" << app_info.extra_code1
            << "], completion_message[" << app_info.completion_message
            << "], post_install_launch_command_line["
            << app_info.post_install_launch_command_line << "]";

    // TODO(crbug.com/1352307): Figure out how to populate members like
    // `completion_code` and `post_install_url`. For now, set the completion
    // for the basic cases and ignore the post install URL.
    if (app_info.error_code == 0) {
      app_info.completion_code =
          app_info.post_install_launch_command_line.empty()
              ? CompletionCodes::COMPLETION_CODE_SUCCESS
              : CompletionCodes::COMPLETION_CODE_LAUNCH_COMMAND;
    } else {
      app_info.completion_code = CompletionCodes::COMPLETION_CODE_ERROR;
    }
  }
  observer_info.apps_info.push_back(app_info);

  return observer_info;
}

// Creates the install progress observer. The observer has thread affinity. It
// must be created, process its messages, and be destroyed on the same thread.
void AppInstallControllerImpl::InitializeUI() {
  DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());

  base::ScopedDisallowBlocking no_blocking_allowed_on_ui_thread;

  ui_message_loop_ = std::make_unique<WTL::CMessageLoop>();
  ui_message_loop_->AddMessageFilter(this);
  ui_thread_id_ = ::GetCurrentThreadId();

  if (is_silent_install_) {
    observer_ = std::make_unique<InstallProgressSilentObserver>(this);
  } else {
    auto progress_wnd =
        std::make_unique<ui::ProgressWnd>(ui_message_loop_.get(), nullptr);
    progress_wnd->SetEventSink(this);
    progress_wnd->Initialize();
    progress_wnd->Show();
    observer_.reset(progress_wnd.release());
  }
}

void AppInstallControllerImpl::RunUI() {
  DCHECK(ui_task_runner_->RunsTasksInCurrentSequence());
  DCHECK_EQ(GetUIThreadID(), GetCurrentThreadId());

  ui_message_loop_->Run();
  ui_message_loop_->RemoveMessageFilter(this);

  // This object is owned by the UI thread must be destroyed on this thread.
  observer_ = nullptr;

  main_task_runner_->PostTask(FROM_HERE,
                              base::BindOnce(std::move(callback_), kErrorOk));
}

void AppInstallControllerImpl::DoExit() {
  DCHECK_EQ(GetUIThreadID(), GetCurrentThreadId());
  PostThreadMessage(GetCurrentThreadId(), WM_QUIT, 0, 0);
}

BOOL AppInstallControllerImpl::PreTranslateMessage(MSG* msg) {
  if (const auto ui_thread_id = GetUIThreadID(); ui_thread_id != 0) {
    DCHECK_EQ(ui_thread_id, GetCurrentThreadId());
  } else {
    VLOG(1) << "Can't find a thread id for the message: " << msg->message;
  }
  if (msg->message == InstallProgressObserverIPC::WM_PROGRESS_WINDOW_IPC) {
    install_progress_observer_ipc_->Invoke(msg->wParam, msg->lParam);
    return true;
  }
  return false;
}

DWORD AppInstallControllerImpl::GetUIThreadID() const {
  DCHECK_NE(ui_thread_id_, 0u);
  return ui_thread_id_;
}

bool AppInstallControllerImpl::DoLaunchBrowser(const std::string& url) {
  DCHECK_EQ(GetUIThreadID(), GetCurrentThreadId());

  return SUCCEEDED(RunDeElevated(base::SysUTF8ToWide(url), {}));
}

bool AppInstallControllerImpl::DoRestartBrowser(
    bool restart_all_browsers,
    const std::vector<std::u16string>& urls) {
  DCHECK_EQ(GetUIThreadID(), GetCurrentThreadId());
  return false;
}

bool AppInstallControllerImpl::DoReboot() {
  DCHECK_EQ(GetUIThreadID(), GetCurrentThreadId());
  return false;
}

void AppInstallControllerImpl::DoCancel() {
  DCHECK_EQ(GetUIThreadID(), GetCurrentThreadId());
  main_task_runner_->PostTask(
      FROM_HERE,
      base::BindOnce(&UpdateService::CancelInstalls, update_service_, app_id_));
}

}  // namespace

scoped_refptr<App> MakeAppInstall(bool is_silent_install) {
  return base::MakeRefCounted<AppInstall>(
      base::BindRepeating(
          [](const std::string& app_name) -> std::unique_ptr<SplashScreen> {
            return std::make_unique<ui::SplashScreen>(
                base::UTF8ToUTF16(app_name));
          }),
      base::BindRepeating(
          [](bool is_silent_install,
             scoped_refptr<UpdateService> update_service)
              -> scoped_refptr<AppInstallController> {
            return base::MakeRefCounted<AppInstallControllerImpl>(
                is_silent_install, update_service);
          },
          is_silent_install));
}

void AppInstall::WakeCandidateDone() {
  FetchPolicies();
}

}  // namespace updater


text:
[uigesturerecognizer](../../../index.md) / [it.sephiroth.android.library.uigestures](../../index.md) / [UIGestureRecognizer](../index.md) / [State](index.md) / [Began](./-began.md)

# Began

`Began`

redpajama_set_name: RedPajamaGithub


text:
ALTER TABLE ofMessageArchive ADD messageID INTEGER NULL;
ALTER TABLE ofMessageArchive ADD stanza LONG NULL;

-- Update database version
UPDATE ofVersion SET version = 3 WHERE name = 'monitoring';

commit;


text:
// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.

package org.usfirst.frc319.RecyleRush.subsystems;

import org.usfirst.frc319.RecyleRush.Robot;
import org.usfirst.frc319.RecyleRush.RobotMap;
import org.usfirst.frc319.RecyleRush.commands.*;

import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Relay.Value;
import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 */
public class ToteLights extends Subsystem {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
	Relay elevatorLightSpike = RobotMap.elevatorLightSpike;

    // Put methods for controlling this subsystem
    // here. Call these from Commands.

    public void initDefaultCommand() {
        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND
        // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND

        // Set the default command for a subsystem here.
    //	setDefaultCommand(new ToteLightsFunction());
        //setDefaultCommand(new MySpecialCommand());
    }

    public void LightUpWhenToteIsInPosition(){
    	if(Robot.elevator.isToteInCollector){
    		elevatorLightSpike.set(Value.kOn);
    	}else{
    		elevatorLightSpike.set(Value.kOff);
    	}
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

    <!-- User authentication filter -->
    <bean id="userAuthFilter" class="com.yourpackagename.yourwebproject.filter.UserAuthFilter" />
</beans>


text:
package com.intellij.uiDesigner.clientProperties;

import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.DimensionService;
import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.ColoredTreeCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.uiDesigner.UIDesignerBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import java.awt.BorderLayout;
import java.util.*;

/**
 * @author yole
 */
public class ConfigureClientPropertiesDialog extends DialogWrapper {
  private JPanel myRootPanel;
  private JTree myClassTree;
  private JTable myPropertiesTable;
  private JSplitPane mySplitPane;
  private JPanel myClassToolBarPanel;
  private JPanel myPropertyToolBarPanel;
  private Class mySelectedClass;
  private ClientPropertiesManager.ClientProperty[] mySelectedProperties = new ClientPropertiesManager.ClientProperty[0];
  private final MyTableModel myTableModel = new MyTableModel();
  private final Project myProject;
  private final ClientPropertiesManager myManager;

  public ConfigureClientPropertiesDialog(final Project project) {
    super(project, true);
    myProject = project;
    init();
    setTitle(UIDesignerBundle.message("client.properties.title"));
    myManager = ClientPropertiesManager.getInstance(project).clone();

    myClassTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
      public void valueChanged(TreeSelectionEvent e) {
        final TreePath leadSelectionPath = e.getNewLeadSelectionPath();
        if (leadSelectionPath == null) return;
        final DefaultMutableTreeNode node = (DefaultMutableTreeNode) leadSelectionPath.getLastPathComponent();
        mySelectedClass = (Class) node.getUserObject();
        updateSelectedProperties();
      }
    });

    myClassTree.setCellRenderer(new ColoredTreeCellRenderer() {
      public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
        if (node.getUserObject() instanceof Class) {
          Class cls = (Class) node.getUserObject();
          if (cls != null) {
            append(cls.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
          }
        }
      }
    });

    createToolBar(new AddClassAction(), new RemoveClassAction(), myClassToolBarPanel, myClassTree);
    createToolBar(new AddPropertyAction(), new RemovePropertyAction(), myPropertyToolBarPanel, myPropertiesTable);

    myPropertiesTable.setModel(myTableModel);

    final int location = DimensionService.getInstance().getExtendedState(getDimensionKey());
    if (location > 0) {
      mySplitPane.setDividerLocation(location);
    }

    fillClassTree();
  }

  private static void createToolBar(final AnAction addAction,
                                    final AnAction removeAction,
                                    final JPanel panel,
                                    final JComponent shortcutHost) {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(addAction);
    group.add(removeAction);
    ActionToolbar toolBar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
    panel.add(toolBar.getComponent(), BorderLayout.CENTER);
    addAction.registerCustomShortcutSet(CommonShortcuts.INSERT, shortcutHost);
    removeAction.registerCustomShortcutSet(CommonShortcuts.DELETE, shortcutHost);
  }

  public void save() {
    ClientPropertiesManager.getInstance(myProject).saveFrom(myManager);
  }

  @Override
  public void dispose() {
    DimensionService.getInstance().setExtendedState(getDimensionKey(), mySplitPane.getDividerLocation());
    super.dispose();
  }

  private void fillClassTree() {
    List<Class> configuredClasses = myManager.getConfiguredClasses();
    Collections.sort(configuredClasses, new Comparator<Class>() {
      public int compare(final Class o1, final Class o2) {
        return getInheritanceLevel(o1) - getInheritanceLevel(o2);
      }

      private int getInheritanceLevel(Class aClass) {
        int level = 0;
        while(aClass.getSuperclass() != null) {
          level++;
          aClass = aClass.getSuperclass();
        }
        return level;
      }
    });

    DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    DefaultTreeModel treeModel = new DefaultTreeModel(root);
    Map<Class, DefaultMutableTreeNode> classToNodeMap = new HashMap<Class, DefaultMutableTreeNode>();
    for(Class cls: configuredClasses) {
      DefaultMutableTreeNode parentNode = root;
      Class superClass = cls.getSuperclass();
      while(superClass != null) {
        if (classToNodeMap.containsKey(superClass)) {
          parentNode = classToNodeMap.get(superClass);
          break;
        }
        superClass = superClass.getSuperclass();
      }
      DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(cls);
      classToNodeMap.put(cls, childNode);
      parentNode.add(childNode);
    }
    myClassTree.setModel(treeModel);
    myClassTree.expandRow(0);
    myClassTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    myClassTree.getSelectionModel().setSelectionPath(new TreePath(new Object[] { root, root.getFirstChild() }));
  }

  private void updateSelectedProperties() {
    mySelectedProperties = myManager.getConfiguredProperties(mySelectedClass);
    myTableModel.fireTableDataChanged();
  }

  @Nullable
  protected JComponent createCenterPanel() {
    return myRootPanel;
  }

  @Override @NonNls
  protected String getDimensionServiceKey() {
    return "ConfigureClientPropertiesDialog";
  }

  private class MyTableModel extends AbstractTableModel {
    public int getRowCount() {
      return mySelectedProperties.length;
    }

    public int getColumnCount() {
      return 2;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
      switch(columnIndex) {
        case 0: return mySelectedProperties [rowIndex].getName();
        default: return mySelectedProperties [rowIndex].getValueClass();
      }
    }

    @Override
    public String getColumnName(int column) {
      switch(column) {
        case 0: return UIDesignerBundle.message("client.properties.name");
        default: return UIDesignerBundle.message("client.properties.class");
      }
    }
  }

  private class AddClassAction extends AnAction {
    public AddClassAction() {
      super(UIDesignerBundle.message("client.properties.add.class.tooltip"), "", IconLoader.getIcon("/general/add.png"));
    }

    public void actionPerformed(AnActionEvent e) {
      ClassNameInputDialog dlg = new ClassNameInputDialog(myProject, myRootPanel);
      dlg.show();
      if (dlg.getExitCode() == OK_EXIT_CODE) {
        String className = dlg.getClassName();
        if (className.length() == 0) return;
        final Class aClass;
        try {
          aClass = Class.forName(className);
        }
        catch(ClassNotFoundException ex) {
          Messages.showErrorDialog(myRootPanel,
                                   UIDesignerBundle.message("client.properties.class.not.found", className),
                                   UIDesignerBundle.message("client.properties.title"));
          return;
        }
        if (!JComponent.class.isAssignableFrom(aClass)) {
          Messages.showErrorDialog(myRootPanel,
                                   UIDesignerBundle.message("client.properties.class.not.component", className),
                                   UIDesignerBundle.message("client.properties.title"));
          return;
        }
        myManager.addClientPropertyClass(className);
        fillClassTree();
      }
    }
  }

  private class RemoveClassAction extends AnAction {
    public RemoveClassAction() {
      super(UIDesignerBundle.message("client.properties.remove.class.tooltip"), "", IconLoader.getIcon("/general/remove.png"));
    }

    public void actionPerformed(AnActionEvent e) {
      if (mySelectedClass != null) {
        myManager.removeClientPropertyClass(mySelectedClass);
        fillClassTree();
      }
    }
  }

  private class AddPropertyAction extends AnAction {
    public AddPropertyAction() {
      super(UIDesignerBundle.message("client.properties.add.property.tooltip"), "", IconLoader.getIcon("/general/add.png"));
    }

    public void actionPerformed(AnActionEvent e) {
      AddClientPropertyDialog dlg = new AddClientPropertyDialog(myProject);
      dlg.show();
      if (dlg.getExitCode() == OK_EXIT_CODE) {
        ClientPropertiesManager.ClientProperty[] props = myManager.getClientProperties(mySelectedClass);
        for(ClientPropertiesManager.ClientProperty prop: props) {
          if (prop.getName().equalsIgnoreCase(dlg.getEnteredProperty().getName())) {
            Messages.showErrorDialog(myRootPanel,
                                     UIDesignerBundle.message("client.properties.already.defined", prop.getName()),
                                     UIDesignerBundle.message("client.properties.title"));
            return;
          }
        }
        myManager.addConfiguredProperty(mySelectedClass, dlg.getEnteredProperty());
        updateSelectedProperties();
      }
    }
  }

  private class RemovePropertyAction extends AnAction {
    public RemovePropertyAction() {
      super(UIDesignerBundle.message("client.properties.remove.property.tooltip"), "", IconLoader.getIcon("/general/remove.png"));
    }

    public void actionPerformed(AnActionEvent e) {
      int row = myPropertiesTable.getSelectedRow();
      if (row >= 0 && row < mySelectedProperties.length) {
        myManager.removeConfiguredProperty(mySelectedClass, mySelectedProperties [row].getName());
        updateSelectedProperties();
        if (mySelectedProperties.length > 0) {
          if (row >= mySelectedProperties.length) row--;
          myPropertiesTable.getSelectionModel().setSelectionInterval(row, row);
        }
      }
    }

    public void update(AnActionEvent e) {
      e.getPresentation().setEnabled(myPropertiesTable.getSelectedRow() >= 0);
    }
  }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>CuapCuap · Home</title>

	<link rel="stylesheet" href="assets/css/kickstart.min.css" />
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

			×

Ogre Magi Two-Headed Ogre

		// unfinished;

			≡

Hot

New

Akademis

Riset

Seni

Olahraga

Santai

							<form action="/search" method="get" accept-charset="utf-8">
								<input type="search" class="search_bar" name="keyword" placeholder="Cari sesuatu?">
							</form>

Ogre Magi

	                        		<time>5 menit</time> yang lalu

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac posuere est. Ut nec diam sollicitudin, suscipit orci ac, facilisis justo. In lacinia cursus enim, ornare vehicula justo pharetra eu. Vivamus sodales erat id libero bibendum mollis. Suspendisse ornare, nulla quis malesuada efficitur, eros lorem porta neque, at pharetra ipsum lectus et nunc. Mauris finibus leo in maximus molestie. Nulla hendrerit libero tortor, at maximus arcu vestibulum vitae. Etiam vel porttitor ante, sed malesuada urna. Duis vulputate at tortor a sagittis. Nullam cursus gravida fermentum. Sed a tortor condimentum, interdum lectus at, pretium enim. Integer vitae pellentesque enim, sit amet eleifend sapien.

Curabitur sit amet justo ultricies, dictum neque et, consectetur odio. Sed at vestibulum odio. Donec commodo dictum ultrices. Proin cursus purus eget tellus faucibus pharetra. Phasellus eleifend dolor at condimentum tempor. Suspendisse ligula felis, pulvinar quis efficitur euismod, luctus eget felis. Mauris nec tristique nibh. In hac habitasse platea dictumst. Cras eget ligula ut purus sagittis placerat. Aliquam elit arcu, iaculis non facilisis eu, vehicula sed nunc. Nam vel arcu suscipit, congue augue non, blandit tellus. Donec malesuada commodo tristique. Sed semper semper erat, non viverra massa vestibulum sit amet. Praesent congue sagittis malesuada.

Nulla tristique, elit sit amet placerat varius, erat lorem blandit nibh, id porta justo quam a eros. Mauris in tempor neque, eget aliquet urna. Pellentesque nisi sapien, hendrerit non euismod non, pellentesque eget leo. Vivamus vitae mi id eros dignissim consectetur. Aenean in sodales felis. In ut arcu sit amet mi vestibulum porta. Etiam sagittis nisl sed tortor viverra, ut interdum mi tincidunt. Praesent ullamcorper sit amet lectus vel rutrum.

Vivamus facilisis vehicula nunc et blandit. Integer accumsan pretium urna vel scelerisque. Cras finibus massa porttitor, varius felis et, aliquam odio. Nullam lacinia libero vel eros fermentum, eget laoreet nibh mattis. Mauris aliquam urna nunc, sit amet blandit sapien mattis eu. Vestibulum in metus congue, euismod libero id, laoreet lacus. Curabitur porttitor mi elit, sed tristique erat tincidunt a. In pellentesque quis ex sit amet sodales. Duis bibendum non sem ut finibus. In dui ligula, venenatis ut placerat eget, accumsan nec mauris. Nam bibendum fermentum nulla, id aliquam nunc. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris luctus ex ac enim efficitur, vel tempor libero cursus.

Sed eget orci quis velit maximus tristique. Nulla non vehicula nibh. Phasellus ornare mi a quam mollis aliquam. Donec at ultrices nulla, et euismod sapien. Curabitur eget felis id eros rhoncus accumsan id non odio. In sed nisi id dolor pretium viverra nec eu sapien. Sed dictum orci et massa malesuada accumsan.

		                        	CUAPIN

		                        		999 Cuap
		                        		Olahraga

		                        		▴
			                        	-9999
			                        	▾

999 CUAP

		                        	Arc Warden the Warden of the Universe
	                        		<time>5 menit</time> yang lalu

Nulla tristique, elit sit amet placerat varius, erat lorem blandit nibh, id porta justo quam a eros. Mauris in tempor neque, eget aliquet urna. Pellentesque nisi sapien, hendrerit non euismod non, pellentesque eget leo. Vivamus vitae mi id eros dignissim consectetur. Aenean in sodales felis. In ut arcu sit amet mi vestibulum porta. Etiam sagittis nisl sed tortor viverra, ut interdum mi tincidunt. Praesent ullamcorper sit amet lectus vel rutrum.

		                        	CUAPIN

		                        		▴
			                        	-9999
			                        	▾

		                        	Arc Warden the Warden of the Universe
	                        		<time>5 menit</time> yang lalu

Nulla tristique, elit sit amet placerat varius, erat lorem blandit nibh, id porta justo quam a eros. Mauris in tempor neque, eget aliquet urna. Pellentesque nisi sapien, hendrerit non euismod non, pellentesque eget leo. Vivamus vitae mi id eros dignissim consectetur. Aenean in sodales felis. In ut arcu sit amet mi vestibulum porta. Etiam sagittis nisl sed tortor viverra, ut interdum mi tincidunt. Praesent ullamcorper sit amet lectus vel rutrum.

		                        	CUAPIN

		                        		▴
			                        	-9999
			                        	▾

		                        	Arc Warden the Warden of the Universe
	                        		<time>5 menit</time> yang lalu

Nulla tristique, elit sit amet placerat varius, erat lorem blandit nibh, id porta justo quam a eros. Mauris in tempor neque, eget aliquet urna. Pellentesque nisi sapien, hendrerit non euismod non, pellentesque eget leo. Vivamus vitae mi id eros dignissim consectetur. Aenean in sodales felis. In ut arcu sit amet mi vestibulum porta. Etiam sagittis nisl sed tortor viverra, ut interdum mi tincidunt. Praesent ullamcorper sit amet lectus vel rutrum.

		                        	CUAPIN

		                        		▴
			                        	-9999
			                        	▾

		                        	Arc Warden the Warden of the Universe
	                        		<time>5 menit</time> yang lalu

Nulla tristique, elit sit amet placerat varius, erat lorem blandit nibh, id porta justo quam a eros. Mauris in tempor neque, eget aliquet urna. Pellentesque nisi sapien, hendrerit non euismod non, pellentesque eget leo. Vivamus vitae mi id eros dignissim consectetur. Aenean in sodales felis. In ut arcu sit amet mi vestibulum porta. Etiam sagittis nisl sed tortor viverra, ut interdum mi tincidunt. Praesent ullamcorper sit amet lectus vel rutrum.

		                        	CUAPIN

		                        		▴
			                        	-9999
			                        	▾

«

1

2

3

4

5

6

7

»

MULAI DISKUSI

MULAI PERTANYAAN

PENGUMUMAN

PENGUMUMAN PENDEK

PENGUMUMAN LAGI

PENGUMUMAN DUA

PENGUMUMAN SATU

PENGUMUMAN TERAKHIR

RULES & GUIDES

PERATURAN FORUM

HOW-TO MAKE A POST

© Tim SBF PTI 2015, All Rights Reserved.

Tentang Kami

Bantuan

Kontak


text:
<?xml version="1.0"?>
<package>
  <name>object_detection_and_tracking</name>
  <version>0.1.4</version>
  <description>The object_detection_and_tracking package</description>

  <maintainer email="faeulhammer@acin.tuwien.ac.at">Thomas Faeulhammer</maintainer>
  <maintainer email="zillich@acin.tuwien.ac.at">Michael Zillich</maintainer>
  <license>MIT</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>cv_bridge</build_depend>
  <build_depend>image_transport</build_depend>
  <build_depend>object_tracker</build_depend>
  <build_depend>object_tracker_srv_definitions</build_depend>
  <build_depend>pcl_conversions</build_depend>
  <build_depend>recognition_srv_definitions</build_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>sensor_msgs</build_depend>
  <build_depend>singleview_object_recognizer</build_depend>
  <build_depend>v4r</build_depend>
  <run_depend>cv_bridge</run_depend>
  <run_depend>image_transport</run_depend>
  <run_depend>object_tracker</run_depend>
  <run_depend>object_tracker_srv_definitions</run_depend>
  <run_depend>pcl_conversions</run_depend>
  <run_depend>recognition_srv_definitions</run_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>rospy</run_depend>
  <run_depend>sensor_msgs</run_depend>
  <run_depend>singleview_object_recognizer</run_depend>
  <run_depend>v4r</run_depend>

  <export>

  </export>
</package>


text:
package org.ngbw.sdk.tool;

public class DisabledResourceException extends Exception
{
	public DisabledResourceException(String message)
	{
		super(message);
	}
}


text:
package br.com.objectos.way.orm.compiler;

import br.com.objectos.way.metainf.Services;
import br.com.objectos.way.orm.Orm;
import br.com.objectos.way.pojo.AbstractPlugin;
import br.com.objectos.way.pojo.Contribution;
import br.com.objectos.way.pojo.Plugin;
import br.com.objectos.way.pojo.PojoAction;
import br.com.objectos.way.pojo.PojoInfo;

/**
 * @author marcio.endo@objectos.com.br (Marcio Endo)
 */
@Services(Plugin.class)
public class InjectPlugin extends AbstractPlugin implements PojoAction {

  @Override
  protected void configure() {
    executeWhen(pojo((info) -> OrmPojoInfo.of(info).isPresent()));

    when(property(instanceOf(Orm.class))).ignore();
    execute(this);
  }

  @Override
  public Contribution execute(PojoInfo pojoInfo) {
    return OrmPojoInfo.of(pojoInfo)
        .get()
        .inject()
        .execute();
  }

}


text:
</div>
    <script src="js/jquery.js"></script>

    <script src="js/bootstrap.min.js"></script>
    <script src="js/bootstrap-toggle.js"></script>

    <script src="js/plugins/morris/raphael.min.js"></script>
    <script src="js/plugins/morris/morris.min.js"></script>
    <script src="js/plugins/morris/morris-data.js"></script>
    <!-- SCRIPT BACKOFFICE -->
    <script src="js/app.js"></script>

</body>

</html>


text:
<!DOCTYPE html>

        <meta charset="UTF-8" />
        <meta name="robots" content="index, follow, all" />
        <title>Thelia\Core\Template\Loop\Product | </title>
                    <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css">

Classes

Namespaces

Interfaces

Traits

Index

Class

Thelia\Core\Template\Loop\Product

    class
    Product        extends BaseI18nLoop        implements
        SearchLoopInterface

Product loop

Class Product

Properties

                $countable

                $timestampable

                $versionable

Methods

                    array

                    getSearchIn()

                    doSearch(ProductQuery $search, $searchTerm $searchTerm, $searchIn $searchIn, $searchCriteria $searchCriteria)

                    LoopResult

                    exec($pagination $pagination)

                    LoopResult

                    execComplex($pagination $pagination)

Details

at line 131

                    public            array
    getSearchIn()

Return Value

            array
            of available field to search in

at line 145

                    public
    doSearch(ProductQuery $search, $searchTerm $searchTerm, $searchIn $searchIn, $searchCriteria $searchCriteria)

Parameters

                ProductQuery
                $search

                $searchTerm
                $searchTerm

                $searchIn
                $searchIn

                $searchCriteria
                $searchCriteria

at line 170

                    public            LoopResult
    exec($pagination $pagination)

Parameters

                $pagination
                $pagination

Return Value

            LoopResult

Exceptions

                InvalidArgumentException

at line 560

                    public            LoopResult
    execComplex($pagination $pagination)

Parameters

                $pagination
                $pagination

Return Value

            LoopResult

Exceptions

                InvalidArgumentException

        Generated by Sami, the API Documentation Generator.


text:
from Stack import Stack

newStack = Stack()

newStack.push(23)
newStack.push(90)
newStack.push(12)
newStack.push(76)
newStack.push(34)
newStack.push(98)

print("======")

newStack.viewFullStack()

newStack.pop()

print("======")

newStack.viewFullStack()

print("======")

newStack.isEmpty()

print("======")

newStack.size()

print("======")

newStack.viewTop()

print("======")


text:
#ifndef SCAL_H_
#define SCAL_H_

#include <gtest/gtest.h>
#include <clBLAS.h>
#include <common.h>
#include <BlasBase.h>
#include <ExtraTestSizes.h>
#include <common.h>

using namespace clMath;
using ::testing::TestWithParam;

class SCAL : public TestWithParam<
    ::std::tr1::tuple<
        int,                // N
        ComplexLong,		// alpha
        int,                // offx
        int,                // incx
        int                 // numCommandQueues
        > > {
public:
    void getParams(TestParams *params)
    {
        params->N = N;
        params->alpha = paramAlpha;
        params->offBX = offx;
        params->incx = incx;
        params->numCommandQueues = numCommandQueues;
    }

protected:
    virtual void SetUp()
    {
        N = ::std::tr1::get<0>(GetParam());
		paramAlpha = ::std::tr1::get<1>(GetParam());
		offx = ::std::tr1::get<2>(GetParam());
		incx = ::std::tr1::get<3>(GetParam());
        numCommandQueues = ::std::tr1::get<4>(GetParam());

        base = ::clMath::BlasBase::getInstance();
        seed = base->seed();

        useNumCommandQueues = base->useNumCommandQueues();
        if (useNumCommandQueues) {
            numCommandQueues = base->numCommandQueues();
        }
    }

    size_t N;
    unsigned int seed;
    size_t offx;
    int incx;
    bool useAlpha;
    ComplexLong paramAlpha;
    ::clMath::BlasBase *base;
    bool useNumCommandQueues;
    cl_uint numCommandQueues;
};

#endif  // SCAL_H_


text:
.class public Lcom/htc/weather/animations/LightningV1;
.super Lcom/htc/weather/animations/WeatherAnimationData;
.source "LightningV1.java"

# instance fields
.field private lightning01:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

.field private lightning02:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/htc/weather/EnvSetting$Env;)V
    .locals 1
    .parameter "context"
    .parameter "env"

    .prologue
    .line 18
    invoke-direct {p0, p1, p2}, Lcom/htc/weather/animations/WeatherAnimationData;-><init>(Landroid/content/Context;Lcom/htc/weather/EnvSetting$Env;)V

    .line 40
    new-instance v0, Lcom/htc/weather/animations/LightningV1$1;

    invoke-direct {v0, p0}, Lcom/htc/weather/animations/LightningV1$1;-><init>(Lcom/htc/weather/animations/LightningV1;)V

    iput-object v0, p0, Lcom/htc/weather/animations/LightningV1;->lightning01:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

    .line 142
    new-instance v0, Lcom/htc/weather/animations/LightningV1$2;

    invoke-direct {v0, p0}, Lcom/htc/weather/animations/LightningV1$2;-><init>(Lcom/htc/weather/animations/LightningV1;)V

    iput-object v0, p0, Lcom/htc/weather/animations/LightningV1;->lightning02:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

    .line 20
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Lcom/htc/weather/EnvSetting$Env;IIFFFJ)V
    .locals 1
    .parameter "context"
    .parameter "env"
    .parameter "shift_x"
    .parameter "shift_y"
    .parameter "scale_x"
    .parameter "scale_y"
    .parameter "alpha"
    .parameter "delay"

    .prologue
    .line 24
    invoke-direct/range {p0 .. p9}, Lcom/htc/weather/animations/WeatherAnimationData;-><init>(Landroid/content/Context;Lcom/htc/weather/EnvSetting$Env;IIFFFJ)V

    .line 40
    new-instance v0, Lcom/htc/weather/animations/LightningV1$1;

    invoke-direct {v0, p0}, Lcom/htc/weather/animations/LightningV1$1;-><init>(Lcom/htc/weather/animations/LightningV1;)V

    iput-object v0, p0, Lcom/htc/weather/animations/LightningV1;->lightning01:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

    .line 142
    new-instance v0, Lcom/htc/weather/animations/LightningV1$2;

    invoke-direct {v0, p0}, Lcom/htc/weather/animations/LightningV1$2;-><init>(Lcom/htc/weather/animations/LightningV1;)V

    iput-object v0, p0, Lcom/htc/weather/animations/LightningV1;->lightning02:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

    .line 27
    return-void
.end method

# virtual methods
.method public getImageViewsAndAnimations()[Lcom/htc/weather/animations/ImageViewAndAnimationSets;
    .locals 3

    .prologue
    .line 35
    const/4 v0, 0x2

    new-array v0, v0, [Lcom/htc/weather/animations/ImageViewAndAnimationSets;

    const/4 v1, 0x0

    iget-object v2, p0, Lcom/htc/weather/animations/LightningV1;->lightning02:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

    aput-object v2, v0, v1

    const/4 v1, 0x1

    iget-object v2, p0, Lcom/htc/weather/animations/LightningV1;->lightning01:Lcom/htc/weather/animations/ImageViewAndAnimationSets;

    aput-object v2, v0, v1

    return-object v0
.end method


text:
class RepackRequest(object):

    def __init__(self):
        self.compression = None
        self.filename = None

    def getCompression(self):
        return self.compression

    def setCompression(self, compression):
        self.compression = compression

    def getFilename(self):
        return self.filename

    def setFilename(self, filename):
        self.filename = filename


text:
package cz.muni.fi.pa165.languageschool.web;

import cz.muni.fi.pa165.languageschool.dto.LectureTO;
import cz.muni.fi.pa165.languageschool.dto.StudentTO;
import cz.muni.fi.pa165.languageschool.service.LectureService;
import cz.muni.fi.pa165.languageschool.service.StudentService;
import static cz.muni.fi.pa165.languageschool.web.LectureActionBean.log;
import java.util.List;
import net.sourceforge.stripes.action.Before;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.LocalizableMessage;
import net.sourceforge.stripes.action.RedirectResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.UrlBinding;
import net.sourceforge.stripes.controller.LifecycleStage;
import net.sourceforge.stripes.integration.spring.SpringBean;
import net.sourceforge.stripes.validation.Validate;
import net.sourceforge.stripes.validation.ValidateNestedProperties;
import net.sourceforge.stripes.validation.ValidationErrorHandler;
import net.sourceforge.stripes.validation.ValidationErrors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author Michal Fučík (395624) michal.fuca.fucik(at)gmail.com
 */
@UrlBinding("/students/{$event}/{activity.id}")
public class StudentActionBean extends BaseActionBean implements ValidationErrorHandler {

    final static Logger log = LoggerFactory.getLogger(StudentActionBean.class);

    @SpringBean
    protected StudentService studentService;

    @SpringBean
    protected LectureService lectureService;

    private List<StudentTO> students;

    private List<LectureTO> lectures;

    private StudentTO student;

    public List<LectureTO> getLectures(){
        return lectures;
    }

    public List<StudentTO> getStudents() {
        return students;
    }

    public StudentTO getStudent(){
        return student;
    }

    public void setLectures(List<StudentTO> students) {
        this.students = students;
    }

    public void setStudent(StudentTO student){
        this.student = student;
    }

//--- part for showing a list of students ----
    @DefaultHandler
    public Resolution list() {
	log.info("Default handler students list");
        students = (List<StudentTO>) studentService.getAllStudents();
        return new ForwardResolution("/jsp/student/list.jsp");
    }

//--- part for adding a book ----
     @ValidateNestedProperties(value = {
            @Validate(on = {"add", "save"}, field = "firstName", required = true),
            @Validate(on = {"add", "save"}, field = "lastName", required = true),

    })

    public Resolution add() {
        log.debug("add() student={}", student);
        studentService.createStudent(student);
        getContext().getMessages().add(new LocalizableMessage("student.add.success",escapeHTML(student.getFirstName()+" "+student.getLastName()),escapeHTML(student.getFirstName()+" "+student.getLastName())));
        return new RedirectResolution(this.getClass(), "list");
    }

    @Override
    public Resolution handleValidationErrors(ValidationErrors errors) throws Exception {
        //fill up the data for the table if validation errors occured
        students = (List<StudentTO>) studentService.getAllStudents();
        //return null to let the event handling continue
        return null;
    }

//--- part for deleting a student ----
    public Resolution delete() {
        log.debug("delete({})", student.getId());
        //only id is filled by the form
        student = studentService.getStudent(student.getId());
        studentService.deleteStudent(student);
        getContext().getMessages().add(new LocalizableMessage("student.delete.success",escapeHTML(student.getFirstName()+" "+student.getLastName()),escapeHTML(student.getFirstName()+" "+student.getLastName())));
        return new RedirectResolution(this.getClass(), "list");
    }

//--- part for editing a book ----

   @Before(stages = LifecycleStage.BindingAndValidation, on = {"edit", "save"})
    public void loadStudentFromDatabase() {
       log.debug("LOADING student={}", student);
        String ids = getContext().getRequest().getParameter("student.id");
        if (ids == null)
            return;
        student = studentService.getStudent(Long.parseLong(ids));
    }

    public Resolution edit() {
        log.debug("EDIT student={}", student);

        return new ForwardResolution("/jsp/student/edit.jsp");
    }

    public Resolution save() {
        log.debug("UPDATING student={}", student);

        studentService.updateStudent(student);
        return new RedirectResolution(this.getClass(), "list");
    }

    public Resolution cancelEdit() {
        log.info("Student editing cancelled");
        return new RedirectResolution(this.getClass(), "list");
    }

}


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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.

#ifndef _WIN32
#include <sys/wait.h>
#include <unistd.h>
#endif

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <memory>
#include <string>
#include <thread>
#include <vector>

#include <gtest/gtest.h>

#include "arrow/status.h"
#include "arrow/testing/gtest_util.h"
#include "arrow/util/io_util.h"
#include "arrow/util/macros.h"
#include "arrow/util/thread_pool.h"

namespace arrow {
namespace internal {

static void busy_wait(double seconds, std::function<bool()> predicate) {
  const double period = 0.001;
  for (int i = 0; !predicate() && i * period < seconds; ++i) {
    SleepFor(period);
  }
}

template <typename T>
static void task_add(T x, T y, T* out) {
  *out = x + y;
}

template <typename T>
static void task_slow_add(double seconds, T x, T y, T* out) {
  SleepFor(seconds);
  *out = x + y;
}

typedef std::function<void(int, int, int*)> AddTaskFunc;

template <typename T>
static T add(T x, T y) {
  return x + y;
}

template <typename T>
static T slow_add(double seconds, T x, T y) {
  SleepFor(seconds);
  return x + y;
}

template <typename T>
static T inplace_add(T& x, T y) {
  return x += y;
}

// A class to spawn "add" tasks to a pool and check the results when done

class AddTester {
 public:
  explicit AddTester(int nadds) : nadds(nadds), xs(nadds), ys(nadds), outs(nadds, -1) {
    int x = 0, y = 0;
    std::generate(xs.begin(), xs.end(), [&] {
      ++x;
      return x;
    });
    std::generate(ys.begin(), ys.end(), [&] {
      y += 10;
      return y;
    });
  }

  AddTester(AddTester&&) = default;

  void SpawnTasks(ThreadPool* pool, AddTaskFunc add_func) {
    for (int i = 0; i < nadds; ++i) {
      ASSERT_OK(pool->Spawn([=] { add_func(xs[i], ys[i], &outs[i]); }));
    }
  }

  void CheckResults() {
    for (int i = 0; i < nadds; ++i) {
      ASSERT_EQ(outs[i], (i + 1) * 11);
    }
  }

  void CheckNotAllComputed() {
    for (int i = 0; i < nadds; ++i) {
      if (outs[i] == -1) {
        return;
      }
    }
    ASSERT_TRUE(0) << "all values were computed";
  }

 private:
  ARROW_DISALLOW_COPY_AND_ASSIGN(AddTester);

  int nadds;
  std::vector<int> xs;
  std::vector<int> ys;
  std::vector<int> outs;
};

class TestThreadPool : public ::testing::Test {
 public:
  void TearDown() override {
    fflush(stdout);
    fflush(stderr);
  }

  std::shared_ptr<ThreadPool> MakeThreadPool() { return MakeThreadPool(4); }

  std::shared_ptr<ThreadPool> MakeThreadPool(int threads) {
    return *ThreadPool::Make(threads);
  }

  void SpawnAdds(ThreadPool* pool, int nadds, AddTaskFunc add_func) {
    AddTester add_tester(nadds);
    add_tester.SpawnTasks(pool, add_func);
    ASSERT_OK(pool->Shutdown());
    add_tester.CheckResults();
  }

  void SpawnAddsThreaded(ThreadPool* pool, int nthreads, int nadds,
                         AddTaskFunc add_func) {
    // Same as SpawnAdds, but do the task spawning from multiple threads
    std::vector<AddTester> add_testers;
    std::vector<std::thread> threads;
    for (int i = 0; i < nthreads; ++i) {
      add_testers.emplace_back(nadds);
    }
    for (auto& add_tester : add_testers) {
      threads.emplace_back([&] { add_tester.SpawnTasks(pool, add_func); });
    }
    for (auto& thread : threads) {
      thread.join();
    }
    ASSERT_OK(pool->Shutdown());
    for (auto& add_tester : add_testers) {
      add_tester.CheckResults();
    }
  }
};

TEST_F(TestThreadPool, ConstructDestruct) {
  // Stress shutdown-at-destruction logic
  for (int threads : {1, 2, 3, 8, 32, 70}) {
    auto pool = this->MakeThreadPool(threads);
  }
}

// Correctness and stress tests using Spawn() and Shutdown()

TEST_F(TestThreadPool, Spawn) {
  auto pool = this->MakeThreadPool(3);
  SpawnAdds(pool.get(), 7, task_add<int>);
}

TEST_F(TestThreadPool, StressSpawn) {
  auto pool = this->MakeThreadPool(30);
  SpawnAdds(pool.get(), 1000, task_add<int>);
}

TEST_F(TestThreadPool, StressSpawnThreaded) {
  auto pool = this->MakeThreadPool(30);
  SpawnAddsThreaded(pool.get(), 20, 100, task_add<int>);
}

TEST_F(TestThreadPool, SpawnSlow) {
  // This checks that Shutdown() waits for all tasks to finish
  auto pool = this->MakeThreadPool(2);
  SpawnAdds(pool.get(), 7, [](int x, int y, int* out) {
    return task_slow_add(0.02 /* seconds */, x, y, out);
  });
}

TEST_F(TestThreadPool, StressSpawnSlow) {
  auto pool = this->MakeThreadPool(30);
  SpawnAdds(pool.get(), 1000, [](int x, int y, int* out) {
    return task_slow_add(0.002 /* seconds */, x, y, out);
  });
}

TEST_F(TestThreadPool, StressSpawnSlowThreaded) {
  auto pool = this->MakeThreadPool(30);
  SpawnAddsThreaded(pool.get(), 20, 100, [](int x, int y, int* out) {
    return task_slow_add(0.002 /* seconds */, x, y, out);
  });
}

TEST_F(TestThreadPool, QuickShutdown) {
  AddTester add_tester(100);
  {
    auto pool = this->MakeThreadPool(3);
    add_tester.SpawnTasks(pool.get(), [](int x, int y, int* out) {
      return task_slow_add(0.02 /* seconds */, x, y, out);
    });
    ASSERT_OK(pool->Shutdown(false /* wait */));
    add_tester.CheckNotAllComputed();
  }
  add_tester.CheckNotAllComputed();
}

TEST_F(TestThreadPool, SetCapacity) {
  auto pool = this->MakeThreadPool(3);
  ASSERT_EQ(pool->GetCapacity(), 3);
  ASSERT_EQ(pool->GetActualCapacity(), 3);

  ASSERT_OK(pool->SetCapacity(5));
  ASSERT_EQ(pool->GetCapacity(), 5);
  ASSERT_EQ(pool->GetActualCapacity(), 5);

  ASSERT_OK(pool->SetCapacity(2));
  ASSERT_EQ(pool->GetCapacity(), 2);
  // Wait for workers to wake up and secede
  busy_wait(0.5, [&] { return pool->GetActualCapacity() == 2; });
  ASSERT_EQ(pool->GetActualCapacity(), 2);

  ASSERT_OK(pool->SetCapacity(5));
  ASSERT_EQ(pool->GetCapacity(), 5);
  ASSERT_EQ(pool->GetActualCapacity(), 5);

  // Downsize while tasks are pending
  for (int i = 0; i < 10; ++i) {
    ASSERT_OK(pool->Spawn(std::bind(SleepFor, 0.01 /* seconds */)));
  }
  ASSERT_OK(pool->SetCapacity(2));
  ASSERT_EQ(pool->GetCapacity(), 2);
  busy_wait(0.5, [&] { return pool->GetActualCapacity() == 2; });
  ASSERT_EQ(pool->GetActualCapacity(), 2);

  // Ensure nothing got stuck
  ASSERT_OK(pool->Shutdown());
}

// Test Submit() functionality

TEST_F(TestThreadPool, Submit) {
  auto pool = this->MakeThreadPool(3);
  {
    ASSERT_OK_AND_ASSIGN(Future<int> fut, pool->Submit(add<int>, 4, 5));
    Result<int> res = fut.result();
    ASSERT_OK_AND_EQ(9, res);
  }
  {
    ASSERT_OK_AND_ASSIGN(Future<std::string> fut,
                         pool->Submit(add<std::string>, "foo", "bar"));
    ASSERT_OK_AND_EQ("foobar", fut.result());
  }
  {
    ASSERT_OK_AND_ASSIGN(auto fut, pool->Submit(slow_add<int>, 0.01 /* seconds */, 4, 5));
    ASSERT_OK_AND_EQ(9, fut.result());
  }
  {
    // Reference passing
    std::string s = "foo";
    ASSERT_OK_AND_ASSIGN(auto fut,
                         pool->Submit(inplace_add<std::string>, std::ref(s), "bar"));
    ASSERT_OK_AND_EQ("foobar", fut.result());
    ASSERT_EQ(s, "foobar");
  }
  {
    // `void` return type
    ASSERT_OK_AND_ASSIGN(auto fut, pool->Submit(SleepFor, 0.001));
    ASSERT_OK(fut.status());
  }
}

// Test fork safety on Unix

#if !(defined(_WIN32) || defined(ARROW_VALGRIND) || defined(ADDRESS_SANITIZER) || \
      defined(THREAD_SANITIZER))
TEST_F(TestThreadPool, ForkSafety) {
  pid_t child_pid;
  int child_status;

  {
    // Fork after task submission
    auto pool = this->MakeThreadPool(3);
    ASSERT_OK_AND_ASSIGN(auto fut, pool->Submit(add<int>, 4, 5));
    ASSERT_OK_AND_EQ(9, fut.result());

    child_pid = fork();
    if (child_pid == 0) {
      // Child: thread pool should be usable
      ASSERT_OK_AND_ASSIGN(fut, pool->Submit(add<int>, 3, 4));
      if (*fut.result() != 7) {
        std::exit(1);
      }
      // Shutting down shouldn't hang or fail
      Status st = pool->Shutdown();
      std::exit(st.ok() ? 0 : 2);
    } else {
      // Parent
      ASSERT_GT(child_pid, 0);
      ASSERT_GT(waitpid(child_pid, &child_status, 0), 0);
      ASSERT_TRUE(WIFEXITED(child_status));
      ASSERT_EQ(WEXITSTATUS(child_status), 0);
      ASSERT_OK(pool->Shutdown());
    }
  }
  {
    // Fork after shutdown
    auto pool = this->MakeThreadPool(3);
    ASSERT_OK(pool->Shutdown());

    child_pid = fork();
    if (child_pid == 0) {
      // Child
      // Spawning a task should return with error (pool was shutdown)
      Status st = pool->Spawn([] {});
      if (!st.IsInvalid()) {
        std::exit(1);
      }
      // Trigger destructor
      pool.reset();
      std::exit(0);
    } else {
      // Parent
      ASSERT_GT(child_pid, 0);
      ASSERT_GT(waitpid(child_pid, &child_status, 0), 0);
      ASSERT_TRUE(WIFEXITED(child_status));
      ASSERT_EQ(WEXITSTATUS(child_status), 0);
    }
  }
}
#endif

TEST(TestGlobalThreadPool, Capacity) {
  // Sanity check
  auto pool = GetCpuThreadPool();
  int capacity = pool->GetCapacity();
  ASSERT_GT(capacity, 0);
  ASSERT_EQ(pool->GetActualCapacity(), capacity);
  ASSERT_EQ(GetCpuThreadPoolCapacity(), capacity);

  // Exercise default capacity heuristic
  ASSERT_OK(DelEnvVar("OMP_NUM_THREADS"));
  ASSERT_OK(DelEnvVar("OMP_THREAD_LIMIT"));
  int hw_capacity = std::thread::hardware_concurrency();
  ASSERT_EQ(ThreadPool::DefaultCapacity(), hw_capacity);
  ASSERT_OK(SetEnvVar("OMP_NUM_THREADS", "13"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), 13);
  ASSERT_OK(SetEnvVar("OMP_NUM_THREADS", "7,5,13"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), 7);
  ASSERT_OK(DelEnvVar("OMP_NUM_THREADS"));

  ASSERT_OK(SetEnvVar("OMP_THREAD_LIMIT", "1"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), 1);
  ASSERT_OK(SetEnvVar("OMP_THREAD_LIMIT", "999"));
  if (hw_capacity <= 999) {
    ASSERT_EQ(ThreadPool::DefaultCapacity(), hw_capacity);
  }
  ASSERT_OK(SetEnvVar("OMP_NUM_THREADS", "6,5,13"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), 6);
  ASSERT_OK(SetEnvVar("OMP_THREAD_LIMIT", "2"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), 2);

  // Invalid env values
  ASSERT_OK(SetEnvVar("OMP_NUM_THREADS", "0"));
  ASSERT_OK(SetEnvVar("OMP_THREAD_LIMIT", "0"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), hw_capacity);
  ASSERT_OK(SetEnvVar("OMP_NUM_THREADS", "zzz"));
  ASSERT_OK(SetEnvVar("OMP_THREAD_LIMIT", "x"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), hw_capacity);
  ASSERT_OK(SetEnvVar("OMP_THREAD_LIMIT", "-1"));
  ASSERT_OK(SetEnvVar("OMP_NUM_THREADS", "99999999999999999999999999"));
  ASSERT_EQ(ThreadPool::DefaultCapacity(), hw_capacity);

  ASSERT_OK(DelEnvVar("OMP_NUM_THREADS"));
  ASSERT_OK(DelEnvVar("OMP_THREAD_LIMIT"));
}

}  // namespace internal
}  // namespace arrow


text:
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd">
    <id>configuration</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>configuration</directory>
            <lineEnding>keep</lineEnding>
            <outputDirectory>/</outputDirectory>
        </fileSet>
    </fileSets>
</assembly>


text:
SYNONYM

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

#### Published in
Hort. bot. vindob. 3:8, t. 8. 1776

#### Original name
null

### Remarks
null


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

The org.jamwiki.parser package contains the interfaces, abstract classes, and utility classes needed to implement a parser for JAMWiki.  Custom parsers can be easily created by extending the {@link org.jamwiki.parser.AbstractParser} class.  In addition, to make JAMWiki aware of any new parsers an entry for the parser must be added to the parsers section of the /WEB-INF/classes/jamwiki-configuration-1.3.xml file.


text:
package logger

//--------------------
// IMPORTS
//--------------------

import (
	"fmt"
	"io"
	"log"
	"os"
	"path"
	"runtime"
	"strings"
	"sync"
	"time"
)

//--------------------
// TYPES AND TYPE FUNCTIONS
//--------------------

// LogLevel describes the chosen log level between
// debug and critical.
type LogLevel int

// Log levels to control the logging output.
const (
	LevelDebug LogLevel = iota
	LevelInfo
	LevelWarning
	LevelError
	LevelCritical
	LevelFatal
)

// FatalExiterFunc defines a functions that will be called
// in case of a Fatalf call.
type FatalExiterFunc func()

// OsFatalExiter exits the application with os.Exit and
// the return code -1.
func OsFatalExiter() {
	os.Exit(-1)
}

// PanacFatalExiter exits the application with a panic.
func PanicFatalExiter() {
	panic("program aborted after fatal situation, see log")
}

//--------------------
// LOG CONTROL
//--------------------

// Log control variables.
var (
	logMux         sync.Mutex
	logLevel       LogLevel        = LevelInfo
	logFatalExiter FatalExiterFunc = OsFatalExiter
)

// Level returns the current log level.
func Level() LogLevel {
	logMux.Lock()
	defer logMux.Unlock()
	return logLevel
}

// SetLevel switches to a new log level and returns
// the current one.
func SetLevel(level LogLevel) LogLevel {
	logMux.Lock()
	defer logMux.Unlock()
	current := logLevel
	switch {
	case level <= LevelDebug:
		logLevel = LevelDebug
	case level >= LevelFatal:
		logLevel = LevelFatal
	default:
		logLevel = level
	}
	return current
}

// SetFatalExiter sets the fatal exiter function and
// returns the current one.
func SetFatalExiter(fef FatalExiterFunc) FatalExiterFunc {
	logMux.Lock()
	defer logMux.Unlock()
	current := logFatalExiter
	logFatalExiter = fef
	return current
}

//--------------------
// LOGGING
//--------------------

// Debugf logs a message at debug level.
func Debugf(format string, args ...interface{}) {
	logMux.Lock()
	defer logMux.Unlock()
	if logLevel <= LevelDebug {
		ci := retrieveCallInfo()
		fi := fmt.Sprintf(format, args...)

		logBackend.Debug(ci.verboseFormat(), fi)
	}
}

// Infof logs a message at info level.
func Infof(format string, args ...interface{}) {
	logMux.Lock()
	defer logMux.Unlock()
	if logLevel <= LevelInfo {
		ci := retrieveCallInfo()
		fi := fmt.Sprintf(format, args...)

		logBackend.Info(ci.shortFormat(), fi)
	}
}

// Warningf logs a message at warning level.
func Warningf(format string, args ...interface{}) {
	logMux.Lock()
	defer logMux.Unlock()
	if logLevel <= LevelWarning {
		ci := retrieveCallInfo()
		fi := fmt.Sprintf(format, args...)

		logBackend.Warning(ci.shortFormat(), fi)
	}
}

// Errorf logs a message at error level.
func Errorf(format string, args ...interface{}) {
	logMux.Lock()
	defer logMux.Unlock()
	if logLevel <= LevelError {
		ci := retrieveCallInfo()
		fi := fmt.Sprintf(format, args...)

		logBackend.Error(ci.shortFormat(), fi)
	}
}

// Criticalf logs a message at critical level.
func Criticalf(format string, args ...interface{}) {
	logMux.Lock()
	defer logMux.Unlock()
	if logLevel <= LevelCritical {
		ci := retrieveCallInfo()
		fi := fmt.Sprintf(format, args...)

		logBackend.Critical(ci.verboseFormat(), fi)
	}
}

// Fatalf logs a message independant of any level. After
// logging the message the functions calls the fatal exiter
// function, which by default means exiting the application
// with error code -1.
func Fatalf(format string, args ...interface{}) {
	logMux.Lock()
	defer logMux.Unlock()
	ci := retrieveCallInfo()
	fi := fmt.Sprintf(format, args...)

	logBackend.Fatal(ci.verboseFormat(), fi)
	logFatalExiter()
}

//--------------------
// LOGGER
//--------------------

// Logger is the interface for different logger backends.
type Logger interface {
	// Debug logs a debugging message.
	Debug(info, msg string)

	// Info logs an informational message.
	Info(info, msg string)

	// Warning logs a warning message.
	Warning(info, msg string)

	// Error logs an error message.
	Error(info, msg string)

	// Critical logs a critical error message.
	Critical(info, msg string)

	// Fatal logs a fatal error message.
	Fatal(info, msg string)
}

// logger references the used application logger.
var logBackend Logger = NewStandardLogger(os.Stdout)

// SetLogger sets a new logger.
func SetLogger(l Logger) {
	logBackend = l
}

// timeFormat controls how the timestamp of the standard logger is printed.
const timeFormat = "2006-01-02 15:04:05 Z07:00"

// StandardLogger is a simple logger writing to the given writer. Beside
// the output it doesn't handle the levels differently.
type StandardLogger struct {
	mutex sync.Mutex
	out   io.Writer
}

// NewStandardLogger creates the standard logger.
func NewStandardLogger(out io.Writer) Logger {
	return &StandardLogger{out: out}
}

// Debug is specified on the Logger interface.
func (sl *StandardLogger) Debug(info, msg string) {
	sl.mutex.Lock()
	defer sl.mutex.Unlock()

	io.WriteString(sl.out, time.Now().Format(timeFormat))
	io.WriteString(sl.out, " [DEBUG] ")
	io.WriteString(sl.out, info)
	io.WriteString(sl.out, " ")
	io.WriteString(sl.out, msg)
	io.WriteString(sl.out, "\n")
}

// Info is specified on the Logger interface.
func (sl *StandardLogger) Info(info, msg string) {
	sl.mutex.Lock()
	defer sl.mutex.Unlock()

	io.WriteString(sl.out, time.Now().Format(timeFormat))
	io.WriteString(sl.out, " [INFO] ")
	io.WriteString(sl.out, info)
	io.WriteString(sl.out, " ")
	io.WriteString(sl.out, msg)
	io.WriteString(sl.out, "\n")
}

// Warning is specified on the Logger interface.
func (sl *StandardLogger) Warning(info, msg string) {
	sl.mutex.Lock()
	defer sl.mutex.Unlock()

	io.WriteString(sl.out, time.Now().Format(timeFormat))
	io.WriteString(sl.out, " [WARNING] ")
	io.WriteString(sl.out, info)
	io.WriteString(sl.out, " ")
	io.WriteString(sl.out, msg)
	io.WriteString(sl.out, "\n")
}

// Error is specified on the Logger interface.
func (sl *StandardLogger) Error(info, msg string) {
	sl.mutex.Lock()
	defer sl.mutex.Unlock()

	io.WriteString(sl.out, time.Now().Format(timeFormat))
	io.WriteString(sl.out, " [ERROR] ")
	io.WriteString(sl.out, info)
	io.WriteString(sl.out, " ")
	io.WriteString(sl.out, msg)
	io.WriteString(sl.out, "\n")
}

// Critical is specified on the Logger interface.
func (sl *StandardLogger) Critical(info, msg string) {
	sl.mutex.Lock()
	defer sl.mutex.Unlock()

	io.WriteString(sl.out, time.Now().Format(timeFormat))
	io.WriteString(sl.out, " [CRITICAL] ")
	io.WriteString(sl.out, info)
	io.WriteString(sl.out, " ")
	io.WriteString(sl.out, msg)
	io.WriteString(sl.out, "\n")
}

// Fatal is specified on the Logger interface.
func (sl *StandardLogger) Fatal(info, msg string) {
	sl.mutex.Lock()
	defer sl.mutex.Unlock()

	io.WriteString(sl.out, time.Now().Format(timeFormat))
	io.WriteString(sl.out, " [FATAL] ")
	io.WriteString(sl.out, info)
	io.WriteString(sl.out, " ")
	io.WriteString(sl.out, msg)
	io.WriteString(sl.out, "\n")
}

// GoLogger just uses the standard go log package.
type GoLogger struct{}

// NewGoLogger returns a logger implementation using the
// Go log package.
func NewGoLogger() Logger {
	return &GoLogger{}
}

// Debug is specified on the Logger interface.
func (gl *GoLogger) Debug(info, msg string) {
	log.Println("[DEBUG]", info, msg)
}

// Info is specified on the Logger interface.
func (gl *GoLogger) Info(info, msg string) {
	log.Println("[INFO]", info, msg)
}

// Warning is specified on the Logger interface.
func (gl *GoLogger) Warning(info, msg string) {
	log.Println("[WARNING]", info, msg)
}

// Error is specified on the Logger interface.
func (gl *GoLogger) Error(info, msg string) {
	log.Println("[ERROR]", info, msg)
}

// Critical is specified on the Logger interface.
func (gl *GoLogger) Critical(info, msg string) {
	log.Println("[CRITICAL]", info, msg)
}

// Fatal is specified on the Logger interface.
func (gl *GoLogger) Fatal(info, msg string) {
	log.Println("[FATAL]", info, msg)
}

//--------------------
// HELPER
//--------------------

// callInfo bundles the info about the call environment
// when a logging statement occured.
type callInfo struct {
	packageName string
	fileName    string
	funcName    string
	line        int
}

// shortFormat returns a string representation in a short variant.
func (ci *callInfo) shortFormat() string {
	return fmt.Sprintf("[%s]", ci.packageName)
}

// verboseFormat returns a string representation in a more verbose variant.
func (ci *callInfo) verboseFormat() string {
	return fmt.Sprintf("[%s] (%s:%s:%d)", ci.packageName, ci.fileName, ci.funcName, ci.line)
}

// retrieveCallInfo
func retrieveCallInfo() *callInfo {
	pc, file, line, _ := runtime.Caller(2)
	_, fileName := path.Split(file)
	parts := strings.Split(runtime.FuncForPC(pc).Name(), ".")
	pl := len(parts)
	packageName := ""
	funcName := parts[pl-1]

	if parts[pl-2][0] == '(' {
		funcName = parts[pl-2] + "." + funcName
		packageName = strings.Join(parts[0:pl-2], ".")
	} else {
		packageName = strings.Join(parts[0:pl-1], ".")
	}

	return &callInfo{
		packageName: packageName,
		fileName:    fileName,
		funcName:    funcName,
		line:        line,
	}
}

// EOF


text:
/* Estilos para Sociales */

.rt-social-buttons {
    right: 0;
    width: 45px;
    position: fixed;
    top: 200px;
    z-index: 10;
}

.rt-social-buttons .rt-social-text {
    display:none;
    margin: 11px 0 11px 32px;
    white-space:nowrap;
    font-family: times;
    font-size: 14px;
    margin-left: 38px;
    color: #fff;
}

.rt-social-buttons #rt-facebook-btn span { background-position: 12px 10px; }
.rt-social-buttons #rt-twitter-btn span { background-position: 11px -35px; }
.rt-social-buttons #rt-google-btn span { background-position: 10px -127px; }
.rt-social-buttons #rt-youtube-btn span { background-position: 11px -167px; }
.rt-social-buttons #rt-instagram-btn span { background-position: 11px -257px; }
.rt-social-buttons #rt-rss-btn span { background-position: 10px -80px; }

.rt-social-buttons #rt-twitter-btn .rt-social-icon, .rt-social-buttons #rt-facebook-btn .rt-social-icon, .rt-social-buttons #rt-google-btn .rt-social-icon, .rt-social-buttons #rt-instagram-btn .rt-social-icon, .rt-social-buttons #rt-flickr-btn .rt-social-icon, .rt-social-buttons #rt-youtube-btn .rt-social-icon, .rt-social-buttons #rt-rss-btn .rt-social-icon {
    background-color: #33353B;
    background-image: url(../img/social-icons.png);
}

.rt-social-buttons .rt-social-icon {
    height: 43px;
    width: 43px;
    float: right;
    display: block;
    background-repeat: no-repeat;
    margin-bottom: 2px;
    transition: width 0.2s ease-in, background-color 0.2s ease-in;
}

.rt-social-buttons .rt-social-icon:hover {
    width:170px;
}

.rt-social-buttons a:hover > span {
    width:auto;
}

.rt-social-buttons a:hover .rt-social-text {
    display:block;
}

.rt-social-buttons #rt-facebook-btn .rt-social-icon:hover { background-color: #3e5c9a; }
.rt-social-buttons #rt-twitter-btn .rt-social-icon:hover { background-color: #1da1f2; }
.rt-social-buttons #rt-google-btn .rt-social-icon:hover { background-color: #d94a38; }
.rt-social-buttons #rt-youtube-btn .rt-social-icon:hover { background-color: #cc181e; }
.rt-social-buttons #rt-instagram-btn .rt-social-icon:hover { background-color: #3e5c9a; }
.rt-social-buttons #rt-rss-btn .rt-social-icon:hover { background-color: #9a903e; }


text:
layout: page
title: Susan Gilbert's 55th Birthday
date: 2016-05-24
author: Linda Becker
tags: weekly links, java
status: published
summary: In hac habitasse platea dictumst. Nulla accumsan, felis ut tristique.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 08/24/2017
  endDate: 08/25/2017
  ctyhocn: SPIILHX
  groupCode: SG5B
published: true
---
Sed odio urna, condimentum eget mattis quis, molestie a dolor. Sed euismod cursus enim. Curabitur id justo velit. Donec ut nisi non lacus fringilla congue. Aliquam bibendum sem vitae nisl elementum, nec malesuada nibh egestas. Phasellus ac vehicula libero. Aliquam eget cursus enim. Pellentesque bibendum arcu a ex lacinia, at pulvinar ex lobortis.

1 Suspendisse dignissim diam eget vestibulum vestibulum
1 Pellentesque tristique lacus in justo mattis mattis.

Quisque ut nunc a dui rutrum dapibus. Fusce gravida sapien at porttitor consequat. Maecenas ullamcorper bibendum odio, ut consectetur orci venenatis sed. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nullam id ipsum at turpis suscipit pulvinar. Mauris viverra ac sem condimentum viverra. Vestibulum congue nisi eget sapien venenatis hendrerit. In sem leo, tincidunt et tempor ut, euismod quis risus. Ut efficitur justo massa, a condimentum lorem malesuada finibus. Ut quis efficitur mauris.


text:
case platform
when "ubuntu"
  set[:ubuntu][:archive_url]  = "http://us.archive.ubuntu.com/ubuntu"
  set[:ubuntu][:security_url] = "http://security.ubuntu.com/ubuntu"
end


text:
package ru.job4j.strategy;

import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

/**
 * Class SquareTest 002.4.4.
 * @author rzhedunov.
 * @since 2018-02-03.
 * @version 002.4.4.
 */
public class SquareTest {
    /**
     * Method whenDrawSquareThenReturnsSquare tests drawing the square.
     */
    @Test
    public void whenDrawSquare() {
        Square square = new Square();
        assertThat(
                square.draw(),
                is(
                        new StringBuilder()
                                .append("++++")
                                .append("+  +")
                                .append("+  +")
                                .append("++++")
                                .toString()
                )
        );
    }

}