text:
<Title:>
  Capture the Flag

  <meta name="viewport" content="width=device-width">
  <meta name="mobile-web-app-capable" content="yes">
  <link rel="shortcut icon" sizes="128x128" href="/img/flag.png">

  <view name="d-connection-alert"></view>
  <view name="d-before-unload"></view>

{{_page.room}}

      <input
        placeholder="topic"
        value="{{rooms[_page.room].topic}}"
        disabled="{{users[_session.userId].team !== 'admin'}}"
        >
      <button id="toggle-fullscreen" class="settings-toggle"
        title="Full Screen">
        ^
      </button>

        <input checked="{{users[_session.userId].settings}}" type="checkbox">
        *

        {{each _page.list as #message}}

<view name="message" user="{{users[#message.userId]}}"></view>

        {{/each}}

      <view name="form" user="{{users[_session.userId]}}"></view>

<message:>

      {{@user.team}}

        {{@user.name}}

      {{_page.showTime && formatTime(#message)}}

      ({{formatGeo(#message)}})

{{#message.comment}}

<form:>

      <input value="{{@user.name}}" placeholder="name" title="Name" class="color-{{@user.team}}" required>
      <select class="team color-{{@user.team}}" title="Team"
        data-maybe-disabled="{{@user.team !== 'neutral'}}">
        {{each _page.roles as #team}}
          <option value="{{#team}}" selected="{{@user.team === #team}}" class="bg-{{#team}} color-{{#team}}">{{#team}}</option>
        {{/each}}
      </select>

    <input type="hidden" value="{{@user.team}}" placeholder="team" class="color-{{@user.team}}">
    <form id="new-comment" on-submit="add()">
      <input value="{{_page.newComment}}" autofocus placeholder="message">
    </form>


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Graphis streblocarpa (Bél.) Nyl.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
package org.apache.olingo.odata2.client.core.ep.serializer;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;

import org.apache.olingo.odata2.api.edm.Edm;
import org.apache.olingo.odata2.api.edm.EdmEntitySet;
import org.apache.olingo.odata2.api.edm.EdmFacets;
import org.apache.olingo.odata2.api.edm.EdmProperty;
import org.apache.olingo.odata2.api.edm.EdmTyped;
import org.apache.olingo.odata2.api.ep.EntityProviderException;
import org.apache.olingo.odata2.api.processor.ODataResponse;
import org.apache.olingo.odata2.client.api.ep.Entity;
import org.apache.olingo.odata2.client.api.ep.EntityCollection;
import org.apache.olingo.odata2.client.api.ep.EntityCollectionSerializerProperties;
import org.apache.olingo.odata2.client.api.ep.EntitySerializerProperties;
import org.apache.olingo.odata2.client.core.ep.JsonSerializerDeserializer;
import org.apache.olingo.odata2.testutil.fit.BaseTest;
import org.apache.olingo.odata2.testutil.helper.StringHelper;
import org.apache.olingo.odata2.testutil.mock.MockFacade;
import org.junit.Test;

/**
 *
 */
public class JsonFeedEntitySerializerTest extends BaseTest {
  protected static final String BASE_URI = "http://host:80/service/";
  protected static final EntitySerializerProperties DEFAULT_PROPERTIES =
      EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).build();
  protected static final String ERROR_MSG = "Entity or expanded entity cannot have null value.";

  @Test
  public void unbalancedPropertyEntryWithInlineFeed() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    data.setWriteProperties(DEFAULT_PROPERTIES);
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("RoomId", "1");
    data.setWriteProperties(DEFAULT_PROPERTIES);
    innerData.addEntity(data);
    roomData.addNavigation("nr_Employees", innerData);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    assertNotNull(response);
    assertNotNull(response.getEntity());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"nr_Employees\":"
        + "[{\"EmployeeId\":\"1\",\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},"
        + "{\"EmployeeId\":\"1\",\"RoomId\":\"1\"}]}", json);
  }

  @Test
  public void unbalancedPropertyEntryWithInlineFeedWithPropertiesInParent() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);
    roomData.addNavigation("nr_Employees", innerData);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    assertNotNull(response);
    assertNotNull(response.getEntity());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"nr_Employees\":"
        + "[{\"EmployeeId\":\"1\",\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},"
        + "{\"EmployeeId\":\"1\",\"RoomId\":\"1\"}]}", json);
  }

  @Test
  public void unbalancedPropertyEntryWithEmptyInlineFeed() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    EntityCollection innerData = new EntityCollection();
    roomData.addNavigation("nr_Employees", innerData);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    ODataResponse response = new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"nr_Employees\":"
        + "[]}", json);
  }

  @Test
  public void unbalancedPropertyEntryWithPartialEmptyInlineFeed() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    data.setWriteProperties(DEFAULT_PROPERTIES);
    innerData.addEntity(data);

    data = new Entity();
    innerData.addEntity(data);
    roomData.addNavigation("nr_Employees", innerData);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    ODataResponse response = new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"nr_Employees\":"
        + "[{\"EmployeeId\":\"1\",\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},{}]}", json);
  }

  @Test
  public void entryWithExpandedFeedButEmptyEntityCollection() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Buildings");
    Entity buildingData = new Entity();
    buildingData.addProperty("Id", "1");
    buildingData.setWriteProperties(DEFAULT_PROPERTIES);

    EntityCollection roomCollection = new EntityCollection();
    Entity roomData = new Entity();
    roomCollection.addEntity(roomData);
    buildingData.addNavigation("nb_Rooms", roomCollection);

    ODataResponse response = new JsonSerializerDeserializer().writeEntry(entitySet, buildingData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertEquals("{\"Id\":\"1\",\"nb_Rooms\":[{}]}", json);
  }

  @Test
  public void entryWithExpandedFeedButNullEntityCollection() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Buildings");
    Entity buildingData = new Entity();
    buildingData.addProperty("Id", "1");
    buildingData.setWriteProperties(DEFAULT_PROPERTIES);

    EntityCollection roomCollection = new EntityCollection();
    roomCollection.addEntity(null);
    buildingData.addNavigation("nb_Rooms", roomCollection);

    try {
      new JsonSerializerDeserializer().writeEntry(entitySet, buildingData);
    } catch (EntityProviderException e) {
      assertEquals(ERROR_MSG, e.getMessage());
    }
  }

  @Test
  public void unbalancedPropertyEntryWithNullInlineFeed() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    roomData.addNavigation("nr_Employees", null);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    try {
      new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    } catch (EntityProviderException e) {
      assertEquals(ERROR_MSG, e.getMessage());
    }
  }

  @Test
  public void entryWithExpandedEntryWithWritePropertiesOnCollection() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));
    roomData.addProperty("Version", new Integer(3));
    roomData.setWriteProperties(DEFAULT_PROPERTIES);

    EntityCollection employeeCollection = new EntityCollection();
    Entity employeeData = new Entity();
    employeeData.addProperty("EmployeeId", "1");
    employeeData.addProperty("ImageUrl", "hhtp://url");
    employeeCollection.addEntity(employeeData);
    employeeCollection.setCollectionProperties
    (EntityCollectionSerializerProperties.
        serviceRoot(URI.create(BASE_URI)).build());
    roomData.addNavigation("nr_Employees", employeeCollection);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    final String json = verifyResponse(response);
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"Version\":3,"
        + "\"nr_Employees\":[{\"EmployeeId\":\"1\",\"ImageUrl\":\"hhtp://url\"}]}",
        json);
  }

  @Test
  public void entryWithExpandedEntryWithGlobalWritePropertiesOnCollection() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));
    roomData.addProperty("Version", new Integer(3));
    roomData.setWriteProperties(DEFAULT_PROPERTIES);

    EntityCollection employeeCollection = new EntityCollection();
    Entity employeeData = new Entity();
    employeeData.addProperty("EmployeeId", "1");
    employeeData.addProperty("ImageUrl", "hhtp://url");
    employeeCollection.addEntity(employeeData);
    employeeCollection.setGlobalEntityProperties(EntitySerializerProperties.
        serviceRoot(URI.create(BASE_URI)).validatingFacets(true).build());
    employeeCollection.setCollectionProperties
    (EntityCollectionSerializerProperties.
        serviceRoot(URI.create(BASE_URI)).build());
    roomData.addNavigation("nr_Employees", employeeCollection);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    final String json = verifyResponse(response);
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"Version\":3,"
        + "\"nr_Employees\":[{\"EmployeeId\":\"1\",\"ImageUrl\":\"hhtp://url\"}]}",
        json);
  }

  @Test
  public void entryWithExpandedEntryWithoutKeyWithGlobalWritePropertiesOnCollection() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));
    roomData.addProperty("Version", new Integer(3));
    roomData.setWriteProperties(DEFAULT_PROPERTIES);

    EntityCollection employeeCollection = new EntityCollection();
    Entity employeeData = new Entity();
    employeeData.addProperty("EmployeeId", "1");
    employeeData.addProperty("ImageUrl", "hhtp://url");
    employeeCollection.addEntity(employeeData);
    employeeCollection.setGlobalEntityProperties(EntitySerializerProperties.
        serviceRoot(URI.create(BASE_URI)).validatingFacets(true).includeMetadata(true).build());
    employeeCollection.setCollectionProperties
    (EntityCollectionSerializerProperties.
        serviceRoot(URI.create(BASE_URI)).build());
    roomData.addNavigation("nr_Employees", employeeCollection);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    final String json = verifyResponse(response);
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"Version\":3,"
        + "\"nr_Employees\":[{\"__metadata\":{\"id\":\"http://host:80/service/Employees('1')\",\"uri\":"
        + "\"http://host:80/service/Employees('1')\",\"type\":\"RefScenario.Employee\",\"content_type\":"
        + "\"application/octet-stream\",\"media_src\":\"http://host:80/service/Employees('1')/$value\","
        + "\"edit_media\":\"http://host:80/service/Employees('1')/$value\"},\"EmployeeId\":\"1\","
        + "\"ImageUrl\":\"hhtp://url\"}]}",
        json);
  }

  private String verifyResponse(final ODataResponse response) throws IOException {
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    return json;
  }

  @Test
  public void unbalancedPropertyEntryWithInlineFeedWithoutKey() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Id", "1");
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    data.setWriteProperties(DEFAULT_PROPERTIES);
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("RoomId", "1");
    data.setWriteProperties(DEFAULT_PROPERTIES);
    innerData.addEntity(data);
    roomData.addNavigation("nr_Employees", innerData);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    assertNotNull(response);
    assertNotNull(response.getEntity());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"nr_Employees\":"
        + "[{\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},"
        + "{\"RoomId\":\"1\"}]}", json);
  }

  @Test
  public void unbalancedPropertyEntryWithoutKeyWithInlineFeed() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    data.setWriteProperties(DEFAULT_PROPERTIES);
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("EmployeeId", "2");
    data.addProperty("RoomId", "1");
    data.setWriteProperties(DEFAULT_PROPERTIES);
    innerData.addEntity(data);
    roomData.addNavigation("nr_Employees", innerData);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    final String json = verifyResponse(response);
    assertEquals("{\"Name\":\"Neu Schwanstein\",\"Seats\":20,\"nr_Employees\":"
        + "[{\"EmployeeId\":\"1\",\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},"
        + "{\"EmployeeId\":\"2\",\"RoomId\":\"1\"}]}",
        json);
  }

  @Test(expected=EntityProviderException.class)
  public void unbalancedPropertyEntryWithoutKeyWithEmptyInlineFeedIncludingMetadata() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .includeMetadata(true).build());
    EntityCollection innerData = new EntityCollection();
    roomData.addNavigation("nr_Employees", innerData);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
  }

  @Test
  public void unbalancedPropertyEntryWithoutKeyWithNullInlineFeed() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    Entity roomData = new Entity();
    roomData.addProperty("Name", "Neu Schwanstein");
    roomData.addProperty("Seats", new Integer(20));

    roomData.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI))
        .build());
    roomData.addNavigation("nr_Employees", null);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    try {
      new JsonSerializerDeserializer().writeEntry(entitySet, roomData);
    } catch (EntityProviderException e) {
      assertEquals(ERROR_MSG, e.getMessage());
    }
  }

  @Test
  public void feed() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
    EntityCollection teamsData = new EntityCollection();
    Entity team1Data = new Entity();
    team1Data.addProperty("Id", "1");
    team1Data.addProperty("isScrumTeam", true);
    Entity team2Data = new Entity();
    team2Data.addProperty("Id", "2");
    team2Data.addProperty("isScrumTeam", false);
    teamsData.addEntity(team1Data);
    teamsData.addEntity(team2Data);
    teamsData.setCollectionProperties(EntityCollectionSerializerProperties.serviceRoot(URI.create(BASE_URI)).build());

    final ODataResponse response = new JsonSerializerDeserializer().writeFeed(entitySet, teamsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"Id\":\"1\",\"isScrumTeam\":true},{\"Id\":\"2\",\"isScrumTeam\":false}]}",
        json);
  }

  @Test
  public void feedWithEmptyData() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
    EntityCollection teamsData = new EntityCollection();
    Entity team1Data = new Entity();
    team1Data.addProperty("Id", "1");
    team1Data.addProperty("isScrumTeam", true);
    Entity team2Data = new Entity();
    teamsData.addEntity(team1Data);
    teamsData.addEntity(team2Data);
    teamsData.setCollectionProperties(EntityCollectionSerializerProperties.serviceRoot(URI.create(BASE_URI)).build());

    final ODataResponse response = new JsonSerializerDeserializer().writeFeed(entitySet, teamsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"Id\":\"1\",\"isScrumTeam\":true},{}]}",
        json);
  }

  @Test
  public void feedWithNullData() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");

    try {
      new JsonSerializerDeserializer().writeFeed(entitySet, null);
    } catch (EntityProviderException e) {
      assertEquals(ERROR_MSG, e.getMessage());
    }
  }

  @Test
  public void feedWithMetadata() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
    EntityCollection teamsData = new EntityCollection();
    Entity team1Data = new Entity();
    team1Data.addProperty("Id", "1");
    team1Data.addProperty("isScrumTeam", true);
    team1Data.setWriteProperties(EntitySerializerProperties.
        serviceRoot(URI.create(BASE_URI)).includeMetadata(true).build());
    Entity team2Data = new Entity();
    team2Data.addProperty("Id", "2");
    team2Data.addProperty("isScrumTeam", false);
    teamsData.addEntity(team1Data);
    teamsData.addEntity(team2Data);
    teamsData.setCollectionProperties(EntityCollectionSerializerProperties.
        serviceRoot(URI.create(BASE_URI)).build());

    final ODataResponse response = new JsonSerializerDeserializer().writeFeed(entitySet, teamsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"__metadata\":{\"id\":\"http://host:80/service/Teams('1')\","
        + "\"uri\":\"http://host:80/service/Teams('1')\",\"type\":\"RefScenario.Team\"},"
        + "\"Id\":\"1\",\"isScrumTeam\":true},{\"Id\":\"2\",\"isScrumTeam\":false}]}",
        json);
  }

  @Test
  public void feedWithGlobalEntityProperties() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
    EntityCollection teamsData = new EntityCollection();
    Entity team1Data = new Entity();
    team1Data.addProperty("Id", "1");
    team1Data.addProperty("isScrumTeam", true);
    Entity team2Data = new Entity();
    team2Data.addProperty("Id", "2");
    team2Data.addProperty("isScrumTeam", false);
    teamsData.addEntity(team1Data);
    teamsData.addEntity(team2Data);
    teamsData.setCollectionProperties(EntityCollectionSerializerProperties.serviceRoot(URI.create(BASE_URI)).build());
    teamsData.setGlobalEntityProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        includeMetadata(true).build());

    final ODataResponse response = new JsonSerializerDeserializer().writeFeed(entitySet, teamsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"__metadata\":{\"id\":\"http://host:80/service/Teams('1')\","
        + "\"uri\":\"http://host:80/service/Teams('1')\",\"type\":\"RefScenario.Team\"},"
        + "\"Id\":\"1\",\"isScrumTeam\":true},{\"__metadata\":"
        + "{\"id\":\"http://host:80/service/Teams('2')\",\"uri\":"
        + "\"http://host:80/service/Teams('2')\",\"type\":\"RefScenario.Team\"},"
        + "\"Id\":\"2\",\"isScrumTeam\":false}]}",
        json);
  }

  @Test
  public void feedWithPropertiesForEveryEntry() throws Exception {
    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
    EntityCollection teamsData = new EntityCollection();
    Entity team1Data = new Entity();
    team1Data.addProperty("Id", "1");
    team1Data.addProperty("isScrumTeam", true);
    team1Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        includeMetadata(true).build());
    Entity team2Data = new Entity();
    team2Data.addProperty("Id", "2");
    team2Data.addProperty("isScrumTeam", false);
    team2Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        includeMetadata(true).build());
    teamsData.addEntity(team1Data);
    teamsData.addEntity(team2Data);
    teamsData.setCollectionProperties(EntityCollectionSerializerProperties.serviceRoot(URI.create(BASE_URI)).build());

    final ODataResponse response = new JsonSerializerDeserializer().writeFeed(entitySet, teamsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"__metadata\":{\"id\":\"http://host:80/service/Teams('1')\","
        + "\"uri\":\"http://host:80/service/Teams('1')\",\"type\":\"RefScenario.Team\"},"
        + "\"Id\":\"1\",\"isScrumTeam\":true},{\"__metadata\":"
        + "{\"id\":\"http://host:80/service/Teams('2')\",\"uri\":"
        + "\"http://host:80/service/Teams('2')\",\"type\":\"RefScenario.Team\"},"
        + "\"Id\":\"2\",\"isScrumTeam\":false}]}",
        json);
  }

  @Test
  public void unbalancedPropertyFeedWithInlineFeed() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    EntityCollection roomsData = new EntityCollection();
    Entity room1Data = new Entity();
    room1Data.addProperty("Id", "1");
    room1Data.addProperty("Name", "Neu Schwanstein");
    room1Data.addProperty("Seats", new Integer(20));
    room1Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(true).build());

    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);

    room1Data.addNavigation("nr_Employees", innerData);
    roomsData.addEntity(room1Data);

    Entity room2Data = new Entity();
    room2Data.addProperty("Id", "2");
    room2Data.addProperty("Name", "John");
    room2Data.addProperty("Seats", new Integer(10));
    room2Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(true).build());

    innerData = new EntityCollection();
    data = new Entity();
    data.addProperty("EmployeeId", "2");
    data.addProperty("EmployeeName", "EmpName2");
    data.addProperty("RoomId", "2");
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("EmployeeId", "2");
    data.addProperty("RoomId", "2");
    innerData.addEntity(data);

    room2Data.addNavigation("nr_Employees", innerData);
    roomsData.addEntity(room2Data);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeFeed(entitySet, roomsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,"
        + "\"nr_Employees\":[{\"EmployeeId\":\"1\",\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},"
        + "{\"EmployeeId\":\"1\",\"RoomId\":\"1\"}]},"
        + "{\"Id\":\"2\",\"Name\":\"John\",\"Seats\":10,"
        + "\"nr_Employees\":[{\"EmployeeId\":\"2\",\"EmployeeName\":\"EmpName2\",\"RoomId\":\"2\"},"
        + "{\"EmployeeId\":\"2\",\"RoomId\":\"2\"}]}]}", json);
  }

  @Test
  public void unbalancedPropertyFeedWithInlineFeedAndNavigationLink() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    EntityCollection roomsData = new EntityCollection();
    Entity room1Data = new Entity();
    room1Data.addProperty("Id", "1");
    room1Data.addProperty("Name", "Neu Schwanstein");
    room1Data.addProperty("Seats", new Integer(20));
    room1Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(true).build());

    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("EmployeeId", "1");
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);

    room1Data.addNavigation("nr_Employees", innerData);
    Map<String, Object> link1 = new HashMap<String, Object>();
    link1.put("Id", 1);
    room1Data.addNavigation("nr_Building", link1);
    roomsData.addEntity(room1Data);

    Entity room2Data = new Entity();
    room2Data.addProperty("Id", "2");
    room2Data.addProperty("Name", "John");
    room2Data.addProperty("Seats", new Integer(10));
    room2Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(true).build());

    innerData = new EntityCollection();
    data = new Entity();
    data.addProperty("EmployeeId", "2");
    data.addProperty("EmployeeName", "EmpName2");
    data.addProperty("RoomId", "2");
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("EmployeeId", "2");
    data.addProperty("RoomId", "2");
    innerData.addEntity(data);

    room2Data.addNavigation("nr_Employees", innerData);
    Map<String, Object> link2 = new HashMap<String, Object>();
    link2.put("Id", 2);
    room2Data.addNavigation("nr_Building", link2);
    roomsData.addEntity(room2Data);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeFeed(entitySet, roomsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,"
        + "\"nr_Employees\":[{\"EmployeeId\":\"1\",\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},"
        + "{\"EmployeeId\":\"1\",\"RoomId\":\"1\"}],\"nr_Building\":{\"__deferred\":"
        + "{\"uri\":\"http://host:80/service/Buildings('1')\"}}},"
        + "{\"Id\":\"2\",\"Name\":\"John\",\"Seats\":10,"
        + "\"nr_Employees\":[{\"EmployeeId\":\"2\",\"EmployeeName\":\"EmpName2\",\"RoomId\":\"2\"},"
        + "{\"EmployeeId\":\"2\",\"RoomId\":\"2\"}],\"nr_Building\":{\"__deferred\":"
        + "{\"uri\":\"http://host:80/service/Buildings('2')\"}}}]}", json);
  }

  @Test
  public void unbalancedPropertyFeedWithInlineEntryAndNavigationLink() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    EntityCollection roomsData = new EntityCollection();
    Entity room1Data = new Entity();
    room1Data.addProperty("Id", "1");
    room1Data.addProperty("Name", "Neu Schwanstein");
    room1Data.addProperty("Seats", new Integer(20));
    room1Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(true).build());

    Map<String, Object> link1 = new HashMap<String, Object>();
    link1.put("Id", 1);
    room1Data.addNavigation("nr_Building", link1);
    roomsData.addEntity(room1Data);

    Entity room2Data = new Entity();
    room2Data.addProperty("Id", "2");
    room2Data.addProperty("Name", "John");
    room2Data.addProperty("Seats", new Integer(10));
    room2Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(true).build());

    Entity data = new Entity();
    data.addProperty("Id", "2");
    data.addProperty("Name", "Team2");

    room2Data.addNavigation("nr_Building", data);
    roomsData.addEntity(room2Data);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeFeed(entitySet, roomsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"Id\":\"1\",\"Name\":\"Neu Schwanstein\",\"Seats\":20,"
        + "\"nr_Building\":{\"__deferred\":{\"uri\":\"http://host:80/service/Buildings('1')\"}}},"
        + "{\"Id\":\"2\",\"Name\":\"John\",\"Seats\":10,\"nr_Building\":"
        + "{\"Id\":\"2\",\"Name\":\"Team2\"}}]}", json);
  }

  @Test
  public void unbalancedPropertyFeedWithInlineFeedAndNavigationLinkWithoutKeys() throws Exception {
    Edm edm = MockFacade.getMockEdm();
    EdmTyped imageUrlProperty = edm.getEntityType("RefScenario", "Employee").getProperty("ImageUrl");
    EdmFacets facets = mock(EdmFacets.class);
    when(facets.getMaxLength()).thenReturn(1);
    when(((EdmProperty) imageUrlProperty).getFacets()).thenReturn(facets);

    EntityCollection roomsData = new EntityCollection();
    Entity room1Data = new Entity();
    room1Data.addProperty("Name", "Neu Schwanstein");
    room1Data.addProperty("Seats", new Integer(20));
    room1Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(false).isKeyAutoGenerated(true).build());

    EntityCollection innerData = new EntityCollection();
    Entity data = new Entity();
    data.addProperty("EmployeeName", "EmpName1");
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("RoomId", "1");
    innerData.addEntity(data);

    room1Data.addNavigation("nr_Employees", innerData);
    Map<String, Object> link1 = new HashMap<String, Object>();
    link1.put("Id", 1);
    room1Data.addNavigation("nr_Building", link1);
    roomsData.addEntity(room1Data);

    Entity room2Data = new Entity();
    room2Data.addProperty("Name", "John");
    room2Data.addProperty("Seats", new Integer(10));
    room2Data.setWriteProperties(EntitySerializerProperties.serviceRoot(URI.create(BASE_URI)).
        validatingFacets(false).isKeyAutoGenerated(true).build());

    innerData = new EntityCollection();
    data = new Entity();
    data.addProperty("EmployeeName", "EmpName2");
    data.addProperty("RoomId", "2");
    innerData.addEntity(data);

    data = new Entity();
    data.addProperty("RoomId", "2");
    innerData.addEntity(data);

    room2Data.addNavigation("nr_Employees", innerData);
    Map<String, Object> link2 = new HashMap<String, Object>();
    link2.put("Id", 2);
    room2Data.addNavigation("nr_Building", link2);
    roomsData.addEntity(room2Data);

    EdmEntitySet entitySet = edm.getDefaultEntityContainer().getEntitySet("Rooms");
    final ODataResponse response =
        new JsonSerializerDeserializer().writeFeed(entitySet, roomsData);
    assertNotNull(response);
    assertNotNull(response.getEntity());

    final String json = StringHelper.inputStreamToString((InputStream) response.getEntity());
    assertNotNull(json);
    assertEquals("{\"results\":[{\"Name\":\"Neu Schwanstein\",\"Seats\":20,"
        + "\"nr_Employees\":[{\"EmployeeName\":\"EmpName1\",\"RoomId\":\"1\"},"
        + "{\"RoomId\":\"1\"}],\"nr_Building\":{\"__deferred\":"
        + "{\"uri\":\"http://host:80/service/Buildings('1')\"}}},"
        + "{\"Name\":\"John\",\"Seats\":10,"
        + "\"nr_Employees\":[{\"EmployeeName\":\"EmpName2\",\"RoomId\":\"2\"},"
        + "{\"RoomId\":\"2\"}],\"nr_Building\":{\"__deferred\":"
        + "{\"uri\":\"http://host:80/service/Buildings('2')\"}}}]}", json);
  }

}


text:
/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package baptest;

import BESA.Kernel.System.AdmBESA;
import BESA.Log.ReportBESA;

/**
 *
 * @author fabianjose
 */
public class BAPMain {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        AdmBESA admLocal = AdmBESA.getInstance("res/BAPContainer.xml");
        ReportBESA.info(admLocal.getAdmHandler().getAlias() + " [OK].");
    }
}


text:
using MasterDevs.ChromeDevTools;

namespace MasterDevs.ChromeDevTools.Protocol.Tracing
{
	/// <summary>
	/// Signals that tracing is stopped and there is no trace buffers pending flush, all data were delivered via dataCollected events.
	/// </summary>
	[Event(ProtocolName.Tracing.TracingComplete)]
	public class TracingCompleteEvent
	{
	}
}


text:
using System;

enum Color
{
    Black       = ConsoleColor.Black,
    DarkBlue    = ConsoleColor.DarkBlue,
    DarkGreen   = ConsoleColor.DarkGreen,
    DarkCyan    = ConsoleColor.DarkCyan,
    DarkRed     = ConsoleColor.DarkRed,
    DarkMagenta = ConsoleColor.DarkMagenta,
    DarkYellow  = ConsoleColor.DarkYellow,
    Gray        = ConsoleColor.Gray,
    DarkGray    = ConsoleColor.DarkGray,
    Blue        = ConsoleColor.Blue,
    Green       = ConsoleColor.Green,
    Cyan        = ConsoleColor.Cyan,
    Red         = ConsoleColor.Red,
    Magenta     = ConsoleColor.Magenta,
    Yellow      = ConsoleColor.Yellow,
    White       = ConsoleColor.White,
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Ceratocystis bacillospora Butin & G. Zimm.

### Remarks
null


text:
require 'autoparts/packages/php5_ext'

module Autoparts
  module Packages
    class Php5Phalcon < Package
      include Php5Ext

      name 'php5-phalcon'
      version '2.0.0'
      description 'Phalcon web framework.'
      source_url 'https://github.com/phalcon/cphalcon/archive/phalcon-v2.0.0.tar.gz'
      source_sha1 '118d17b285b03f1895db973a7836d93a56239f7e'
      source_filetype 'tar.gz'
      category Category::WEB_DEVELOPMENT

      depends_on 'php5'

      def php_extension_name
         "phalcon"
      end

      def php_extension_dir
         "cphalcon-phalcon-v2.0.0/build/64bits"
      end

      def php_compile_args
         ['--enable-phalcon']
      end
    end
  end
end


text:
std::string from_hex( const std::string &h );
std::string parse_mac( const std::string &opt );
std::string parse_option( const std::string &opt );
std::string print_options( const std::string &opt );


text:
import { Routes, RouterModule } from "@angular/router";
import { AppComponent } from './app.component';
import { ContatoComponent } from './contato/contato.component';
import { MenuHoverComponent } from './menu-hover/menu-hover.component'

const APP_ROUTES: Routes = [
    {path: '', component: MenuHoverComponent, pathMatch: 'full'},
    {path: 'contato', component: ContatoComponent}
];

export const routing = RouterModule.forRoot(APP_ROUTES);


text:
package fortunedog.mail.reflow;

import static net.htmlparser.jericho.HTMLElementName.BODY;
import static net.htmlparser.jericho.HTMLElementName.HEAD;
import static net.htmlparser.jericho.HTMLElementName.LINK;

import java.util.Map;
import java.util.TreeMap;

import net.htmlparser.jericho.Attribute;
import net.htmlparser.jericho.Attributes;
import net.htmlparser.jericho.HTMLElementName;
import net.htmlparser.jericho.StartTag;
import net.htmlparser.jericho.Tag;

/**
 *
 * ¹ýÂËPowerPointÉú³ÉµÄhtml 1, °Ñ<div id=SlideObj ÀïÃæµÄvisibility:hiddenÈ¥µô, ±£Ö¤¿ÉÒÔÏÔʾ 2,
 * °Ñ½Å±¾script¶¼É¾µô 3. v:shape µÈ£¬ËùÓбêÇ©µÄo:gfxdataÊôÐÔɾµô ppt html,È¥µô


text:
package by.serzh.airnavigationdrawer;

public interface OpeningPercentListener {
	void onOpeningPercentUpdate(float percent);
}


text:
import DS from 'ember-data';
import BackboneElement from 'ember-fhir/models/backbone-element';

const { attr, belongsTo, hasMany } = DS;

export default BackboneElement.extend({
  identifier: hasMany('identifier', { async: true }),
  description: attr('string'),
  type_: belongsTo('codeable-concept', { async: false }),
  capacity: belongsTo('quantity', { async: false }),
  specimenQuantity: belongsTo('quantity', { async: false }),
  additiveCodeableConcept: belongsTo('codeable-concept', { async: false }),
  additiveReference: belongsTo('reference', { async: false })
});


text:
"""Helper functions for decoding Viterbi sequences outside of Tensorflow.

viterbi_decode provides known-tested snippets for Viterbi decoding in log and
standard space for use outside of a Tensorflow graph.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import numpy as np

def decode(score,
           transition_params=None,
           allowed_transitions=None,
           use_log_space=True,
           use_start_and_end_states=False):
  """Decode the highest scoring sequence of tags.

  This function uses numpy instead of Tensorflow ops, and so cannot be used
  inside a Tensorflow graph or function.

  Args:
    score: A [seq_len, num_tags] matrix of unary potentials.
    transition_params: A [num_tags, num_tags] matrix of binary potentials.
    allowed_transitions: A [num_tags, num_tags] matrix where FALSE indicates
      a transition that cannot be taken.
    use_log_space: Whether to perform the Viterbi calculation in logarithmic
      space.
    use_start_and_end_states: If True, add an implicit 'start' and 'end' state
      to the start and end of the given sequence. If this is True,
      transition_params should contain an extra row and column, representing
      potentials for starting/ending a sequence with a given state. These values
      should occupy the outermost row and column of the transition_params
      matrix.

  Returns:
    viterbi: A [seq_len] list of integers containing the highest scoring tag
        indices.
    viterbi_score: A float containing the score for the Viterbi sequence.
  """
  if transition_params is None:
    num_tags = score.shape[-1]
    if use_log_space:
      transition_params = np.zeros(num_tags, num_tags)
    else:
      transition_params = np.ones(num_tags, num_tags)

  if allowed_transitions is not None:
    if use_log_space:
      transition_mask = np.where(allowed_transitions, 1, -float("inf"))
    else:
      transition_mask = np.where(allowed_transitions, 1, 0.0)

    transition_params = transition_params * transition_mask

  if use_log_space:
    return _decode_in_log_space(score, transition_params,
                                use_start_and_end_states)
  else:
    return _decode_in_exp_space(score, transition_params,
                                use_start_and_end_states)

def _decode_in_log_space(score, transition_params, use_start_and_end_states):
  """Perform Viterbi decoding in log space."""
  trellis = np.zeros_like(score)
  backpointers = np.zeros_like(score, dtype=np.int32)

  if use_start_and_end_states:
    start_potentials = transition_params[-1, :-1]
    end_potentials = transition_params[:-1, -1]
    transition_potentials = transition_params[:-1, :-1]
  else:
    transition_potentials = transition_params

  # Calculate the start value.
  if use_start_and_end_states:
    trellis[0] = score[0] + start_potentials
  else:
    trellis[0] = score[0]

  # Calculate intermediate values.
  for t in range(1, score.shape[0]):
    v = np.expand_dims(trellis[t - 1], 1) + transition_potentials
    trellis[t] = score[t] + np.max(v, 0)
    backpointers[t] = np.argmax(v, 0)

  # If we are using explicit start and end states, change the final scores
  # based on the final state's potentials.
  if use_start_and_end_states:
    final_scores = trellis[-1] + end_potentials
  else:
    final_scores = trellis[-1]

  viterbi = [np.argmax(final_scores)]
  for bp in reversed(backpointers[1:]):
    viterbi.append(bp[viterbi[-1]])
  viterbi.reverse()

  viterbi_score = np.max(final_scores)

  return viterbi, viterbi_score

def _decode_in_exp_space(score, transition_params, use_start_and_end_states):
  """Perform Viterbi decoding in exp space."""
  if np.any(transition_params < 0):
    raise ValueError("Transition params must be non-negative in exp space.")
  trellis = np.zeros_like(score)
  backpointers = np.zeros_like(score, dtype=np.int32)
  max_scores = np.zeros(score.shape[0])

  if use_start_and_end_states:
    start_potentials = transition_params[-1, :-1]
    end_potentials = transition_params[:-1, -1]
    transition_potentials = transition_params[:-1, :-1]
  else:
    transition_potentials = transition_params

  # Calculate the start value.
  if use_start_and_end_states:
    trellis[0] = score[0] * start_potentials
  else:
    trellis[0] = score[0]

  max_scores[0] = np.max(trellis[0])
  trellis[0] = trellis[0] / max_scores[0]

  # Calculate intermediate values.
  for t in range(1, score.shape[0]):
    v = np.expand_dims(trellis[t - 1], 1) * transition_potentials
    trellis[t] = score[t] * np.max(v, 0)
    backpointers[t] = np.argmax(v, 0)
    max_scores[t] = np.max(trellis[t])
    trellis[t] = trellis[t] / max_scores[t]

  # If we are using explicit start and end states, change the final scores
  # based on the final state's potentials.
  if use_start_and_end_states:
    final_scores = trellis[-1] * end_potentials
  else:
    final_scores = trellis[-1]

  viterbi = [np.argmax(final_scores)]
  for bp in reversed(backpointers[1:]):
    viterbi.append(bp[viterbi[-1]])
  viterbi.reverse()

  viterbi_score = np.max(final_scores) * np.prod(max_scores)
  return viterbi, viterbi_score


text:
Install_phpMyAdmin() {
  pushd ${asn_dir}/src
  tar xzf phpMyAdmin-${phpMyAdmin_version}-all-languages.tar.gz
  /bin/mv phpMyAdmin-${phpMyAdmin_version}-all-languages ${wwwroot_dir}/default/phpMyAdmin
  /bin/cp ${wwwroot_dir}/default/phpMyAdmin/{config.sample.inc.php,config.inc.php}
  mkdir ${wwwroot_dir}/default/phpMyAdmin/{upload,save}
  sed -i "s@UploadDir.*@UploadDir'\] = 'upload';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
  sed -i "s@SaveDir.*@SaveDir'\] = 'save';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
  sed -i "s@blowfish_secret.*;@blowfish_secret\'\] = \'$(cat /dev/urandom | head -1 | base64 | head -c 45)\';@" ${wwwroot_dir}/default/phpMyAdmin/config.inc.php
  chown -R ${run_user}.$run_user ${wwwroot_dir}/default/phpMyAdmin
  popd
}


text:
package skyranger.game.desktop;

import skyranger.game.MainGameClass;

public class DesktopLauncher {

	public static void main (String[] arg) {

		@SuppressWarnings("unused")
		LibgdxWSwtWindow mainClass = new LibgdxWSwtWindow(new MainGameClass());

		//when u dont need SWT winfow anymore, just uncomment this
//		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
//		new LwjglApplication(new MainGameClass(), config);

	}
}


text:
Agent Fabrics
=============

Prior to version 8.1, SHIELD only supported one method of agent
orchestration: an active SSH connection was made from the SHIELD
core every time a task needed executing.

This works great in single-segment networking, when address
translation is not in play.  However, as soon as the agent host
and the SHIELD Core are separated by one or more NAT devices, it
breaks down.

Starting with 8.1, we have abstracted this communication method
out from the core code, to allow alternate systems to be tried out
and implemented, based on site and operator need.  We call these
_fabrics_.

Each _fabric_ implements the `fabric.Fabric` interface, as defined
in `$src/core/fabric/fabric.go`:

    type Fabric interface {
        /* back up a target to a store, encrypt it,
           and optionally compress it. */
        Backup(*db.Task, vault.Parameters) scheduler.Chore

        /* restore an encrypted archive to a target. */
        Restore(*db.Task, vault.Parameters) scheduler.Chore

        /* check the status of the agent. */
        Status(*db.Task) scheduler.Chore

        /* purge an from cloud storage archive. */
        Purge(*db.Task) scheduler.Chore

        /* test the viability of a storage system. */
        TestStore(*db.Task) scheduler.Chore
    }

Each of these methods corresponds to a task type.

Configuring Fabrics
-------------------

With the exception of trivial fabrics (which we'll see in a
moment), all fabrics need some sort of configuration.  To
facilitate this, the SHIELD Core now has a top-level `fabrics:`
configuration directive that houses operator-provided details
about how the fabric in question should behave.

Here is an example configuration snippet, which provides the SSH
private key necessary for the Legacy (Active SSH) fabric to work:

    fabrics:
      - name: legacy
        ssh-key: |
          -----BEGIN RSA PRIVATE KEY-----
          MIIEpQIBAAKCAQEAw1G6CPhJ/+/6WdYGab80FeBU/ERxaYUY7GT3WHnsth1Pw77O
          ... etc. ...
          6JKLdAirjIQB7QVu8DtFFN6gnqrvD+roej55exRlKN8uAGo0VrCo3LQ=
          -----END RSA PRIVATE KEY-----

**Note**: each fabric has bespoke code in the SHIELD core module
to handle this configuration.  If a new fabric is added, the core
needs to be updated accordingly.

Fabric Selection
----------------

TBD

The Dummy Fabric
----------------

For _TESTING PURPOSES ONLY_, the Dummy Fabric implements mock
handlers for all task types.  The fabric as a whole can be
configured with a _delay_ parameter, which it uses to sleep during
task execution.  This can be quite handy for testing out the
SHIELD scheduler, since it slows down the normally fast-paced
scheduling and execution activities, so you can observe the
scheduler and its priority queue.

Configuration is as follows:

    fabrics:
      - name:  dummy
        delay: 15 # seconds

The Dummy Fabric is defined in `$src/core/fabric/dummy.go`.

The Error Fabric
----------------

The Error fabric exists mostly as an internal implementation
detail.  Operators should never configure this fabric in their
SHIELD cores.  Every method results in a failed task.

The Error Fabric is defined in `$src/core/fabric/error.go`.

The Legacy (Active SSH) Fabric
------------------------------

The Legacy Fabric provides the active SSH connection method of
agent orchestration that was built into SHIELD versions prior to
8.1.  Every task is executed across an SSH `exec` channel.

To configure the Legacy fabric, the SHIELD operator has to provide
the private SSH key to use for initiating connections to the
listening agents:

    fabrics:
      - name: legacy
        ssh-key: |
          ... an RSA private key, in PEM format ...

The Legacy Fabric is defined in `$src/core/fabric/legacy.go`.


text:
Porting [Porick](http://github.com/kopf/porick) to Flask

## Getting started
    $ mkvirtualenv porick-flask
    $ git clone https://github.com/stesh/porick-flask.git
    $ cd porick-flask
    $ pip install -r requirements.txt

## Running locally

* Create a file in `settings/` in which to store your settings, e.g. `settings/dev.py`
* Create `settings/__init__.py` with the contents: `from .dev import *`
(this allows you to have multiple sets of settings you can switch between easily)
* Fill your `dev.py` file with the settings detailed in `settings.example`
* `python runserver.py`

## Database setup

```
>>> from porick import db
>>> db.create_all()
```


text:
/*!
   \file iModuleIterator.h
   \brief Interface for an iterator for firmware modules on a LEGO MINDSTORMS NXT.
*/
/*
   © Copyright 2005-2006,
   National Instruments Corporation.
   All rights reserved.

   File:        iModuleIterator.h
   Originated:  8 Aug 2005
*/

#ifndef ___fantom_iModuleIterator_h___
#define ___fantom_iModuleIterator_h___

// includes...

#ifndef ___fantom_platform_h___
   #include "platform.h"
#endif

#ifndef ___fantom_iModule_h___
   #include "iModule.h"
#endif

#ifndef ___fantom_tStatus_h___
   #include "tStatus.h"
#endif

// defines...

namespace nFANTOM100
{
   // forward declarations...

   // typedefs...

   // classes...

   /*!
      \class iModuleIterator
      \brief Interface to an iterator for firmware modules on a LEGO MINDSTORMS NXT.
   */
   class iModuleIterator
   {
      friend class tNXT;

      // methods
      protected:

         //! Destructor
         virtual ~iModuleIterator() = 0;

      public:

         //! Creates a module object for the module referenced by this iterator.
         /*!
            Creates a module object for the module referenced by this iterator.  An object is not
               created if the specified status is fatal or if this iterator refers to the end of
               the list.  The returned module object should be destroyed using the
               iNXT::destroyModule method.

            \param status Status chaining object.
            \return A pointer to the iModule object that was created.
         */
         virtual iModule* getModule( tStatus& status ) = 0;

         //! Advances this iterator.
         /*!
            Advances this iterator to the next module that matches the previously specified
               module name pattern.  If no more modules match, this iterator is advanced to the
               end of the list.
            The iterator is not advanced if the specified status is fatal.
            If this iterator is already at the end of the list, a fatal status will be generated.

            \param status Status chaining object.
         */
         virtual void advance( tStatus& status ) = 0;

         //! Retrieves the name of the module to which this iterator refers.
         /*!
            \param moduleName Populated with the name of the module to which this iterator
               refers.  The module name character array must be able to accomodate a
               NULL-terminated, 15.3 formatted module name.  This is, it must have a capacity of
               20 bytes.
            \param status Status chaining object.
         */
         virtual void getName( ViChar moduleName[], tStatus& status ) = 0;

   };

   // constants...

} // namespace nFANTOM100

   // declarations for globally-scoped globals...

   // typedefs
   typedef ViObject nFANTOM100_iModuleIterator;

   extern "C"
   {
      nFANTOM100_kExport nFANTOM100_iModule _VI_FUNCC nFANTOM100_iModuleIterator_getModule(
            nFANTOM100_iModuleIterator iteratorPtr,
            ViStatus* status );

      nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModuleIterator_advance(
            nFANTOM100_iModuleIterator iteratorPtr,
            ViStatus* status );

      nFANTOM100_kExport void _VI_FUNCC nFANTOM100_iModuleIterator_getName(
            nFANTOM100_iModuleIterator iteratorPtr,
            ViChar moduleName[],
            ViStatus* status );
   }

#endif // ___fantom_iModuleIterator_h___


text:
package com.ibm.websphere.samples.daytrader.web;

import javax.servlet.*;
import javax.servlet.annotation.WebListener;

import com.ibm.websphere.samples.daytrader.direct.*;
import com.ibm.websphere.samples.daytrader.util.*;

@WebListener()
public class TradeWebContextListener
	implements ServletContextListener
{

	//receieve trade web app startup/shutown events to start(initialized)/stop TradeDirect
	public void contextInitialized(ServletContextEvent event)
	{
		Log.trace("TradeWebContextListener contextInitialized -- initializing TradeDirect");
		TradeDirect.init();
	}
	public void contextDestroyed(ServletContextEvent event)
	{
		Log.trace("TradeWebContextListener  contextDestroy calling TradeDirect:destroy()");
		//TradeDirect.destroy();
	}

}


text:
"""This service updates project's edition and build dashboards."""

from __future__ import annotations

from pathlib import PurePosixPath
from typing import TYPE_CHECKING, Any

import boto3
from ltdconveyor.s3 import upload_dir
from structlog import get_logger

from keeper import fastly
from keeper.dashboard.context import Context
from keeper.dashboard.templateproviders import BuiltinTemplateProvider
from keeper.s3 import (
    open_s3_resource,
    upload_dir_redirect_object,
    upload_object,
)

if TYPE_CHECKING:
    from keeper.models import Product

__all__ = ["build_dashboard"]

logger = get_logger(__name__)

def build_dashboard(product: Product, logger: Any) -> None:
    """Build a dashboard (run from a Celery task)."""
    logger.debug("In build_dashboard service function.")

    organization = product.organization

    aws_id = organization.aws_id
    aws_secret = organization.get_aws_secret_key()
    aws_region = organization.get_aws_region()
    use_public_read_acl = organization.get_bucket_public_read()

    fastly_service_id = organization.fastly_service_id
    fastly_key = organization.get_fastly_api_key()

    # Render dashboards using the built-in dashboard template provider;
    # eventually we'll add the ability to get templates from a configured
    # S3 bucket location.
    context = Context.create(product)
    template_provider = BuiltinTemplateProvider()
    edition_html = template_provider.render_edition_dashboard(
        project_context=context.project_context,
        edition_contexts=context.edition_contexts,
    )
    build_html = template_provider.render_build_dashboard(
        project_context=context.project_context,
        build_contexts=context.build_contexts,
    )

    if aws_id is not None and aws_secret is not None:
        s3_service = open_s3_resource(
            key_id=aws_id,
            access_key=aws_secret.get_secret_value(),
            aws_region=aws_region,
        )

        upload_dir(
            product.organization.bucket_name,
            f"{product.slug}/_dashboard-assets",
            str(template_provider.static_dir),
            upload_dir_redirect_objects=True,
            surrogate_key=product.surrogate_key,
            surrogate_control="max-age=31536000",
            cache_control="no-cache",
            acl="public-read" if use_public_read_acl else None,
            aws_access_key_id=aws_id,
            aws_secret_access_key=aws_secret.get_secret_value(),
        )

        upload_dashboard_html(
            html=edition_html,
            key="v/index.html",
            product=product,
            s3_service=s3_service,
        )
        upload_dashboard_html(
            html=build_html,
            key="builds/index.html",
            product=product,
            s3_service=s3_service,
        )

    else:
        logger.warning(
            "Skipping dashboard uploads because AWS credentials are not set"
        )

    if (
        organization.fastly_support
        and fastly_service_id is not None
        and fastly_key is not None
    ):
        logger.info("Starting Fastly purge_key")
        fastly_service = fastly.FastlyService(
            fastly_service_id, fastly_key.get_secret_value()
        )
        fastly_service.purge_key(product.surrogate_key)
        logger.info("Finished Fastly purge_key")
    else:
        logger.warning("Skipping Fastly purge because credentials are not set")

def upload_dashboard_html(
    *,
    html: str,
    key: str,
    product: Product,
    s3_service: boto3.resources.base.ServiceResource,
) -> None:
    organization = product.organization
    use_public_read_acl = organization.get_bucket_public_read()
    bucket = s3_service.Bucket(organization.bucket_name)

    if not key.startswith("/"):
        key = f"/{key}"

    object_path = f"{product.slug}{key}"
    logger.debug("Object path for html upload", path=object_path)

    # Have Fastly cache the dashboard for a year (or until purged)
    metadata = {
        "surrogate-key": product.surrogate_key,
        "surrogate-control": "max-age=31536000",
    }
    acl = "public-read" if use_public_read_acl else None
    # Have the *browser* never cache the dashboard
    cache_control = "no-cache"

    # Upload HTML object
    upload_object(
        bucket_path=object_path,
        bucket=bucket,
        content=html,
        metadata=metadata,
        acl=acl,
        cache_control=cache_control,
        content_type="text/html",
    )

    # Upload directory redirect object
    bucket_dir_path = str(PurePosixPath(object_path).parent)
    upload_dir_redirect_object(
        bucket_dir_path=bucket_dir_path,
        bucket=bucket,
        metadata=metadata,
        acl=acl,
        cache_control=cache_control,
    )


text:
goog.provide('lime.Renderer.DOM');

goog.require('goog.dom');
goog.require('lime.Renderer');
goog.require('lime.style');

/**
 * DOM renderer. This renders as div dom elements and
 * styles are added with CSS
 * @const
 * @type {lime.Renderer}
 */
lime.Renderer.DOM = new lime.Renderer();

/**
 * Update the DOM tree relations of the element.
 * @this {lime.Node}
 */
lime.Renderer.DOM.updateLayout = function() {
    var j = 0, el;
    for (var i = 0, child; child = this.children_[i]; i++) {
        el = child instanceof lime.Node ? child.rootElement : child;

        if (el == this.domElement.childNodes[j]) {
            j++;
            continue;
        }
        else {
            if (goog.dom.contains(this.containerElement, el)) {
                goog.dom.removeNode(el);
            }
            lime.Renderer.DOM.appendAt_(this.containerElement, el, j++);
            continue;
        }
    }

   /* var lastIndex = this.containerElement.childNodes.length - 1;
    while (lastIndex >= j) {
        goog.dom.removeNode(this.containerElement.childNodes[lastIndex]);
        lastIndex--;
    }*/
};

/**
 * Calculate the size and position of the element and draw it
 * @this {lime.Node}
 */
lime.Renderer.DOM.drawSizePosition = function() {
    var size = this.getSize(),
       quality = this.getQuality(),
       position = this.getPosition(),
       rquality = this.relativeQuality_ || 1;

    if (this.transitionsActive_[lime.Transition.POSITION]) {
        position = this.transitionsActive_[lime.Transition.POSITION];
    }

    var width = Math.round(size.width * rquality);
    var height = Math.round(size.height * rquality);

    var realScale = this.getScale().clone();
    if (this.transitionsActive_[lime.Transition.SCALE]) {
        realScale = this.transitionsActive_[lime.Transition.SCALE].clone();
    }
    if (width != 0) realScale.scale(size.width / (width * quality / rquality));
    else realScale.scale(1 / quality);

    lime.style.setSize(this.domElement, width, height);

    lime.style.setTransformOrigin(this.domElement,
        this.anchorPoint_.x * 100, this.anchorPoint_.y * 100, true);

    var ax = this.anchorPoint_.x * size.width * rquality;
    var ay = this.anchorPoint_.y * size.height * rquality;

    var px = position.x * rquality / quality - ax,
        py = position.y * rquality / quality - ay;

    var so = this.stroke_ ? this.stroke_.width_ : 0;

    if (((ax-so) != 0 || (ay-so) != 0) && this.domElement == this.containerElement &&
            this.children_.length) {
        lime.Renderer.DOM.makeContainer.call(this);
    }

    if (this.domElement != this.containerElement) {
        if (!this.transitionsActiveSet_[lime.Transition.POSITION] && !this.transitionsActiveSet_[lime.Transition.SCALE] && !this.transitionsActiveSet_[lime.Transition.ROTATION])
        lime.style.setTransform(this.containerElement,
                new lime.style.Transform().translate(ax-so, ay-so));
    }

    if (this.mask_ != this.activeMask_) {
        if (this.activeMask_) {
            lime.Renderer.DOM.removeMask.call(this);
        }

        if (this.mask_) {
            lime.Renderer.DOM.addMask.call(this);
        }
    }

    var transform = new lime.style.Transform().setPrecision(.1);

    if (this.mask_) {
      lime.Renderer.DOM.calculateMaskPosition.call(this.mask_);
       transform.setPrecision(.1).
            translate(-this.mask_.mX - ax, -this.mask_.mY - ay).
            rotate(this.mask_.mRot, 'rad').translate(ax, ay).setPrecision(1);
    }

    var rotation = -this.getRotation();
    if (goog.isDef(this.transitionsActive_[lime.Transition.ROTATION])) {
        rotation = -this.transitionsActive_[lime.Transition.ROTATION];
    }

    transform.translate(px, py).scale(realScale.x, realScale.y).
        rotate(rotation);

    if (!this.transitionsActiveSet_[lime.Transition.POSITION] && !this.transitionsActiveSet_[lime.Transition.SCALE] && !this.transitionsActiveSet_[lime.Transition.ROTATION]) {
       //     console.log('transform',this.transition_position_set_,this.transition_position_);
        lime.style.setTransform(this.domElement, transform);
    }

};

/**
 * Update nodes dirty values and call draw after
 * @this {lime.Node}
 */
lime.Renderer.DOM.update = function() {
    if (!this.domElement) return;

    lime.Renderer.DOM.drawSizePosition.call(this);

    if (!this.transitionsActiveSet_[lime.Transition.OPACITY]) {
        var opacity = this.opacity_;
        if (goog.isDef(this.transitionsActive_[lime.Transition.OPACITY])) {
            opacity = this.transitionsActive_[lime.Transition.OPACITY];
        }
        if (this.getDirty() & lime.Dirty.ALPHA) {
            goog.style.setOpacity(this.domElement, opacity);
        }
    }

    if (this.getDirty() & lime.Dirty.VISIBILITY) {
        this.domElement.style['display'] = this.hidden_ ? 'none' : 'block';
    }

    if(!this.maskTarget_)
    this.renderer.draw.call(this, this.domElement);

};

/**
 * Update the mask changes to reflect on the element
 * @this {lime.Node}
 */
lime.Renderer.DOM.calculateMaskPosition = function() {

    if (!goog.isDef(this.targetNode) || !this.targetNode.inTree_) return;

    var target = this.targetNode;
    //todo: replace with bounds method
    var bb = this.getFrame();
    var tl = new goog.math.Coordinate(bb.left, bb.top);
    var tr = new goog.math.Coordinate(bb.right, bb.top);
    var br = new goog.math.Coordinate(bb.right, bb.bottom);

    var targetParent = target.getParent();

    tl = this.localToNode(tl, targetParent);
    tr = this.localToNode(tr, targetParent);
    br = this.localToNode(br, targetParent);
    /*
    console.log('tl: '+tl.x+' '+tl.y);
    console.log('tr: '+tr.x+' '+tr.y);
    console.log('br: '+br.x+' '+br.y);
    */
    var rot = Math.atan2(tl.y - tr.y, tr.x - tl.x);

    var x1 = tr.x - tl.x;
    var y1 = tl.y - tr.y;

    var x2 = br.x - tr.x;
    var y2 = br.y - tr.y;

    var cos = Math.cos(rot);
    var sin = Math.sin(rot);

    this.mWidth = Math.round(Math.sqrt(x1 * x1 + y1 * y1));
    this.mHeight = Math.round(Math.sqrt(x2 * x2 + y2 * y2));

    if (target.renderer.getType() == lime.Renderer.DOM) {
        var el = target.rootElement;

        //todo: can be optimized
        goog.style.setSize(el, this.mWidth, this.mHeight);

        lime.style.setTransform(el, new lime.style.Transform().setPrecision(.1).
            translate(tl.x, tl.y).rotate(-rot, 'rad'));
    }

    if (this.renderer.getType() == lime.Renderer.DOM) {
       this.domElement.style['display'] = 'none';
    }

    this.mPos = target.parentToLocal(tl.clone());

    this.mSet = true;
    this.mX = cos * tl.x - sin * tl.y;
    this.mY = cos * tl.y + sin * tl.x;
    this.mRot = rot;
/*
    target.setDirty(lime.Dirty.POSITION);
    target.update();
*/

};

/**
 * Helper function to add DOM node to the specific position
 * as a child.
 * @param {Object} p Parent DOM element.
 * @param {Object} c Child DOM element.
 * @param {number} opt_pos Position of the child.
 * @private
 */
lime.Renderer.DOM.appendAt_ = function(p, c, opt_pos) {
    if (opt_pos == undefined || p.childNodes.length <= opt_pos)
        p.appendChild(c);
    else
        p.insertBefore(c, p.childNodes[opt_pos]);
};

/**
 * Make separate container element for the childnodes
 * @this {lime.Node}
 */
lime.Renderer.DOM.makeContainer = function() {
    this.containerElement = goog.dom.createDom('div');
    var fragment = document.createDocumentFragment(),
        child;
    while ((child = this.domElement.firstChild)) {
       this.domElement.removeChild(child);
       fragment.appendChild(child);
    }
    this.containerElement.appendChild(fragment);
    this.domElement.appendChild(this.containerElement);
};

/**
 * Remove mask element relations
 * @this {lime.Node}
 */
lime.Renderer.DOM.removeMask = function() {
    if (this.domElement == this.rootElement) return;
    if (this.renderer.getType() == lime.Renderer.DOM) {
        goog.dom.removeNode(this.domElement);
        goog.dom.replaceNode(this.domElement, this.rootElement);
        this.rootElement = this.domElement;
    }
    this.activeMask_.isMask = 0;
    this.activeMask_ = null;
};

/**
 * Add mask element and make its relations
 * @this {lime.Node}
 */
lime.Renderer.DOM.addMask = function() {
    if (this.renderer.getType() == lime.Renderer.DOM) {
        this.rootElement = goog.dom.createDom('div');
        this.rootElement.style.cssText = 'position:absolute;overflow:hidden;';
        //todo: combine into css class
        lime.style.setTransformOrigin(this.rootElement,0,0);
        goog.dom.replaceNode(this.rootElement, this.domElement);
        this.rootElement.appendChild(this.domElement);
    }

    this.mask_.isMask = 1;
    this.mask_.targetNode = this;
    this.activeMask_ = this.mask_;
    this.mask_.setDirty(lime.Dirty.POSITION);
};


text:
> `npm install --save @types/bluebird`

# Summary
This package contains type definitions for bluebird (https://github.com/petkaantonov/bluebird).

# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bluebird

Additional Details
 * Last updated: Mon, 26 Jun 2017 14:01:14 GMT
 * Dependencies: none
 * Global values: none

# Credits
These definitions were written by Leonard Hecker <https://github.com/lhecker>.


text:
<?php

namespace backend\modules\ranap\models;

use Yii;

/**
 * This is the model class for table "dokter".
 *
 * @property integer $id_dokter
 * @property string $nama_dokter
 * @property string $spesialis
 * @property string $posisi
 *
 * @property ApotikResep[] $apotikReseps
 * @property RanapRawatInap[] $ranapRawatInaps
 * @property RanapTindakan[] $ranapTindakans
 */
class Dokter extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'dokter';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['nama_dokter', 'spesialis', 'posisi'], 'required'],
            [['nama_dokter'], 'string', 'max' => 100],
            [['spesialis'], 'string', 'max' => 50],
            [['posisi'], 'string', 'max' => 7],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id_dokter' => 'Id Dokter',
            'nama_dokter' => 'Nama Dokter',
            'spesialis' => 'Spesialis',
            'posisi' => 'Posisi',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getApotikReseps()
    {
        return $this->hasMany(ApotikResep::className(), ['id_dokter' => 'id_dokter']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getRanapRawatInaps()
    {
        return $this->hasMany(RanapRawatInap::className(), ['kode_dokter' => 'id_dokter']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getRanapTindakans()
    {
        return $this->hasMany(RanapTindakan::className(), ['kode_dokter' => 'id_dokter']);
    }
}


text:
Creating the Simulator Plugin
===========================
This section will show how we can integrate the OpenModelica compiler (OMC) with the webgme. The example shown here is
of course quite specific to Modelica, still the main takeaway is the pattern which can be reused for many
analysis tools in general.

Calling OMC from cmd/shell
---------------------------
Download and install the open-source Modelica modeling and simulation environment
`OpenModelica <https://openmodelica.org/>`_. After the installation make sure the following command is working from an
arbitrary directory.

Windows
    ``> %OPENMODELICAHOME%\bin\omc.exe --help``

Linux/Mac
    ``$ omc --help``

OpenModelica supports scripting of model-editing and simulation via `mos scripts <https://build.openmodelica.org/Documentation/OpenModelica.Scripting.html>`_.
From the ``--help`` output we see that these can be invoked by the command:

.. code-block:: bash

    omc Script.mos           will run the commands from Script.mos.

The following mos code will load and simulate a circuit model and store the results in ``aCircuit_res.csv`` (details about
the functions used is documented `here <https://build.openmodelica.org/Documentation/OpenModelica.Scripting.html>`_.)

.. code-block:: Java

    // Load Modelica Standard Library (MSL).
    loadModel(Modelica); getErrorString();
    // Load the generated circuit model.
    loadFile("aCircuit.mo"); getErrorString();
    // Simulate the model and generate the output as an csv file.
    simulate(aCircuit, startTime=0.0, stopTime=1.0, outputFormat= "csv"); getErrorString();

Save the code snippet above in ``simulate.mos`` and place the generated ``aCircuit.mo`` file in the same directory.
Providing you used the same name for your circuit confirm that the following command works and indeed generates the
result file.

Windows
    ``> %OPENMODELICAHOME%\bin\omc.exe simulate.mos``

Linux/Mac
    ``$ omc simulate.mos``

Alright so we have a programmatic way of simulating our circuits. Now let's implement this code in a plugin!

Generating the SimulateModelica Plugin
--------------------------------------
Just like when we generated the `ModelicaCodeGenerator` plugin we again use the webgme-cli tool.

.. code-block:: bash

    webgme new plugin SimulateModelica

This plugin will be responsible for the following tasks:

1. Invoking the ModelicaCodeGenerator to retrieve the modelica code
2. Generating a mos script that simulates the circuit from the modelica code
3. Calling OMC to execute the simulation
4. Reading in the results and storing them in the model

Since this plugin will execute commands on the server we need to enable execution of server side plugins in the
`gmeConfig <https://github.com/webgme/webgme/tree/master/config#plugin>`_.

In the plugin's ``metadata.json`` we will disable browser execution of the specific plugin, add a configuration parameter and register that `ModelicaCodeGenerator` is a dependency of the plugin.
Additionally we register that the plugin requires write access to the project, that way users without write access won't
be able to execute the plugin. For detailed info about the ``metadata.json`` documentation is
`available here <https://github.com/webgme/webgme/wiki/GME-Plugins#metadatajson>`_.

`Click here to open the video in a browser. <https://www.youtube.com/embed/ZEbxRAKi5Z0>`_.

.. raw:: html

|

Invoking the ModelicaCodeGenerator
----------------------------
Plugin can be invoked from other plugins and the invoker will receive the results generated from the invoked plugin.
The video below shows how to do this.

`Click here to open the video in a browser. <https://www.youtube.com/embed/TnP5oxjgyUU>`_.

.. raw:: html

|

Simulating the Model
-------------------------
At this point we have access to the model-content and a way to invoke OpenModelica from command line. We will create a
unique directory on the server where the ``.mo`` and ``.mos`` files will be written out. After that we will execute the
command using `nodejs's child_process module <https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html>`_. (From
the same link documentation about the other built-in modules of nodejs can be found.)

The first video shows how to generate the files and the second one shows how to simulate and store the result in the model.

`Click here to open the first video in a browser. <https://www.youtube.com/embed/q9AS35VhAYg>`_.

.. raw:: html

|

`Click here to open the second video in a browser. <https://www.youtube.com/embed/Ol8YqcNnSNs>`_.

.. raw:: html

|

Notes for Developers
-------------------
When developing plugins it is typically faster to execute the plugin directly from command line and much easier to debug
server side code than running and restarting the server. The webgme bin script for running plugins is available
and documented at ``npm run plugin`` (the script itself is located at ``./node_modules/webgme-engine/src/bin/run_plugin.js``.

This tutorial has not touched on how to write tests for the plugins. Webgme provides a range of helper methods to build
up the model context for a plugin, see the generated test files for some examples.