text:
namespace mozc {
namespace win32 {
namespace tsf {

namespace {

using WTL::CBitmap;
using WTL::CDC;
using WTL::CIcon;
using WTL::CMenu;
using WTL::CMenuItemInfo;
using WTL::CSize;

const int kDefaultDPI = 96;

// Represents the cookie for the sink to an TipLangBarButton object.
const int kTipLangBarMenuCookie = (('M' << 24) |
                                   ('o' << 16) |
                                   ('z' << 8) |
                                   ('c' << 0));

// "MS ゴシック"
const char kTextIconFont[] =
    "\xEF\xBC\xAD\xEF\xBC\xB3"
    "\x20\xE3\x82\xB4\xE3\x82\xB7\xE3\x83\x83\xE3\x82\xAF";

// TODO(yukawa): Refactor LangBar code so that we can configure following
// settings as a part of initialization.
string GetIconStringIfNecessary(UINT icon_id) {
  switch (icon_id) {
    case IDI_DIRECT_NT:
      return "A";
    case IDI_HIRAGANA_NT:
      // "あ"
      return "\xE3\x81\x82";
    case IDI_FULL_KATAKANA_NT:
      // "ア"
      return "\xE3\x82\xA2";
    case IDI_HALF_ALPHANUMERIC_NT:
      return "_A";
    case IDI_FULL_ALPHANUMERIC_NT:
      // "A"
      return "\xEF\xBC\xA1";
    case IDI_HALF_KATAKANA_NT:
      // "_ア"
      return "_" "\xEF\xBD\xB1";
  }
  return string();
}

// Loads an icon which is appropriate for the current theme.
// An icon ID 0 represents "no icon".
HICON LoadIconFromResource(HINSTANCE instance,
                           UINT icon_id_for_non_theme,
                           UINT icon_id_for_theme) {
  // We use a 32-bpp icon if we can observe the uxtheme is running.
  UINT id = icon_id_for_non_theme;
  if (icon_id_for_theme != 0) {
    const wchar_t kThemeDll[] = L"uxtheme.dll";
    typedef BOOL (WINAPI *FPIsThemeActive)();

    // Util::GetSystemModuleHandle is not safe when the specified DLL is
    // unloaded by other threads.
    const HMODULE theme_dll =
        WinUtil::GetSystemModuleHandleAndIncrementRefCount(kThemeDll);
    if (theme_dll != nullptr) {
      FPIsThemeActive is_thread_active = reinterpret_cast<FPIsThemeActive>(
          ::GetProcAddress(theme_dll, "IsThemeActive"));
      if (is_thread_active != nullptr && is_thread_active()) {
        id = icon_id_for_theme;
      }
    }
    if (theme_dll != nullptr) {
      ::FreeLibrary(theme_dll);
    }
  }

  if (id == 0) {
    return nullptr;
  }

  const auto icon_size = ::GetSystemMetrics(SM_CYSMICON);

  // Replace some text icons with on-the-fly image drawn with MS-Gothic.
  const auto &icon_text = GetIconStringIfNecessary(id);
  if (!icon_text.empty()) {
    const COLORREF text_color = ::GetSysColor(COLOR_WINDOWTEXT);
    return TextIcon::CreateMonochromeIcon(
        icon_size, icon_size, icon_text, kTextIconFont, text_color);
  }

  return static_cast<HICON>(::LoadImage(
      instance, MAKEINTRESOURCE(id),
      IMAGE_ICON, icon_size, icon_size, LR_CREATEDIBSECTION));
}

// Retrieves the bitmap handle loaded by using an icon ID.
// Returns true if the specified icons is available as bitmaps.
// Caller can set nullptr for |color| and/or |mask| to represent not to recieve
// the specified handle even if it exists.  Caller should releases any returned
// bitmap handle and this function releases any handle which is not recieved
// by the caller.
bool LoadIconAsBitmap(HINSTANCE instance,
                      UINT icon_id_for_non_theme,
                      UINT icon_id_for_theme,
                      HBITMAP *color,
                      HBITMAP *mask) {
  if (color != nullptr) {
    *color = nullptr;
  }
  if (mask != nullptr) {
    *mask = nullptr;
  }

  CIcon icon(LoadIconFromResource(
     instance, icon_id_for_non_theme, icon_id_for_theme));

  if (icon.IsNull()) {
    return false;
  }

  ICONINFO icon_info = {};
  if (!::GetIconInfo(icon, &icon_info)) {
    return false;
  }

  CBitmap color_bitmap(icon_info.hbmColor);
  CBitmap mask_bitmap(icon_info.hbmMask);

  if (color != nullptr) {
    *color = color_bitmap.Detach();
  }
  if (mask != nullptr) {
    *mask = mask_bitmap.Detach();
  }

  return true;
}

}  // namespace

HRESULT TipLangBarMenuDataArray::Init(
    HINSTANCE instance,
    const TipLangBarMenuItem *menu,
    int count) {
  HRESULT result = S_OK;

  // Attach menu texts and icons.
  for (int i = 0; i < count; ++i) {
    TipLangBarMenuData data = {};
    int length = 0;
    HICON icon = nullptr;
    if ((menu[i].flags_ & TF_LBMENUF_SEPARATOR) == 0) {
      // Retrieve the menu text and button icon.
      length = ::LoadString(instance,
                            menu[i].text_id_,
                            &data.text_[0],
                            arraysize(data.text_));
    }
    data.flags_ = menu[i].flags_;
    data.item_id_ = menu[i].item_id_;
    data.text_id_ = menu[i].text_id_;
    data.length_ = length;
    data.icon_id_for_non_theme_ = menu[i].icon_id_for_non_theme_;
    data.icon_id_for_theme_ = menu[i].icon_id_for_theme_;
    data_.push_back(data);
  }

  return result;
}

size_t TipLangBarMenuDataArray::size() const {
  return data_.size();
}

TipLangBarMenuData* TipLangBarMenuDataArray::data(size_t i) {
  if (i >= size()) {
    return nullptr;
  }
  return &data_[i];
}

// Implements the constructor of the TipLangBarButton class.
TipLangBarButton::TipLangBarButton(TipLangBarCallback *langbar_callback,
                                   const GUID &guid,
                                   bool is_menu,
                                   bool show_in_tray)
    : item_sink_(nullptr),
      langbar_callback_(nullptr),
      status_(0),
      context_menu_enabled_(true) {
  // Initialize its TF_LANGBARITEMINFO object, which contains the properties of
  // this item and is copied to the TSF manager in GetInfo() function.
  item_info_.clsidService = TsfProfile::GetTextServiceGuid();
  item_info_.guidItem = guid;
  // The visibility of a langbar-item in the minimized langbar is actually
  // controlled by TF_LBI_STYLE_SHOWNINTRAY flag despite the fact that the
  // document says "This flag is not currently supported".
  // http://msdn.microsoft.com/en-us/library/ms629078.aspx
  // http://b/2275633
  item_info_.dwStyle = 0;
  if (is_menu) {
    item_info_.dwStyle |= TF_LBI_STYLE_BTN_MENU;
  } else {
    item_info_.dwStyle |= TF_LBI_STYLE_BTN_BUTTON;
  }
  if (show_in_tray) {
    item_info_.dwStyle |= TF_LBI_STYLE_SHOWNINTRAY;
  }
  item_info_.ulSort = 0;
  item_info_.szDescription[0] = L'\0';

  // Save the TipLangBarCallback object who owns this button, and increase its
  // reference count not to prevent the object from being deleted
  langbar_callback_ = langbar_callback;
  langbar_callback_->AddRef();
}

// Implements the destructor of the TipLangBarButton class.
TipLangBarButton::~TipLangBarButton() {
  // Release the owner TipLangBarCallback object.
  if (langbar_callback_ != nullptr) {
    langbar_callback_->Release();
  }
  langbar_callback_ = nullptr;
}

// Implements the ITfLangBarItem::GetInfo() function.
// This function is called by Windows to update this button menu.
STDMETHODIMP TipLangBarButton::GetInfo(TF_LANGBARITEMINFO *item_info) {
  // Just copies the cached TF_LANGBARITEMINFO object.
  *item_info = item_info_;
  return S_OK;
}

// Implements the ITfLangBarItem::GetStatus() function.
// This fucntion is called by Windows to retrieve the current status of this
// button menu.
STDMETHODIMP TipLangBarButton::GetStatus(DWORD *status) {
  *status = status_;
  return S_OK;
}

// Implements the ITfLangBarItem::Show() function.
// This function is called by Windows to notify the display status of this
// button menu has been updated.
STDMETHODIMP TipLangBarButton::Show(BOOL show) {
  // Just return becasue this button is always shown, i.e. we do not have to
  // manage the display state of this button menu.
  return E_NOTIMPL;
}

// Implements the ITfLangBarItem::GetTooltipString() function.
// This function is called when Windows to retrieve the tool-tip string of
// this button menu.
STDMETHODIMP TipLangBarButton::GetTooltipString(BSTR *tooltip) {
  // Created a COM string from the description and copy it.
  *tooltip = ::SysAllocString(&item_info_.szDescription[0]);
  return (*tooltip ? S_OK : E_OUTOFMEMORY);
}

// Implements the ITfLangBarItemButton::OnClick() function.
// This function is not used for a button menu.
STDMETHODIMP TipLangBarButton::OnClick(TfLBIClick click,
                                       POINT point,
                                       const RECT *rect) {
  if (IsMenuButton()) {
    // ITfLangBarItem object is a button menu.
    return S_OK;
  }
  if (click == TF_LBI_CLK_LEFT) {
    return langbar_callback_->OnItemClick(item_info_.szDescription);
  }

  // If context menu is disabled, do nothing.
  if (!context_menu_enabled_) {
    return S_OK;
  }

  CMenu menu;
  menu.CreatePopupMenu();
  for (size_t i = 0; i < menu_data_size(); ++i) {
    TipLangBarMenuData *data = menu_data(i);
    const UINT id = static_cast<UINT>(data->item_id_);
    const wchar_t *text = data->text_;
    CMenuItemInfo info;
    if (data->flags_ == TF_LBMENUF_SEPARATOR) {
      info.fMask |= MIIM_FTYPE;
      info.fType |= MFT_SEPARATOR;
    } else {
      info.fMask |= MIIM_ID;
      info.wID = id;

      info.fMask |= MIIM_FTYPE;
      info.fType |= MFT_STRING;

      info.fMask |= MIIM_STRING;
      info.dwTypeData = data->text_;

      switch (data->flags_) {
        case TF_LBMENUF_RADIOCHECKED:
          info.fMask |= MIIM_STATE;
          info.fState |= MFS_CHECKED;
          info.fMask |= MIIM_FTYPE;
          info.fType |= MFT_RADIOCHECK;
          break;
        case TF_LBMENUF_CHECKED:
          info.fMask |= MIIM_STATE;
          info.fState |= MFS_CHECKED;
          break;
        case TF_LBMENUF_SUBMENU:
          // TODO(yukawa): Support this.
          break;
        case TF_LBMENUF_GRAYED:
          info.fMask |= MIIM_STATE;
          info.fState |= MFS_GRAYED;
          break;
        default:
          info.fMask |= MIIM_STATE;
          info.fState |= MFS_ENABLED;
          break;
      }
    }
    menu.InsertMenuItemW(i, TRUE, &info);
  }

  // Caveats: TPM_NONOTIFY is important because the attached window may
  // change the menu state unless this flag is specified. We actually suffered
  // from this issue with Internet Explorer 10 on Windows 8. b/10217103.
  const DWORD kMenuFlags = TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTALIGN |
                           TPM_TOPALIGN | TPM_LEFTBUTTON;
  const BOOL result = menu.TrackPopupMenu(
      kMenuFlags, point.x, point.y, ::GetFocus());
  if (!result) {
    return E_FAIL;
  }
  return langbar_callback_->OnMenuSelect(
      static_cast<TipLangBarCallback::ItemId>(result));
}

// Implements the ITfLangBarItemButton::GetText() function.
// This function is called by Windows to retrive the text label of this
// button menu.
STDMETHODIMP TipLangBarButton::GetText(BSTR *text) {
  *text = ::SysAllocString(&item_info_.szDescription[0]);
  return (*text ? S_OK : E_OUTOFMEMORY);
}

// Implements the ITfSource::AdviseSink() funtion.
STDMETHODIMP TipLangBarButton::AdviseSink(REFIID interface_id,
                                          IUnknown *unknown,
                                          DWORD *cookie) {
  // Return if the caller tries to start advising any events except the
  // ITfLangBarItemSink events.
  if (!IsEqualIID(IID_ITfLangBarItemSink, interface_id))
    return CONNECT_E_CANNOTCONNECT;

  // Exit if this object has a sink which advising ITfLangBarItemSink events.
  if (item_sink_ != nullptr)
    return CONNECT_E_ADVISELIMIT;

  // Retrieve the ITfLangBarItemSink interface from the given object and store
  // it into |item_sink_|.
  HRESULT result = unknown->QueryInterface(
      IID_ITfLangBarItemSink, reinterpret_cast<void **>(&item_sink_));
  if (result != S_OK) {
    item_sink_ = nullptr;
    return result;
  }

  // Return the cookie of this object.
  *cookie = kTipLangBarMenuCookie;
  return result;
}

STDMETHODIMP TipLangBarButton::UnadviseSink(DWORD cookie) {
  // Return if the given cookie
  if (cookie != kTipLangBarMenuCookie || item_sink_ == nullptr)
    return CONNECT_E_NOCONNECTION;

  // Release the copy of this event.
  item_sink_->Release();
  item_sink_ = nullptr;

  return S_OK;
}

// Initializes an TipLangBarButton instance.
// This function is called by a text service to provide the information
// required for creating a menu button. A text service MUST call this function
// before calling the ITfLangBarItemMgr::AddItem() function and adding this
// button menu to a language bar.
HRESULT TipLangBarButton::Init(HINSTANCE instance,
                               int string_id,
                               const TipLangBarMenuItem *menu,
                               int count) {
  HRESULT result = S_OK;
  // Retrieve the text label from the resource.
  // This string is also used as a tool-tip text.
  ::LoadString(instance, string_id, &item_info_.szDescription[0],
               arraysize(item_info_.szDescription));

  // Create a new TipLangBarMenuItem object.
  menu_data_.Init(instance, menu, count);

  return S_OK;
}

HRESULT TipLangBarButton::OnUpdate(DWORD update_flag) {
  // For some reason, this method might be called when the event sink is not
  // available. See b/2977835 for details.
  if (item_sink_ == nullptr) {
    return E_FAIL;
  }
  return item_sink_->OnUpdate(update_flag);
}

HRESULT TipLangBarButton::SetEnabled(bool enabled) {
  HRESULT result = S_OK;

  if (enabled) {
    status_ &= ~TF_LBI_STATUS_DISABLED;
  } else {
    status_ |= TF_LBI_STATUS_DISABLED;
  }
  result = TipLangBarButton::OnUpdate(TF_LBI_STATUS);

  return result;
}

bool TipLangBarButton::CanContextMenuDisplay32bppIcon() {
  // We always use a non-theme icon for a context menu icon on the LangBar
  // unless the current display mode is 32-bpp.  We cannot assume we can
  // display a 32-bpp icon for a context menu icon on the LangBar unless the
  // current display mode is 32-bpp.  See http://b/2260057
  CDC display_dc(::GetDC(nullptr));
  return !display_dc.IsNull() &&
         display_dc.GetDeviceCaps(PLANES) == 1 &&
         display_dc.GetDeviceCaps(BITSPIXEL) == 32;
}

TipLangBarMenuData* TipLangBarButton::menu_data(size_t i) {
  return menu_data_.data(i);
}

size_t TipLangBarButton::menu_data_size() const {
  return menu_data_.size();
}

const TF_LANGBARITEMINFO* TipLangBarButton::item_info() const {
  return &item_info_;
}

bool TipLangBarButton::IsMenuButton() const {
  return (item_info_.dwStyle & TF_LBI_STYLE_BTN_MENU) ==
         TF_LBI_STYLE_BTN_MENU;
}

void TipLangBarButton::SetContextMenuEnabled(bool enabled) {
  context_menu_enabled_ = enabled;
}

// Basic implements the IUnknown::QueryInterface() function.
STDMETHODIMP TipLangBarButton::QueryInterfaceBase(
    REFIID interface_id, void **object) {
  if (!object) {
    return E_INVALIDARG;
  }

  // Find a matching interface from the ones implemented by this object
  // (i.e. IUnknown, ITfLangBarItem, ITfLangBarItemButton, ITfSource).
  if (::IsEqualIID(interface_id, __uuidof(IMozcLangBarItem))) {
    IMozcLangBarItem *ptr = static_cast<IMozcLangBarItem *>(this);
    ptr->AddRef();
    *object = ptr;
    return S_OK;
  }

  if (::IsEqualIID(interface_id, IID_IUnknown)) {
    ITfLangBarItemButton *ptr = static_cast<ITfLangBarItemButton *>(this);
    ptr->AddRef();
    *object = static_cast<IUnknown*>(ptr);
    return S_OK;
  }

  if (::IsEqualIID(interface_id, IID_ITfLangBarItem)) {
    ITfLangBarItem *ptr = static_cast<ITfLangBarItem *>(this);
    ptr->AddRef();
    *object = ptr;
    return S_OK;
  }

  if (::IsEqualIID(interface_id, IID_ITfLangBarItemButton)) {
    ITfLangBarItemButton *ptr = static_cast<ITfLangBarItemButton *>(this);
    ptr->AddRef();
    *object = ptr;
    return S_OK;
  }

  if (::IsEqualIID(interface_id, IID_ITfSource)) {
    ITfSource *ptr = static_cast<ITfSource *>(this);
    ptr->AddRef();
    *object = ptr;
    return S_OK;
  }

  // This object does not implement the given interface.
  *object = nullptr;
  return E_NOINTERFACE;
}

void TipLangBarButton::SetDescription(const wstring &description) {
  ::StringCchCopy(item_info_.szDescription,
                  arraysize(item_info_.szDescription),
                  description.c_str());
}

TipLangBarMenuButton::TipLangBarMenuButton(
    TipLangBarCallback *langbar_callback, const GUID &guid, bool show_in_tray)
    : TipLangBarButton(langbar_callback, guid, true, show_in_tray),
      menu_icon_id_for_theme_(0),
      menu_icon_id_for_non_theme_(0) {
}

// Implements the IUnknown::QueryInterface() function.
// This function is used by Windows to retrieve the interfaces implemented by
// this class.
STDMETHODIMP TipLangBarMenuButton::QueryInterface(
    REFIID interface_id, void** object) {
  return QueryInterfaceBase(interface_id, object);
}

STDMETHODIMP_(ULONG) TipLangBarMenuButton::AddRef() {
  return ref_count_.AddRefImpl();
}

STDMETHODIMP_(ULONG) TipLangBarMenuButton::Release() {
  const ULONG count = ref_count_.ReleaseImpl();
  if (count == 0) {
    delete this;
  }
  return count;
}

STDMETHODIMP TipLangBarMenuButton::InitMenu(ITfMenu *menu) {
  HRESULT result = S_OK;

  // Do nothing if the element is not menu botton.
  if (!IsMenuButton()) {
    return result;
  }

  // Add the menu items of this object to the given ITfMenu object.
  for (size_t i = 0; i < menu_data_size(); ++i) {
    const TipLangBarMenuData* data = menu_data(i);

    const UINT icon_id_for_theme =
        CanContextMenuDisplay32bppIcon() ? data->icon_id_for_theme_
                                         : data->icon_id_for_non_theme_;
    CBitmap bitmap;
    CBitmap mask;
    // If LoadIconAsBitmap fails, |bitmap.m_hBitmap| and |mask.m_hBitmap|
    // remain nullptr bitmap handles.
    LoadIconAsBitmap(TipDllModule::module_handle(),
                     data->icon_id_for_non_theme_,
                     icon_id_for_theme,
                     &bitmap.m_hBitmap,
                     &mask.m_hBitmap);
    result = menu->AddMenuItem(i, data->flags_, bitmap, mask,
                               data->text_, data->length_,
                               nullptr);
    if (result != S_OK) {
      break;
    }
  }

  return result;
}

STDMETHODIMP TipLangBarMenuButton::OnMenuSelect(UINT menu_id) {
  // Call the TipLangBarCallback::OnMenuSelect() function to dispatch the
  // given event.
  TipLangBarMenuData* data = menu_data(menu_id);
  if (data == nullptr) {
    return E_INVALIDARG;
  }
  if (data->item_id_ == TipLangBarCallback::kCancel) {
    return S_OK;
  }
  const HRESULT result = langbar_callback_->OnMenuSelect(
      static_cast<TipLangBarCallback::ItemId>(data->item_id_));
  return result;
}

// Implements the ITfLangBarItem::GetInfo() function.
// This function is called by Windows to update this button menu.
STDMETHODIMP TipLangBarMenuButton::GetInfo(TF_LANGBARITEMINFO *item_info) {
  HRESULT result = S_OK;

  if (item_info == nullptr) {
    return E_INVALIDARG;
  }

  // Just copies the cached TF_LANGBARITEMINFO object.
  *item_info = *this->item_info();

  CIcon icon;
  if (FAILED(GetIcon(&icon.m_hIcon)) || icon.IsNull()) {
    return S_OK;
  }

  ICONINFO icon_info = {};
  const BOOL get_icon_succeeded = icon.GetIconInfo(&icon_info);
  CBitmap color(icon_info.hbmColor);
  CBitmap mask(icon_info.hbmMask);
  if (!get_icon_succeeded) {
    return S_OK;
  }

  if (color.IsNull() && !mask.IsNull()) {
    item_info->dwStyle |= TF_LBI_STYLE_TEXTCOLORICON;
    return S_OK;
  }

  return S_OK;
}

STDMETHODIMP TipLangBarMenuButton::GetIcon(HICON *icon) {
  if (icon == nullptr) {
    return E_INVALIDARG;
  }

  //  Excerpt: http://msdn.microsoft.com/en-us/library/ms628718.aspx
  //  The caller must free this icon when it is no longer required by
  //  calling DestroyIcon.
  *icon = LoadIconFromResource(TipDllModule::module_handle(),
                               menu_icon_id_for_non_theme_,
                               menu_icon_id_for_theme_);
  return (*icon ? S_OK : E_FAIL);
}

// Initializes an ImeButtonMenu instance.
// This function allocates resources for an ImeButtonMenu instance.
HRESULT TipLangBarMenuButton::Init(HINSTANCE instance,
                                   UINT string_id,
                                   const TipLangBarMenuItem* menu,
                                   int count,
                                   UINT menu_icon_id_for_non_theme,
                                   UINT menu_icon_id_for_theme) {
  menu_icon_id_for_theme_ = menu_icon_id_for_theme;
  menu_icon_id_for_non_theme_ = menu_icon_id_for_non_theme;
  return TipLangBarButton::Init(instance, string_id, menu, count);
}

TipLangBarToggleButton::TipLangBarToggleButton(
    TipLangBarCallback *langbar_callback,
    const GUID &guid,
    bool is_menu,
    bool show_in_tray)
    : TipLangBarButton(langbar_callback, guid, is_menu, show_in_tray),
      menu_selected_(0),
      disabled_(false) {
}

TipLangBarToggleButton::~TipLangBarToggleButton() {
}

// Implements the IUnknown::QueryInterface() function.
// This function is used by Windows to retrieve the interfaces implemented by
// this class.
STDMETHODIMP TipLangBarToggleButton::QueryInterface(
    REFIID interface_id, void** object) {
  if (!object) {
    return E_INVALIDARG;
  }

  if (::IsEqualIID(interface_id, __uuidof(IMozcLangBarToggleItem))) {
    *object = static_cast<IMozcLangBarToggleItem *>(this);
    AddRef();
    return S_OK;
  }

  return QueryInterfaceBase(interface_id, object);
}

STDMETHODIMP_(ULONG) TipLangBarToggleButton::AddRef() {
  return ref_count_.AddRefImpl();
}

STDMETHODIMP_(ULONG) TipLangBarToggleButton::Release() {
  const ULONG count = ref_count_.ReleaseImpl();
  if (count == 0) {
    delete this;
  }
  return count;
}

// Implements the ITfLangBarItem::GetInfo() function.
// This function is called by Windows to update this button menu.
STDMETHODIMP TipLangBarToggleButton::GetInfo(TF_LANGBARITEMINFO *item_info) {
  HRESULT result = S_OK;

  if (item_info == nullptr) {
    return E_INVALIDARG;
  }

  // Just copies the cached TF_LANGBARITEMINFO object.
  *item_info = *this->item_info();

  if (FAILED(result)) {
    return result;
  }

  CIcon icon;
  if (FAILED(GetIcon(&icon.m_hIcon)) || icon.IsNull()) {
    return S_OK;
  }

  ICONINFO icon_info = {};
  const BOOL get_icon_succeeded = icon.GetIconInfo(&icon_info);
  CBitmap color(icon_info.hbmColor);
  CBitmap mask(icon_info.hbmMask);
  if (!get_icon_succeeded) {
    return S_OK;
  }

  if (color.IsNull() && !mask.IsNull()) {
    item_info->dwStyle |= TF_LBI_STYLE_TEXTCOLORICON;
    return S_OK;
  }

  return S_OK;
}

STDMETHODIMP TipLangBarToggleButton::InitMenu(ITfMenu *menu) {
  HRESULT result = S_OK;

  // Do nothing if the langbar item is not menu botton.
  if (!IsMenuButton()) {
    return result;
  }

  // Add the menu items of this object to the given ITfMenu object.
  for (size_t i = 0; i < menu_data_size(); ++i) {
    const TipLangBarMenuData* data = menu_data(i);
    result = menu->AddMenuItem(i, data->flags_, nullptr, nullptr,
                               data->text_, data->length_,
                               nullptr);
    if (result != S_OK) {
      break;
    }
  }

  return result;
}

STDMETHODIMP TipLangBarToggleButton::OnMenuSelect(UINT menu_id) {
  // Call the TipLangBarCallback::OnMenuSelect() function to dispatch the
  // given event.
  TipLangBarMenuData* data = menu_data(menu_id);
  if (data == nullptr) {
    return E_INVALIDARG;
  }
  if (data->item_id_ == TipLangBarCallback::kCancel) {
    return S_OK;
  }
  const HRESULT result = langbar_callback_->OnMenuSelect(
      static_cast<TipLangBarCallback::ItemId>(data->item_id_));
  if (result != S_OK) {
    return result;
  }
  TipLangBarMenuData* selected = menu_data(menu_selected_);
  selected->flags_ &= ~TF_LBMENUF_RADIOCHECKED;
  data->flags_ |= TF_LBMENUF_RADIOCHECKED;
  menu_selected_ = menu_id;
  return result;
}

STDMETHODIMP TipLangBarToggleButton::GetIcon(HICON* icon) {
  if (icon == nullptr) {
    return E_INVALIDARG;
  }

  // MSIME 2012 shows special icon when the LangBar item is disabled. Here we
  // adopt this behavior for the consistency.
  // TODO(yukawa): Refactor this design. We should split TipLangBarToggleButton
  //     into two different classes anyway.
  const TipLangBarMenuData &data = !IsMenuButton() && disabled_
      ? menu_data_for_disabled_ : *menu_data(menu_selected_);

  //  Excerpt: http://msdn.microsoft.com/en-us/library/ms628718.aspx
  //  The caller must free this icon when it is no longer required by
  //  calling DestroyIcon.
  *icon = LoadIconFromResource(TipDllModule::module_handle(),
                               data.icon_id_for_non_theme_,
                               data.icon_id_for_theme_);
  return (*icon ? S_OK : E_FAIL);
}

HRESULT TipLangBarToggleButton::Init(
    HINSTANCE instance,
    int string_id,
    const TipLangBarMenuItem* menu,
    int count,
    const TipLangBarMenuItem &menu_for_disabled) {
  TipLangBarMenuDataArray array;
  if (SUCCEEDED(array.Init(instance, &menu_for_disabled, 1))) {
    menu_data_for_disabled_ = *array.data(0);
  }
  wchar_t buffer[arraysize(menu_data_for_disabled_.text_)];
  ::LoadString(instance, string_id, buffer, arraysize(buffer));
  description_for_enabled_ = buffer;
  return TipLangBarButton::Init(instance, string_id, menu, count);
}

// Implements the IMozcToggleButtonMenu::SelectMenuItem() function.
HRESULT TipLangBarToggleButton::SelectMenuItem(UINT menu_id) {
  // Now SelectMenuItem may be called frequently to update LangbarItem for
  // every key input.  So we call TipLangBarButton::OnUpdate only if any item
  // state is updated.
  bool item_state_changed = false;
  for (size_t i = 0; i < menu_data_size(); ++i) {
    TipLangBarMenuData* data = menu_data(i);
    if (data->item_id_ == menu_id) {
      if ((data->flags_ & TF_LBMENUF_RADIOCHECKED) != 0 ||
          menu_selected_ != static_cast<UINT>(i)) {
        item_state_changed |= true;
      }
      data->flags_ |= TF_LBMENUF_RADIOCHECKED;
      menu_selected_ = static_cast<UINT>(i);
    } else {
      if (data->flags_ != 0) {
        item_state_changed |= true;
      }
      data->flags_ &= ~TF_LBMENUF_RADIOCHECKED;
    }
  }
  if (item_state_changed) {
    TipLangBarButton::OnUpdate(TF_LBI_ICON | TF_LBI_STATUS | TF_LBI_TEXT);
  }
  return S_OK;
}

HRESULT TipLangBarToggleButton::SetEnabled(bool enabled) {
  disabled_ = !enabled;

  // For menu-button, use parent implementation.
  if (IsMenuButton()) {
    return TipLangBarButton::SetEnabled(enabled);
  }

  // For button type element, adopt special behavior to be consistent with
  // MSIME 2012's behavior.
  // TODO(yukawa): Refactor this design. We should split TipLangBarToggleButton
  //     into two different classes anyway.
  SetContextMenuEnabled(enabled);
  if (enabled) {
    const HRESULT result = SelectMenuItem(menu_data(menu_selected_)->item_id_);
    SetDescription(description_for_enabled_);
    TipLangBarButton::OnUpdate(TF_LBI_ICON | TF_LBI_STATUS | TF_LBI_TEXT);
    return result;
  }
  SetDescription(menu_data_for_disabled_.text_);
  TipLangBarButton::OnUpdate(TF_LBI_ICON | TF_LBI_STATUS | TF_LBI_TEXT);
  return S_OK;
}

// Implements the constructor of the TipSystemLangBarMenu class.
TipSystemLangBarMenu::TipSystemLangBarMenu(TipLangBarCallback *langbar_callback,
                                           const GUID &guid) {
  // Save the TipLangBarCallback object who owns this button, and increase its
  // reference count not to prevent the object from being deleted
  langbar_callback_ = langbar_callback;
  langbar_callback_->AddRef();
}

// Implements the destructor of the TipSystemLangBarMenu class.
TipSystemLangBarMenu::~TipSystemLangBarMenu() {
  // Release the owner TipLangBarCallback object.
  if (langbar_callback_ != nullptr) {
    langbar_callback_->Release();
  }
  langbar_callback_ = nullptr;
}

// Implements the IUnknown::QueryInterface() function.
// This function is used by Windows to retrieve the interfaces implemented by
// this class.
STDMETHODIMP TipSystemLangBarMenu::QueryInterface(REFIID interface_id,
                                                  void **object) {
  if (!object) {
    return E_INVALIDARG;
  }

  // Find a matching interface from the ones implemented by this object
  // (i.e. IUnknown, ITfSystemLangBarItemSink, ITfSource).
  if (IsEqualIID(interface_id, IID_IUnknown) ||
      IsEqualIID(interface_id, IID_ITfSystemLangBarItemSink)) {
    *object = static_cast<ITfSystemLangBarItemSink*>(this);
    AddRef();
    return S_OK;
  } else {
    // This object does not implement the given interface.
    *object = nullptr;
    return E_NOINTERFACE;
  }
}

STDMETHODIMP_(ULONG) TipSystemLangBarMenu::AddRef() {
  return ref_count_.AddRefImpl();
}

STDMETHODIMP_(ULONG) TipSystemLangBarMenu::Release() {
  const ULONG count = ref_count_.ReleaseImpl();
  if (count == 0) {
    delete this;
  }
  return count;
}

// Implements the ITfLangBarItemButton::InitMenu() function.
// This function is called by Windows to create the button menu.
STDMETHODIMP TipSystemLangBarMenu::InitMenu(ITfMenu *menu) {
  HRESULT result = S_OK;

  // Add the menu items of this object to the given ITfMenu object.
  for (size_t i = 0; i < menu_data_.size(); ++i) {
    const TipLangBarMenuData* data = menu_data_.data(i);
    const UINT icon_id_for_theme =
        TipLangBarButton::CanContextMenuDisplay32bppIcon()
            ? data->icon_id_for_theme_
            : data->icon_id_for_non_theme_;
    CBitmap bitmap;
    CBitmap mask;
    // If LoadIconAsBitmap fails, |bitmap.m_hBitmap| and |mask.m_hBitmap|
    // remain nullptr bitmap handles.
    LoadIconAsBitmap(TipDllModule::module_handle(),
                     data->icon_id_for_non_theme_,
                     icon_id_for_theme,
                     &bitmap.m_hBitmap,
                     &mask.m_hBitmap);
    result = menu->AddMenuItem(i, data->flags_, bitmap, mask,
                               data->text_, data->length_,
                               nullptr);
    if (result != S_OK) {
      break;
    }
  }

  return result;
}

// Implements the ITfLangBarItemButton::OnMenuSelect() function.
// This function is called by Windows to notify a user selects an item in
// this button menu.
STDMETHODIMP TipSystemLangBarMenu::OnMenuSelect(UINT menu_id) {
  // Call the TipLangBarCallback::OnMenuSelect() function to dispatch the
  // given event.
  TipLangBarMenuData* data = menu_data_.data(menu_id);
  if (data == nullptr) {
    return E_INVALIDARG;
  }
  if (data->item_id_ == TipLangBarCallback::kCancel) {
    return S_OK;
  }
  const HRESULT result = langbar_callback_->OnMenuSelect(
      static_cast<TipLangBarCallback::ItemId>(data->item_id_));
  return S_OK;
}

// Initializes an TipLangBarButton instance.
// This function is called by a text service to provide the information
// required for creating a menu button. A text service MUST call this function
// before calling the ITfLangBarItemMgr::AddItem() function and adding this
// button menu to a language bar.
HRESULT TipSystemLangBarMenu::Init(HINSTANCE instance,
                                   const TipLangBarMenuItem *menu,
                                   int count) {
  return menu_data_.Init(instance, menu, count);
}

}  // namespace tsf
}  // namespace win32
}  // namespace mozc


text:
Q: np.ones(size, 'd') what does the 'd' do? Following this post I'm trying to implement a one-dimensional smoothing algorithm. When creating a flat window for a simple moving average the call is as follows:
w = numpy.ones(window_len, 'd')

which yields an array of float64 ones. If I omit the 'd' the result is the same. So what does this parameter do? More interestingly the official documentation does not list a second positional argument and the implementation doesn't seem to accept one so I'm even a little confused the call above doesn't simply blow up in my face.

A: d is just the character code for a double-precision floating-point dtype. It's a key word argument but can also just be specified positionally:
numpy.ones(shape, dtype=None, order='C')

Find more on numpy's datatypes in Data type objects (dtype)

A: numpy.ones(shape, dtype=None, order='C')

Parameters
shapeint or sequence of ints

    Shape of the new array, e.g., (2, 3) or 2.
dtypedata-type, optional

    The desired data-type for the array, e.g., numpy.int8. Default is numpy.float64.
order{'C', 'F'}, optional, default: C

    Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.

full documentation at https://numpy.org/doc/stable/reference/generated/numpy.ones.html

redpajama_set_name: RedPajamaStackExchange


text:
Европско првенство у одбојци за жене 1951. је било 3. по реду Европско првенство које се од 15. до 22. септембра одржавало у Француској. Титулу је одбранила репрезентација СССР-а.

Учесници
На Европском првенству је учествовало 6 репрезентација.

Формат
Такмичење се састојало од два различита круга. У првом кругу, шест репрезентација су биле подељене у две групе по 3 екипе. Првопласиране и другопласиране екипе из обе групе су се пласирале у завршном кругу. Играло се по Бергеровом систему.

Први круг

Група 1

Група 2

Завршни круг

Коначан пласман

Спољашње везе
 Резултати

Европска првенства у одбојци за жене
Одбојка у Француској
Одбојка у 1951.
Спорт у Паризу

redpajama_set_name: RedPajamaWikipedia


text:
Medical Posts
Bing is elitist and Wave is confusing
Mike Elgan
Published: June 9th, 2009
Industry titans Microsoft Corp. and Google Inc. are getting rave reviews this week about innovative new approaches to Internet search and communications, respectively.
Even Apple Inc. co-founder Steve Wozniak told a reporter that Microsoft's new Bing search engine looks "astounding" and that he's "a big fan, now."
There's much to like. In a nutshell, Bing does more to surface information you're probably looking for than Google does.
For example, if you search for a company, one of the top results will present links to customer service, store locator — that kind of information.
If you haven't seen it, go here to see the Microsoft pitch for Bing.
Looks great, right? What's not to like. Well…
Bashing Bing
If you'll notice, the URL for the video link above is: DecisionEngine.com. And that's exactly what Bing does better than Google. It makes decisions for you. Of more concern is that it makes decisions for all users.
So what's wrong with that? Well, nothing for you and me.
For individual people, Bing is a nice alternative to Google and the other search engines. It can save you time and hassle for some kinds of searches — no question about it.
The problem is how Bing might affect culture, especially if Google copies some of its features to neutralize Microsoft as a competitor. In other words, if search engines that made decisions for you is a trend, it's probably a bad trend, not a good one.
Decisions are — and must be — based on value judgments. To use Bing is to see the Internet through Microsoft's corporate values.
Bing brings "the best match to the top," not the most popular. In other words, Microsoft is overriding the democratic approach for an elitist, we-know-best approach.
The demo video shows a search for "home depot," which offers alternatives to the left of the results, including "Ace Hardware" and "Walmart." That the alternative to a mega-chain is another mega-chain is a value judgment. Why isn't the mom-and-pop hardware store in my neighborhood the best alternative to Home Depot? To some it is. To Microsoft, it isn't. Could Bing, if popular, accelerate the demise of locally owned businesses in favor of giant corporations?
"Bing's health results bring together resources from the top medical sources in the world, including the Mayo Clinic," Microsoft says in the demo. Microsoft's value judgments about whom to trust for medical information win the day, namely conventional Western medical authorities. Alternative therapies, which may favor diet and exercise for obesity or cardiovascular disease over drugs and surgery, are buried. The whole complex debate about whether the Western medical establishment is overly influenced by pharmaceutical industry pressure, insurance industry pressure, and so on, is settled before you even start exploring your options. Microsoft has chosen sides — for all of us.
Yes, Bing is easy. It's always easy to have someone else choose your values and make your decisions for you. But is that good for society?
O what a tangled Wave we weave
Google Wave also demos well. And what's not to like? The prototype promises the joining together of e-mail, chat, photo sharing and other forms of communication into a single online app.
At first glance, the "hosted" messaging system of Wave looks compelling. You can comment to a specific part of a conversation by dropping in your note right there in the message (rather than copying and pasting). ]
This feature looks great on stage, but I fear in practice it will result in confusion. It's sort of like how Google currently does Gmail. Unlike other e-mail systems, where the most recent message is at the top, Gmail has some mysterious system for how it orders threaded comments.
I and others I've spoken to constantly find ourselves confused about where the most recent comment is. The thread feels shuffled.
Wave looks like it could make this situation even worse. After bouncing stuff back and forth, and after people comment on various parts of the thread, adding commentary at the top, bottom and middle of the original message, clarity about what's old, new, moot or relevant seems unlikely.
The other major problem with Wave is its generous contribution to the larger problem of over complexity and information overload.
There is so much going on here that Wave fights against the quest for clarity, simplicity and minimalism – the qualities that made Google famous.
This is essentially what Microsoft attempted with Outlook, and the result was bloat. "It's a floor wax AND a dessert topping! "
I'm not sure we need yet another app that does everything.
What's bad about both
The biggest problem with Bing and Wave is that both are on the wrong side of two technology-design battles raging in the industry.
The first is the battle over linearity, and the other is the battle for mobility.
Have you noticed that every massively popular new way to communicate in the past few years has shared the attribute of perfect linearity? First e-mail, then chat, then blogs, then Twitter — all provided the benefit of strict, top-to-bottom, most-recent-first organization. Linearity imposes clarity on information, and puts the user's mind at ease. All attempts to "improve" these media with non-linear views have failed. People love linearity.
But this is exactly how both Microsoft and Google are trying to improve search and communication, respectively: by introducing non-linearity.
In the case of Bing, Microsoft displays results in order down the middle of the page. But there are alternative results on the left as well. It's not a big deal, and Google has introduced similar non-linearity in recent years.
But Google got rich and famous by providing a single search box, followed by a single ordered list of results.
In the case of Wave, the many killer features may be overshadowed by the amount of "stuff" happening all over the page. I'd love to have the good features, such as the ability to see the other person typing, but in a single, linear column from newest to oldest.
Finally, constant improvements in the quality of mobile devices have created the possibility of sites that work great on screens both big and small. I want giant companies that play in both spaces, such as Microsoft and Google, to drive this initiative.
They should seek ways to get everything working great on all devices, and to avoid systems where there's a PC version and a separate mobile version.
Both Bing and Wave appear to be optimized for big screens and unrealistic for phones and other mobile devices.
This was a great week for announcements about innovative new products. But announcements are really nothing more than sales pitches.
Let's all reserve judgment about these two exciting new technologies until we can see for ourselves what effect they'll have on what's really important: Our ability to focus, think clearly and make decisions objectively.
Mike Elgan writes about technology and global tech culture. He blogs about the technology needs, desires and successes of mobile warriors in his Computerworld blog, The World Is My Office. Contact Mike at mike.elgan@elgan.com, follow him on Twitter or his blog, The Raw Feed.
Post to Twitter Post to Facebook Share on LinkedIn Share on LinkedIn Share with Google+
Nine Twitter tips for business
The 10 Facebook status archetypes you can't avoid
Medical, Posts
BING, Google, Microsoft
Microsoft announces Surface Pro 7+ for business users
Google employees seeking to unionize
Microsoft Future Now at a glance: Business leaders say DX is overdue, critical research highlights, and more
Google finally hangs up on Hangouts, says auto migrations to Chat begin in 2021

redpajama_set_name: RedPajamaCommonCrawl


Dr. Harvey Frommer received his Ph.D. from New York University. Professor Emeritus, Distinguished Professor nominee, and recipient of the "Salute to Scholars Award" at CUNY where he taught writing and speech for many years, he was cited in the Congessional Record and by the New York State Legislature as a sports historian and journalist.
Author of autobiographies of sports legends Nolan Ryan, Red Holzman and Tony Dorset, Frommer's other sports books include Shoeless Joe and Ragtime Baseball, New York City Baseball: 1947-1957, A Yankee Century, Red Sox vs. Yankees plus the acclaimed oral histories Remembering Yankee Stadium and Remembering Fenway Park. His When It Was Just A Game: Remembering the First Super Bowl, An Oral History and It Happened in Miami: An Oral History were published in 2015.
Oral History has been used extensively by Dr. Frommer in his many travel and sports articles and books.
In 2015, the Frommers were selected to appear at the Miami International Book Fair and the National Press Club, Washington, D.C. Book Fair.
The Spectacle. The History. The Lore. The Legacy.
The New York Yankees have captivated and thrilled their fans and the world of baseball for generations. They have re-written the record books. Forty-four players and 11 managers are in the Hall of Fame. They have claimed forty pennants. Twenty-seven world championships. Featured dozens of players with unparalleled major league legacies like Ruth, Gehrig, DiMaggio, Mantle, and Jeter. For these Bronx Bombers "heritage", "mystique", "ritual", "magic", "aura", and "tradition" aren't just public relations constructs but critical pieces of their narrative. Where "greatest" and "most" and "ultimate" are operative words, not wishful thinking.
For the franchise that has offered so many unequalled performances and generated such an incomparable share of the game's history, Dr. Harvey Frommer presents the seminal book that echoes these superlative accomplishments and celebrates all things Yankees, "THE ULTIMATE YANKEE BOOK: From the Beginning to Today: Trivia, Facts and Stats, Oral History, Marker Moments and Legendary Personalities—A History and Reference Book about Baseball's Greatest Franchise" (Page Street Publishing, October 24, 2017).
From its baseball gods to its public relations men; its dynasty builders to its clubhouse attendants, Frommer highlights the great men who have created the framework of the gloried team, but also goes in-depth on all of the great stories and trivia, games and statistics, high points and low ones. THE ULTIMATE YANKEE BOOK also features an incredible collection of classic photographs from Yankee history, and includes other unique images like vintage programs, scorecards, tickets, baseball cards, advertisements, snapshots, and more. There are so many fascinating pieces of artwork that it is like a New York Yankee museum on the printed page.
Brilliant in design and composition, THE ULTIMATE YANKEE BOOK in its entirety can only be overshadowed by one of its sections: the "Ultimate Yankee Quiz", which could be one of the most fiendish and beguiling tests for any Yankee fan or baseball history aficionado.
Dr. Frommer's prose is clean and compelling and has put together one of the great oral histories in sports publishing. The book is filled classic quotes and memories from the voices of Grantland Rice, Roger Kahn, John Cheever, Ernest Hemingway, Thomas Wolfe, James Thurber, Rudy Giuliani, Mario Cuomo among many others, along with all of the details and inside stories of so many Yankee greats like Mel Allen, Billy Martin, Lefty Gomez, Roger Maris, Bob Sheppard, Thurman Munson, Don Mattingly, Mariano Rivera, Tony Lazzeri, and Reggie Jackson to name just a few.
For a team built on superlatives, THE ULTIMATE YANKEE BOOK is a most fitting tribute.
One of the most prolific and respected sports journalists and oral historians in the United States, author of the autobiographies of legends Nolan Ryan, Tony Dorsett and Red Holzman, Dr. Harvey Frommer is an expert on the New York Yankees. He wrote for Yankees Magazine for 18 years and has arguably written more books, articles and reviews on the New York Yankees than anyone. A professor at Dartmouth College, Frommer was dubbed "Dartmouth's Mr. Baseball" by their alumni magazine. He lives in Lyme, New Hampshire, with his wife Myrna Katz Frommer.
- "In It Happened in Miami, the Magic City by Myrna Katz Frommer and Harvey Frommer (Taylor Trade, $29.95), a wide range of voices reminisce, and the result is captivating. You'll find great tidbits that will make you want to learn more."


text:
using Newtonsoft.Json;
namespace WebDriverGoogleLighthouse
{
    public class LighthouseCoreAuditsByteEfficiencyTotalByteWeightJsDisplayValue
    {
        [JsonProperty("values")]
        public Values Values { get; set; }

        [JsonProperty("path")]
        public string Path { get; set; }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Irish company's Qatari branch involved in catering dispute
Sepam Qatar, criticised for its visa regime, is in a row with a food supplier
Sat, Mar 7, 2015, 01:01 Updated: Sat, Mar 7, 2015, 16:20
Colm Keena
We take a look inside a labour camp in Qatar that is housing migrant workers and is owned by Irish company SEPAM.
An artist's impression of the Al-Wakrah stadium complex. Photograph: Getty Images
Meals for about 270 migrant workers, mostly from India and the Philippines, were cancelled by a catering and labour camp operator in Qatar because of a dispute with their employer, an Irish construction business.
The migrant workers were living six to a room in a complex in Doha that was the subject of an August 2013 contract between Sepam Qatar LLC and Sunshine Catering, the provider of the labour camp. At one stage Sunshine also threatened to cut off water and sewage services because of the dispute.
Sepam Qatar is part of the Sepam Group, which was founded in the 1970s by Irish businessman Gus Kearney. It is headquartered in Clonmel and, according to its website, has offices in Ireland, the UK, the US, China, Kazakhstan, Kuwait, Bahrain, Qatar and the United Arab Emirates.
Non-payment
Imran Iltaf
As a result the workers in the camp were no longer being fed by Sunshine, he said. "I don't know how they are being fed." He said he had not thrown the workers out of the camp despite the non-payment of the agreed fees. "We can't throw the workers out. That is not human."
Barry O'Brien, acting general manager with Sepam Qatar, said it was in dispute with Sunshine Catering because of Sunshine's failure to meet the terms of the contract it had signed with Sepam and that, as a result, Sepam was "forced to review its agreement".
"Sepam has had to source an alternative catering service provider to cater for the needs of a large, multi-ethnic workforce within the Sunshine accommodation facilities."
Asked who was providing the service, Mr O'Brien said he did not want to comment further.
Mr Iltaf, who is from Pakistan, said Sunshine had been in business for three years and had labour camps accommodating 3,500 migrant workers in Qatar. The workers, who come from across south Asia, are working on building, road and metro construction projects.
Construction boom
The contract between Sunshine Catering and Sepam Qatar was signed by Mr Iltaf and Anthony Creane, general manager of Sepam Qatar, and concerned a "labour camp" at "Industrial Area, Street 43, Gate No 55, in Doha".
The lease involved 84 rooms, 12 kitchens and 12 bathroom areas, as well as washing areas.
"This is a labour camp and therefore it should conform to a standard in keeping for its use," the contract said.
It said the rent would be QAR36 (€9.11) per person per day for the first 400 people accommodated, including catering services, with a 1 per cent discount if the numbers went above 400, and a lesser, revised rate if the numbers fell below 400. Payment was to be a month in advance.
Under the terms of the contract Sepam Qatar was responsible for cleaning the camp, laundry services, pest control, the provision of mattresses and linen and recreation facilities.
Sunshine was to feed the workers. The ones on day shift were to get meals in the camp at 5am and 7pm, and a meal on site at 11am, while workers on the night shift were to get meals in the camp at 3pm and 5am, and a meal on site at 9.30pm.
Asked about international criticism of the treatment of migrant labourers in Qatar, Mr Iltaf said there were strict rules governing standards in labour camps.
"The labour camp is very nice," he said. "The Qatari government is very strict. The ministry for labour checks the labour camps and there is a heavy penalty if they are not to a high standard."
Following publication of a report in this newspaper late last year about the visa regime operated by Sepam for its Irish employees in Qatar, a number of former and current employees of the group, mostly Irish, got in contact and complained about the late payment of wages by Sepam in Qatar and other matters.
One of the key complaints from a number of Irish workers who had worked for Sepam was that it would not give them documentation that would allow them to work for other companies in Qatar.
At the time of the report about the visa regime operated by Sepam, a company spokesman said it complied "with all labour and other pertinent regulations and operates to industry norms in each market where it has a presence. Any queries in relation to the employment conditions in Qatar should be sent to the Irish Department of Foreign Affairs."
Irish people working for Sepam are provided with apartments. Both Sepam Qatar and Sunshine Catering are joint ventures involving Qatari partners. In the case of Sunshine, Iltaf owns 49 per cent of the company.
Anthony Creane
Barry O Brien
Gus Kearney
Irish Department Of Foreign Affairs
Qatari Government
Sepam Group
Sunshine Catering
Sepam: Clonmel company has operations worldwide
'Conspiracy of silence' surrounds World Cup construction in Qatar
Coombe should not have given Covid vaccines to family of staff, Donohoe says
Latest World
Workers trapped in Chinese mine confirm 12 out of 22 are alive 11:56
Arrest of Alexei Navalny condemned by western governments 10:08
'We're starving': Guatemala blocks hundreds of US-bound migrants 09:56
Museum of London acquires Donald Trump baby blimp 09:19
Covid-19: China reports increasing cases as New Year holiday looms 08:19
World View Podcast
World View - The Foreign Affairs Podcast - Pro-Trump rioters storm the US Capitol 26:07
World View - The challenges facing the Biden administration - with Thomas Wright 36:00
World View - our correspondents pick their moments of 2020 23:26
3 Dublin hospital gave leftover vaccines to 16 relatives of staff
5 Coombe should not have given Covid vaccines to family of staff, Donohoe says


New Show Homes in Nisku to view. These show homes illustrate our high level of finishing that distinguish Western Modular Homes from all others. Come and see them in person and learn how we can help you build your next home.


text:
Justia Patents Including Use Of VacuumUS Patent for Process for producing microporous tubes of polytetrafluoroethylene Patent (Patent # 4,250,138)
Process for producing microporous tubes of polytetrafluoroethylene
May 23, 1979 - Sumitomo Electric Industries, Ltd.
Polytetrafluoroethylene resin tubes having small pore size and high porosity are produced by a process which includes stretching the tubes by drawing using a metal die and a metal plug. By using the die and plug, the stress necessary for stretching is converted to a compressive force in the thickness direction of the tube. This compressive force is an essential factor in producing the microporous structure of the tubes. In addition, when stretching is performed by drawing, a ratio of thickness to inside diameter of the tube of 0.07 or less can be easily achieved.
Latest Sumitomo Electric Industries, Ltd. Patents:
SWITCH DEVICE AND COMMUNICATION CONTROL METHOD
INDIUM PHOSPHIDE SINGLE-CRYSTAL BODY AND INDIUM PHOSPHIDE SINGLE-CRYSTAL SUBSTRATE
Printed circuit board and electronic component
Electric wire coated with multiple insulating layers having different elastic modulus
The present invention relates to polytetrafluoroethylene resin tubes having small pore size simultaneously with a high porosity and to a process for producing the same.
Although nonporous tubes or pipes composed of polytetrafluoroethylene resin having various inside diameters and wall thicknesses have been on the market, only quite limited kinds of porous tubes or pipes have been produced. Processes for producing porous polytetrafluoroethylene resin tubes are described in Japanese Patent Publications Nos. 13560/67 and 18991/76. The process for producing porous polytetrafluoroethylene resin tubes as described in these patent publications comprises molding a polytetrafluoroethylene resin by a paste method to form a tube and heating it to 327.degree. C. or more in a stretched state. The tubes produced by such processes have a microstructure comprising nodules linked to one another by fine filaments, and the space surrounded by the filaments and the nodules defines a pore. As a result of various studies about tube molding, the present inventors have found that prior art moldings only having comparatively large pore size as large as 1.mu. or more are generally obtained by these known processes and they have a defect that porosity remarkably decreases when the pore size is 0.5.mu. or less.
On the one hand, in spite of being nonporous or porous, there is a definite relation between the inside diameter and the thickness of the polytetrafluoroethylene resin tubes. Namely, if the inside diameter increases, the thickness has a tendency to increase and the ratio of the thickness to the inside diameter is generally larger than 0.1. This depends upon the method of producing the polytetrafluoroethylene resin, such as the paste extruding method, etc. The reasons for this are that the tube before sintering at about 327.degree. C. or more is very brittle and the tube is more easily broken by a slight exterior force if the inside diameter becomes larger. For use in filtration or separation of a mixture such as solids, liquids and gases, etc., it is often preferred to have a small thickness irrespective of the inside diameter of the tube.
The first object of the present invention is to provide polytetrafluoroethylene resin tubes having small pore size and high porosity.
The second object of the present invention is to provide porous polytetrafluoroethylene resin tubes having small thickness such that a ratio of thickness to inside diameter is 0.07 or less and having a high porosity.
The third object of the present invention to provide a process for expanding the produced microporous tubes.
In the present invention, when the tube is stretched in the lengthwise direction, it is stretched by drawing using a metal die and a metal plug. In this way, the stress necessary to stretch the tube is converted into a compressive force by the plug acting against the die. If necessary, the tube so produced is expanded by reducing the pressure on the outside thereof simultaneously with sintering at 327.degree. C. or more. Thus, a microporous tube is obtained.
BRIEF DESCRIPTION OF THE DRAWING
In the drawings:
FIG. 1 is a diagram which shows a characteristic range A, B, C and D of the porosity and the bubble point obtained by stretching by drawing and a characteristic range in the prior case of not stretching by drawing; and
FIG. 2 is a simplified cross-sectional view which shows the relation of the plug 1, the tube 2 and the die 3 suitable for stretching by drawing.
The moldings of the present invention will be illustrated in detail by comparison with the prior moldings. The characteristics of these moldings are shown by porosity, pore size, thickness, inside diameter and strength, etc. Among these, the porosity and the pore size are the most important characteristics of the porous moldings. The porosity can be calculated by measurement of the specific gravity in air and that in water. Further, although an indication of the pore size differs depending on the method of measurement, the pore size used in this specification means the maximum pore size. The maximum pore size can be calculated by measurement of the bubble point, namely, the pressure at which the first bubble is generated when the molding is wetted by a liquid having a low surface tension such as alcohol, etc. and air pressure is applied to one face of the wetted molding while gradually increasing the air pressure. Refer to, for example, ASTM F316-70. The bubble point is in inverse proportion to the maximum pore size. The larger the bubble point is, the smaller the maximum pore size is.
Moldings obtained by the prior art method which comprises stretching a tube while heating have considerably large pore size, although the pore size somewhat differs by stretching conditions. Namely, in the prior art method, only moldings having a low bubble point are obtained. If it is intended to increase the bubble point by reducing the stretching ratio, the moldings tend to have a low porosity. More specifically, in order to make the porosity 80% or more, the bubble point becomes 0.2 kg/cm.sup.2 or less. On the other hand, in order to make the bubble point 0.5 kg/cm.sup.2, moldings having a porosity of 60% or less are obtained.
In contrast, in moldings of the present invention, bubble points of between 0.26 kg/cm.sup.2 -0.8 kg/cm.sup.2 can be suitably obtained while keeping the porosity 80% or more. Further, even if the bubble point is 1.0 kg/cm.sup.2, moldings having a porosity up to 75% can be obtained. These relations are shown in detail in FIG. 1. As can be understood from this figure, it is possible to obtain moldings having porosities between 20-60% and bubble points between 1.5 kg/cm.sup.2 or 2.0 kg/cm.sup.2. This range is shown as an area surrounded by straight lines linking each point A, B, C and D. The porosity and the bubble point at each point are as follows: Point A (96%, 0.02 kg/cm.sup.2), Point B (54%, 2.0 kg/cm.sup.2), Point C (20%, 2.0 kg/cm.sup.2) and Point D (30%, 1.0 kg/cm.sup.2).
In the following, a process for producing the moldings of the present invention is illustrated. The first step is to obtain a tubular molding by the paste method. In this step, almost all resins can be used if they are made as a fine powder. As the liquid lubricating agent for mixing, materials which are capable of wetting the surfaces of the resin and capable of being removed by evaporation or extraction at a temperature below the decomposition point of the resin can be used. The polytetrafluoroethylene resin composition containing the liquid lubricating agent is molded by extrusion by means of a ram type extruder to form a tube. Then, the liquid lubricating agent is removed from the tube by evaporation or extraction. These steps are the same as or nearly similar to the steps of molding tubes in the piror art paste method. However, next a stretching step is performed and this is different from the known method. This is a distinguishing feature of the present invention.
In stretching the tube, it is necessary to provide an exterior tensile stress higher than the tensile strength of the tube. Hitherto, fixed points or fulcrums for stress loading are provided in the lengthwise direction of the tube. For example, one end is fixed and the other end is drawn. A similar effect can be accomplished by stretching by means of rolls equipped with grooves and having a different revolving ratio. In the present invention, fixed points or fulcrums for stress loading are provided in the lengthwise direction and a reduction die and plug is provided through the thickness of the tube so as to disperse a part of the stress in the diameter direction or the thickness direction of the tube. Thus, the reduction die and plug functions as a fixed point or a fulcrum for the stress load in the thickness direction of the tube.
FIG. 2 illustrates the stretching process according to the invention. The plug 1 functions as a mandrel and is composed of two columnar parts, one having a size smaller than the initial inside diameter of the tube 2 and a tappered part. On the other hand, the die 3 is composed of an orifice part having a size smaller than the initial outside diameter of the tube 2 and a tapered part. It is preferred that the angle of the tapered part in the die 3 be larger than that in the plug 1.
When the tube 2 is stretched in the direction of the arrow a part of the stress is converted into a compressive force in the thickness direction in the tapered parts of the plug 1 and the die 3, and consequently the thickness of the tube 2 becomes small. Of course, in this case, the plug 1, the tube 2 and the die 3 are all heated to a temperature lower than the melting point of the polytetrafluoroethylene resin. Since the residual liquid lubricating agent often evaporates, it is preferred to provide openings for dispersing the evaporated gas in the center of the plug 1. The compressive force depends upon the angle of the tapered parts of the plug 1 and the die 3, the inside diameter of the orifice in the die 3, the outside diameter and weight of the plug 1, the thickness of the tube 2 and the temperature, speed or stretching ratio for stretching by drawing. In order to obtain small pore size and a high porosity, it is preferred that conventional stretching which does not use the die and plug be first carried out and then stretching by drawing is carried out using the die and plug.
In carrying out stretching without the use the die and plug, an increase of the porosity and an increase of pore size first occur. Then, the pore size decreases; that is, the bubble point increases by carrying out stretching by drawing, while the porosity somewhat decreases. In cases of carrying out stretching only by drawing, the porosity does not sufficiently increase even though the pore size decreases or, on the contrary, the pore size sometimes does not decrease when the porosity is large. Further, if the stretching ratio is too large, the pore size increases again as a function of the compressive force. Therefore, it is preferred to generate the compressive force at a comparatively low stretching ratio from the viewpoint of producing a tube having a high porosity and small pore size.
The molding stretched by drawing is then sintered at a temperature of about 327.degree. C. or more to fix its structure obtained by stretching. In this case, the thickness of the tube becomes thin and the ratio of thickness to inside diameter of the tube is nearly the same as the case of an extrusion tube prepared using the paste method. However, if the tube is held so that it is not contracted in the lengthwise direction of the tube and is expanded in the diameter direction by reducing the pressure of the outside of the tube when sintering at a temperature of about 327.degree. C. or more is carried out, the thickness of the tube becomes even thinner and the inside diameter thereof becomes larger. Consequently, it is possible to obtain a ratio of thickness to inside diameter of 0.07 or less and sometimes 0.03. Such porous tubes having a ratio of 0.03 generally can not be obtained by the paste extrusion method, and long moldings can not be obtained even if short moldings can be produced.
It has been found that the degree of expansion in the diameter direction can be quite freely selected by varying the reduction in outside pressure. However, if the degree of expansion is large, though the porosity increases, the bubble point tends to decrease as illustrated by the characteristic in the upper left area of FIG. 1. Polytetrafluoroethylene resin tubes having such small pore size simultaneously with a high porosity did not exist hitherto, although it has been known that such tubes would provide meaningful materials for artificial tubular internal organs or industrial filtration.
In the following, the present invention will be illustrated with reference to examples. However the scope of the present invention is not limited to these examples.
3 kg of Polyflon F-104 (tradename of polytetrafluroethylene fine powder produced by Daikin Kogyo Co.) was mixed with 0.75 kg of Deo-Base (tradename of a light petroleum distilate produced by Witco Chemical Co.) and the mixture was extruded at a section reduction ratio of 580 to form a tube having a 5.5 mm outside diameter and a 4.0 mm inside diameter. After removing the Deo-Base by extraction with trichloroethylene, the tube was stretched fourfold at 300.degree. C. in the lengthwise direction at a 20 cm/min tube supplying rate. The tube was then stretched twofold or threefold by drawing using a die, having a 4.2 mm orifice diameter and a 30.degree. taper angle, and a plug, having columnar parts with outside diameters of a 4.0 mm and 3.0 mm and a 20.degree. taper angle, at a 300.degree. C. tube temperature in the lengthwise direction at a 20 cm/min tube supplying rate.
The tube stretched by drawing was sintered by passing the tube through an electric furnace at 510.degree. C. at 60 cm/min. The results are shown in Table 1. For comparison, the characteristics of a tube produced under the same conditions without using the die and the orifice are also shown in Table 1.
TABLE 1 ______________________________________ Second Inside Exper- stret- Bubble diam- Thick- iment ching Die and Porosity point eter ness No. ratio plug (%) (kg/cm.sup.2) (mm) (mm) ______________________________________ 1 2 times Present 40.4 1.3 3.2 0.195 2 3 Present 81.6 0.31 3.3 0.346 3 2 Absent 76.0 0.20 3.4 0.48 4 3 Absent 85.3 0.11 3.4 0.44 ______________________________________
In the tubes which were not stretched by drawing, the ratio of thickness to inside diameter is more than 0.1. On the other hand, it is clear that the bubble point is high in cases of tubes which were produced by stretching using the die and the plug.
The tube stretched by drawing in Example 1 was introduced under reduced pressure in an electric furnace and heated to 327.degree. C. or more while the tube was expanded by reducing the pressure on the outside of the tube. The characteristics obtained are shown in Table 2.
TABLE 2 ______________________________________ Exper- Second Bubble Inside iment stretch- Porosity point diameter Thickness No. ing ratio (%) (kg/cm.sup.2) (mm) (mm) ______________________________________ 5 2 times 56.4 0.76 5.8 0.12 6 3 83.7 0.27 5.6 0.28 ______________________________________
The bubble point decreases as compared with the cases in Example 1, but the porosity tends to increase and the ratio of thickness to inside diameter becomes small, which is 0.02 and 0.05.
The same experiment was carried out as in Example 1 except that the columnar parts of the plug had outside diameters of 4.0 mm and 3.5 mm and the taper angle was 17.degree., 21.degree. or 36.degree.. The first stretching was carried out by stretching threefold and the second stretching was carried out by stretching twofold or threefold.
The sintering was carried out without using a reduced pressure.
TABLE 3 ______________________________________ Second Exper- stretch- Bubble Inside Thick- iment Taper ing Porosity point diameter ness No. angle ratio (%) (kg/cm.sup.2) (mm) (mm) ______________________________________ 7 17.degree. 2 times 61.2 1.12 3.4 0.27 8 17 3 73.7 0.43 3.4 0.18 9 21 2 60.3 1.55 3.5 0.21 10 21 3 70.5 0.46 3.4 0.18 11 36 2 57.4 1.76 3.6 0.21 12 36 3 68.7 0.54 3.4 0.18 ______________________________________
When the taper angle increases, the porosity slightly decreases and consequently the bubble point increases and the thickness decreases. This is supposed to be due to a change of compressive force in the thickness direction.
A tube having an outside diameter of 8.0 mm and an inside diameter of 6.0 mm was produced in the same manner as in Example 1. After the tube was stretched threefold, it was stretched twofold by drawing using a die having a 5.1 mm orifice diameter and a 30.degree. taper angle and a plug having columnar parts with outside diameters of 6.0 mm and 5.1 mm and a 25.degree. taper angle at a 290.degree. C. tube temperature at a 25 cm/min tube supplying rate. The tube sintered at 360.degree. C. had a 68% porosity, a 0.62 kg/cm.sup.2 bubble point, a 4.8 mm inside diameter and a 0.23 mm thickness. The tube which was expanded by reducing the outside pressure while sintering at 360.degree. C. had a 85% porosity, a 0.39 kg/cm.sup.2 bubble point, a 9.5 mm inside diameter and a 0.09 mm thickness .
1. A process for producing microporous tubes which comprises
molding a polytetrafluoroethylene resin containing a liquid lubricating agent by a paste method to form a tube,
removing the liquid lubricating agent,
stretching by drawing the tube in a lengthwise direction using a die and a plug, and
sintering at a temperature of about 327.degree. C. or more
whereby as a result of said stretching and said drawing, a microporous tube is produced having a porosity and a bubble point in a range between the point A, B, C and D defined in the following table;
2. A process for producing microporous tubes as set forth in claim 1, wherein the stretching in the lengthwise direction is carried out two or more times and the final stretching is carried out by drawing using the die and the plug.
3. A process for producing microporous tubes as set forth in claim 1 which comprises sintering the tube at about 327.degree. C. or more simultaneously with expanding the tube by reducing the pressure on the outside of the tube after carrying out stretching by drawing.
3085290 April 1963 Chu
3295166 January 1967 Owingo
3356108 December 1967 Johnston
3907955 September 1975 Viennot
3953566 April 27, 1976 Gore
Filed: May 23, 1979
Date of Patent: Feb 10, 1981
Assignee: Sumitomo Electric Industries, Ltd. (Osaka)
Inventor: Koichi Okita (Osaka)
Primary Examiner: James B. Lowe
Law Firm: Sughrue, Rothwell, Mion, Zinn and Macpeak
Application Number: 6/41,586
Current U.S. Class: Including Use Of Vacuum (264/568); Fluorocarbon Resin (264/127); Reshaping Running Or Indefinite-length Work (264/280); By Drawing Over A Form (264/292)
International Classification: B29D 2301; B29D 2708;


Helping "orphaned" wildlife often means doing nothing.
Bluebonnets, warm days, and baby animals abound in spring, when most species produce new offspring. This is also the time when "Wildlife Rehab" specialists spring into action. Almost everyone would help an orphaned bird, or fawn or cottontail if they could. We all mean well. That's why it's important to know that most of these animals aren't really orphans. Animal parents rarely "abandon" their young before they're ready. They are rarely far away, but they are very good at staying invisible.
Offspring calling from a nest. Parent not present: Many animals deliberately avoid areas where their offspring are present. Such "hiding" behaviors reduce the chance of calling a predator's attention to the young. While you may not be able to see or hear a parent, it is likely nearby and in contact with its offspring. Feel free to observe the nest; see if the parent returns! If you still think the nest is "abandoned" you can place small sticks around it, without touching it. If after one day, the sticks have been disturbed, and the offspring still appear to be healthy, the nest has probably been visited by a parent.
Blown-down nest: If the nest is fairly undamaged, and the birds or eggs are unharmed, put it back into the tree, or into a nearby tree. Parents will continue to tend it. A damaged nest can be placed into a strawberry basket or something of a similar size and placed in a tree. You may need to secure the nest to the branch with twine. One common fallacy is that birds reject their young if they acquire a human scent. In fact, few bird species have well-developed senses of smell. Please avoid excessive handling anyway. Predators CAN be attracted to human scents as they search for food.
Grounded baby birds: Birds seen hopping on the ground "begging" for food DO NOT need your help. It is common for birds to fledge from the nest before they are fully feathered or ready to fly. They will eat on the ground for a day or two until they can fly. They may fly with a parent until they can forage on their own. If the bird on the ground is healthy, a parent is often attending it or foraging nearby. Careful observation can help you make a correct determination. If the bird is in a street, move it under a nearby bush. If you see dogs or cats, try to keep them away from the area. Never handle or move the fledgling from the area where it was found.
"Abandoned" fawns: it is common for people to see deer that look orphaned or abandoned. This is because mothers often leave their fawns "bedded down" while they are away foraging. If the fawn is not crying or covered with ants, and its eyes are not swollen, and it has no visible wounds, avoid disturbing it. You would only cause it stress.


Composing songs is not a big deal to Gipraise. God takes care of that for the up-and-coming gospel artiste. Each time He speaks to him, the Almighty has given Gideon Timah (his real names) a new track. That explains why in virtually all his songs, the Europe-based Cameroonian musician reflects the mind of God. If praising the Holy Father is his ultimate goal, reaching the world with His soothing message is even a more challenging responsibility which the singer seeks to meet. TIPTOPSTARS� Titus Banyoh has been talking with the 1.75m-tall Gipraise and seeking to know how he functions. Amongst other things, the praise singer tells us about his albums and the people he works with. Excerpts of the chat both men had!
Titus Banyoh (TB): Hello Gipraise, it is a pleasure having you on TIPTOPSTARS magazine.
Gipraise: Thanks too for thinking about me, the pleasure is equally mine.
Gipraise: I think it is an appropriate genre with which to reach out to the world.
TB: How long have you been into music?
TB: When you sing, what do you vehicle?
Gipraise: The mind of God. When I hear Him speak, I put it into music. That�s all.
TB: Any album so far?
Gipraise: Oh yes! I have one album in the market with seven tracks.
TB: Who writes your songs?
Gipraise: I do write and compose all my songs.
TB: What are some of your challenges as a gospel singer?
Gipraise: Getting a sponsor I must say.
TB: Who are some of the people you haveworked with and who do you intend to associate to your future projects?
Gipraise:I always work with Adolf Kumbaboy in Paris. It would be interesting to know that he is one of best guitarists Cameroon has. I have also worked with Ps.David Chucks from Nigeria. In the future, I will be working with Jeremy, a producer from East Africa.
TB: Any intensions for a new album soon?
TB: How do you intend to go about sales when you know there is a seemingly endless problem of piracy staring you in the face?
Gipraise: For now, I have a few people who are interested in handling sales but for piracy, I doubt. We live in a world of high tech which makes it impossible to apprehend piracy.
TB: What are your strong points as a gospel singer?
Gipraise: I�m not only a singer, I do play a few instruments. So, that gives me an extra boost in directing music as a whole. I�m a bass guitarist and I do play piano as well.
TB: Can you in a few words describe your rhythm?
Gipraise: I do a cross-rhythmic pattern from an African root, not very traditional but blended with European folklore and American Hip-Hop.
TB: What are the themes you exploit in your songs?
Gipraise: Life, courage, salvation, worship, creation, love, patience, peace, just to name a few.
TB: Who are your role models in the world of gospel music?
Gipraise: Micheal W. Smith and Uche.
TB: How did you come about the name Gipraise?
Gipraise: Hahahaha! I took the first two letters from my name and added Praise to it. If you pronounce it with the pidgin phonetics, the meaning will be something like give praise in English.
Gipraise: TIPTOPSTARS of course! Meanwhile, my website is still in the making.
TB: Thanks so much for talking to us.
Gipraise: It was my pleasure.


text:
Changed My Mind
The Depolarization Project
Changed My Mind is The Depolarization Project's podcast, hosted by Alex Chesterfield, Laura Osborne and Ali Goldsworthy. We ask guests to tell us a substantive issue they have changed their mind on, why and what they have learned from it. We work with global media outlet Open Democracy to bring this podcast to you. read less
Accepting American democracy was in mortal danger, with Cass Sunstein
World-renowned behavioural economist Cass Sunstein on why dismissing his friends' fears about democracy being at risk in the US was wrong.
Changing your mind on the Iraq War with Ed Owen
Former advisor to the Foreign Secretary at the time of the Iraq War, Ed Owen, on why he now feels differently about the decision to go to war in Iraq.
Realising America's Criminal Justice System Was Broken with Jordan Blashek and Chris Haugh
The Authors of Union: a Search for Common Ground on how an American road trip woke them up to the failings in the criminal justice system and the limitations of beloved media outlets.
Danny Finkelstein on Changing Political Allies
Danny Finkelstein, associate editor of the Times and Conservative peer, talks to us about why being able to clearly see both sides of an argument is important but can also feel debilitating in a world that craves certainty. He shares his lessons from switching parties and why it is critical to reduce the cost of people changing their minds.
Peter Geoghegan on Unaccountability and Returning Home
Peter Geoghegan, author of Democracy for Sale and investigative journalist, left Ireland as a young man desperate to get away but has returned in lockdown to find a country much changed. He tells us why, from his childhood bedroom, and explains the need to dig deeper into unaccountable money in politics, in the UK as well as the US.
Getting Less Liberal About Prostitution with Helen Lewis
Helen Lewis, a journalist at the Atlantic and author of Difficult Women: the History of Feminism in 11 Fights, talks about how she came to question her previous liberal beliefs on prostitution, a former Labour MP who cried after receiving an apology for being deselected when she came out in the 70s, the limits of unconscious bias training, and more.
Deciding That People Should Have a Platform with Kajal Odedra
The Director of Change.org in the UK Kajal Odedra talks about realising no platforming tended to backfire, her changing relationship with her own identity and how Change.org's supporters come from a much broader base than most people imagine.
Conflicting Identities with Jamie Susskind
Author of Future Politics, Jamie Susskind, left the Labour Party after 10 years of activism due to antisemitism. He tells us what happened, why he is on the cusp of going back and what politicians need to think about now to prepare for the tech of the future.
On Realising Mainstreaming Is Not Enough with Derek Bardowell
Author Derek Bardowell used to think mainstreaming would be enough to tackle racism. Over decades over work he's realise that on it's own, it is far from enough.
Becoming Friends With Your Arch Enemy with Leah Garces
When Leah Garces sat opposite Craig Watts in his living room it was an unlikely occurrence. Leah, a vegan and CEO at Mercy for Animals, did not expect to have much in common with the factory farmer she had spent years campaigning against. Yet, she and Watts were to become unexpected allies in the fight to improve animal welfare. She tells us how that happened, why she changed her mind about people and what her Trump supporting family taught her.
Leaving Al-Qaeda with Aimen Dean and Thomas Small
Aimen Dean was a bombmaker for Al-Qaeda before leaving to become an MI6 informant. He and the Middle East expert Thomas Small join us to explore why and what we can learn from a 14th century Muslim scholar.
Joseph Marks on positive discrimination
Social psychologist, rising star at UCL & MIT, and author of new book Messengers on why he's changed his mind (several times) on positive discrimination. Plus, learn why the messenger is now the message and what you can do (and should NOT do) to be heard.
Sonia Sodha on disagreeing with her younger self about student funding
Chief Leader writer at The Observer and The Guardian, Sonia Sodha was very active in the campaign to make higher education free. Fifteen years on, she has changed her mind. We talk about why, what her 20 year old self would make of it and the role of the media in polarization.
Flattery and leadership with Jeff Pfeffer
Jeff Pfeffer once wrote that leaders often made little difference to a company, now he thinks they can. We talk about why telling people to be authentic is terrible advice and how flattery helps change people's minds with one of the world's leading management thinkers.
Admitting you got it all wrong about online education with Prof Sarah Soule
Stanford Professor and expert in protest movements on how she performed a total u-turn on the value of online learning. From thinking it was never going to work to leading courses and persuading colleagues to join in. With such a strong background in protest we also talked to her about when they work, why and how in 2019 our political polarization problems are playing out so very differently.
Hanging like a bat with Carwyn Jones
Carwyn Jones, the former First Minister of Wales talks leadership, why he switched his position to be in favour of another referendum on the UK's membership of the EU and what chastisement of children is reasonable.
You don't always need to be nice with Prof Maggie Neale
World renowned negotiations expert Stanford's Professor Maggie Neale talks about becoming comfortable with conflict, learning that you don't always need to be nice and the importance of owning a dog.
Nandos, teaching and the limits of capitalism with Dr Marcia Chatelain
Georgetown University's Dr Marcia Chatelain takes it to a meta level with us. We talk about her work looking at the relationship between race and fast food in the States, why people don't own up to mistakes and how she has changed her mind on capitalism.
Changing your behaviour is easier than changing your mind with Steve Martin
When are people more likely to change their minds? Steve Martin, one of the world's leading experts on behaviour change and persuasion talks about the limitations of information in influencing people.
Getting women into politics
Former UK Government Minister Jo Swinson MP talks about gradually changing her mind on how to get more women into politics, the experiences and gentle persuasion that achieved it, and the times former colleagues in Government surprised her.


Blog that aggregates online information about mobile technology related to fleets, public safety and transit.
Weeks after OC Transpo enlisted spies to monitor its drivers, the transit company is poised to spend $250,000 to equip 265 of its buses with cameras that will watch over them -- and passengers -- in a bid to improve safety and boost ridership.
If the six-month pilot project is a success, OC Transpo will spend $750,000 more to equip all buses with cameras by next year.
Cameras will be installed early next year over the rearview mirrors of test buses. They will automatically capture audio and video when drivers brake hard, swerve or speed up rapidly, or if the buses are involved in accidents. Drivers will also be able to activate the cameras manually should they want to record an incident. The digital recording system allows events leading to, during and after incidents to be saved.
OC Transpo boss Alain Mercier told councillors that he expects the cameras will improve the service, based on experiences in several other cities that use cameras.
"The data is clear that we should see some benefits from this," he said.
A survey last spring found the citizen satisfaction rating for transit among the lowest of 20 services the city provides, and transit officials are hoping that better driving and more courteous service will get more people to use public transit and increase rider satisfaction.
In a report on the project to city councillors on the municipality's transit committee, city staff say studies show the systems reduce risky driving habits because the drivers know they are being watched and tend to concentrate harder on the task at hand so they won't trigger the recording systems.
The studies show accidents drop on average 38 per cent and vehicle damage, personal injury and workers' compensation claims drop 25 per cent. Accident claims costs also drop dramatically because the cameras often show drivers aren't at fault.
The studies say drivers tend to operate buses more smoothly and safely when the cameras are on board even though they know the cameras aren't recording all the time.
Another benefit of this system is that it's one-tenth the cost of closed-circuit television systems that constantly monitor the buses, which were being considered by transit officials before the alternative system was found.
City council set aside $500,000 last year to get cameras on some buses.
Members of the Amalgamated Transit Union Local 279, which represents OC Transpo drivers, mechanics and others, were consulted by company officials.
Calls to the union weren't returned yesterday, but the city staff report says the union is of two minds on the issue. The report says the union supports putting the cameras on the buses because it feels the system will increase the safety of the drivers.
At the same time, however, the report says the union wants assurances that the recordings "will not be used in disciplinary matters."
Mr. Mercier said the purpose of the cameras is to get drivers to operate their vehicles better and to increase their safety, not to monitor drivers and use the information against them.
"Any data we have as part of our operations is available for us to use in that manner," he said.
"It's not the purpose, the purpose is to protect drivers, and we aren't going to use this as a baseball bat, but if a situation arises that demands we use it, we can."
At Hurdman Station yesterday, Mohammad Ghaderi, who has been driving for OC Transpo for almost a decade, said he supports the move.
"The operators can benefit because safety matters and society can benefit because they will feel safe in the back of the bus if there are cameras," he said. "Having the cameras will eliminate any violence on the bus."
Some riders also said they thought the cameras would make buses safer for everyone.
"I think it would be a good idea because some of the routes like the No. 2, the 97, sometimes it gets a little rowdy and a little scary, not only for us but it would also be safer for the drivers," said 42-year-old Chantal Houle.
Safety on buses has been a high-profile issue since last September, when 23-year-old Michael Oatway was stabbed to death on the Route 118 bus after a group of youths demanded he hand over his iPod. After that incident, 10 video cameras were placed on certain bus routes as part of a pilot project.
His death also prompted the drivers' union to demand video cameras on all buses, a Plexiglas barrier to protect drivers and bus marshals to enhance security.
Other riders said safety wasn't the only thing that would improve if the drivers are monitored.
"Sometimes the drivers are crazy, they hit the gas and someone goes flying," said Jonathon Gillan, 26.
This the second time in a few months OC Transpo officials have employed a monitoring program in order to get drivers to do their jobs better. In the early fall, the company hired spies to ride buses to check whether drivers were calling out stops in accordance with its policy.
At the time, Mr. Mercier let it be known that the "silent shoppers" were riding buses at all times of the day and on weekends recording drivers' performance.
He said if drivers were caught not calling stops, there would be increasing levels of discipline up to dismissal.
This program appears to be working. The company reported recently that more and more drivers are complying with the policy of calling out stops.
Steve has worked with public safety, private fleets and public transportation officials domestically and internationally. He is a author and speaker on vehicle-based applications and active participant on national committees for recommended practices. ----- All opinions are my own.
Advanced Fleet Telematics including fuel management, engine diagnostics, reporting, alerting, and GPS vehicle tracking, dispatch, mapping and telematics.
This blog is an aggregation of internet-posted information. The news, views, information, links and postings do not necessarily reflect the views of blog manager, his customers or his employer".


SHIP seeks to maintain accurate information whenever possible but reserves the right to modify information, policies and figures as it deems necessary to accommodate the complex and dynamic nature of such a development project. SHIP seeks to provide the best value for the community and tenants while at the same time meeting financial and operating mandates shared by all stakeholders involved.
1. How will the units be assigned? Units will be assigned on a first come, first served basis, considering tenant meet all expected requirements.
2. Will people who currently live in subsidized housing elsewhere have a priority to live in Hansen subsidized units? The Region of Peel is responsible for subsidized units. Please call Peel Access To Housing at (905) 453-1300 or visit www.peelregion.ca/housing/social.
3. What will be the fee for extra storage? No extra storage will be offered.
4. What utilities are extra over and above rent? Hydro, cable TV, phone, and the internet.
5. How does parking work? Costs? Locations? Only underground Parking space rental is available to tenants on a first come first served basis. A family that has two cars will only be offered a second space IF there is availability.
6. Will washing machines be allowed in units for those who do not wish to use the laundry room? Unfortunately, we cannot accommodate washing machines in the apartment units.
7. Will pets be allowed? Yes, pets are allowed. The tenants must agree that as pet owners, they will be fully responsible and liable for all damages caused by pets. To ensure the safety and happiness of all Hansen tenants, larger dogs are discouraged.
8. Will there be central A/C? Yes, each tenant will have the freedom to control their heating and cooling as needed.
9. Is tenant insurance mandatory? Yes, all tenants are required to have tenant insurance before taking possession of their unit.