text:
copyright:
  years: 2015, 2016

lastupdated: "2016-08-18"

---

{:tsSymptoms: .tsSymptoms}
{:tsCauses: .tsCauses}
{:tsResolve: .tsResolve}
{:new_window: target="_blank"}
{:shortdesc: .shortdesc}
{:codeblock: .codeblock}

# Resolução de problemas para gerenciamento de contas
{: #managingaccounts}

Você pode ter problemas ao gerenciar sua conta, como apps diferentes compartilham o mesmo nome de domínio e administradores não podem visualizar todas as organizações. No entanto, em vários casos, é possível recuperar-se desses
problemas seguindo algumas etapas simples.
{:shortdesc}

## A conta está inativa
{: #ts_accnt_inactive}

Não é possível criar um app no {{site.data.keyword.Bluemix_notm}} se a sua conta estiver inativa. Deve-se entrar em contato com a equipe de suporte para corrigir esse problema.

Ao tentar criar um app no {{site.data.keyword.Bluemix_notm}}, você vê a mensagem de erro a seguir:
{: tsSymptoms}

`BXNUI0096E: O app não foi criado. Sua conta está inativa porque ela foi cancelada
ou suspensa.`

O status de sua conta do {{site.data.keyword.Bluemix_notm}} torna-se inativo quando a conta é cancelada ou suspensa.
{: tsCauses}

Para reativar sua conta, entre em contato com o [Suporte {{site.data.keyword.Bluemix_notm}}](http://ibm.biz/bluemixsupport.com){: new_window}. No email, deve-se incluir as informações a seguir:
{: tsResolve}

  * O ID IBM que você usa para efetuar login no {{site.data.keyword.Bluemix_notm}}.
  * O nome da organização em que seu app está sendo criado. Essas informações podem ajudar a equipe de suporte a determinar se você está designado às funções ou associação corretas em sua organização.

## Nenhum espaço está associado com a sua organização atual
{: #ts_no_space}

Não será possível criar um aplicativo se não houver espaço
associado à sua organização atual.

Ao tentar criar um app no {{site.data.keyword.Bluemix_notm}}, você vê a mensagem de erro a seguir:
{: tsSymptoms}

`BXNUI0097E: Para que seja possível incluir um app, pelo menos um espaço deve estar associado à sua organização e região. No Painel, clique em Criar um espaço. Quando o espaço for criado, tente novamente. `

Os apps no {{site.data.keyword.Bluemix_notm}} devem ser criados dentro de um espaço em sua organização.
{: tsCauses}

Para criar um espaço, use um dos métodos a seguir:
{: tsResolve}

  * No Painel do {{site.data.keyword.Bluemix_notm}}, selecione a organização em que você deseja criar o espaço, em seguida, clique em **Criar um espaço**.
  * Na interface de linha de comandos cf, digite `cf create-space <space_name> -o <organization_name>`.

## Os apps compartilham o mesmo nome de domínio
{: #ts_domain_diff}

Você pode observar que diversos aplicativos compartilham a mesma
URL em {{site.data.keyword.Bluemix_notm}}.

Esse problema pode ocorrer quando você designa a mesma
rota de URL para diferentes aplicativos dentro de um espaço.
{: tsCauses}

Por exemplo, você envia por push o aplicativo myApp1 para o {{site.data.keyword.Bluemix_notm}} e configura o domínio como "mynewapp.stage1.mybluemix.net". Em seguida, você envia por push outro aplicativo myApp2 para o mesmo espaço e configura uma de suas rotas de URL como "mynewapp.stage1.mybluemix.net". A rota agora é mapeada para ambos os aplicativos.

Esse é o comportamento suportado do {{site.data.keyword.Bluemix_notm}} e
é possível usar essa prática para atingir o tempo de inatividade zero para o upgrade de seu
aplicativo. Para obter mais informações, veja Implementações azul-verde.
{: tsResolve}

<!-- begin STAGING ONLY -->

## Os administradores não podem visualizar todas as organizações usando a interface com o usuário do {{site.data.keyword.Bluemix_notm}}
{: #ts_ui_org}

Como administrador, quando você utiliza a interface com o usuário do
{{site.data.keyword.Bluemix_notm}}, não é possível exibir cada organização para
administrá-las. Você pode exibir e administrar apenas as organizações às quais pertence.

Como administrador, não é possível ver todas as organizações utilizando a interface com o usuário do {{site.data.keyword.Bluemix_notm}}.
{: tsSymptoms}

Essa é uma limitação da interface com o usuário do {{site.data.keyword.Bluemix_notm}}.
{: tsCauses}

É possível usar o comando, como `cf orgs`, `cf
create-org` e `cf delete-org`, a partir da interface de linha
de comandos cf para gerenciar todas as organizações. Para obter uma lista completa de
comandos cf, insira `cf help`.
{: tsResolve}

<!-- end STAGING ONLY -->

## O cartão de crédito não pode ser incluído
{: #ts_addcc}

Não é possível enviar suas informações de cartão de crédito para converter
sua conta para teste em uma conta Pré-pago.

O botão Enviar na página Incluir cartão de crédito está desativado.
{: tsSymptoms}

Esse problema ocorre quando suas informações não são preenchidas corretamente na página Incluir cartão de crédito.
{: tsCauses}

Conclua as etapas a seguir para resolver esse problema:
{: tsResolve}

  1. Na página Incluir cartão de crédito, preencha todos os campos obrigatórios nas seções de informações de contato, endereço de contato e endereço para cobrança.
  2. Selecione **Eu li e concordo com os Termos e Condições da IBM**,
em seguida, clique em **Enviar**. A seção **Selecionar um método de pagamento** é exibida.
  3. Insira seu número do cartão de crédito, a data de expiração de seu cartão
e o código de segurança que está em seu cartão. Em seguida,
clique em **Enviar**.


text:
package org.apache.camel.util;

import java.util.Properties;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
 *
 */
public class DumpModelAsXmlChoiceFilterRoutePropertyPlaceholderTest extends ContextTestSupport {

    @Test
    public void testDumpModelAsXml() throws Exception {
        ExtendedCamelContext ecc = context.adapt(ExtendedCamelContext.class);
        String xml = ecc.getModelToXMLDumper().dumpModelAsXml(context, context.getRouteDefinition("myRoute"));
        assertNotNull(xml);
        log.info(xml);

        assertTrue(xml.contains("{{duke}}"));
        assertTrue(xml.contains("{{best}}"));
        assertTrue(xml.contains("{{extra}}"));
        assertTrue(xml.contains("<simple>${body} contains 'Camel'</simple>"));
    }

    @Test
    public void testDumpModelAsXmAl() throws Exception {
        ExtendedCamelContext ecc = context.adapt(ExtendedCamelContext.class);
        String xml = ecc.getModelToXMLDumper().dumpModelAsXml(context, context.getRouteDefinition("a"));
        assertNotNull(xml);
        log.info(xml);

        assertTrue(xml.contains("message=\"{{mypath}}\""));
        assertTrue(xml.contains("<constant>bar</constant>"));
        assertTrue(xml.contains("<expressionDefinition>header{test} is not null</expressionDefinition>"));
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                Properties prop = new Properties();
                prop.put("duke", "dude");
                prop.put("best", "gold");
                prop.put("extra", "extra-gold");
                prop.put("mypath", "xpath");

                context.getPropertiesComponent().setInitialProperties(prop);

                from("direct:start").routeId("myRoute").to("log:input").transform().header("{{duke}}").choice().when()
                        .header("{{best}}").to("mock:gold").filter()
                        .header("{{extra}}").to("mock:extra-gold").endChoice().when().simple("${body} contains 'Camel'")
                        .to("mock:camel").otherwise().to("mock:other").end()
                        .to("mock:result");

                from("seda:a").routeId("a").setProperty("foo").constant("bar").choice().when(header("test").isNotNull())
                        .log("not null").when(xpath("/foo/bar")).log("{{mypath}}")
                        .end().to("mock:a");
            }
        };
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 *    @file
 *      This file declares test entry points for CHIP Internet (inet)
 *      layer library unit tests.
 *
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

int TestInetAddress(void);
int TestInetBuffer(void);
int TestInetErrorStr(void);
int TestInetTimer(void);
int TestInetEndPoint(void);
int TestInetLayerDNS(void);
#ifdef __cplusplus
}
#endif


text:
module.exports = {
	useTabs: true,
	tabWidth: 4,
	printWidth: 80,
	singleQuote: true,
	trailingComma: 'es5',
	bracketSpacing: true,
	parenSpacing: true,
	jsxBracketSameLine: false,
	semi: true,
	arrowParens: 'always',
};


text:
package com.haulmont.cuba.desktop.sys;

import com.haulmont.cuba.desktop.gui.components.DesktopComponentsHelper;

import javax.annotation.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * Dialog that can be enabled/disabled like the main frame.
 *
Used by {@link DesktopWindowManager} to show windows in DIALOG mode.

 *
 */
public class DialogWindow extends JDialog {

    protected DisabledGlassPane glassPane;
    protected Integer fixedHeight;
    protected Integer fixedWidth;

    protected boolean softModal;

    public DialogWindow(Frame frame, String title) {
        super(frame, title, false);
        glassPane = new DisabledGlassPane();
        JRootPane rootPane = SwingUtilities.getRootPane(this);
        rootPane.setGlassPane(glassPane);

        addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);

                DesktopComponentsHelper.flushCurrentInputField();
            }
        });
    }

    public void disableWindow(@Nullable String message) {
        glassPane.activate(message);
    }

    public void enableWindow() {
        glassPane.deactivate();
        requestFocus();
        toFront();
    }

    public Integer getFixedHeight() {
        return fixedHeight;
    }

    public Integer getFixedWidth() {
        return fixedWidth;
    }

    @Override
    public Dimension getPreferredSize() {
        if (fixedHeight != null && fixedWidth != null) {
            // dialog does not grow
            return new Dimension(fixedWidth, fixedHeight);
        }

        if (fixedWidth != null) {
            // dialog does not grow by horizontal axis
            return new Dimension(fixedWidth, super.getPreferredSize().height);
        }

        if (fixedHeight != null) {
            // dialog does not grow by vertical axis
            return new Dimension(super.getPreferredSize().width, fixedHeight);
        }

        return super.getPreferredSize();
    }

    public void setFixedWidth(Integer fixedWidth) {
        this.fixedWidth = fixedWidth;
    }

    public void setFixedHeight(Integer fixedHeight) {
        this.fixedHeight = fixedHeight;
    }

    public boolean isSoftModal() {
        return softModal;
    }

    public void setSoftModal(boolean softModal) {
        this.softModal = softModal;
    }
}


text:
namespace arangodb {
class ClientFeature;

namespace application_features {
class ApplicationServer;
}

namespace httpclient {
class GeneralClientConnection;
class SimpleHttpClient;
class SimpleHttpResult;
}  // namespace httpclient

namespace fuerte {
inline namespace v1 { class Connection; }
}  // namespace fuerte

////////////////////////////////////////////////////////////////////////////////
/// @brief class for http requests
////////////////////////////////////////////////////////////////////////////////

class V8ClientConnection {
  V8ClientConnection(V8ClientConnection const&) = delete;
  V8ClientConnection& operator=(V8ClientConnection const&) = delete;

 public:
  explicit V8ClientConnection(application_features::ApplicationServer&, ClientFeature&);
  ~V8ClientConnection();

  void setInterrupted(bool interrupted);
  bool isConnected() const;

  void connect();
  void reconnect();

  double timeout() const;

  void timeout(double value);

  std::string protocol() const;

  std::string const& databaseName() const { return _databaseName; }
  void setDatabaseName(std::string const& value);
  void setForceJson(bool value) { _forceJson = value; };
  std::string username() const { return _builder.user(); }
  std::string password() const { return _builder.password(); }
  int lastHttpReturnCode() const { return _lastHttpReturnCode; }
  std::string lastErrorMessage() const { return _lastErrorMessage; }
  std::string const& version() const { return _version; }
  std::string const& mode() const { return _mode; }
  std::string const& role() const { return _role; }
  std::string endpointSpecification() const;

  application_features::ApplicationServer& server();

  v8::Handle<v8::Value> getData(v8::Isolate* isolate, arangodb::velocypack::StringRef const& location,
                                std::unordered_map<std::string, std::string> const& headerFields,
                                bool raw);

  v8::Handle<v8::Value> headData(v8::Isolate* isolate, arangodb::velocypack::StringRef const& location,
                                 std::unordered_map<std::string, std::string> const& headerFields,
                                 bool raw);

  v8::Handle<v8::Value> deleteData(v8::Isolate* isolate, arangodb::velocypack::StringRef const& location,
                                   v8::Local<v8::Value> const& body,
                                   std::unordered_map<std::string, std::string> const& headerFields,
                                   bool raw);

  v8::Handle<v8::Value> optionsData(v8::Isolate* isolate, arangodb::velocypack::StringRef const& location,
                                    v8::Local<v8::Value> const& body,
                                    std::unordered_map<std::string, std::string> const& headerFields,
                                    bool raw);

  v8::Handle<v8::Value> postData(v8::Isolate* isolate, arangodb::velocypack::StringRef const& location,
                                 v8::Local<v8::Value> const& body,
                                 std::unordered_map<std::string, std::string> const& headerFields,
                                 bool raw = false, bool isFile = false);

  v8::Handle<v8::Value> putData(v8::Isolate* isolate, arangodb::velocypack::StringRef const& location,
                                v8::Local<v8::Value> const& body,
                                std::unordered_map<std::string, std::string> const& headerFields,
                                bool raw);

  v8::Handle<v8::Value> patchData(v8::Isolate* isolate, arangodb::velocypack::StringRef const& location,
                                  v8::Local<v8::Value> const& body,
                                  std::unordered_map<std::string, std::string> const& headerFields,
                                  bool raw);

  void initServer(v8::Isolate*, v8::Handle<v8::Context> context);

 private:
  std::shared_ptr<fuerte::Connection> createConnection();
  std::shared_ptr<fuerte::Connection> acquireConnection();

  v8::Local<v8::Value> requestData(v8::Isolate* isolate, fuerte::RestVerb verb,
                                   arangodb::velocypack::StringRef const& location,
                                   v8::Local<v8::Value> const& body,
                                   std::unordered_map<std::string, std::string> const& headerFields,
                                   bool isFile = false);

  v8::Local<v8::Value> requestDataRaw(v8::Isolate* isolate, fuerte::RestVerb verb,
                                      arangodb::velocypack::StringRef const& location,
                                      v8::Local<v8::Value> const& body,
                                      std::unordered_map<std::string, std::string> const& headerFields);

  v8::Local<v8::Value> handleResult(v8::Isolate* isolate,
                                    std::unique_ptr<fuerte::Response> response,
                                    fuerte::Error ec);

  /// @brief shuts down the connection _connection and resets the pointer
  /// to a nullptr
  void shutdownConnection();

  void setCustomError(int httpCode, std::string const& msg) {
    _setCustomError = true;
    _lastHttpReturnCode = httpCode;
    _lastErrorMessage = msg;
  }

 private:
  application_features::ApplicationServer& _server;
  ClientFeature& _client;

  std::string _databaseName;
  std::chrono::duration<double> _requestTimeout;

  mutable std::recursive_mutex _lock;
  unsigned _lastHttpReturnCode;
  std::string _lastErrorMessage;
  std::string _version;
  std::string _mode;
  std::string _role;

  fuerte::EventLoopService _loop;
  fuerte::ConnectionBuilder _builder;
  std::shared_ptr<fuerte::Connection> _connection;
  velocypack::Options _vpackOptions;
  bool _forceJson;
  std::atomic<bool> _setCustomError;

  // a per-endpoint, per-user cache for connections. whenever we reconnect
  // to another endpoint, we can put the old connection into this cache,
  // and recycle it later. the goal is to not use too many separate connections
  // and ephemeral ports for patterns such as "connect-to-leader" -> "connect-to-follower"
  // -> "connect-to-leader" etc.
  std::unordered_map<std::string, std::shared_ptr<fuerte::Connection>> _connectionCache;
};
}  // namespace arangodb


text:
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SkyAppTestUtility, expect } from '@skyux-sdk/testing';
import {
  SkyTheme,
  SkyThemeMode,
  SkyThemeService,
  SkyThemeSettingsChange,
} from '@skyux/theme';

import { AgGridAngular } from 'ag-grid-angular';
import {
  CellEditingStartedEvent,
  CellEditingStoppedEvent,
  Column,
  ColumnApi,
  DetailGridInfo,
  FirstDataRenderedEvent,
  GridApi,
  GridReadyEvent,
  RowDataUpdatedEvent,
} from 'ag-grid-community';
import { BehaviorSubject, Subject } from 'rxjs';

import { SkyAgGridAdapterService } from './ag-grid-adapter.service';
import { SkyAgGridWrapperComponent } from './ag-grid-wrapper.component';
import {
  EnableTopScroll,
  SkyAgGridFixtureComponent,
} from './fixtures/ag-grid.component.fixture';
import { SkyAgGridFixtureModule } from './fixtures/ag-grid.module.fixture';
import { SecondInlineHelpComponent } from './fixtures/inline-help.component';

describe('SkyAgGridWrapperComponent', () => {
  let gridAdapterService: SkyAgGridAdapterService;
  let gridWrapperFixture: ComponentFixture<SkyAgGridWrapperComponent>;
  let gridWrapperComponent: SkyAgGridWrapperComponent;
  let gridWrapperNativeElement: HTMLElement;
  let mockThemeSvc: {
    settingsChange: BehaviorSubject<SkyThemeSettingsChange>;
  };

  const agGrid = {
    api: new GridApi(),
    columnApi: new ColumnApi(),
    gridReady: new Subject<GridReadyEvent>(),
    rowDataUpdated: new Subject<RowDataUpdatedEvent>(),
    firstDataRendered: new Subject<FirstDataRenderedEvent>(),
    cellEditingStarted: new Subject<CellEditingStartedEvent>(),
    cellEditingStopped: new Subject<CellEditingStartedEvent>(),
  } as unknown as AgGridAngular;

  beforeEach(() => {
    mockThemeSvc = {
      settingsChange: new BehaviorSubject<SkyThemeSettingsChange>({
        currentSettings: {
          theme: SkyTheme.presets.default,
          mode: SkyThemeMode.presets.light,
        },
        previousSettings: undefined,
      }),
    };
    TestBed.configureTestingModule({
      imports: [SkyAgGridFixtureModule],
      providers: [
        {
          provide: SkyThemeService,
          useValue: mockThemeSvc,
        },
      ],
    });

    gridWrapperFixture = TestBed.createComponent(SkyAgGridWrapperComponent);
    gridAdapterService = TestBed.inject(SkyAgGridAdapterService);
    gridWrapperComponent = gridWrapperFixture.componentInstance;
    gridWrapperNativeElement = gridWrapperFixture.nativeElement;
    gridWrapperComponent.agGrid = agGrid;

    gridWrapperFixture.detectChanges();
  });

  it('should render a sky-ag-grid-wrapper element', () => {
    expect(gridWrapperNativeElement).toBeVisible();
  });

  it('should add .ag-header to the viewkeeper classes when the domLayout is set to autoHeight', () => {
    agGrid.gridOptions = { domLayout: 'autoHeight' };

    const autoHeightGridWrapperFixture = TestBed.createComponent(
      SkyAgGridWrapperComponent
    );
    const autoHeightGridWrapperComponent =
      autoHeightGridWrapperFixture.componentInstance;
    autoHeightGridWrapperComponent.agGrid = agGrid;

    autoHeightGridWrapperFixture.detectChanges();

    expect(
      autoHeightGridWrapperComponent.viewkeeperClasses.indexOf('.ag-header')
    ).not.toEqual(-1);
  });

  it('should apply ag-theme', async () => {
    spyOn(agGrid.api, 'setHeaderHeight').and.returnValue(undefined);
    spyOn(agGrid.api, 'resetRowHeights').and.returnValue(undefined);
    spyOn(agGrid.api, 'refreshCells').and.returnValue(undefined);
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).toHaveCssClass('ag-theme-sky-default');

    mockThemeSvc.settingsChange.next({
      currentSettings: {
        theme: SkyTheme.presets.modern,
        mode: SkyThemeMode.presets.light,
      },
      previousSettings: undefined,
    });
    gridWrapperFixture.detectChanges();
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).toHaveCssClass('ag-theme-sky-modern-light');

    mockThemeSvc.settingsChange.next({
      currentSettings: {
        theme: SkyTheme.presets.modern,
        mode: SkyThemeMode.presets.dark,
      },
      previousSettings: undefined,
    });
    gridWrapperFixture.detectChanges();
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).toHaveCssClass('ag-theme-sky-modern-dark');

    mockThemeSvc.settingsChange.next({
      currentSettings: {
        theme: SkyTheme.presets.default,
        mode: SkyThemeMode.presets.light,
      },
      previousSettings: undefined,
    });
    gridWrapperFixture.detectChanges();
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).toHaveCssClass('ag-theme-sky-default');
  });

  it('should add and remove the cell editing class', () => {
    agGrid.cellEditingStarted.next({ colDef: {} } as CellEditingStartedEvent);
    agGrid.cellEditingStopped.next({} as CellEditingStoppedEvent);
    agGrid.cellEditingStarted.next({
      colDef: {
        type: 'test',
      },
    } as CellEditingStartedEvent);
    gridWrapperFixture.detectChanges();
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).toHaveCssClass('sky-ag-grid-cell-editing-test');
    agGrid.cellEditingStopped.next({} as CellEditingStoppedEvent);
    gridWrapperFixture.detectChanges();
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).not.toHaveCssClass('sky-ag-grid-cell-editing-test');
    agGrid.cellEditingStarted.next({
      colDef: {
        type: ['test'],
      },
    } as CellEditingStartedEvent);
    gridWrapperFixture.detectChanges();
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).toHaveCssClass('sky-ag-grid-cell-editing-test');
    agGrid.cellEditingStopped.next({} as CellEditingStoppedEvent);
    gridWrapperFixture.detectChanges();
    expect(
      gridWrapperNativeElement.querySelector('.sky-ag-grid')
    ).not.toHaveCssClass('sky-ag-grid-cell-editing-test');
  });

  describe('onGridKeydown', () => {
    let skyAgGridDivEl: HTMLElement;
    beforeEach(() => {
      skyAgGridDivEl = gridWrapperNativeElement.querySelector(
        `#${gridWrapperComponent.gridId}`
      ) as HTMLElement;
    });

    function fireKeydownOnGrid(key: string, shiftKey: boolean): void {
      SkyAppTestUtility.fireDomEvent(skyAgGridDivEl, 'keydown', {
        keyboardEventInit: {
          key,
          shiftKey,
        },
      });

      gridWrapperFixture.detectChanges();
    }

    it('should not move focus when tab is pressed but cells are being edited', () => {
      const col = {} as Column;
      spyOn(gridAdapterService, 'setFocusedElementById');
      spyOn(agGrid.api, 'getEditingCells').and.returnValue([
        { rowIndex: 0, column: col, rowPinned: undefined },
      ]);

      fireKeydownOnGrid('Tab', false);

      expect(gridAdapterService.setFocusedElementById).not.toHaveBeenCalled();
    });

    it('should not move focus when tab is pressed but master/detail cells are being edited', () => {
      const col = {} as Column;
      spyOn(gridAdapterService, 'setFocusedElementById');
      spyOn(agGrid.api, 'getEditingCells').and.returnValue([]);
      spyOn(agGrid.api, 'forEachDetailGridInfo').and.callFake((fn) => {
        fn(
          {
            api: {
              getEditingCells: (): any[] => {
                return [{ rowIndex: 0, column: col, rowPinned: '' }];
              },
            } as GridApi,
          } as DetailGridInfo,
          0
        );
      });

      fireKeydownOnGrid('Tab', false);

      expect(gridAdapterService.setFocusedElementById).not.toHaveBeenCalled();
    });

    it('should not move focus when a non-tab key is pressed', () => {
      spyOn(gridAdapterService, 'setFocusedElementById');
      spyOn(agGrid.api, 'getEditingCells').and.returnValue([]);

      fireKeydownOnGrid('L', false);

      expect(gridAdapterService.setFocusedElementById).not.toHaveBeenCalled();
    });

    it(`should move focus to the anchor after the grid when tab is pressed, no cells are being edited,
      and the grid was previously focused`, () => {
      spyOn(agGrid.api, 'getEditingCells').and.returnValue([]);
      spyOn(agGrid.api, 'forEachDetailGridInfo').and.callFake((fn) => {
        fn(
          {
            api: {
              getEditingCells: (): any[] => {
                return [];
              },
            } as GridApi,
          } as DetailGridInfo,
          0
        );
      });
      spyOn(gridAdapterService, 'getFocusedElement').and.returnValue(
        skyAgGridDivEl
      );
      spyOn(gridAdapterService, 'setFocusedElementById');

      fireKeydownOnGrid('Tab', false);

      expect(gridAdapterService.setFocusedElementById).toHaveBeenCalledWith(
        gridWrapperNativeElement,
        gridWrapperComponent.afterAnchorId
      );
    });

    it(`should move focus to the anchor before the grid when shift + tab is pressed, no cells are being edited,
      and the grid was previous focused`, () => {
      spyOn(agGrid.api, 'getEditingCells').and.returnValue([]);
      spyOn(gridAdapterService, 'getFocusedElement').and.returnValue(
        skyAgGridDivEl
      );
      spyOn(gridAdapterService, 'setFocusedElementById');

      fireKeydownOnGrid('Tab', true);

      expect(gridAdapterService.setFocusedElementById).toHaveBeenCalledWith(
        gridWrapperNativeElement,
        gridWrapperComponent.beforeAnchorId
      );
    });
  });

  describe('onKeyUpEscape', () => {
    let skyAgGridDivEl: HTMLElement;
    beforeEach(() => {
      skyAgGridDivEl = gridWrapperNativeElement.querySelector(
        `#${gridWrapperComponent.gridId}`
      ) as HTMLElement;
    });

    function fireKeyupEscape(): void {
      SkyAppTestUtility.fireDomEvent(skyAgGridDivEl, 'keyup', {
        keyboardEventInit: {
          key: 'Escape',
        },
      });
      gridWrapperFixture.detectChanges();
    }

    it('should not move focus when tab is pressed but cells are being edited', () => {
      spyOn(agGrid.api, 'stopEditing');
      fireKeyupEscape();
      expect(agGrid.api.stopEditing).toHaveBeenCalled();
    });
  });

  describe('onAnchorFocus', () => {
    function focusOnAnchor(
      anchorEl: HTMLElement,
      previousFocusedEl: HTMLElement
    ): void {
      SkyAppTestUtility.fireDomEvent(anchorEl, 'focusin', {
        customEventInit: {
          relatedTarget: previousFocusedEl,
        },
      });

      gridWrapperFixture.detectChanges();
    }

    it('should shift focus to the first grid cell if it was not the previously focused element and there is a cell', () => {
      const afterAnchorEl = gridWrapperNativeElement.querySelector(
        `#${gridWrapperComponent.afterAnchorId}`
      ) as HTMLElement;
      const afterButtonEl = gridWrapperNativeElement.querySelector(
        '#button-after-grid'
      ) as HTMLElement;
      const column = new Column({}, {}, 'name', true);
      const rowIndex = 0;

      spyOn(agGrid.columnApi, 'getAllDisplayedColumns').and.returnValue([
        column,
      ]);
      spyOn(agGrid.api, 'getFirstDisplayedRow').and.returnValue(rowIndex);
      spyOn(agGrid.api, 'setFocusedCell');

      focusOnAnchor(afterAnchorEl, afterButtonEl);

      expect(agGrid.api.setFocusedCell).toHaveBeenCalledWith(rowIndex, column);
    });

    it('should not shift focus to the first grid cell if there is no cell', () => {
      const afterAnchorEl = gridWrapperNativeElement.querySelector(
        `#${gridWrapperComponent.afterAnchorId}`
      ) as HTMLElement;
      const afterButtonEl = gridWrapperNativeElement.querySelector(
        '#button-after-grid'
      ) as HTMLElement;
      const column = new Column({}, {}, 'name', true);

      spyOn(agGrid.columnApi, 'getAllDisplayedColumns').and.returnValue([
        column,
      ]);
      spyOn(agGrid.api, 'getFirstDisplayedRow');
      spyOn(agGrid.api, 'setFocusedCell');

      focusOnAnchor(afterAnchorEl, afterButtonEl);

      expect(agGrid.api.setFocusedCell).not.toHaveBeenCalled();
    });

    it('should not shift focus to the grid if it was the previously focused element', () => {
      const afterAnchorEl = gridWrapperNativeElement.querySelector(
        `#${gridWrapperComponent.afterAnchorId}`
      ) as HTMLElement;
      const gridEl = gridWrapperNativeElement.querySelector(
        `#${gridWrapperComponent.gridId}`
      ) as HTMLElement;
      spyOn(gridAdapterService, 'setFocusedElementById');

      focusOnAnchor(afterAnchorEl, gridEl);

      expect(gridAdapterService.setFocusedElementById).not.toHaveBeenCalled();
    });
  });
});

describe('SkyAgGridWrapperComponent via fixture', () => {
  let gridWrapperFixture: ComponentFixture<SkyAgGridFixtureComponent>;
  let gridWrapperNativeElement: HTMLElement;
  const getChildrenClassNames = () =>
    Array.from(
      gridWrapperNativeElement.querySelector('.ag-root')?.children || []
    ).map((el) => el.classList[0]);

  it('should move the horizontal scroll based on enableTopScroll check, static data', async () => {
    TestBed.configureTestingModule({
      imports: [SkyAgGridFixtureModule],
      providers: [
        {
          provide: EnableTopScroll,
          useValue: true,
        },
      ],
    });
    gridWrapperFixture = TestBed.createComponent(SkyAgGridFixtureComponent);
    gridWrapperNativeElement = gridWrapperFixture.nativeElement;

    gridWrapperFixture.detectChanges();
    await gridWrapperFixture.whenStable();

    // Expect the scrollbar at the bottom.
    expect(getChildrenClassNames()).toEqual([
      'ag-header',
      'ag-body-horizontal-scroll',
      'ag-floating-top',
      'ag-body-viewport',
      'ag-sticky-top',
      'ag-floating-bottom',
      'ag-overlay',
    ]);
  });

  it('should move the horizontal scroll based on enableTopScroll check, async loading', async () => {
    TestBed.configureTestingModule({
      imports: [SkyAgGridFixtureModule],
    });
    gridWrapperFixture = TestBed.createComponent(SkyAgGridFixtureComponent);
    gridWrapperNativeElement = gridWrapperFixture.nativeElement;

    gridWrapperFixture.detectChanges();
    await gridWrapperFixture.whenStable();

    // Expect the scrollbar at the bottom.
    expect(getChildrenClassNames()).toEqual([
      'ag-header',
      'ag-floating-top',
      'ag-body-viewport',
      'ag-sticky-top',
      'ag-floating-bottom',
      'ag-body-horizontal-scroll',
      'ag-overlay',
    ]);

    gridWrapperFixture.componentInstance.gridOptions.context = {
      enableTopScroll: true,
    };
    gridWrapperFixture.componentInstance.agGrid?.gridReady.emit();

    // Expect the scrollbar below the header.
    expect(getChildrenClassNames()).toEqual([
      'ag-header',
      'ag-body-horizontal-scroll',
      'ag-floating-top',
      'ag-body-viewport',
      'ag-sticky-top',
      'ag-floating-bottom',
      'ag-overlay',
    ]);

    gridWrapperFixture.componentInstance.gridOptions.context = {
      enableTopScroll: false,
    };
    gridWrapperFixture.componentInstance.agGrid?.rowDataUpdated.emit();

    // Expect the scrollbar at the bottom.
    expect(getChildrenClassNames()).toEqual([
      'ag-header',
      'ag-floating-top',
      'ag-body-viewport',
      'ag-sticky-top',
      'ag-floating-bottom',
      'ag-body-horizontal-scroll',
      'ag-overlay',
    ]);
  });

  it('should show inline help', async () => {
    TestBed.configureTestingModule({
      imports: [SkyAgGridFixtureModule],
    });
    gridWrapperFixture = TestBed.createComponent(SkyAgGridFixtureComponent);
    gridWrapperNativeElement = gridWrapperFixture.nativeElement;

    gridWrapperFixture.detectChanges();
    await gridWrapperFixture.whenStable();

    expect(
      gridWrapperNativeElement.querySelector(
        `[col-id="name"] .sky-control-help`
      )
    ).toBeTruthy();
    expect(
      gridWrapperNativeElement.querySelector(
        `[col-id="value"] .sky-control-help`
      )
    ).toBeTruthy();
    expect(
      gridWrapperNativeElement
        .querySelector(`[col-id="value"] .sky-control-help`)
        ?.getAttribute('title')
    ).toEqual('Current Value help');

    gridWrapperFixture.componentInstance.agGrid?.api.setColumnDefs([
      ...gridWrapperFixture.componentInstance.columnDefs.map((col) => {
        switch (col.field) {
          case 'name':
            return {
              ...col,
              headerComponentParams: {
                ...col.headerComponentParams,
                inlineHelpComponent: undefined,
              },
            };
          case 'value':
            return {
              ...col,
              headerComponentParams: {
                ...col.headerComponentParams,
                inlineHelpComponent: SecondInlineHelpComponent,
              },
            };
          case 'target':
            return {
              ...col,
              hide: true,
            };
          default:
            return col;
        }
      }),
    ]);
    gridWrapperFixture.detectChanges();
    await gridWrapperFixture.whenStable();
    await new Promise((resolve) => setTimeout(resolve, 1000));

    expect(
      gridWrapperNativeElement.querySelector(
        `[col-id="name"] .sky-control-help`
      )
    ).toBeFalsy();
    expect(
      gridWrapperNativeElement.querySelector(
        `[col-id="value"] .sky-control-help`
      )
    ).toBeTruthy();
    expect(
      gridWrapperNativeElement
        .querySelector(`[col-id="value"] .sky-control-help`)
        ?.getAttribute('title')
    ).toEqual('Current Value help replaced');
  });
});


text:
package ior.parser.corba.iop;

import ior.parser.mvc.UpdateMessage;

public class IORMessageTypes
{
	public static final int BAD_IOR = 0;
	public static final int IOR_SET = 1;
	public static final int IOR_UNSET = 2;
}


text:
package org.springframework.security.authorization;

/**
 * @author Rob Winch
 * @since 5.0
 */
public class AuthorizationDecision {
	private final boolean granted;

	public AuthorizationDecision(boolean granted) {
		this.granted = granted;
	}

	public boolean isGranted() {
		return granted;
	}
}


text:
package fsm

import (
	"fmt"
	"time"

	"github.com/armon/go-metrics"
	"github.com/hashicorp/consul/agent/consul/state"
	"github.com/hashicorp/consul/agent/structs"
	"github.com/hashicorp/go-msgpack/codec"
	"github.com/hashicorp/raft"
)

// snapshot is used to provide a snapshot of the current
// state in a way that can be accessed concurrently with operations
// that may modify the live state.
type snapshot struct {
	state *state.Snapshot
}

// snapshotHeader is the first entry in our snapshot
type snapshotHeader struct {
	// LastIndex is the last index that affects the data.
	// This is used when we do the restore for watchers.
	LastIndex uint64
}

// persister is a function used to help snapshot the FSM state.
type persister func(s *snapshot, sink raft.SnapshotSink, encoder *codec.Encoder) error

// persisters is a list of snapshot functions.
var persisters []persister

// registerPersister adds a new helper. This should be called at package
// init() time.
func registerPersister(fn persister) {
	persisters = append(persisters, fn)
}

// restorer is a function used to load back a snapshot of the FSM state.
type restorer func(header *snapshotHeader, restore *state.Restore, decoder *codec.Decoder) error

// restorers is a map of restore functions by message type.
var restorers map[structs.MessageType]restorer

// registerRestorer adds a new helper. This should be called at package
// init() time.
func registerRestorer(msg structs.MessageType, fn restorer) {
	if restorers == nil {
		restorers = make(map[structs.MessageType]restorer)
	}
	if restorers[msg] != nil {
		panic(fmt.Errorf("Message %d is already registered", msg))
	}
	restorers[msg] = fn
}

// Persist saves the FSM snapshot out to the given sink.
func (s *snapshot) Persist(sink raft.SnapshotSink) error {
	defer metrics.MeasureSince([]string{"consul", "fsm", "persist"}, time.Now())
	defer metrics.MeasureSince([]string{"fsm", "persist"}, time.Now())

	// Write the header
	header := snapshotHeader{
		LastIndex: s.state.LastIndex(),
	}
	encoder := codec.NewEncoder(sink, msgpackHandle)
	if err := encoder.Encode(&header); err != nil {
		sink.Cancel()
		return err
	}

	// Run all the persisters to write the FSM state.
	for _, fn := range persisters {
		if err := fn(s, sink, encoder); err != nil {
			sink.Cancel()
			return err
		}
	}
	return nil
}

func (s *snapshot) Release() {
	s.state.Close()
}


text:
Here you can see your achievements

                                {{achievement.name}}

{{achievement.description}}


text:
import logging

from django.core.cache import cache
from django.db import transaction
from django.http import HttpResponse
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
import django_filters
from rest_framework import viewsets, mixins
from rest_framework.permissions import DjangoModelPermissionsOrAnonReadOnly
import reversion
from user_agents import parse

from obcy.models import Joke
from obcy.extras import prepare_view
from api.serializers import ObcyJokeSerializer
from api.models import Device
from api.commands import delete_joke as api_remove_joke

logger = logging.getLogger(__name__)

class ObcyJokeFilter(django_filters.FilterSet):
    before = django_filters.DateTimeFilter(name='added', lookup_type='lt')
    after = django_filters.DateTimeFilter(name='added', lookup_type='gt')
    min_votes = django_filters.NumberFilter(name='votes', lookup_type='gte')
    changed_after = django_filters.DateTimeFilter(name='changed', lookup_type='gt')

    class Meta:
        model = Joke
        fields = ['after', 'before', 'min_votes', 'changed_after']

class AllViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin, mixins.UpdateModelMixin, mixins.DestroyModelMixin,
                 viewsets.GenericViewSet):
    serializer_class = ObcyJokeSerializer
    filter_class = ObcyJokeFilter
    lookup_field = 'key'
    paginate_by_param = 'limit'
    permission_classes = (DjangoModelPermissionsOrAnonReadOnly,)
    queryset = Joke.objects.none()

    def get_queryset(self):
        jokes = Joke.objects.all().order_by('-added')
        if 'changed_after' not in self.request.GET:
            jokes = jokes.filter(hidden=None)

        return jokes

    def perform_destroy(self, instance):
        with transaction.atomic(), reversion.create_revision():
            instance.hidden = timezone.now()
            instance.save()
            logger.info('Joke %s removed via API.', instance.key)
            cache.clear()
            api_remove_joke(instance.key)

class RandomJokes(viewsets.ReadOnlyModelViewSet):
    serializer_class = ObcyJokeSerializer
    lookup_field = 'key'
    paginate_by_param = 'limit'

    def get_queryset(self):
        return prepare_view.random(self.request, pages=False)['jokes']

@csrf_exempt
@require_POST
def register_device(request):
    registration_id = request.POST.get('registration_id')
    android_id = request.POST.get('android_id')
    version = request.POST.get('version', '0.3.0')
    user_agent = parse(request.META['HTTP_USER_AGENT'])
    model = user_agent.device.family
    os_version = user_agent.os.version_string
    device_type = 'Mobile' if user_agent.is_mobile else 'Tablet'
    ip = get_client_ip(request)
    logger.debug(
        'register request from %s\nandroid_id = %s\napp_version = %s\nuser_agent = %s\nmodel = %s\nos_version = %s',
        ip, android_id, version, user_agent, model, os_version)
    try:
        device = Device.objects.get(android_id=android_id)
        device.registration_id = registration_id
        device.version = version
        device.model = model
        device.os_version = os_version
        device.type = device_type
        device.active = True
        device.last_seen = timezone.localtime(timezone.now())
        device.save()
        logger.debug('Device %s marked as last seen on %s', device.android_id, device.last_seen)
    except Device.DoesNotExist:
        Device.objects.create(registration_id=registration_id, android_id=android_id, version=version, model=model,
                              os_version=os_version, type=device_type)
        logger.info('Registered new device: %s', android_id)
    return HttpResponse(status=200)

@csrf_exempt
@require_POST
def deactivate_device(request):
    registration_id = request.POST.get('registration_id')
    try:
        device = Device.objects.get(registration_id=registration_id)
        device.active = False
        device.save()
    except Device.DoesNotExist:
        pass
    return HttpResponse(status=200)

def get_client_ip(request):
    x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
    if x_forwarded_for:
        ip = x_forwarded_for.split(',')[0]
    else:
        ip = request.META.get('REMOTE_ADDR')
    return ip


text:
<?xml version="1.0" encoding="utf-8"?>
<cn.yan.library.SlideLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:slideDirection="fromTop"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/content_id"
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="ViewPager"/>

    <TextView
        android:id="@+id/slide1_id"
        android:background="@android:color/darker_gray"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:gravity="center"
        android:text="收藏"/>
</cn.yan.library.SlideLayout>


text:
package com.shonshampain.streamrecorder.util;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

import com.shonshampain.streamrecorder.R;
import com.shonshampain.streamrecorder.dao.Alarm;
import com.shonshampain.streamrecorder.dao.Stream;
import com.shonshampain.streamrecorder.db.AlarmHelper;
import com.shonshampain.streamrecorder.db.StreamHelper;
import com.shonshampain.streamrecorder.events.RipConfirmationEvent;
import com.shonshampain.streamrecorder.receivers.AlarmReceiver;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Utils {

    private static final String TAG = "Utils";
    private static final boolean DBG = false;

    private static DecimalFormat hoursFormat = new DecimalFormat("#");
    private static DecimalFormat minSecFormat = new DecimalFormat("00");

    public static final int MILLISECONDS_PER_SECOND = 1000;
    public static final int SECONDS_PER_MINUTE = 60;
    public static final int MINUTES_PER_HOUR = 60;

    public static final int ONE_MINUTE = MILLISECONDS_PER_SECOND * SECONDS_PER_MINUTE;
    public static final int ONE_HOUR = ONE_MINUTE * MINUTES_PER_HOUR;

    public static String createPlaylistName(Context context, String streamName) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", java.util.Locale.getDefault());
        Date now = new Date();
        String date = dateFormat.format(now);
        return context.getString(R.string.playlist) + " " +
                streamName + " " +
                date;
    }

    public static String toHHMMSS(int value) {
        int hours = value / ONE_HOUR;
        int leftover = value - hours * ONE_HOUR;
        int minutes = leftover / ONE_MINUTE;
        int seconds = (leftover - minutes * ONE_MINUTE) / MILLISECONDS_PER_SECOND;
        return hoursFormat.format(hours) + ":" +
                minSecFormat.format(minutes) + ":" +
                minSecFormat.format(seconds);
    }

    public static PendingIntent createAlarmPendingIntent(Context context, com.shonshampain.streamrecorder.dao.Alarm alarm, long id) {
        Stream stream = StreamHelper.getInstance().fetch(context, alarm.streamId);
        Intent intent = new Intent(context, AlarmReceiver.class);
        intent.putExtra("duration", alarm.duration * Utils.ONE_MINUTE);
        intent.putExtra("name", alarm.name);
        intent.putExtra("stream", stream.url);
        intent.putExtra("mute", alarm.mute? 1 : 0);
        intent.putExtra("repeat", alarm.repeat.ordinal());
        intent.putExtra("calendar", alarm.time);
        intent.putExtra("id", id);
        PendingIntent pendingIntent =  PendingIntent.getBroadcast(context, (int)id, intent, 0);
        Logger.d(DBG, TAG, "id of pending intent[" + intent.getLongExtra("id", -1) + "]");
        return pendingIntent;
    }

    public static void setAlarm(Context context, Alarm alarm, boolean create) {
        long id;
        if (create) {
            id = AlarmHelper.getInstance().insert(context, alarm);
        } else {
            id = alarm._id;
        }
        PendingIntent pendingIntent = createAlarmPendingIntent(context, alarm, id);
        AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        alarmManager.setExact(AlarmManager.RTC_WAKEUP, alarm.time, pendingIntent);
    }

    public static String getAlarmName(String name, RipConfirmationEvent.Repeat repeat, Calendar calendar) {
        SimpleDateFormat mdy = new SimpleDateFormat("M/d/yy", java.util.Locale.getDefault());
        if (repeat != RipConfirmationEvent.Repeat.None) {
            return name + " " + mdy.format(calendar.getTime());
        }
        return name;
    }

}


text:
package org.keycloak.client.admin.cli.aesh;

import org.jboss.aesh.console.AeshConsoleImpl;

import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * This stream blocks and waits, until there is a stream in the queue.
 * It reads the stream to the end, then stops Aesh console.
 *
 * @author Marko Strukelj
 */
public class ValveInputStream extends InputStream {

    private BlockingQueue<InputStream> queue = new LinkedBlockingQueue<>(10);

    private InputStream current;

    private AeshConsoleImpl console;

    @Override
    public int read() throws IOException {
        if (current == null) {
            try {
                current = queue.take();
            } catch (InterruptedException e) {
                throw new InterruptedIOException("Signalled to exit");
            }
        }
        int c = current.read();
        if (c == -1) {
            //current = null;
            if (console != null) {
                console.stop();
            }
        }

        return c;
    }

    /**
     * For some reason AeshInputStream wants to do blocking read of whole buffers, which for stdin
     * results in blocked input.
     */
    @Override
    public int read(byte b[], int off, int len) throws IOException {
        int c = read();
        if (c == -1) {
            return c;
        }
        b[off] = (byte) c;
        return 1;
    }

    public void setInputStream(InputStream is) {
        if (queue.contains(is)) {
            return;
        }
        queue.add(is);
    }

    public void setConsole(AeshConsoleImpl console) {
        this.console = console;
    }

    public boolean isStdinAvailable() {
        return console.isRunning();
    }
}


text:
package mobi.inthepocket.android.beacons.app.utils;

import android.support.test.espresso.matcher.ViewMatchers;
import android.support.test.rule.ActivityTestRule;

import mobi.inthepocket.android.beacons.app.R;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
import static android.support.test.espresso.action.ViewActions.replaceText;
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
/**
 * Created by eliaslecomte on 29/10/2016.
 */

public class MainActivityTestHelper
{
    private final ActivityTestRule activityTestRule;

    public MainActivityTestHelper(final ActivityTestRule activityTestRule)
    {
        this.activityTestRule = activityTestRule;
    }

    public void inputUUID(final String value)
    {
        onView(ViewMatchers.withId(R.id.edittext_uuid)).perform(replaceText(value)).perform(closeSoftKeyboard());
    }

    public void inputMajor(final String value)
    {
        onView(ViewMatchers.withId(R.id.edittext_major)).perform(replaceText(value)).perform(closeSoftKeyboard());
    }

    public void inputMinor(final String value)
    {
        onView(ViewMatchers.withId(R.id.edittext_minor)).perform(replaceText(value)).perform(closeSoftKeyboard());
    }

    public void assertUUIDHasNoErrorMessage()
    {
        TextInputLayoutTestUtils.onErrorViewWithinTilWithId(R.id.textinputlayout_uuid).check(doesNotExist());
    }

    public void assertUUIDHasErrorMessage()
    {
        final String expectedError = this.activityTestRule.getActivity().getString(R.string.uuid_error);
        TextInputLayoutTestUtils.onErrorViewWithinTilWithId(R.id.textinputlayout_uuid).check(matches(withText(expectedError)));
    }

    public void assertMajorHasErrorMessage()
    {
        final String expectedError = this.activityTestRule.getActivity().getString(R.string.major_error);
        TextInputLayoutTestUtils.onErrorViewWithinTilWithId(R.id.textinputlayout_major).check(matches(withText(expectedError)));
    }

    public void assertMajorHasNoErrorMessage()
    {
        TextInputLayoutTestUtils.onErrorViewWithinTilWithId(R.id.textinputlayout_major).check(doesNotExist());
    }

    public void assertMinorHasErrorMessage()
    {
        final String expectedError = this.activityTestRule.getActivity().getString(R.string.minor_error);
        TextInputLayoutTestUtils.onErrorViewWithinTilWithId(R.id.textinputlayout_minor).check(matches(withText(expectedError)));
    }

    public void assertMinorHasNoErrorMessage()
    {
        TextInputLayoutTestUtils.onErrorViewWithinTilWithId(R.id.textinputlayout_minor).check(doesNotExist());
    }

    public void clickOnButton(final int viewId)
    {
        onView(withId(viewId)).perform(click());
    }
}


text:
/*
 * Author      Andrew Pieniezny <andrew.pieniezny@neric.org>
 * Version     1.6.1
 * Since       2018-06-04
 */
namespace RicOneApi.Common.Objects
{
    internal enum ServicePathType { Object, Single, Predicate }

    /// <summary>
    /// Class that stores service path information. Used for GetLastPage().
    /// </summary>
    public class ServicePath
    {
        private readonly string servicePathName;
        private readonly string servicePath;
        private readonly ServicePathType servicePathType;

        private ServicePath(string servicePathName, string servicePath, ServicePathType servicePathType)
        {
            this.servicePathName = servicePathName;
            this.servicePath = servicePath;
            this.servicePathType = servicePathType;
        }

        /// <summary>
        /// Returns all Leas.
        /// </summary>
        public static ServicePath GetXLeas = new ServicePath("GetXLeas", "xLeas", ServicePathType.Object);
        /// <summary>
        /// Returns a single Lea by refId.
        /// </summary>
        public static ServicePath GetXLeaByRefId = new ServicePath("GetXLeaByRefId", "xLeas/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns a single Lea by BEDS code or Local Id.
        /// </summary>
        public static ServicePath GetXLeaById = new ServicePath("GetXLeaById", "xLeas/{id}", ServicePathType.Single);
        /// <summary>
        /// Returns Leas associated to a specific School by refId.
        /// </summary>
        public static ServicePath GetXLeasByXSchool = new ServicePath("GetXLeasByXSchool", "xSchools/{refId}/xLeas", ServicePathType.Predicate);
        /// <summary>
        /// Returns Leas associated to a specific Roster by refId.
        /// </summary>
        public static ServicePath GetXLeasByXRoster = new ServicePath("GetXLeasByXRoster", "xRosters/{refId}/xLeas", ServicePathType.Predicate);
        /// <summary>
        /// Returns Leas associated to a specific Staff by refId.
        /// </summary>
        public static ServicePath GetXLeasByXStaff = new ServicePath("GetXLeasByXStaff", "xStaffs/{refId}/xLeas", ServicePathType.Predicate);
        /// <summary>
        /// Returns Leas associated to a specific Student by refId.
        /// </summary>
        public static ServicePath GetXLeasByXStudent = new ServicePath("GetXLeasByXStudent", "xStudents/{refId}/xLeas", ServicePathType.Predicate);
        /// <summary>
        /// Returns Leas associated to a specific Contact by refId
        /// </summary>
        public static ServicePath GetXLeasByXContact = new ServicePath("GetXLeasByXContact", "xContacts/{refId}/xLeas", ServicePathType.Predicate);
        /// <summary>
        /// Returns all Schools.
        /// </summary>
        public static ServicePath GetXSchools = new ServicePath("GetXSchools", "xSchools", ServicePathType.Object);
        /// <summary>
        /// Returns a single School by refId.
        /// </summary>
        public static ServicePath GetXSchoolByRefId = new ServicePath("GetXSchoolByRefId", "xSchools/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns a single School by BEDS code or Local Id.
        /// </summary>
        public static ServicePath GetXSchoolById = new ServicePath("GetXSchoolById", "xSchools/{id}", ServicePathType.Single);
        /// <summary>
        /// Returns Schools associated to a specific Lea by refId.
        /// </summary>
        public static ServicePath GetXSchoolsByXLea = new ServicePath("GetXSchoolsByXLea", "xLeas/{refId}/xSchools", ServicePathType.Predicate);
        /// <summary>
        /// Returns Schools associated to a specific Calendar by refId.
        /// </summary>
        public static ServicePath GetXSchoolsByXCalendar = new ServicePath("GetXSchoolsByXCalendar", "xCalendars/{refId}/xSchools", ServicePathType.Predicate);
        /// <summary>
        /// Returns Schools associated to a specific Course by refId.
        /// </summary>
        public static ServicePath GetXSchoolsByXCourse = new ServicePath("GetXSchoolsByXCourse", "xCourses/{refId}/xSchools", ServicePathType.Predicate);
        /// <summary>
        /// Returns Schools associated to a specific Roster by refId.
        /// </summary>
        public static ServicePath GetXSchoolsByXRoster = new ServicePath("GetXSchoolsByXRoster", "xRosters/{refId}/xSchools", ServicePathType.Predicate);
        /// <summary>
        /// Returns Schools associated to a specific Staff by refId.
        /// </summary>
        public static ServicePath GetXSchoolsByXStaff = new ServicePath("GetXSchoolsByXStaff", "xStaffs/{refId}/xSchools", ServicePathType.Predicate);
        /// <summary>
        /// Returns Schools associated to a specific Student by refId.
        /// </summary>
        public static ServicePath GetXSchoolsByXStudent = new ServicePath("GetXSchoolsByXStudent", "xStudents/{refId}/xSchools", ServicePathType.Predicate);
        /// <summary>
        /// Returns Schools associated to a specific Contact by refId.
        /// </summary>
        public static ServicePath GetXSchoolsByXContact = new ServicePath("GetXSchoolsByXContact", "xContacts/{refId}/xSchools", ServicePathType.Predicate);
        /// <summary>
        /// Returns all Calendars.
        /// </summary>
        public static ServicePath GetXCalendars = new ServicePath("GetXCalendars", "xCalendars", ServicePathType.Object);
        /// <summary>
        /// Returns a single Calendar by refId.
        /// </summary>
        public static ServicePath GetXCalendarByRefId = new ServicePath("GetXCalendarByRefId", "xCalendars/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns Calendars associated to a specific Lea by refId
        /// </summary>
        public static ServicePath GetXCalendarsByXLea = new ServicePath("GetXCalendarsByXLea", "xLeas/{refId}/xCalendars", ServicePathType.Predicate);
        /// <summary>
        /// Returns Calendars associated to a specific School by refId.
        /// </summary>
        public static ServicePath GetXCalendarsByXSchool = new ServicePath("GetXCalendarsByXSchool", "xSchools/{refId}/xCalendars", ServicePathType.Predicate);
        /// <summary>
        /// Returns all Courses.
        /// </summary>
        public static ServicePath GetXCourses = new ServicePath("GetXCourses", "xCourses", ServicePathType.Object);
        /// <summary>
        /// Returns a single Course by refId.
        /// </summary>
        public static ServicePath GetXCourseByRefId = new ServicePath("GetXCourseByRefId", "xCourses/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns Courses associated to a specific Lea by refId.
        /// </summary>
        public static ServicePath GetXCoursesByXLea = new ServicePath("GetXCoursesByXLea", "xLeas/{refId}/xCourses", ServicePathType.Predicate);
        /// <summary>
        /// Returns Courses associated to a specific School by refId.
        /// </summary>
        public static ServicePath GetXCoursesByXSchool = new ServicePath("GetXCoursesByXSchool", "xSchools/{refId}/xCourses", ServicePathType.Predicate);
        /// <summary>
        /// Returns Courses associated to a specific Roster by refId.
        /// </summary>
        public static ServicePath GetXCoursesByXRoster = new ServicePath("GetXCoursesByXRoster", "xRosters/{refId}/xCourses", ServicePathType.Predicate);
        /// <summary>
        /// Returns all Rosters.
        /// </summary>
        public static ServicePath GetXRosters = new ServicePath("GetXRosters", "xRosters", ServicePathType.Object);
        /// <summary>
        /// Returns a single Roster by refId.
        /// </summary>
        public static ServicePath GetXRosterByRefId = new ServicePath("GetXRosterByRefId", "xRosters/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns Rosters associated to a specific Lea by refId.
        /// </summary>
        public static ServicePath GetXRostersByXLea = new ServicePath("GetXRostersByXLea", "xLeas/{refId}/xRosters", ServicePathType.Predicate);
        /// <summary>
        /// Returns Rosters associated to a specific School by refId.
        /// </summary>
        public static ServicePath GetXRostersByXSchool = new ServicePath("GetXRostersByXSchool", "xSchools/{refId}/xRosters", ServicePathType.Predicate);
        /// <summary>
        /// Returns Rosters associated to a specific Course by refId.
        /// </summary>
        public static ServicePath GetXRostersByXCourse = new ServicePath("GetXRostersByXCourse", "xCourses/{refId}/xRosters", ServicePathType.Predicate);
        /// <summary>
        /// Returns Sections associated to a specific Staff by refId.
        /// </summary>
        public static ServicePath GetXRostersByXStaff = new ServicePath("GetXRostersByXStaff", "xStaffs/{refId}/xRosters", ServicePathType.Predicate);
        /// <summary>
        /// Returns Rosters associated to a specific Student by refId.
        /// </summary>
        public static ServicePath GetXRostersByXStudent = new ServicePath("GetXRostersByXStudent", "xStudents/{refId}/xRosters", ServicePathType.Predicate);
        /// <summary>
        /// Returns all Staff.
        /// </summary>
        public static ServicePath GetXStaffs = new ServicePath("GetXStaffs", "xStaffs", ServicePathType.Object);
        /// <summary>
        /// Returns a single Staff by refId.
        /// </summary>
        public static ServicePath GetXStaffByRefId = new ServicePath("GetXStaffByRefId", "xStaffs/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns a single Staff by state or local id.
        /// </summary>
        public static ServicePath GetXStaffById = new ServicePath("GetXStaffById", "xStaffs/{id}", ServicePathType.Single);
        /// <summary>
        /// Returns Staff associated to a specific Lea by refId.
        /// </summary>
        public static ServicePath GetXStaffsByXLea = new ServicePath("GetXStaffsByXLea", "xLeas/{refId}/xStaffs", ServicePathType.Predicate);
        /// <summary>
        /// Returns Staff associated to a specific School by refId.
        /// </summary>
        public static ServicePath GetXStaffsByXSchool = new ServicePath("GetXStaffsByXSchool", "xSchools/{refId}/xStaffs", ServicePathType.Predicate);
        /// <summary>
        /// Returns Staff associated to a specific Course by refId.
        /// </summary>
        public static ServicePath GetXStaffsByXCourse = new ServicePath("GetXStaffsByXCourse", "xCourses/{refId}/xStaffs", ServicePathType.Predicate);
        /// <summary>
        /// Returns Staff associated to a specific Roster by refId
        /// </summary>
        public static ServicePath GetXStaffsByXRoster = new ServicePath("GetXStaffsByXRoster", "xRosters/{refId}/xStaffs", ServicePathType.Predicate);
        /// <summary>
        /// Returns Staff associated to a specific Student by refId.
        /// </summary>
        public static ServicePath GetXStaffsByXStudent = new ServicePath("GetXStaffsByXStudent", "xStudents/{refId}/xStaffs", ServicePathType.Predicate);
        /// <summary>
        /// Returns all Students.
        /// </summary>
        public static ServicePath GetXStudents = new ServicePath("GetXStudents", "xStudents", ServicePathType.Object);
        /// <summary>
        /// Returns a single Student by refId.
        /// </summary>
        public static ServicePath GetXStudentByRefId = new ServicePath("GetXStudentByRefId", "xStudents/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns a single Student by state or local id.
        /// </summary>
        public static ServicePath GetXStudentById = new ServicePath("GetXStudentById", "xStudents/{id}", ServicePathType.Single);
        /// <summary>
        /// Returns Students associated to a specific Lea by refId.
        /// </summary>
        public static ServicePath GetXStudentsByXLea = new ServicePath("GetXStudentsByXLea", "xLeas/{refId}/xStudents", ServicePathType.Predicate);
        /// <summary>
        /// Returns Students associated to a specific School by refId.
        /// </summary>
        public static ServicePath GetXStudentsByXSchool = new ServicePath("GetXStudentsByXSchool", "xSchools/{refId}/xStudents", ServicePathType.Predicate);
        /// <summary>
        /// Returns Students associated to a specific Roster by refId.
        /// </summary>
        public static ServicePath GetXStudentsByXRoster = new ServicePath("GetXStudentsByXRoster", "xRosters/{refId}/xStudents", ServicePathType.Predicate);
        /// <summary>
        /// Returns Students associated to a specific Staff by refId.
        /// </summary>
        public static ServicePath GetXStudentsByXStaff = new ServicePath("GetXStudentsByXStaff", "xStaffs/{refId}/xStudents", ServicePathType.Predicate);
        /// <summary>
        /// Returns Students associated to a specific Contact by refId.
        /// </summary>
        public static ServicePath GetXStudentsByXContact = new ServicePath("GetXStudentsByXContact", "xContacts/{refId}/xStudents", ServicePathType.Predicate);
        /// <summary>
        /// Returns all Contacts.
        /// </summary>
        public static ServicePath GetXContacts = new ServicePath("GetXContacts", "xContacts", ServicePathType.Object);
        /// <summary>
        /// Returns a single Contact by refId.
        /// </summary>
        public static ServicePath GetXContactByRefId = new ServicePath("GetXContactByRefId", "xContacts/{refId}", ServicePathType.Single);
        /// <summary>
        /// Returns Contacts associated to a specific Lea by refId.
        /// </summary>
        public static ServicePath GetXContactsByXLea = new ServicePath("GetXContactsByXLea", "xLeas/{refId}/xContacts", ServicePathType.Predicate);
        /// <summary>
        /// Returns Contacts associated to a specific School by refId.
        /// </summary>
        public static ServicePath GetXContactsByXSchool = new ServicePath("GetXContactsByXSchool", "xSchools/{refId}/xContacts", ServicePathType.Predicate);
        /// <summary>
        /// Returns Contacts associated to a specific Student by refId.
        /// </summary>
        public static ServicePath GetXContactsByXStudent = new ServicePath("GetXContactsByXStudent", "xStudents/{refId}/xContacts", ServicePathType.Predicate);

        internal string GetServicePathName() { return servicePathName; }
        internal string GetServicePath() { return servicePath; }
        internal ServicePathType GetServicePathType() { return servicePathType; }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <HorizontalScrollView
        android:id="@+id/hsvEditTextContainer"
        android:layout_width="200dp"
        android:layout_height="match_parent"
        android:layout_alignParentStart="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_above="@id/ime_container"
        android:layout_margin="16dp"
        android:fillViewport="true">

        <net.studymongolian.mongollibrary.MongolEditText
            android:id="@+id/mongoledittext"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:padding="10dp"
            app:textSize="30sp"
            tools:layout_editor_absoluteX="20dp"
            tools:layout_editor_absoluteY="128dp" />

    </HorizontalScrollView>

    <EditText
        android:id="@+id/edittext"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_toRightOf="@id/hsvEditTextContainer"
        android:layout_toEndOf="@id/hsvEditTextContainer"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_above="@id/ime_container"
        android:layout_margin="16dp"/>

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:padding="8dp"
        android:src="@drawable/ic_keyboard_32dp"
        android:onClick="onShowKeyboardButtonClick"
        />

    <net.studymongolian.mongollibrary.ImeContainer
        android:id="@+id/ime_container"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:background="#dbdbdb"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true">

        <net.studymongolian.mongollibrary.KeyboardQwerty
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:candidatesLocation="horizontal_top"
            style="@style/KeyboardTheme"
            />

        <net.studymongolian.mongollibrary.KeyboardAeiou
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:candidatesLocation="vertical_left"
            app:primaryTextSize="30sp"
            style="@style/KeyboardTheme"
            />

    </net.studymongolian.mongollibrary.ImeContainer>

</RelativeLayout>


text:
.voice-read-tweet i{
	background-image: url('../images/speaker.svg');
	background-size: 16px 32px;
	background-position: 0px -8px;
	background-color: white;
}

.voice-read-tweet a:hover .ic-mask{
	background-image: url('../images/speakerblue.svg');
	background-color: white;
}

.voice-read-tweet .ic-readed{
	background-image: url('../images/speakerreaded.svg');
	background-color: white;
}

.voice-read-tweet .ic-reading{
	background-image: url('../images/speakerblue.svg');
	background-color: white;
	position: relative;
	-webkit-animation: bounceAround 1.1s ease-in-out infinite;
	-webkit-animation-duration: 1.5s;
}

.show-helper{
	visibility: visible;
}

@-webkit-keyframes bounceAround {
	 0% {-webkit-transform: scale(1)}
	10% {-webkit-transform: scale(1.1)}
	20% {-webkit-transform: scale(1.2)}
}

.voice-read-tweet i.ic-con{
	width: 20px;
}


text:
<?php

namespace Behat\Behat\Context\Exception;

use InvalidArgumentException;

/**
 * Represents an exception thrown when provided context class is not found.
 *
 * @author Konstantin Kudryashov <ever.zet@gmail.com>
 */
final class ContextNotFoundException extends InvalidArgumentException implements ContextException
{
    /**
     * @var string
     */
    private $class;

    /**
     * Initializes exception.
     *
     * @param string $message
     * @param string $class
     */
    public function __construct($message, $class)
    {
        $this->class = $class;

        parent::__construct($message);
    }

    /**
     * Returns not found classname.
     *
     * @return string
     */
    public function getClass()
    {
        return $this->class;
    }
}


text:
<?php

class Sailthru_Email_Model_Config_Source_Validatedyesno extends Sailthru_Email_Model_Config_Source
{

    /**
     * Options getter
     *
     * @return array
     */
    public function toOptionArray()
    {
        try {
            $this->testKeys();
            return array(
                array( 'value' => 1, 'label' => Mage::helper('adminhtml')->__('Yes') ),
                array( 'value' => 0, 'label' => Mage::helper('adminhtml')->__('No') ),
            );
        } catch (Sailthru_Client_Exception $e) {
            return $this->processOptionArrayError($e);
        }
    }
}