text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace EDRoutePlanner
{
	public class CmdrsLogStationData : IDataSourceStations
	{
		private CmdrsLogDataReader readerSystemData;

		static DemandType[] statiV1;

		static CmdrsLogStationData() {
			statiV1 = new DemandType[9];
			statiV1[8] = DemandType.NotSet;
			statiV1[7] = DemandType.Illegal;
			statiV1[6] = DemandType.HighDemand;
			statiV1[5] = DemandType.MediumDemand;
			statiV1[4] = DemandType.LowDemand;
			statiV1[3] = DemandType.None;
			statiV1[2] = DemandType.LowSupply;
			statiV1[1] = DemandType.MediumSupply;
			statiV1[0] = DemandType.HighSupply;
		}

		public static DemandType parseStatusCmdrsLogV1 (int status) {
			if (status < 0 || status > 8)
			{
				return DemandType.NotSet;
			}
			else
			{
				return statiV1[status];
			}
		}

		public CmdrsLogStationData(string basePath)
		{
			readerSystemData = new CmdrsLogDataReader(basePath);
		}

		public void reloadStations(Data data)
		{
			//TODO: Respect saveVersion!

			data.systems.Clear();

			/*
			 * Systems
			 */
			foreach (string system in readerSystemData.rootSection.subsections.Keys)
			{
				CmdrsLogDataReader.Section systemSection = readerSystemData.rootSection.subsections[system];

				SystemData sysData = new SystemData(system);
				data.systems[system] = sysData;

				/*
				 * Stations
				 */
				foreach (string station in systemSection.subsections.Keys)
				{
					CmdrsLogDataReader.Section stationSection = systemSection.subsections[station];

					StationData stationData = new StationData(system, station);
					sysData.stations[station] = stationData;
					stationSection.dictionary.TryGetValue("economy", out stationData.economy);
					stationSection.dictionary.TryGetValue("government", out stationData.government);
					stationSection.dictionary.TryGetValue("faction", out stationData.faction);
					//TODO: Respect hidden
					//TODO: Respect blackmarket?

					//TODO: DAU-Safe code (make wrapper inside Section class!)
					CmdrsLogDataReader.Section commoditiesSection = stationSection.subsections["Commodities"];

					//TODO: Load Notes?

					/*
					 * Commodities
					 */
					foreach (string commodity in commoditiesSection.subsections.Keys)
					{
						CmdrsLogDataReader.Section commoditySection = commoditiesSection.subsections[commodity];

						CommodityPrice cp = new CommodityPrice(commodity);
						stationData.commodityData[commodity] = cp;
						string status = null;
						string modTime = null;
						string price = null;
						string quantity = null;
						commoditySection.dictionary.TryGetValue("status", out status);
						commoditySection.dictionary.TryGetValue("modTime", out modTime);
						commoditySection.dictionary.TryGetValue("price", out price);
						commoditySection.dictionary.TryGetValue("quantity", out quantity);

						int statusAsInt = 8;
						int priceAsInt = 0;

						//TODO: respect modTime?
						int.TryParse(price, out priceAsInt);
						int.TryParse(quantity, out cp.quantity);
						int.TryParse(status, out statusAsInt);

						cp.demandType = parseStatusCmdrsLogV1(statusAsInt);

						switch (cp.demandType)
						{
							case DemandType.HighDemand:
							case DemandType.MediumDemand:
							case DemandType.LowDemand:
								cp.priceBuy = priceAsInt;
								break;
							case DemandType.HighSupply:
							case DemandType.MediumSupply:
							case DemandType.LowSupply:
								cp.priceSell = priceAsInt;
								break;
						}
					}
				}
			}
		}

	}
}


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
Cycl. Amer. hort. 4:1457. 1902

#### Original name
null

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Security.Principal;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

using NUnit.Framework;
using Moq;
using TestStack.FluentMVCTesting;

using CarSystem.Data.Models;
using CarSystem.Data.Services.Contracts;
using CarSystem.Web.Infrastucture.Contracts;
using CarSystem.Web.Models.Advert;

namespace CarSystem.Web.Controllers.Tests.AdvertControllerTests
{
    [TestFixture]
    public class CreatePostShould
    {
        [Test]
        public void CreatePost_Should_RedirectToDefaultViewWithCorrectParameterModel_WhenThereIsExceptionOnCreatingInDatabase()
        {
            // Arrange
            var mockedContext = new Mock<HttpContextBase>();
            var identity = new GenericIdentity("dedoviqt@gmail.com");
            identity.AddClaim(new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "1"));
            var principal = new GenericPrincipal(identity, new[] { "user" });
            mockedContext.Setup(s => s.User).Returns(principal);

            var model = new AdvertCreateViewModel();
            IEnumerable<HttpPostedFileBase> uploadedFiles = null;

            var mockedAdvertService = new Mock<IAdvertService>();
            var mockedMappingService = new Mock<IMappingService>();
            var mockedCityService = new Mock<ICityService>();
            var mockedVehicleModelService = new Mock<IVehicleModelService>();

            mockedAdvertService.Setup(a => a.CreateAdvert(It.IsAny<Advert>(), It.IsAny<IEnumerable<HttpPostedFileBase>>())).Throws(new Exception());

            var advertController = new AdvertController(
                mockedAdvertService.Object,
                mockedMappingService.Object,
                mockedVehicleModelService.Object,
                mockedCityService.Object);

            advertController.ControllerContext = new ControllerContext(mockedContext.Object, new RouteData(), advertController);

            // Act & Assert
            advertController
                .WithCallTo(c => c.Create(model, uploadedFiles))
                .ShouldRenderDefaultView()
                .WithModel<AdvertCreateViewModel>(x =>
                {
                    Assert.IsNull(x.Title);
                    Assert.AreEqual(x.VehicleModelId, 0);
                    Assert.AreEqual(x.Year, 0);
                    Assert.AreEqual(x.Price, 0);
                    Assert.AreEqual(x.Power, 0);
                    Assert.AreEqual(x.DistanceCoverage, 0);
                    Assert.AreEqual(x.CityId, 0);
                    Assert.IsNull(x.Description);
                });
        }

        [Test]
        public void CreatePost_Should_SetTempData_NotificationsWithCorrectMessage_WhenThereIsAnExceptionOnCreatingInDatabase()
        {
            // Arrange
            var context = new Mock<HttpContextBase>();
            var identity = new GenericIdentity("dedoviqt@gmail.com");
            identity.AddClaim(new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "1"));
            var principal = new GenericPrincipal(identity, new[] { "user" });
            context.Setup(s => s.User).Returns(principal);

            var model = new AdvertCreateViewModel();
            IEnumerable<HttpPostedFileBase> uploadedFiles = null;

            var mockedAdvertService = new Mock<IAdvertService>();
            var mockedMappingService = new Mock<IMappingService>();
            var mockedCityService = new Mock<ICityService>();
            var mockedVehicleModelService = new Mock<IVehicleModelService>();

            mockedAdvertService.Setup(a => a.CreateAdvert(It.IsAny<Advert>(), It.IsAny<IEnumerable<HttpPostedFileBase>>())).Throws(new Exception());

            var advertController = new AdvertController(
                mockedAdvertService.Object,
                mockedMappingService.Object,
                mockedVehicleModelService.Object,
                mockedCityService.Object);

            advertController.ControllerContext = new ControllerContext(context.Object, new RouteData(), advertController);

            // Act
            advertController.Create(model, uploadedFiles);

            // Assert
            Assert.AreEqual(advertController.TempData["Notification"], "Exception.");
        }

        [Test]
        public void Create_Post_Should_ThrowArgumentNullException_WhenModelParameterIsNull()
        {
            // Arrange
            var context = new Mock<HttpContextBase>();
            var identity = new GenericIdentity("dedoviqt@gmail.com");
            identity.AddClaim(new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "1"));
            var principal = new GenericPrincipal(identity, new[] { "user" });
            context.Setup(s => s.User).Returns(principal);

            AdvertCreateViewModel model = null;
            IEnumerable<HttpPostedFileBase> uploadedFiles = null;

            var mockedAdvertService = new Mock<IAdvertService>();
            var mockedMappingService = new Mock<IMappingService>();
            var mockedCityService = new Mock<ICityService>();
            var mockedVehicleModelService = new Mock<IVehicleModelService>();

            mockedAdvertService.Setup(a => a.CreateAdvert(It.IsAny<Advert>(), It.IsAny<IEnumerable<HttpPostedFileBase>>()));

            var advertController = new AdvertController(
                mockedAdvertService.Object,
                mockedMappingService.Object,
                mockedVehicleModelService.Object,
                mockedCityService.Object);

            advertController.ControllerContext = new ControllerContext(context.Object, new RouteData(), advertController);

            // Act & Assert
            Assert.Throws<ArgumentNullException>(() => advertController.Create(model, uploadedFiles));
        }

        [Test]
        public void CreatePost_Should_ReturnDefaultViewWithAdvertCreateViewModel_WhenModelStateIsNotValid()
        {
            // Arrange
            var model = new AdvertCreateViewModel();
            IEnumerable<HttpPostedFileBase> uploadedFiles = null;

            var mockedAdvertService = new Mock<IAdvertService>();
            var mockedMappingService = new Mock<IMappingService>();
            var mockedCityService = new Mock<ICityService>();
            var mockedVehicleModelService = new Mock<IVehicleModelService>();

            var advertController = new AdvertController(
                mockedAdvertService.Object,
                mockedMappingService.Object,
                mockedVehicleModelService.Object,
                mockedCityService.Object);

            advertController.ModelState.AddModelError("Yolo", "Yolo");

            // Act & Assert
            advertController
                .WithCallTo(x => x.Create(model, uploadedFiles))
                .ShouldRenderDefaultView()
                .WithModel<AdvertCreateViewModel>(x =>
                {
                    Assert.IsNull(x.Title);
                    Assert.AreEqual(x.VehicleModelId, 0);
                    Assert.AreEqual(x.Year, 0);
                    Assert.AreEqual(x.Price, 0);
                    Assert.AreEqual(x.Power, 0);
                    Assert.AreEqual(x.DistanceCoverage, 0);
                    Assert.AreEqual(x.CityId, 0);
                    Assert.IsNull(x.Description);
                }
            );
        }

        [Test]
        public void CreatePost_Should_InvokeAdvertServiceMethod_CreateAdvert_Once_WhenModelStateIsValid()
        {
            // Arrange
            var context = new Mock<HttpContextBase>();
            var identity = new GenericIdentity("dedoviqt@gmail.com");
            identity.AddClaim(new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "1"));
            var principal = new GenericPrincipal(identity, new[] { "user" });
            context.Setup(s => s.User).Returns(principal);

            var model = new AdvertCreateViewModel();
            IEnumerable<HttpPostedFileBase> uploadedFiles = null;

            var mockedAdvertService = new Mock<IAdvertService>();
            var mockedMappingService = new Mock<IMappingService>();
            var mockedCityService = new Mock<ICityService>();
            var mockedVehicleModelService = new Mock<IVehicleModelService>();

            mockedAdvertService.Setup(a => a.CreateAdvert(It.IsAny<Advert>(), It.IsAny<IEnumerable<HttpPostedFileBase>>()));

            var advertController = new AdvertController(
                mockedAdvertService.Object,
                mockedMappingService.Object,
                mockedVehicleModelService.Object,
                mockedCityService.Object);

            advertController.ControllerContext = new ControllerContext(context.Object, new RouteData(), advertController);

            // Act
            advertController.Create(model, uploadedFiles);

            // Assert
            mockedAdvertService.Verify(a => a.CreateAdvert(It.IsAny<Advert>(), It.IsAny<IEnumerable<HttpPostedFileBase>>()), Times.Once);
        }
    }
}


text:
package controller

import org.joda.time._
import model._
import skinny.micro.context.SkinnyContext
import skinny.micro.async.AsyncOperations

import scala.concurrent._
import scala.concurrent.duration._

case class DashboardOps(controller: DashboardController) {
  def setCurrentUser(implicit ctx: SkinnyContext) = {
    val userId = controller.currentUserId.getOrElse(controller.halt(401))
    controller.set("currentUser" -> controller.adminUserService.getCurrentUser(userId))
  }
}

class DashboardController extends ApplicationController with AsyncOperations {

  val adminUserService = new AdminUserService
  val accessService    = new AccessLogService
  val alertService     = new AlertService
  val ops              = DashboardOps(this)

  def index = warnElapsedTimeWithRequest(500) {
    if (currentUserId.isEmpty) session += "userId" -> 1

    val scope: scala.collection.concurrent.Map[String, Any] = requestScope
    awaitFutures(5.seconds)(
      // simply define operation inside of this controller
      Future {
        set("hourlyStats", accessService.getHourlyStatsForGraph(new LocalDate))
      },
      Future {
        ops.setCurrentUser
      },
      // just use Future directly
      Future {
        // When using Future directly, you must be aware of Scalatra's DynamicScope's thread local request.
        // In this case, you cannot use request here. requestScope, session and so on should be captured outside of this Future value.
        scope.update("alerts", alertService.findAll())
      }
    )
    render("/dashboard/index")
  }

  private[controller] def currentUserId: Option[Long] = session.getAs[Long]("userId")

  class AdminUserService extends skinny.util.TimeLogging {

    private[this] val users = Seq(AdminUser(1, "Alice", "alice@example.com"))

    def getCurrentUser(id: Long): Option[AdminUser] = warnElapsedTime(100) {
      Thread.sleep(50L)
      users.find(_.id == id)
    }
  }

  class AccessLogService extends skinny.util.TimeLogging {

    def getHourlyStatsForGraph(date: LocalDate): Seq[HourlyStat] = warnElapsedTime(200) {
      Thread.sleep(300L)
      Seq(
        HourlyStat("2014072000", 224.5, 200000, 21),
        HourlyStat("2014072001", 254.0, 170000, 4),
        HourlyStat("2014072002", 180.2, 92000, 0),
        HourlyStat("2014072003", 192.8, 64000, 0),
        HourlyStat("2014072004", 160.1, 41000, 0),
        HourlyStat("2014072005", 201.5, 58000, 10),
        HourlyStat("2014072006", 724.2, 78000, 7453),
        HourlyStat("2014072007", 157.7, 91000, 15),
        HourlyStat("2014072008", 189.3, 155000, 0)
      )
    }
  }

  class AlertService extends skinny.util.TimeLogging {

    def findAll(): Seq[String] = warnElapsedTime(200) {
      Thread.sleep(150L)
      Seq(
        "New Record!!!",
        "Please register master data."
      )
    }
  }

}


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: Snowizard.proto

package com.ge.snowizard.api.protos;

public final class SnowizardProtos {
  private SnowizardProtos() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
  }
  public interface SnowizardResponseOrBuilder extends
      // @@protoc_insertion_point(interface_extends:snowizard.SnowizardResponse)
      com.google.protobuf.MessageOrBuilder {

    /**
     * repeated int64 id = 1 [packed = true];
     */
    java.util.List<java.lang.Long> getIdList();
    /**
     * repeated int64 id = 1 [packed = true];
     */
    int getIdCount();
    /**
     * repeated int64 id = 1 [packed = true];
     */
    long getId(int index);
  }
  /**
   * Protobuf type {@code snowizard.SnowizardResponse}
   */
  public static final class SnowizardResponse extends
      com.google.protobuf.GeneratedMessage implements
      // @@protoc_insertion_point(message_implements:snowizard.SnowizardResponse)
      SnowizardResponseOrBuilder {
    // Use SnowizardResponse.newBuilder() to construct.
    private SnowizardResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private SnowizardResponse(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final SnowizardResponse defaultInstance;
    public static SnowizardResponse getDefaultInstance() {
      return defaultInstance;
    }

    public SnowizardResponse getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private SnowizardResponse(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 8: {
              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                id_ = new java.util.ArrayList<java.lang.Long>();
                mutable_bitField0_ |= 0x00000001;
              }
              id_.add(input.readInt64());
              break;
            }
            case 10: {
              int length = input.readRawVarint32();
              int limit = input.pushLimit(length);
              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) {
                id_ = new java.util.ArrayList<java.lang.Long>();
                mutable_bitField0_ |= 0x00000001;
              }
              while (input.getBytesUntilLimit() > 0) {
                id_.add(input.readInt64());
              }
              input.popLimit(limit);
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
          id_ = java.util.Collections.unmodifiableList(id_);
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.ge.snowizard.api.protos.SnowizardProtos.internal_static_snowizard_SnowizardResponse_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.ge.snowizard.api.protos.SnowizardProtos.internal_static_snowizard_SnowizardResponse_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse.class, com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse.Builder.class);
    }

    public static com.google.protobuf.Parser<SnowizardResponse> PARSER =
        new com.google.protobuf.AbstractParser<SnowizardResponse>() {
      public SnowizardResponse parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new SnowizardResponse(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<SnowizardResponse> getParserForType() {
      return PARSER;
    }

    public static final int ID_FIELD_NUMBER = 1;
    private java.util.List<java.lang.Long> id_;
    /**
     * repeated int64 id = 1 [packed = true];
     */
    public java.util.List<java.lang.Long>
        getIdList() {
      return id_;
    }
    /**
     * repeated int64 id = 1 [packed = true];
     */
    public int getIdCount() {
      return id_.size();
    }
    /**
     * repeated int64 id = 1 [packed = true];
     */
    public long getId(int index) {
      return id_.get(index);
    }
    private int idMemoizedSerializedSize = -1;

    private void initFields() {
      id_ = java.util.Collections.emptyList();
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (getIdList().size() > 0) {
        output.writeRawVarint32(10);
        output.writeRawVarint32(idMemoizedSerializedSize);
      }
      for (int i = 0; i < id_.size(); i++) {
        output.writeInt64NoTag(id_.get(i));
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      {
        int dataSize = 0;
        for (int i = 0; i < id_.size(); i++) {
          dataSize += com.google.protobuf.CodedOutputStream
            .computeInt64SizeNoTag(id_.get(i));
        }
        size += dataSize;
        if (!getIdList().isEmpty()) {
          size += 1;
          size += com.google.protobuf.CodedOutputStream
              .computeInt32SizeNoTag(dataSize);
        }
        idMemoizedSerializedSize = dataSize;
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code snowizard.SnowizardResponse}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:snowizard.SnowizardResponse)
        com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponseOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return com.ge.snowizard.api.protos.SnowizardProtos.internal_static_snowizard_SnowizardResponse_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.ge.snowizard.api.protos.SnowizardProtos.internal_static_snowizard_SnowizardResponse_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse.class, com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse.Builder.class);
      }

      // Construct using com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        id_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return com.ge.snowizard.api.protos.SnowizardProtos.internal_static_snowizard_SnowizardResponse_descriptor;
      }

      public com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse getDefaultInstanceForType() {
        return com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse.getDefaultInstance();
      }

      public com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse build() {
        com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse buildPartial() {
        com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse result = new com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse(this);
        int from_bitField0_ = bitField0_;
        if (((bitField0_ & 0x00000001) == 0x00000001)) {
          id_ = java.util.Collections.unmodifiableList(id_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.id_ = id_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse) {
          return mergeFrom((com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse other) {
        if (other == com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse.getDefaultInstance()) return this;
        if (!other.id_.isEmpty()) {
          if (id_.isEmpty()) {
            id_ = other.id_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureIdIsMutable();
            id_.addAll(other.id_);
          }
          onChanged();
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (com.ge.snowizard.api.protos.SnowizardProtos.SnowizardResponse) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      private java.util.List<java.lang.Long> id_ = java.util.Collections.emptyList();
      private void ensureIdIsMutable() {
        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
          id_ = new java.util.ArrayList<java.lang.Long>(id_);
          bitField0_ |= 0x00000001;
         }
      }
      /**
       * repeated int64 id = 1 [packed = true];
       */
      public java.util.List<java.lang.Long>
          getIdList() {
        return java.util.Collections.unmodifiableList(id_);
      }
      /**
       * repeated int64 id = 1 [packed = true];
       */
      public int getIdCount() {
        return id_.size();
      }
      /**
       * repeated int64 id = 1 [packed = true];
       */
      public long getId(int index) {
        return id_.get(index);
      }
      /**
       * repeated int64 id = 1 [packed = true];
       */
      public Builder setId(
          int index, long value) {
        ensureIdIsMutable();
        id_.set(index, value);
        onChanged();
        return this;
      }
      /**
       * repeated int64 id = 1 [packed = true];
       */
      public Builder addId(long value) {
        ensureIdIsMutable();
        id_.add(value);
        onChanged();
        return this;
      }
      /**
       * repeated int64 id = 1 [packed = true];
       */
      public Builder addAllId(
          java.lang.Iterable<? extends java.lang.Long> values) {
        ensureIdIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, id_);
        onChanged();
        return this;
      }
      /**
       * repeated int64 id = 1 [packed = true];
       */
      public Builder clearId() {
        id_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:snowizard.SnowizardResponse)
    }

    static {
      defaultInstance = new SnowizardResponse(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:snowizard.SnowizardResponse)
  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_snowizard_SnowizardResponse_descriptor;
  private static
    com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internal_static_snowizard_SnowizardResponse_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n\017Snowizard.proto\022\tsnowizard\"#\n\021Snowizar" +
      "dResponse\022\016\n\002id\030\001 \003(\003B\002\020\001B0\n\033com.ge.snow" +
      "izard.api.protosB\017SnowizardProtosH\001"
    };
    com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
        new com.google.protobuf.Descriptors.FileDescriptor.    InternalDescriptorAssigner() {
          public com.google.protobuf.ExtensionRegistry assignDescriptors(
              com.google.protobuf.Descriptors.FileDescriptor root) {
            descriptor = root;
            return null;
          }
        };
    com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
        }, assigner);
    internal_static_snowizard_SnowizardResponse_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_snowizard_SnowizardResponse_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessage.FieldAccessorTable(
        internal_static_snowizard_SnowizardResponse_descriptor,
        new java.lang.String[] { "Id", });
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
#ifndef __IMAGEANALYZER__
#define __IMAGEANALYZER__

#include <QDeclarativeItem>
#include <QImage>

class ImageAnalyzer : public QDeclarativeItem
{
    Q_OBJECT
    Q_PROPERTY(float overLitAmount READ getOverLitAmount NOTIFY overLitAmountChanged)

public:
    ImageAnalyzer(QDeclarativeItem *parent = 0);
    virtual ~ImageAnalyzer();

    void analyze(unsigned int *sourceData,
                 int sourceWidth, int sourceHeight,
                 int sourcePitch, bool highDetail);

    QImage getThumbnailImage() const { return m_thumbnailImage; }

    // Histogram information
    inline unsigned int *getRedHistogram() { return m_histogram; }
    inline unsigned int *getGreenHistogram() { return m_histogram + 256; }
    inline unsigned int *getBlueHistogram() { return m_histogram + 512; }

    inline unsigned int *getLowdetailHistogram() {
        return m_lowDetailHistogram;
    }

    // Return movement indicator between 0 and 1
    inline float getMovement() const {
        return (float)m_movementSensor / 255.0f;
    }
    inline int getMovementSensor() const { return m_movementSensor;}
    inline float getOverLitAmount() const { return m_overLitAmount; }

    // Return the raw amount of movement
    inline int getRawAmountOfMovement() const { return m_amountOfMovement; }

    inline unsigned int getCurrentFrame() const { return m_currentFrame; }

signals:
    void overLitAmountChanged();

protected:
    void createThumbnail(QImage source);

protected:
    QImage m_thumbnailImage;

    // Between 0 and 1. How large part of the image is overlit.
    float m_overLitAmount;

    unsigned int m_currentFrame;

    // 0 - 65535 : Raw change sigma from previous frame
    int m_amountOfMovement;
    // 0 - 255 : Tweaked "movement" - value from amount of movement
    int m_movementSensor;

    // RGB-component histogram: 256*3 = 768
    // Latest frame
    unsigned int m_histogram[768];

    // Low detail, downscaled version of the histogram
    unsigned int m_lowDetailHistogram[64 * 3];
    unsigned int m_prevLowDetailHistogram[64 * 3];
};

QML_DECLARE_TYPE(ImageAnalyzer)

#endif


text:
ACCEPTED

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

#### Published in
Bot. Mag. 49: t. 2312. 1822

#### Original name
null

### Remarks
null


text:
var React = require('react/addons');
var Loader = require('react-loader');
var TextInput = require('./name_input.js').textInput;
var RadioButton = require('./name_input.js').radioButton;

var CountForm = React.createClass({
    getInitialState: function () {
        return {
            lastName: '長野',
            lastNameInputStatus: true,
            isMaleIndex: 0,
            isNewCountIndex: 0
        };
    },
    handleLastNameChange: function (e, validationResult) {
        this.setState({
            lastName: e.target.value.trim(),
            lastNameInputStatus: validationResult,
        });
        this.props.onChange();
    },
    handleIsMaleChange: function (e, index) {
        this.setState({
            isMaleIndex: index
        });
    },
    handleIsNewCountChange: function (e, index) {
        this.setState({
            isNewCountIndex: index
        });
    },
    handleSubmit: function (e) {
        e.preventDefault();
        var lastName = this.state.lastName.trim();
        var isMail = this.state.isMaleIndex == 0;
        var isNewCount = this.state.isNewCountIndex != 0;
        this.props.onFormSubmit(lastName, isMail, isNewCount);
    },
    render: function () {
        var disabled = !this.state.lastNameInputStatus;

        var errorText = this.props.isError ?
            "指定された名前には対応していません。おそらく名前に使えない字と考えられます。" : null;

        return (
            <form className="form-horizontal" onSubmit={this.handleSubmit}>

{errorText}

                <TextInput id="lastName" name="姓 : " placeholder="姓" reg={"^[^ -~。-゚]+$"} minLen={1} maxLen={5}
                           errorText="1から5文字以内の漢字で指定してください"
                           onChange={this.handleLastNameChange}>{this.state.lastName}</TextInput>

                <RadioButton id="isMaleRadios" name="性別: " buttons={["男", "女"]} currentIndex={this.state.isMaleIndex}
                             onChange={this.handleIsMaleChange}/>

                <RadioButton id="isNewCountRadios" name="字体: " buttons={["旧字体", "新字体"]}
                             currentIndex={this.state.isNewCountIndex}
                             onChange={this.handleIsNewCountChange}/>

                        <button type="submit" className="btn btn-primary" disabled={disabled}>送る</button>

            </form>
        );
    }
});

var CountResultItem = React.createClass({
    render: function () {
        var styles = {
            color: "#ff7f7f",
            backgroundColor: "#bfff7f",
            fontSize: '16px',
            fontWeight: 'bold'
        }
        var className;
        var totalPoint = this.props.totalPoint;
        if (totalPoint > 80) {
            className = "success"
        } else if (totalPoint > 60) {
            className = "warning";
        } else if (totalPoint < 40) {
            className = "danger";
        }

        return (

                {this.props.tiUn}
                {this.props.firstNameCounts.length.toString()}
                {this.props.firstNameCounts.toString()}
                {this.props.tenUn}
                {this.props.jinUn}
                {this.props.gaiUn}
                {this.props.souUn}
                {this.props.tenUnPoint}
                {this.props.tiUnPoint}
                {this.props.jinUnPoint}
                {this.props.gaiUnPoint}
                {this.props.souUnPoint}
                {this.props.inyouPoint}
                {this.props.totalPoint.toString() + "点"}

        );
    }
});

var CountResult = React.createClass({
    getInitialState: function () {
        return {
            results: [],
            loaded: true
        };
    },

    handleChange: function () {
        this.setState({
            isError: false
        });
    },

    handleFormSubmit: function (lastName, isMale, isNewCount) {
        this.setState({
            loaded: false
        });
        var url = '/api/names?'
            + 'last_name=' + lastName
            + '&is_male=' + isMale
            + '&is_new_count=' + isNewCount;

        //console.log(url);
        $.ajax({
            url: url,
            dataType: 'json',
            cache: false,
            success: function (data) {
                if (!data) {
                    this.setState({
                        isError: true,
                        loaded: true
                    });
                    return;
                }
                var results = data.map(function (r) {
                    return {
                        isError: false,
                        firstName: r.first_name,
                        lastName: r.last_name,
                        isMale: r.is_male,
                        firstNameCounts: r.first_name_writing_count_vec,
                        lastNameCounts: r.last_name_writing_count_vec,
                        tenUn: r.ten_un,
                        tiUn: r.ti_un,
                        jinUn: r.jin_un,
                        gaiUn: r.gai_un,
                        souUn: r.sou_un,
                        tenUnPoint: r.ten_un_point,
                        tiUnPoint: r.ti_un_point,
                        jinUnPoint: r.jin_un_point,
                        gaiUnPoint: r.gai_un_point,
                        souUnPoint: r.sou_un_point,
                        inyouPoint: r.in_myou_point,
                        totalPoint: r.total_point
                    };
                });
                this.setState({
                    results: results,
                    loaded: true
                });
            }.bind(this),
            error: function (xhr, status, err) {
                console.error(this.props.url, status, err.toString());
                this.setState({
                    isError: true,
                    loaded: true
                });
            }.bind(this)
        });
    },

    render: function () {
        var results = this.state.results.map(function (r) {
            return <CountResultItem key={r.firstNameCounts.toString()} lastName={r.lastName} firstName={r.firstName}
                                    isMale={r.isMale ? "男" : "女"}
                                    lastNameCounts={r.lastNameCounts} firstNameCounts={r.firstNameCounts}
                                    tenUn={r.tenUn} tiUn={r.tiUn} jinUn={r.jinUn} gaiUn={r.gaiUn} souUn={r.souUn}
                                    tenUnPoint={r.tenUnPoint * 10} tiUnPoint={r.tiUnPoint * 10}
                                    jinUnPoint={r.jinUnPoint * 10} gaiUnPoint={r.gaiUnPoint * 10}
                                    souUnPoint={r.souUnPoint * 10} inyouPoint={r.inyouPoint * 10}
                                    totalPoint={r.totalPoint * 10}/>
        });

        return (

よい画数を調べてみよう

名前をどの画数にしたら良い運勢になるか調べてみよう~
地運, 人運, 外運, 総運が全て吉数になるパターンを調べることができます。

                <CountForm onFormSubmit={this.handleFormSubmit} onChange={this.handleChange}
                           isError={this.state.isError}/>
                <Loader loaded={this.state.loaded}>

                            名前画数
(地運画数)
                            文字数
                            各画数
                            天運画数
                            人運画数
                            外運画数
                            総運画数
                            天運
                            地運
                            人運
                            外運
                            総運
                            陰陽
                            トータル

                        {results}

                </Loader>

        );
    }
});

module.exports = CountResult;


text:
RSpec.configure do |config|
  config.filter_run :focused => true
  config.run_all_when_everything_filtered = true
  config.alias_example_to :fit, :focused => true

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
  config.mock_with :none
end


text:
/* XMLParseException.java
 *
 * $Revision: 1.7.34.3 $
 * $Date: 2006/07/25 20:28:20 $
 * $Name: fm_060405_integration $
 *
 * This file is part of NanoXML 2 Lite.
 * Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
 *
 * This software is provided 'as-is', without any express or implied warranty.
 * In no event will the authors be held liable for any damages arising from the
 * use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 *  1. The origin of this software must not be misrepresented; you must not
 *     claim that you wrote the original software. If you use this software in
 *     a product, an acknowledgment in the product documentation would be
 *     appreciated but is not required.
 *
 *  2. Altered source versions must be plainly marked as such, and must not be
 *     misrepresented as being the original software.
 *
 *  3. This notice may not be removed or altered from any source distribution.
 *****************************************************************************/

//<delete>
//package nanoxml;
//</delete>
//<insert>
package freemind.main;

//</insert>

/**
 * An XMLParseException is thrown when an error occures while parsing an XML
 * string.
 *

 * $Revision: 1.7.34.3 $

 * $Date: 2006/07/25 20:28:20 $
 *

 *
 * @see XMLElement
 *
 * @author Marc De Scheemaecker
 * @version $Name: fm_060405_integration $, $Revision: 1.7.34.3 $
 */
public class XMLParseException extends RuntimeException {

	/**
	 * Indicates that no line number has been associated with this exception.
	 */
	public static final int NO_LINE = -1;

	/**
	 * The line number in the source code where the error occurred, or
	 * NO_LINE if the line number is unknown.
	 *
	 *

	 *
Invariants:

	 *

	 *

	 *
lineNr &gt 0 || lineNr == NO_LINE
	 *

	 *

	 *

	 */
	private int lineNr;

	/**
	 * Creates an exception.
	 *
	 * @param name
	 *            The name of the element where the error is located.
	 * @param message
	 *            A message describing what went wrong.
	 *
	 *

	 *

	 *
Preconditions:

	 *

	 *

	 *
message != null
	 *

	 *

	 *

	 *
	 *

	 *
Postconditions:

	 *

	 *

	 *
getLineNr() => NO_LINE
	 *

	 *

	 *

	 *

	 */
	public XMLParseException(String name, String message) {
		super("XML Parse Exception during parsing of "
				+ ((name == null) ? "the XML definition"
						: ("a " + name + " element")) + ": " + message);
		this.lineNr = XMLParseException.NO_LINE;
	}

	/**
	 * Creates an exception.
	 *
	 * @param name
	 *            The name of the element where the error is located.
	 * @param lineNr
	 *            The number of the line in the input.
	 * @param message
	 *            A message describing what went wrong.
	 *
	 *

	 *

	 *
Preconditions:

	 *

	 *

	 *
message != null
	 *
lineNr > 0
	 *

	 *

	 *

	 *
	 *

	 *
Postconditions:

	 *

	 *

	 *
getLineNr() => lineNr
	 *

	 *

	 *

	 *

	 */
	public XMLParseException(String name, int lineNr, String message) {
		super("XML Parse Exception during parsing of "
				+ ((name == null) ? "the XML definition"
						: ("a " + name + " element")) + " at line " + lineNr
				+ ": " + message);
		this.lineNr = lineNr;
	}

	/**
	 * Where the error occurred, or NO_LINE if the line number is
	 * unknown.
	 *
	 */
	public int getLineNr() {
		return this.lineNr;
	}

}


text:
from page_sets import webgl_supported_shared_state
from telemetry import page as page_module
from telemetry import story

STARTUP_SCRIPT = '''
    window.benchmarkStarted =false;
    window.benchmarkFinished = false;
    window.benchmarkBeforeRun = function() {
      window.benchmarkStarted = true;
    };
    window.benchmarkAfterRun = function(score) {
      window.benchmarkFinished = true;
      window.benchmarkScore = score;
      window.benchmarkAfterRun = null;
    };'''

class OortOnlinePage(page_module.Page):
  def __init__(self, page_set):
    super(OortOnlinePage, self).__init__(
        url='http://oortonline.gl/#run', page_set=page_set,
        shared_page_state_class=(
            webgl_supported_shared_state.WebGLSupportedSharedState),
        make_javascript_deterministic=False)
    self.archive_data_file = 'data/oortonline.json'
    self.script_to_evaluate_on_commit = STARTUP_SCRIPT

  @property
  def skipped_gpus(self):
    # crbug.com/462729
    return ['arm', 'broadcom', 'hisilicon', 'imagination', 'qualcomm',
            'vivante', 'vmware']

class OortOnlinePageSet(story.StorySet):
  """Oort Online WebGL benchmark.
  URL: http://oortonline.gl/#run
  Info: http://v8project.blogspot.de/2015/10/jank-busters-part-one.html
  """
  def __init__(self):
    super(OortOnlinePageSet, self).__init__(
      archive_data_file='data/oortonline.json',
      cloud_storage_bucket=story.PARTNER_BUCKET)
    self.AddStory(OortOnlinePage(self))

class OortOnlineTBMPage(OortOnlinePage):
  def __init__(self, page_set):
    super(OortOnlineTBMPage, self).__init__(page_set=page_set)

  def RunPageInteractions(self, action_runner):
    WAIT_TIME_IN_SECONDS = 2
    RUN_TIME_IN_SECONDS = 20
    action_runner.WaitForJavaScriptCondition('window.benchmarkStarted')
    # Perform GC to get rid of start-up garbage.
    action_runner.ForceGarbageCollection()
    with action_runner.CreateInteraction('Begin'):
      action_runner.tab.browser.DumpMemory()
    # Skip the first few seconds to get more stable frame times.
    action_runner.Wait(WAIT_TIME_IN_SECONDS)
    with action_runner.CreateInteraction('Running'):
      # We cannot wait until benchmarkFinished because true because the result
      # screen does not update, which affects frame-time discrepancy
      # computation. Instead we stop based on timer.
      action_runner.Wait(RUN_TIME_IN_SECONDS)
    with action_runner.CreateInteraction('End'):
      action_runner.tab.browser.DumpMemory()

class OortOnlineTBMPageSet(story.StorySet):
  """Oort Online WebGL benchmark for TBM.
  URL: http://oortonline.gl/#run
  Info: http://v8project.blogspot.de/2015/10/jank-busters-part-one.html
  """

  def __init__(self):
    super(OortOnlineTBMPageSet, self).__init__(
      archive_data_file='data/oortonline.json',
      cloud_storage_bucket=story.PARTNER_BUCKET)
    self.AddStory(OortOnlineTBMPage(self))


text:
// From http://nadeausoftware.com/articles/2012/07/c_c_tip_how_get_process_resident_set_size_physical_memory_use

#ifndef GET_RSS_H
#define GET_RSS_H

/*
 * Author:  David Robert Nadeau
 * Site:    http://NadeauSoftware.com/
 * License: Creative Commons Attribution 3.0 Unported License
 *          http://creativecommons.org/licenses/by/3.0/deed.en_US
 */

#if defined(_WIN32)
#include <windows.h>
    #include <psapi.h>

#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
#include <unistd.h>
#include <sys/resource.h>

#if defined(__APPLE__) && defined(__MACH__)
#include <mach/mach.h>

#elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
#include <fcntl.h>
    #include <procfs.h>

#elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
#include <stdio.h>

#endif
#else
#error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS."
#endif

namespace mine {
    /**
     * Returns the peak (maximum so far) resident set size (physical
     * memory use) measured in bytes, or zero if the value cannot be
     * determined on this OS.
     */
    size_t getPeakRSS( )
    {
    #if defined(_WIN32)
            /* Windows -------------------------------------------------- */
        PROCESS_MEMORY_COUNTERS info;
        GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) );
        return (size_t)info.PeakWorkingSetSize;

    #elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
            /* AIX and Solaris ------------------------------------------ */
        struct psinfo psinfo;
        int fd = -1;
        if ( (fd = open( "/proc/self/psinfo", O_RDONLY )) == -1 )
            return (size_t)0L;		/* Can't open? */
        if ( read( fd, &psinfo, sizeof(psinfo) ) != sizeof(psinfo) )
        {
            close( fd );
            return (size_t)0L;		/* Can't read? */
        }
        close( fd );
        return (size_t)(psinfo.pr_rssize * 1024L);

    #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
            /* BSD, Linux, and OSX -------------------------------------- */
            struct rusage rusage;
            getrusage( RUSAGE_SELF, &rusage );
    #if defined(__APPLE__) && defined(__MACH__)
            return (size_t)rusage.ru_maxrss;
    #else
            return (size_t)(rusage.ru_maxrss * 1024L);
    #endif

    #else
            /* Unknown OS ----------------------------------------------- */
        return (size_t)0L;			/* Unsupported. */
    #endif
    } // end of getPeakRSS

    /**
     * Returns the current resident set size (physical memory use) measured
     * in bytes, or zero if the value cannot be determined on this OS.
     */
    size_t getCurrentRSS( )
    {
    #if defined(_WIN32)
            /* Windows -------------------------------------------------- */
        PROCESS_MEMORY_COUNTERS info;
        GetProcessMemoryInfo( GetCurrentProcess( ), &info, sizeof(info) );
        return (size_t)info.WorkingSetSize;

    #elif defined(__APPLE__) && defined(__MACH__)
            /* OSX ------------------------------------------------------ */
        struct mach_task_basic_info info;
        mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
        if ( task_info( mach_task_self( ), MACH_TASK_BASIC_INFO,
            (task_info_t)&info, &infoCount ) != KERN_SUCCESS )
            return (size_t)0L;		/* Can't access? */
        return (size_t)info.resident_size;

    #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
            /* Linux ---------------------------------------------------- */
            long rss = 0L;
            FILE* fp = NULL;
            if ( (fp = fopen( "/proc/self/statm", "r" )) == NULL )
                return (size_t)0L;		/* Can't open? */
            if ( fscanf( fp, "%*s%ld", &rss ) != 1 )
            {
                fclose( fp );
                return (size_t)0L;		/* Can't read? */
            }
            fclose( fp );
            return (size_t)rss * (size_t)sysconf( _SC_PAGESIZE);

    #else
            /* AIX, BSD, Solaris, and Unknown OS ------------------------ */
        return (size_t)0L;			/* Unsupported. */
    #endif
    } // end of getCurrentRSS

    size_t getPeakRSSMb() {
        return getPeakRSS() / 1048576.0;
    }
} // end of namespace mine

#endif // GET_RSS_H