text:
import Report from '../../../../ui/components/report.jsx';
import fixture from '../../../fixtures/components/report/data.js';
import suitesParser from './setup.js';
import {render, stubMethod} from '../../helpers.js';

describe('Report', function() {
  describe('Render', function() {
    const {
      suites,
      numberOfPasses,
      numberOfFailures,
      duration
    } = suitesParser(fixture.data);
    let loadChildStub;

    beforeEach(function() {
      loadChildStub = stubMethod(Report, 'loadChild', null);
      render(Report, fixture);
    });

    it('should render the header child', function() {
      expect(loadChildStub).to.have.been
          .calledWith('header', numberOfPasses, numberOfFailures, duration);
    });

    it('should render the results child', function() {
      expect(loadChildStub).to.have.been.calledWith('results', suites);
    });
  });
});

redpajama_set_name: RedPajamaGithub


text:
import static java.lang.System.*;
import java.awt.Color;

public class PieceTester
{
	public static void main(String[] args)
	{
		Piece pieceOne = new Piece();
		out.println(pieceOne);

		Piece redChecker = new Piece("red checker");
		out.println(redChecker);

		Piece theShoe = new Piece(100,100,"the shoe from a money game");
		out.println(theShoe);

		Piece bishop = new Piece(200,200, 20, 20, "bishop", Color.WHITE);
		out.println(bishop);
	}
}


text:
'use strict';

module.exports = function (client) {
  var dependencies = [client.core.base.identity.name];
  return client.module('hackr.panels.admin', dependencies)
    .directive('hackrAdminPanel', require('./directive')(client));
};


text:
<?php

namespace Kunstmaan\AdminListBundle\AdminList;

class ExportList implements ExportableInterface
{
    private $configurator;

    public function __construct($configurator)
    {
        $this->configurator = $configurator;
        $this->configurator->buildExportFields();
        $this->configurator->buildIterator();
    }

    public function getExportColumns()
    {
        return $this->configurator->getExportFields();
    }

    public function getAllIterator()
    {
        return $this->configurator->getIterator();
    }

    public function getStringValue($item, $columnName)
    {
        return $this->configurator->getStringValue($item, $columnName);
    }
}


text:
using System;
class DifferentIntegersSize
{
    static void Main()
    {

        string number = Console.ReadLine();
        long l;

        if (long.TryParse(number, out l))
        {
            Console.WriteLine("{0} can fit in:", number);

            sbyte s; byte b; short sh; ushort us; int i; uint ui;

            if (sbyte.TryParse(number, out s))
            {
                Console.WriteLine("* sbyte");
            }

            if (byte.TryParse(number, out b))
            {
                Console.WriteLine("* byte");
            }

            if (short.TryParse(number, out sh))
            {
                Console.WriteLine("* short");
            }

            if (ushort.TryParse(number, out us))
            {
                Console.WriteLine("* ushort");
            }

            if (int.TryParse(number, out i))
            {
                Console.WriteLine("* int");
            }

            if (uint.TryParse(number, out ui))
            {
                Console.WriteLine("* uint");
            }

            Console.WriteLine("* long");
        }
        else
        {
            Console.WriteLine("{0} can't fit in any type", number);
        }
    }
}


text:
package edu.emory.cci.aiw.cvrg.eureka.services.conversion;

import org.eurekaclinical.eureka.client.comm.Cohort;

/**
 *
 * @author Andrew Post
 */
class CohortConversionSupport extends ConversionSupport {

	CohortConversionSupport() {
	}

	Cohort etlCohortToServicesCohort(Cohort etlCohort) {
		Cohort cohort = new Cohort();
		cohort.setId(etlCohort.getId());
		EtlNodeToServicesNodeVisitor v =
				new EtlNodeToServicesNodeVisitor();
		etlCohort.getNode().accept(v);
		cohort.setNode(v.getNode());

		return cohort;
	}

	Cohort servicesCohortToEtlCohort(Cohort servicesCohort) {
		Cohort cohort = new Cohort();
		cohort.setId(servicesCohort.getId());
		ServicesNodeToEtlNodeVisitor v =
				new ServicesNodeToEtlNodeVisitor();
		servicesCohort.getNode().accept(v);
		cohort.setNode(v.getNode());

		return cohort;
	}

}


text:
package org.motechproject.tasks.domain;

import org.motechproject.tasks.contract.ActionParameterRequest;

import java.util.SortedSet;

/**
 * The ActionParameterBuilder class provides methods for constructing action parameters.
 *
 * @see org.motechproject.tasks.domain.ActionParameter
 */
public class ActionParameterBuilder {
    private String displayName;
    private String key;
    private ParameterType type = ParameterType.UNICODE;
    private Integer order;
    private boolean required = true;
    private String value;
    private boolean hidden;
    private SortedSet<String> options;

    public ActionParameterBuilder setDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    public ActionParameterBuilder setKey(String key) {
        this.key = key;
        return this;
    }

    public ActionParameterBuilder setType(ParameterType type) {
        this.type = type;
        return this;
    }

    public ActionParameterBuilder setOrder(Integer order) {
        this.order = order;
        return this;
    }

    public ActionParameterBuilder setRequired(boolean required) {
        this.required = required;
        return this;
    }

    public ActionParameterBuilder setValue(String value) {
        this.value = value;
        return this;
    }

    public ActionParameterBuilder setHidden(boolean hidden) {
        this.hidden = hidden;
        return this;
    }

    public ActionParameterBuilder setOptions(SortedSet<String> options){
        this.options = options;
        return  this;
    }

    /**
     * Builds an object of the {@code ActionParameter} class.
     *
     * @return the created instance
     */
    public ActionParameter createActionParameter() {
        return new ActionParameter(displayName, type, order, key, value, required, hidden, options);
    }

    /**
     * Builds an object of the {@code ActionParameterBuilder} class based on the passed {@code ActionParameterRequest}
     * instance.
     *
     * @param actionParameterRequest  the action parameter request, not null
     * @return a builder ready to build a new instance of the {@code ActionParameter} class
     */
    public static ActionParameterBuilder fromActionParameterRequest(ActionParameterRequest actionParameterRequest) {
        ActionParameterBuilder builder = new ActionParameterBuilder();
        builder.setDisplayName(actionParameterRequest.getDisplayName());
        builder.setType(ParameterType.fromString(actionParameterRequest.getType()));
        builder.setOrder(actionParameterRequest.getOrder());
        builder.setKey(actionParameterRequest.getKey());
        builder.setValue(actionParameterRequest.getValue());
        builder.setRequired(actionParameterRequest.isRequired());
        builder.setHidden(actionParameterRequest.isHidden());
        builder.setOptions(actionParameterRequest.getOptions());
        return builder;
    }

    /**
     * Builds an object of the {@code ActionParameterBuilder} class based on the passed {@code ActionParameter}
     * instance.
     *
     * @param actionParameter  the action parameter request, not null
     * @return a builder ready to build a new instance of the {@code ActionParameter} class
     */
    public static ActionParameterBuilder fromActionParameter(ActionParameter actionParameter) {
        ActionParameterBuilder builder = new ActionParameterBuilder();
        builder.setDisplayName(actionParameter.getDisplayName());
        builder.setType(actionParameter.getType());
        builder.setOrder(actionParameter.getOrder());
        builder.setKey(actionParameter.getKey());
        builder.setValue(actionParameter.getValue());
        builder.setRequired(actionParameter.isRequired());
        builder.setHidden(actionParameter.isHidden());
        builder.setOptions(actionParameter.getOptions());
        return builder;
    }
}


text:
Search Blog

    <form method="get" action="https://www.google.com/search">
      <input name="q" type="hidden" value="site:liberislabs.com">
      <input class="prompt" name="q" type="text" placeholder="Search blog..." />

    </form>


text:
LEVEL = ../../../..
RUN_OPTIONS     = chair.control.cook chair.camera chair.surfaces chair.cook.ppm ppm pixels_out.cook
STDOUT_FILENAME = cook_log.out
STDERR_FILENAME = cook_log.err
FP_ABSTOLERANCE := 0.005

CPPFLAGS = -include errno.h -DHAS_ERRLIST -DUSE_STRERROR -DSPEC_STDCPP -DNDEBUG

include $(LEVEL)/Makefile.config

ifeq ($(ARCH),PowerPC)
 CPPFLAGS += -DFMAX_IS_DOUBLE
endif

Source = $(addprefix $(SPEC_BENCH_DIR)/src/,  \
            ggCoverageSolidTexture.cc ggPathDielectricMaterial.cc ggBox2.cc \
            ggBox3.cc ggRasterSurfaceTexture.cc ggJitterSample1.cc \
            ggNRooksSample2.cc ggJitterSample2.cc ggRGBFPixel.cc \
            ggRotatingPinholeCamera.cc ggRandomSample2.cc ggRandomSample3.cc \
            ggSolidNoise2.cc ggSolidNoise3.cc ggSolidTexture.cc \
            ggOakSolidTexture.cc ggSpecularMaterial.cc ggNA.cc ggMaterial.cc \
            ggDiffuseMaterial.cc ggDielectricMaterial.cc ggConductorMaterial.cc \
            ggEdgeDiscrepancy.cc ggPolishedMaterial.cc ggFrameInterpolation.cc \
            ggQuaternion.cc ggSpline.cc ggONB2.cc ggONB3.cc ggFrame2.cc \
            ggFrame3.cc ggHMatrix3.cc ggSphere.cc ggRGBE.cc ggGamma.cc \
            ggBRDF.cc ggDiffuseBRDF.cc ggPhongBRDF.cc ggPolishedBRDF.cc \
            ggCamera.cc ggPinholeCamera.cc ggThinLensCamera.cc ggErr.cc \
            ggPixelFilter.cc ggTrianglePixelFilter.cc ggBoxPixelFilter.cc \
            ggFormat.cc ggGeometry.cc ggHAffineMatrix3.cc ggHShearMatrix3.cc \
            ggHBoxMatrix3.cc ggHPerspectiveMatrix3.cc ggHTranslationMatrix3.cc \
            ggHRigidBodyMatrix3.cc ggHRotationMatrix3.cc ggHScaleMatrix3.cc \
            ggHPoint3.cc ggPoint2.cc ggPoint3.cc ggOptics.cc ggPlane.cc \
            ggPolygon.cc ggGrayPixel_x.cc ggRGBPixel_x.cc \
            ggRay2.cc ggRay3.cc ggBoardFloorSolidTexture.cc ggVector2.cc \
            ggVector3.cc ggString.cc ggFineSpectrum.cc ggSpectrum.cc eon.cc \
            eonImageCalculator.cc mrObjectRecord.cc mrCoarsePixelRenderer.cc \
            mrIndirectPixelRenderer.cc mrRushmeierPixelRenderer.cc \
            mrBruteForcePixelRenderer.cc mrKajiyaPixelRenderer.cc \
            mrCookPixelRenderer.cc mrGrid.cc mrScene.cc mrCamera.cc \
            mrTriangle.cc mrFastTriangle.cc mrPolygon.cc mrXYDisk.cc \
            mrXZDisk.cc mrYZDisk.cc mrPhongAreaXYRectangleLuminaire.cc \
            mrPhongAreaXZRectangleLuminaire.cc \
            mrPhongAreaYZRectangleLuminaire.cc mrEmitter.cc mrImposter.cc \
            mrLinkedObjects.cc mrBox.cc mrXCylinder.cc mrYCylinder.cc \
            mrZCylinder.cc mrDiffuseAreaZCylinderLuminaire.cc \
            mrDiffuseCosineZCylinderLuminaire.cc \
            mrDiffuseVisibleAreaZCylinderLuminaire.cc mrXEllipticalCylinder.cc \
            mrYEllipticalCylinder.cc mrZEllipticalCylinder.cc \
            mrSpotAreaXYDiskLuminaire.cc mrDiffuseAreaXYRectangleLuminaire.cc \
            mrDiffuseAreaXZRectangleLuminaire.cc \
            mrDiffuseAreaYZRectangleLuminaire.cc mrSurfaceList.cc \
            mrDiffuseAreaTriangleLuminaire.cc mrDiffuseAreaSphereLuminaire.cc \
            mrDiffuseCosineSphereLuminaire.cc \
            mrDiffuseSolidAngleSphereLuminaire.cc mrShellLuminaire.cc \
            mrInstance.cc mrMaterial.cc mrPhongAreaTriangleLuminaire.cc \
            mrSolidTexture.cc mrSphere.cc mrSurface.cc mrSurfaceTexture.cc \
            mrXYRectangle.cc mrXZRectangle.cc mrYZRectangle.cc myrand.cc)

# Yes, we know this is an old crufty C++ benchmark.  Don't tell us about it GCC!
CXXFLAGS += -fno-exceptions -Wno-deprecated -Wno-non-template-friend -fpermissive -stdlib=libstdc++

LDFLAGS = -stdlib=libstdc++ -lm
LIBS    = -lm

include ../../Makefile.spec2000


text:
import logging
from datetime import datetime
from pprint import pprint
import django
from django.db import connection
from django.db import models
from django.forms.models import model_to_dict

logger = logging.getLogger(__name__)

class SoftDeleteManager(models.Manager):

    def get_query_set(self):
        return super(SoftDeleteManager, self).get_query_set().filter(deleted=False)

    def all_with_deleted(self):
        return super(SoftDeleteManager, self).get_query_set()

    def deleted_set(self):
        return super(SoftDeleteManager, self).get_query_set().filter(deleted=True)

class DataAccessObject(object):

    def __init__(self, model):
        self.model = model
        self.objects = model.objects

    def find_one_by(self, field, value):
        criteria = {}
        criteria[field] = value
        return self.find_one(**criteria)

    def find_one(self, **criteria):
        try:
            result = self.objects.filter(**criteria)[:1]
            if len(result):
                return result[0]
            return None
        except self.model.DoesNotExist:
            return None

    def find_one_or_create(self, **criteria):
        (obj, created) = self.objects.get_or_create(defaults=criteria, **criteria)
        return (obj, created)

    def get_or_create(self, defaults={}, **criteria):
        (obj, created) = self.objects.get_or_create(defaults=defaults, **criteria)
        return (obj, created)

    def create_or_update(self, defaults={}, **criteria):
        (obj, created) = self.objects.get_or_create(defaults=defaults, **criteria)
        if not created:
            obj.__dict__.update(defaults)
            obj.save()
        return obj

    def find_many_by(self, field, value):
        criteria = {}
        criteria[field] = value
        return self.find_many(**criteria)

    def find_many(self, **criteria):
        return self.objects.filter(**criteria)

    def find_all(self):
        return self.objects.all()

    def id_or_object(self, klass, value):
        if isinstance(value, klass):
            return value
        else:
            try:
                return int(value)
            except ValueError:
                raise AttributeError('Mandatory word attribute should be Word or numeric')

    def create(self, **attributes):
        return self.objects.create(**attributes)

    def delete(self, **criteria):
        return self.objects.filter(**criteria).delete()

    def count(self, **criteria):
        return self.objects.filter(**criteria).count()

    def new(self):
        return self.model()

class RegisterDAO(object):
    """
    Decorator that turns class into object callable from command line.
    Usage:
        @RegisterModel(DjangoModel)
        class TestModel(object):
            ...
    """

    def __init__(self, model_class, name=None):
        self.__model_class = model_class
        self.__name = name

    def __call__(self, dao_class=DataAccessObject):
        self.__dao_class = dao_class
        model.register(self.__model_class, self.__dao_class, self.__name)

        return self.__dao_class

class ModelFactory(object):
    """
    Wstępnie inicjalizuje i zwraca obiekt modelu.
    """
    cache = {}

    models = {}

    def register(self, object_class, model_class=DataAccessObject, name=None):
        if not name:
            name = object_class.__name__
        name = name.lower()
        self.models[name] = (object_class, model_class)

    def get(self, name):
        """ Returns instance of model object specified by name parameter """

        name = name.lower()

        if name in self.cache:
            return self.cache[name]

        if name in self.models:
            object_class, model_class = self.models[name]
            model = self.__create_model(object_class, model_class)
        else:
            raise AttributeError(u'No such model: %s' % (name, ))

        self.cache[name] = model

        return model

    def __create_model(self, object_class, model_class):
        model = model_class(object_class)

        return model

    def __getattr__(self, name):
        return self.get(name)

    def to_dict(self, obj, fields=[], exclude=[], related=[]):
        if isinstance(obj, (models.query.QuerySet, list, tuple)):
            result = []
            for entry in obj:
                if fields or exclude:
                    record = model_to_json(entry, fields=fields, exclude=exclude, related=related)
                else:
                    record = model_to_json(entry, related=related)
                result.append(record)
            return result
        elif isinstance(obj, models.Model):
            if fields or exclude:
                return model_to_json(obj, fields=fields, exclude=exclude, related=related)
            else:
                return model_to_json(obj, related=related)
        elif isinstance(obj, dict):
            return obj
        else:
            raise AttributeError('Wrong type pased to to_dict method: %s' % (type(obj), ))

def model_to_json(obj, fields=None, exclude=None, related=[]):

    result = {}
    # pprint( dir(obj._meta))
    # print'------------------------------'
    # pprint( dir(obj))
    # print obj._meta.get_all_field_names()
    # print obj._meta.fields
    # print obj._meta._field_cache
    for field in obj._meta.fields:
        key = field.name
        # key = field
        # print '->'
        # print '++++'
        # value = obj.__getattribute__(key)

        # if isinstance(value, datetime):
        if isinstance(field, django.db.models.fields.DateTimeField):
            value = getattr(obj, key)
            if value and not isinstance(value, str):
                value = value.strftime("%Y-%m-%d %H:%M:%S")
        # if isinstance(value, models.Model):
        elif isinstance(field, django.db.models.fields.related.ForeignKey):
            if key in related:
                value = getattr(obj, key)
                if value:
                    value = model_to_json(value)
                    result[key + '_id'] = value['id']
                else:
                    value = None
                    result[key + '_id'] = None
            else:
                continue
        else:
            value = getattr(obj, key)

        if fields:
            if key in fields:
                result[key] = value
        else:
            result[key] = value

        if exclude:
            if key in exclude:
                del result[key]

    return result

def map_collection(collection, key):
    return dict([(isinstance(entry, dict) and entry[key] or getattr(entry, key), entry) for entry in collection])

def group_collection(collection, key):
    result = {}
    for entry in collection:
        group_id = isinstance(entry, dict) and entry[key] or getattr(entry, key)
        if group_id not in result.keys():
            result[group_id] = []
        result[group_id].append(entry)

    return result

def debug_sql_queries():
    time = 0.0
    logger.debug('*******************************')
    for q in connection.queries:
        time += float(q['time'])
        logger.debug("%s  %f" % (q['sql'], float(q['time'])))

    logger.debug('SQL queries: %d    time: %f' % (len(connection.queries), time))
    logger.debug('*******************************')

model = ModelFactory()
DAO = RegisterDAO


text:
@import MultipeerConnectivity;
@import JavaScriptCore;

@protocol JSBNSObject;

@protocol JSBMCNearbyServiceBrowser <JSExport, JSBNSObject>

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

@property (readonly) NSString *serviceType;
@property (assign) id delegate;
@property (readonly) MCPeerID *myPeerID;

- (instancetype)initWithPeer:(MCPeerID *)myPeerID serviceType:(NSString *)serviceType;
- (void)startBrowsingForPeers;
- (void)stopBrowsingForPeers;
- (void)invitePeer:(MCPeerID *)peerID toSession:(MCSession *)session withContext:(NSData *)context timeout:(NSTimeInterval)timeout;

#pragma clang diagnostic pop

@end


text:
This module assigns a life cycle category to each household. The life cycle categories are similar, but not the same as, those established for the NHTS. The age categories used in VisionEval models are broader than those used by the NHTS to identify children of different ages. As a result it is not possible for the life cycle designations to reflect child ages as they do in the NHTS. Also, adulthood is determined differently in this module. The NHTS uses age 21 as the threshold age for adulthood. This module uses use 20 as nominal age break for adulthood (the 20-29 age group). Moreover, the module identifies some younger persons to be adults in situations where they are likely to be be living independently as adults or emancipated minors. Persons in the 15 to 19 age group are considered adults when there are no older adults (ages 30+) in the household.

## Model Parameter Estimation

This module has no parameters. A set of rules assigns age group categories based on the age of persons and workers in the household.

## How the Module Works

The module uses datasets on the numbers of persons in each household by age category and the numbers of workers by age category. The age categories are 0-14 years, 15-19 years, 20-29 years, 30-54 years, 55-64 years, and 65+ years. However no workers are in the 0-14 year age category. The household life cycle is determined by the number of children in combination with the number of adults and whether the adults are retired. The categories are as follows:
01: one adult, no children
02: 2+ adults, no children
03: one adult, children (corresponds to NHTS 03, 05, and 07)
04: 2+ adults, children (corresponds to NHTS 04, 06, and 08)
09: one adult, retired, no children
10: 2+ adults, retired, no children

Because the 15-19 age category can be ambiguous with regard to adult or child status, the status of persons in that age category in the household is determined based on the presence of older adults in the household. If there are no older persons or only persons aged 20-29 in the household, the age 15-19 persons are considered to be adults. Otherwise they are considered to be children.

The retirement status of adults is determined based on age and worker status. Households are considered to be populated with retired persons if all the adults are in the 65+ age category and there are no workers. If children are present in the household with retired persons, then the life cycle category is 03 or 04 rather than 09 or 10.

## User Inputs
This module has no user input requirements.

## Datasets Used by the Module
The following table documents each dataset that is retrieved from the datastore and used by the module. Each row in the table describes a dataset. All the datasets must be present in the datastore. One or more of these datasets may be entered into the datastore from the user input files. The table names and their meanings are as follows:

NAME - The dataset name.

TABLE - The table in the datastore that the data is retrieved from.

GROUP - The group in the datastore where the table is located. Note that the datastore has a group named 'Global' and groups for every model run year. For example, if the model run years are 2010 and 2050, then the datastore will have a group named '2010' and a group named '2050'. If the value for 'GROUP' is 'Year', then the dataset will exist in each model run year group. If the value for 'GROUP' is 'BaseYear' then the dataset will only exist in the base year group (e.g. '2010'). If the value for 'GROUP' is 'Global' then the dataset will only exist in the 'Global' group.

TYPE - The data type. The framework uses the type to check units and inputs. Refer to the model system design and users guide for information on allowed types.

UNITS - The units that input values need to represent. Some data types have defined units that are represented as abbreviations or combinations of abbreviations. For example 'MI/HR' means miles per hour. Many of these abbreviations are self evident, but the VisionEval model system design and users guide should be consulted.

PROHIBIT - Values that are prohibited. Values in the datastore do not meet any of the listed conditions.

ISELEMENTOF - Categorical values that are permitted. Values in the datastore are one or more of the listed values.

|NAME      |TABLE     |GROUP |TYPE      |UNITS    |PROHIBIT |ISELEMENTOF |
|:---------|:---------|:-----|:---------|:--------|:--------|:-----------|
|Age0to14  |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Age15to19 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Age20to29 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Age30to54 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Age55to64 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Age65Plus |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Wkr15to19 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Wkr20to29 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Wkr30to54 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Wkr55to64 |Household |Year  |people    |PRSN     |NA, < 0  |            |
|Wkr65Plus |Household |Year  |people    |PRSN     |NA, < 0  |            |
|HhType    |Household |Year  |character |category |         |            |

## Datasets Produced by the Module
The following table documents each dataset that is retrieved from the datastore and used by the module. Each row in the table describes a dataset. All the datasets must be present in the datastore. One or more of these datasets may be entered into the datastore from the user input files. The table names and their meanings are as follows:

NAME - The dataset name.

TABLE - The table in the datastore that the data is retrieved from.

GROUP - The group in the datastore where the table is located. Note that the datastore has a group named 'Global' and groups for every model run year. For example, if the model run years are 2010 and 2050, then the datastore will have a group named '2010' and a group named '2050'. If the value for 'GROUP' is 'Year', then the dataset will exist in each model run year. If the value for 'GROUP' is 'BaseYear' then the dataset will only exist in the base year group (e.g. '2010'). If the value for 'GROUP' is 'Global' then the dataset will only exist in the 'Global' group.

TYPE - The data type. The framework uses the type to check units and inputs. Refer to the model system design and users guide for information on allowed types.

UNITS - The units that input values need to represent. Some data types have defined units that are represented as abbreviations or combinations of abbreviations. For example 'MI/HR' means miles per hour. Many of these abbreviations are self evident, but the VisionEval model system design and users guide should be consulted.

PROHIBIT - Values that are prohibited. Values in the datastore do not meet any of the listed conditions.

ISELEMENTOF - Categorical values that are permitted. Values in the datastore are one or more of the listed values.

DESCRIPTION - A description of the data.

|NAME      |TABLE     |GROUP |TYPE      |UNITS    |PROHIBIT |ISELEMENTOF            |DESCRIPTION                                                   |
|:---------|:---------|:-----|:---------|:--------|:--------|:----------------------|:-------------------------------------------------------------|
|LifeCycle |Household |Year  |character |category |         |01, 02, 03, 04, 09, 10 |Household life cycle as defined by 2009 NHTS LIF_CYC variable |


text:
typedef void (^DBProgressBlock)(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite);

typedef void (^DBRpcResponseBlock)(NSData * _Nullable, NSURLResponse * _Nullable, NSError * _Nullable);

typedef void (^DBUploadResponseBlock)(NSData * _Nullable, NSURLResponse * _Nullable, NSError * _Nullable);

typedef void (^DBDownloadResponseBlock)(NSURL * _Nullable, NSURLResponse * _Nullable, NSError * _Nullable);


text:
<!DOCTYPE html>

  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">

<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />

<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">

  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">

  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">

  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">

  <meta name="keywords" content="React," />

  <link rel="alternate" href="/atom.xml" title="Richey's Blog" type="application/atom+xml" />

<meta name="description" content="相关技术栈 Redux 用来做状态管理 REACT/ROUTER 路由管理 BABEL 最新JavaScript特性翻译成浏览器兼容的旧的JavaScript语法 webpack 打包 ESLint 语法检查  Create React Appfackbook 推出的命令行工具,可以快速生成一个React Application项目 整合了Babel/Webpack Config/Testing/">
<meta property="og:type" content="article">
<meta property="og:title" content="1、React脚手架">
<meta property="og:url" content="http://10000hours.top/2019/01/01/1%E3%80%81React%E8%84%9A%E6%89%8B%E6%9E%B6/index.html">
<meta property="og:site_name" content="Richey's Blog">
<meta property="og:description" content="相关技术栈 Redux 用来做状态管理 REACT/ROUTER 路由管理 BABEL 最新JavaScript特性翻译成浏览器兼容的旧的JavaScript语法 webpack 打包 ESLint 语法检查  Create React Appfackbook 推出的命令行工具,可以快速生成一个React Application项目 整合了Babel/Webpack Config/Testing/">
<meta property="article:published_time" content="2018-12-31T16:00:00.000Z">
<meta property="article:modified_time" content="2020-03-21T15:35:33.173Z">
<meta property="article:author" content="Richey Liu">
<meta property="article:tag" content="React">
<meta name="twitter:card" content="summary">

  <link rel="canonical" href="http://10000hours.top/2019/01/01/1、React脚手架/"/>

  <title>1、React脚手架 | Richey's Blog</title>

<meta name="generator" content="Hexo 4.2.0">

        Richey's Blog

吾生也有涯,而知也无涯。以有涯随无涯,殆已。

    <button>

    </button>

            首页

            标签

            分类

            归档

            搜索

      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">

    <link itemprop="mainEntityOfPage" href="http://10000hours.top/2019/01/01/1%E3%80%81React%E8%84%9A%E6%89%8B%E6%9E%B6/">

      <meta itemprop="name" content="Richey Liu">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">

      <meta itemprop="name" content="Richey's Blog">

1、React脚手架

                发表于

              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-01-01T00:00:00+08:00">
                2019-01-01
              </time>

              |

                分类于

                    前端

                |

               |

                 阅读次数:

相关技术栈

Redux 用来做状态管理

REACT/ROUTER 路由管理

BABEL 最新JavaScript特性翻译成浏览器兼容的旧的JavaScript语法

webpack 打包

ESLint 语法检查

Create React App

fackbook 推出的命令行工具,可以快速生成一个React Application项目

整合了Babel/Webpack Config/Testing/ESLint…

入门级的命令行工具,采取最简策略,只引入了必要的包

Rekit

整合了Babel/Webpack Config/Testing/ESLint + Redux/React Router/Less(Scss)/Feature oriented Architecture/Dedicated IDE

Codesandbox

在线开发平台Codesandbox.io.

开发者可以不用关心项目配置的细节,打包,部署,build...

坚持原创技术分享,您的支持将鼓励我继续创作!

  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    打赏
  </button>

微信支付

支付宝

    本文作者:
    Richey Liu

    本文链接:
    http://10000hours.top/2019/01/01/1%E3%80%81React%E8%84%9A%E6%89%8B%E6%9E%B6/

    版权声明:
    本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!

            # React

                 我的Linux常用软件

                2、React-JSX

            文章目录

            站点概览

Richey Liu

花有重开时人无再少年

                  131
                  日志

                  24
                  分类

                  42
                  标签

                RSS

                        GitHub

                        E-Mail

1. 相关技术栈

2. Create React App

3. Rekit

4. Codesandbox

© 2015 — 2021

  Richey Liu

主题 — NexT.Pisces v5.1.4

          0%


text:
@implementation NSBundle (VenmoSDK)

- (NSString *)name {
    return [self objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey];
}

@end


text:
angular.module('wsapp')
.service('applicationService', function($http){
	return{
		uploadFile: function(userid,myFile,onSuccess, onError){
			var fd = new FormData();
			var file = myFile;
        	console.log('file is ' );
        	console.dir(file);
			fd.append('userid',userid);
			fd.append('file', file);
		var req = {
		    method: 'POST',
		    url: '/file-storage-service/storage/user/pdf',
		    headers: {
		        'Content-Type': undefined
		    },
		    data: fd
		}

		$http(req).then(onSuccess, onError);

		}
	}
});


text:
@interface GameDevice : NSObject

@property (copy, nonatomic) NSString *manufacturer;
@property (copy, nonatomic) NSString *product;
@property (nonatomic) unsigned short vendorId;
@property (nonatomic) unsigned short productId;
@property (nonatomic) unsigned short usagePage;
@property (nonatomic) unsigned short usage;

+ (instancetype)createWithHIDInfo:(struct hid_device_info *)info;

@end


text:
<?php

declare(strict_types=1);

namespace Sonata\Component\Tests\Generator;

use Sonata\OrderBundle\Entity\BaseOrder;

class OrderMock extends BaseOrder
{
    protected $id;

    public function setId($id): void
    {
        $this->id = $id;
    }

    /**
     * @return int the order id
     */
    public function getId()
    {
        return $this->id;
    }
}


text:
package com.vladsch.md.nav.parser.api;

import org.jetbrains.annotations.NotNull;

public class MdImageFencedCode {
    public final @NotNull String content;
    public final @NotNull String[] info;
    public final @NotNull String conversionVariant;
    public final boolean isBlock;

    public MdImageFencedCode(@NotNull String content, @NotNull String[] info, @NotNull String conversionVariant, boolean isBlock) {
        this.content = content;
        this.info = info;
        this.conversionVariant = conversionVariant;
        this.isBlock = isBlock;
    }
}


text:
package za.org.grassroot.webapp.model.rest.wrappers;

import za.org.grassroot.core.dto.TaskDTO;

import java.util.List;

/**
 * Created by paballo on 2016/03/02.
 */
public class TaskResponseWrapper {

    private Long id;
    private String groupName;
    private Long userId;
    private List<String> permissions;
    private List<TaskDTO> tasks;

    public Long getId() {
        return id;
    }
    public String getGroupName() {
        return groupName;
    }
    public Long getUserId() {
        return userId;
    }
    public List<String> getPermissions() {return permissions;}
    public List<TaskDTO> getTasks() {return tasks;}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>org.wso2.carbon.identity.governance</groupId>
        <artifactId>identity-governance</artifactId>
        <version>1.3.57-SNAPSHOT</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.identity.recovery</artifactId>
    <packaging>bundle</packaging>
    <name>WSO2 Carbon - Identity Recovery Management</name>

    <dependencies>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.event</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.idp.mgt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.governance</groupId>
            <artifactId>org.wso2.carbon.identity.governance</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.mgt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.consent.mgt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.json.wso2</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.consent.mgt</groupId>
            <artifactId>org.wso2.carbon.consent.mgt.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>org.jacoco.agent</artifactId>
            <classifier>runtime</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.event.handler.accountlock</groupId>
            <artifactId>org.wso2.carbon.identity.handler.event.account.lock</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.identity.framework</groupId>
            <artifactId>org.wso2.carbon.identity.application.authentication.framework</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.scr.ds-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.2.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>
                            ${project.artifactId}
                        </Bundle-SymbolicName>
                        <Private-Package>
                            org.wso2.carbon.identity.recovery.internal
                        </Private-Package>
                        <Export-Package>
                            org.wso2.carbon.identity.recovery.*; version="${identity.governance.exp.pkg.version}",
                            !org.wso2.carbon.identity.recovery.internal
                        </Export-Package>
                        <Import-Package>
                            org.osgi.framework; version="${osgi.framework.imp.pkg.version.range}",
                            org.osgi.service.component; version="${osgi.service.component.imp.pkg.version.range}",
                            org.wso2.carbon.identity.core.*;version="${carbon.identity.framework.imp.pkg.version.range}",
                            org.wso2.carbon.idp.mgt;version="${carbon.identity.framework.imp.pkg.version.range}",
                            org.wso2.carbon.identity.governance;version="${identity.governance.imp.pkg.version.range}",
                            org.wso2.carbon.identity.handler.event.account.lock.service;
                            version="${carbon.identity.account.lock.handler.imp.pkg.version.range}",
                            org.wso2.carbon.identity.handler.event.account.lock.exception;
                            version="${carbon.identity.account.lock.handler.imp.pkg.version.range}",
                            org.wso2.carbon.consent.mgt.core;version="${carbon.consent.mgt.version.range}",
                            org.wso2.carbon.identity.application.authentication.framework.*;
                            version="${carbon.identity.framework.imp.pkg.version.range}",
                            org.wso2.carbon.identity.application.common.model;
                            version="${carbon.identity.framework.imp.pkg.version.range}",
                            org.wso2.carbon.identity.base; version="${carbon.identity.framework.imp.pkg.version.range}",
                            org.wso2.carbon.identity.mgt.util;
                            version="${carbon.identity.framework.imp.pkg.version.range}",
                            org.wso2.carbon.user.api; version="${carbon.user.api.imp.pkg.version.range}",
                            org.wso2.carbon.user.core.*; version="${carbon.kernel.package.import.version.range}",
                            org.wso2.carbon.utils.multitenancy.*;
                            version="${carbon.kernel.package.import.version.range}",
                            javax.servlet.http; version="${imp.pkg.version.javax.servlet}",
                            org.apache.commons.collections; version="${commons-collections.wso2.osgi.version.range}",
                            org.apache.commons.lang; version="${commons-lang.wso2.osgi.version.range}",
                            org.apache.commons.logging.*; version="${commons-logging.osgi.version.range}",
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-prepare-agent-integration</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report-integration</id>
                        <goals>
                            <goal>report-integration</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <rule implementation="org.jacoco.maven.RuleConfiguration">
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit implementation="org.jacoco.report.check.Limit">
                                            <counter>COMPLEXITY</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.05</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Cafe Reserve App</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href='https://fonts.googleapis.com/css?family=Roboto:300' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/normalize.css">
  <link rel="stylesheet" href="bower_components/html5-boilerplate/dist/css/main.css">
  <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
  <link rel="stylesheet" href="assets/css/app.css">
  <link rel="stylesheet" href="assets/css/animation.css">

{{smallTitle}}

Café Reserve

Reservation Confirmed!

    POWERED BY RESERVE


text:
package com.ctrip.hermes.core.bo;

import com.ctrip.hermes.meta.entity.ConsumerGroup;

public class ConsumerView {
	private String topicName;

	private String groupName;

	private String appId;

	private String retryPolicy;

	private Integer ackTimeoutSeconds;

	private boolean orderedConsume;

	public ConsumerView() {
	}

	public ConsumerView(String topicName, ConsumerGroup consumer) {
		this.topicName = topicName;
		this.groupName = consumer.getName();
		this.appId = consumer.getAppIds();
		this.retryPolicy = consumer.getRetryPolicy();
		this.ackTimeoutSeconds = consumer.getAckTimeoutSeconds();
		this.orderedConsume = consumer.getOrderedConsume();
	}

	public  ConsumerGroup toMetaConsumer() {
		ConsumerGroup consumer = new ConsumerGroup();
		consumer.setAckTimeoutSeconds(this.ackTimeoutSeconds);
		consumer.setAppIds(this.appId);
		consumer.setName(this.groupName);
		consumer.setRetryPolicy(this.retryPolicy);
		consumer.setOrderedConsume(this.orderedConsume);

		return consumer;
	}

	public String getTopicName() {
		return topicName;
	}

	public void setTopicName(String topicName) {
		this.topicName = topicName;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getRetryPolicy() {
		return retryPolicy;
	}

	public void setRetryPolicy(String retryPolicy) {
		this.retryPolicy = retryPolicy;
	}

	public Integer getAckTimeoutSeconds() {
		return ackTimeoutSeconds;
	}

	public void setAckTimeoutSeconds(Integer ackTimeoutSeconds) {
		this.ackTimeoutSeconds = ackTimeoutSeconds;
	}

	public boolean isOrderedConsume() {
		return orderedConsume;
	}

	public void setOrderedConsume(boolean orderedConsume) {
		this.orderedConsume = orderedConsume;
	}

	@Override
	public String toString() {
		return "ConsumerView [topicName=" + topicName + ", groupName=" + groupName + ", appId=" + appId
				+ ", retryPolicy=" + retryPolicy + ", ackTimeoutSeconds=" + ackTimeoutSeconds + ", orderedConsume="
				+ orderedConsume + "]";
	}
}


text:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
using System.Diagnostics;

public class Program{
    const long MOD = 123;
    const string YES = "yes";
    const string NO = "NO";

    public static void Main(string[] args){
        ConsoleInput cin = new ConsoleInput(Console.In, ' ');
        long N;
        N = cin.ReadLong;
        long M;
        M = cin.ReadLong;
        string[,] H = new string[N-2+1,M-1-2+1];
        for(int i = 0;i < N-2+1;i++){
            for(int j = 0;j < M-1-2+1;j++){
                H[i,j] = cin.Read;
            }
        }
        long[] A = new long[N-2+1];
        double[] B = new double[N-2+1];
        for(int i = 0;i < N-2+1;i++){
            A[i] = cin.ReadLong;
            B[i] = cin.ReadDouble;
        }
        long Q;
        Q = cin.ReadLong;
        long[] X = new long[M+Q];
        for(int i = 0;i < M+Q;i++){
            X[i] = cin.ReadLong;
        }
        new Program().Solve(N, M, H, A, B, Q, X);
    }

    public void Solve(long N, long M, string[,] H, long[] A, double[] B, long Q, long[] X){

    }
}

public class ConsoleInput{
    private readonly System.IO.TextReader _stream;
    private char _separator = ' ';
    private Queue<string> inputStream;
    public ConsoleInput(System.IO.TextReader stream, char separator = ' '){
        this._separator = separator;
        this._stream = stream;
        inputStream = new Queue<string>();
    }
    public string Read{
        get{
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(_separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
    }
    public string ReadLine { get { return _stream.ReadLine(); } }
    public int ReadInt { get { return int.Parse(Read); } }
    public long ReadLong { get { return long.Parse(Read); } }
    public double ReadDouble { get { return double.Parse(Read); } }
    public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
    public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
    public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
}


text:
import React from 'react';
import Nav from "react-bootstrap/Nav";
import Navbar from "react-bootstrap/Navbar";
import NavDropdown from "react-bootstrap/cjs/NavDropdown";
import NavItem from "react-bootstrap/NavItem";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import { LinkContainer } from "react-router-bootstrap";
import "bootstrap/dist/css/bootstrap.min.css";

// Internal Modules ----------------------------------------------------------

import FacilitySelector from "./components/FacilitySelector";
import LoggedInUser from "./components/LoggedInUser";
import { FacilityContextProvider } from "./contexts/FacilityContext";
import { LoginContextProvider } from "./contexts/LoginContext";
import GuestHistoryReport from "./reports/GuestHistoryReport";
import MonthlySummaryReport from "./reports/MonthlySummaryReport";
import CheckinsView from "./views/CheckinsView";
import FacilitiesView from "./views/FacilitiesView";
import GuestsView from "./views/GuestsView";
import HomeView from "./views/HomeView";
import TemplatesView from "./views/TemplatesView";
import UsersView from "./views/UsersView";

// Component Details ---------------------------------------------------------

function App() {
  return (
      <>

        <LoginContextProvider>
        <FacilityContextProvider>

          <Router>

            <Navbar
                bg="info"
                className="mb-3"
                expand="lg"
                sticky="top"
                variant="dark"
            >

              <Navbar.Brand>
                <img
                  alt="CityTeam Logo"
                  height={66}
                  src="./CityTeamDarkBlue.png"
                  width={160}
                />
              </Navbar.Brand>
              <Navbar.Toggle aria-controls="basic-navbar-brand"/>

              <Navbar.Collapse id="basic-navbar-brand">
                <Nav className="mr-auto">
                  <LinkContainer to="/home">
                    <NavItem className="nav-link">Home</NavItem>
                  </LinkContainer>
                  <LinkContainer to="/checkins">
                    <NavItem className="nav-link">Checkins</NavItem>
                  </LinkContainer>
                  <LinkContainer to="/facilities">
                    <NavItem className="nav-link">Facilities</NavItem>
                  </LinkContainer>
                  <LinkContainer to="/guests">
                    <NavItem className="nav-link">Guests</NavItem>
                  </LinkContainer>
                  <LinkContainer to="/templates">
                    <NavItem className="nav-link">Templates</NavItem>
                  </LinkContainer>
                  <LinkContainer to="/users">
                    <NavItem className="nav-link">Users</NavItem>
                  </LinkContainer>
                  <NavDropdown id="reports" title="Reports">
                    <LinkContainer to="/guestHistoryReport">
                      <NavDropdown.Item>Guest History</NavDropdown.Item>
                    </LinkContainer>
                    <LinkContainer to="/monthlySummaryReport">
                      <NavDropdown.Item>Monthly Summary</NavDropdown.Item>
                    </LinkContainer>
                  </NavDropdown>
                </Nav>
              </Navbar.Collapse>

              <LoggedInUser/>
              <span className="mr-4"/>
              <FacilitySelector/>

            </Navbar>

            <Switch>
              <Route exact path="/checkins">
                <CheckinsView/>
              </Route>
              <Route exact path="/facilities">
                <FacilitiesView/>
              </Route>
              <Route exact path="/guestHistoryReport">
                <GuestHistoryReport/>
              </Route>
              <Route exact path="/guests">
                <GuestsView/>
              </Route>
              <Route exact path="/monthlySummaryReport">
                <MonthlySummaryReport/>
              </Route>
              <Route exact path="/templates">
                <TemplatesView/>
              </Route>
              <Route exact path="/users">
                <UsersView/>
              </Route>
              <Route path="/">
                <HomeView/>
              </Route>
            </Switch>

          </Router>

        </FacilityContextProvider>
        </LoginContextProvider>

      </>

  );

}

export default App;


text:
If you want to create a custom icon for your module, you will have to create an SVG file for your module and set the path to this file in the `desktop/config.py` of your app.<br>

This icon is loaded via AJAX first time, then it will be rendered.

Example:

	from frappe import _

	def get_data():
		return {
			"Frappe Apps": {
				"color": "orange",
				"icon": "assets/frappe/images/frappe.svg",
				"label": _("Frappe.io Portal"),
				"type": "module"
			}
		}

> PS: A great place to buy SVG icons for a low cost is the awesome [Noun Project](http://thenounproject.com/)

<!-- markdown -->


text:
Simple wrapper API around multiple logging APIs.

Overview

This package provides an API for logging in server-based applications that
can be used around a variety of different logging implementations, including
prebuilt support for the following:

Log4J (version 1.2 or later)
    from Apache's Logging project.  Each named Log
    instance is connected to a corresponding Log4J Logger.

    JDK Logging API, included in JDK 1.4 or later systems.  Each named
    Log instance is connected to a corresponding
    java.util.logging.Logger instance.

LogKit from Apache's
    Avalon project.  Each named Log instance is
    connected to a corresponding LogKit Logger.

NoOpLog implementation that simply swallows
    all log output, for all named Log instances.

SimpleLog implementation that writes all
    log output, for all named Log instances, to
    System.err.

Quick Start Guide

For those impatient to just get on with it, the following example
illustrates the typical declaration and use of a logger that is named (by
convention) after the calling class:

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;

    public class Foo {

        private Log log = LogFactory.getLog(Foo.class);

        public void foo() {
            ...
            try {
                if (log.isDebugEnabled()) {
                    log.debug("About to do something to object " + name);
                }
                name.bar();
            } catch (IllegalStateException e) {
                log.error("Something bad happened to " + name, e);
            }
            ...
        }

Unless you configure things differently, all log output will be written
to System.err.  Therefore, you really will want to review the remainder of
this page in order to understand how to configure logging for your
application.

Configuring the Commons Logging Package

Choosing a LogFactory Implementation

From an application perspective, the first requirement is to retrieve an
object reference to the LogFactory instance that will be used
to create Log instances for this
application.  This is normally accomplished by calling the static
getFactory() method.  This method implements the following
discovery algorithm to select the name of the LogFactory
implementation class this application wants to use:

Check for a system property named
   org.apache.commons.logging.LogFactory.

Use the JDK 1.3 JAR Services Discovery mechanism (see

    http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html for
    more information) to look for a resource named
    META-INF/services/org.apache.commons.logging.LogFactory
    whose first line is assumed to contain the desired class name.

Look for a properties file named commons-logging.properties
    visible in the application class path, with a property named
    org.apache.commons.logging.LogFactory defining the
    desired implementation class name.

Fall back to a default implementation, which is described
    further below.

If a commons-logging.properties file is found, all of the
properties defined there are also used to set configuration attributes on
the instantiated LogFactory instance.

Once an implementation class name is selected, the corresponding class is
loaded from the current Thread context class loader (if there is one), or
from the class loader that loaded the LogFactory class itself
otherwise.  This allows a copy of commons-logging.jar to be
shared in a multiple class loader environment (such as a servlet container),
but still allow each web application to provide its own LogFactory
implementation, if it so desires.  An instance of this class will then be
created, and cached per class loader.

The Default LogFactory Implementation

The Logging Package APIs include a default LogFactory
implementation class (
org.apache.commons.logging.impl.LogFactoryImpl) that is selected if no
other implementation class name can be discovered.  Its primary purpose is
to create (as necessary) and return Log instances
in response to calls to the getInstance() method.  The default
implementation uses the following rules:

At most one Log instance of the same name will be created.
    Subsequent getInstance() calls to the same
    LogFactory instance, with the same name or Class
    parameter, will return the same Log instance.

When a new Log instance must be created, the default
    LogFactory implementation uses the following discovery
    process:

Look for a configuration attribute of this factory named
        org.apache.commons.logging.Log (for backwards
        compatibility to pre-1.0 versions of this API, an attribute
        org.apache.commons.logging.log is also consulted).

Look for a system property named
        org.apache.commons.logging.Log (for backwards
        compatibility to pre-1.0 versions of this API, a system property
        org.apache.commons.logging.log is also consulted).

If the Log4J logging system is available in the application
        class path, use the corresponding wrapper class
        (Log4JLogger).

If the application is executing on a JDK 1.4 system, use
        the corresponding wrapper class
        (Jdk14Logger).

Fall back to the default simple logging implementation
        (SimpleLog).

Load the class of the specified name from the thread context class
    loader (if any), or from the class loader that loaded the
    LogFactory class otherwise.

Instantiate an instance of the selected Log
    implementation class, passing the specified name as the single
    argument to its constructor.

See the SimpleLog JavaDocs for detailed
configuration information for this default implementation.

Configuring the Underlying Logging System

The basic principle is that the user is totally responsible for the
configuration of the underlying logging system.
Commons-logging should not change the existing configuration.

Each individual Log implementation may
support its own configuration properties.  These will be documented in the
class descriptions for the corresponding implementation class.

Finally, some Log implementations (such as the one for Log4J)
require an external configuration file for the entire logging environment.
This file should be prepared in a manner that is specific to the actual logging
technology being used.

Using the Logging Package APIs

Use of the Logging Package APIs, from the perspective of an application
component, consists of the following steps:

Acquire a reference to an instance of
    org.apache.commons.logging.Log, by calling the
    factory method

    LogFactory.getInstance(String name).  Your application can contain
    references to multiple loggers that are used for different
    purposes.  A typical scenario for a server application is to have each
    major component of the server use its own Log instance.

Cause messages to be logged (if the corresponding detail level is enabled)
    by calling appropriate methods (trace(), debug(),
    info(), warn(), error, and
    fatal()).

For convenience, LogFactory also offers a static method
getLog() that combines the typical two-step pattern:

  Log log = LogFactory.getFactory().getInstance(Foo.class);

into a single method call:

  Log log = LogFactory.getLog(Foo.class);

For example, you might use the following technique to initialize and
use a Log instance in an application component:

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class MyComponent {

  protected Log log =
    LogFactory.getLog(MyComponent.class);

  // Called once at startup time
  public void start() {
    ...
    log.info("MyComponent started");
    ...
  }

  // Called once at shutdown time
  public void stop() {
    ...
    log.info("MyComponent stopped");
    ...
  }

  // Called repeatedly to process a particular argument value
  // which you want logged if debugging is enabled
  public void process(String value) {
    ...
    // Do the string concatenation only if logging is enabled
    if (log.isDebugEnabled())
      log.debug("MyComponent processing " + value);
    ...
  }

}


text:
#region Disclaimer/Info

///////////////////////////////////////////////////////////////////////////////////////////////////
// Subtext WebLog
//
// Subtext is an open source weblog system that is a fork of the .TEXT
// weblog system.
//
// For updated news and information please visit http://subtextproject.com/
// Subtext is hosted at Google Code at http://code.google.com/p/subtext/
// The development mailing list is at subtext@googlegroups.com
//
// This project is licensed under the BSD license.  See the License.txt file for more information.
///////////////////////////////////////////////////////////////////////////////////////////////////
///Part of this code derives from the original FileBrowserConnector shipped with
///the original FredCK.FCKeditorV2, which is redistributed with the following license

#region Original License

#endregion

#endregion

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Net;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml;
using FredCK.FCKeditorV2;
using Subtext.Extensibility;
using Subtext.Extensibility.Interfaces;
using Subtext.Framework;
using Subtext.Framework.Components;
using Subtext.Framework.Configuration;
using Subtext.Framework.Routing;
using Subtext.Framework.Web.Handlers;

namespace Subtext.Providers.BlogEntryEditor.FCKeditor
{
    /// <summary>
    /// Used to provide file management functionality for FCKEditor.
    /// </summary>
    public class FileBrowserConnector : SubtextPage
    {
        protected override void OnInit(EventArgs e)
        {
            if (!SubtextContext.User.IsInRole("Admins"))
            {
                SubtextContext.HttpContext.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
                SubtextContext.HttpContext.Response.End();
            }
            base.OnInit(e);
        }

        protected override void OnLoad(EventArgs e)
        {
            // Get the main request informaiton.
            string sCommand = Request.QueryString["Command"];
            if (sCommand == null)
            {
                return;
            }

            string sResourceType = Request.QueryString["Type"];
            if (sResourceType == null)
            {
                return;
            }

            string sCurrentFolder = Request.QueryString["CurrentFolder"];
            if (sCurrentFolder == null)
            {
                return;
            }

            // Check the current folder syntax (must begin and start with a slash).
            if (!sCurrentFolder.EndsWith("/"))
            {
                sCurrentFolder += "/";
            }
            if (!sCurrentFolder.StartsWith("/"))
            {
                sCurrentFolder = "/" + sCurrentFolder;
            }

            // File Upload doesn't have to return XML, so it must be intercepted before anything.
            if (sCommand == "FileUpload")
            {
                FileUpload(sResourceType, sCurrentFolder);
                return;
            }

            // Cleans the response buffer.
            Response.ClearHeaders();
            Response.Clear();

            // Prevent the browser from caching the result.
            Response.CacheControl = "no-cache";

            // Set the response format.
            Response.ContentEncoding = Encoding.UTF8;
            Response.ContentType = "text/xml";

            var oXML = new XmlDocument();
            XmlNode oConnectorNode = CreateBaseXml(oXML, sCommand, sResourceType, sCurrentFolder);

            if (CreateImageFolder(oConnectorNode))
            {
                if (sResourceType.Equals("Image"))
                {
                    // Execute the required command.
                    switch (sCommand)
                    {
                        case "GetFolders":
                            GetFolders(oConnectorNode, sCurrentFolder);
                            break;
                        case "GetFoldersAndFiles":
                            GetFolders(oConnectorNode, sCurrentFolder);
                            GetFiles(oConnectorNode, sResourceType, sCurrentFolder);
                            break;
                        case "CreateFolder":
                            CreateFolder(oConnectorNode, sResourceType, sCurrentFolder);
                            break;
                    }
                }
                else if (sResourceType.Equals("Posts"))
                {
                    // Execute the required command.
                    switch (sCommand)
                    {
                        case "GetFolders":
                            GetCategories(oConnectorNode, sCurrentFolder);
                            break;
                        case "GetFoldersAndFiles":
                            GetCategories(oConnectorNode, sCurrentFolder);
                            GetPosts(oConnectorNode, sCurrentFolder);
                            break;
                        case "CreateFolder":
                            CreateFolder(oConnectorNode, sResourceType, sCurrentFolder);
                            break;
                    }
                }
                else if (sResourceType.Equals("File"))
                {
                    // Execute the required command.
                    switch (sCommand)
                    {
                        case "GetFolders":
                            GetFolders(oConnectorNode, sCurrentFolder);
                            break;
                        case "GetFoldersAndFiles":
                            GetFolders(oConnectorNode, sCurrentFolder);
                            GetFiles(oConnectorNode, sResourceType, sCurrentFolder);
                            break;
                        case "CreateFolder":
                            CreateFolder(oConnectorNode, sResourceType, sCurrentFolder);
                            break;
                    }
                }
            }

            // Output the resulting XML.
            Response.Write(oXML.OuterXml);

            Response.End();

            base.OnLoad(e);
        }

        private void GetFolders(XmlNode connectorNode, string currentFolder)
        {
            // Map the virtual path to the local server path.
            string sServerDir = ServerMapFolder(currentFolder, Url.ImageDirectoryUrl(Blog));

            // Create the "Folders" node.
            XmlNode oFoldersNode = XmlUtil.AppendElement(connectorNode, "Folders");

            var oDir = new DirectoryInfo(sServerDir);
            DirectoryInfo[] aSubDirs = oDir.GetDirectories();

            for (int i = 0; i < aSubDirs.Length; i++)
            {
                // Create the "Folders" node.
                XmlNode oFolderNode = XmlUtil.AppendElement(oFoldersNode, "Folder");
                XmlUtil.SetAttribute(oFolderNode, "name", aSubDirs[i].Name);
            }
        }

        private void GetFiles(XmlNode connectorNode, string resourceType, string currentFolder)
        {
            // Map the virtual path to the local server path.
            string sServerDir = ServerMapFolder(currentFolder, Url.ImageDirectoryUrl(Blog));

            // Create the "Files" node.
            XmlNode oFilesNode = XmlUtil.AppendElement(connectorNode, "Files");

            var oDir = new DirectoryInfo(sServerDir);
            FileInfo[] aFiles = oDir.GetFiles();

            for (int i = 0; i < aFiles.Length; i++)
            {
                if (Regex.IsMatch(aFiles[i].Extension, GetAllowedExtension(resourceType), RegexOptions.IgnoreCase))
                {
                    Decimal iFileSize = Math.Round((Decimal)aFiles[i].Length / 1024);
                    if (iFileSize < 1 && aFiles[i].Length != 0)
                    {
                        iFileSize = 1;
                    }

                    // Create the "File" node.
                    XmlNode oFileNode = XmlUtil.AppendElement(oFilesNode, "File");
                    XmlUtil.SetAttribute(oFileNode, "name", aFiles[i].Name);
                    XmlUtil.SetAttribute(oFileNode, "size", iFileSize.ToString(CultureInfo.InvariantCulture));
                }
            }
        }

        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
            Justification =
                "The error number is used to create an error node in the XML document, so we need to catch a general exception as well."
            )]
        private void CreateFolder(XmlNode connectorNode, string resourceType, string currentFolder)
        {
            string sErrorNumber = "0";

            if (resourceType.Equals("Posts"))
            {
                sErrorNumber = "103";
            }
            else
            {
                string sNewFolderName = Request.QueryString["NewFolderName"];

                if (sNewFolderName == null || sNewFolderName.Length == 0)
                {
                    sErrorNumber = "102";
                }
                else
                {
                    // Map the virtual path to the local server path of the current folder.
                    string sServerDir = ServerMapFolder(currentFolder, Url.ImageDirectoryUrl(Blog));

                    try
                    {
                        Util.CreateDirectory(Path.Combine(sServerDir, sNewFolderName));
                    }
                    catch (ArgumentException)
                    {
                        sErrorNumber = "102";
                    }
                    catch (PathTooLongException)
                    {
                        sErrorNumber = "102";
                    }
                    catch (IOException)
                    {
                        sErrorNumber = "101";
                    }
                    catch (SecurityException)
                    {
                        sErrorNumber = "103";
                    }
                    catch (Exception)
                    {
                        sErrorNumber = "110";
                    }
                }
            }

            // Create the "Error" node.
            XmlNode oErrorNode = XmlUtil.AppendElement(connectorNode, "Error");
            XmlUtil.SetAttribute(oErrorNode, "number", sErrorNumber);
        }

        private void FileUpload(string resourceType, string currentFolder)
        {
            string sErrorNumber = "0";
            string sFileName = "";

            if (!resourceType.Equals("Posts"))
            {
                HttpPostedFile oFile = Request.Files["NewFile"];

                if (oFile != null)
                {
                    // Map the virtual path to the local server path.
                    string sServerDir = ServerMapFolder(currentFolder, Url.ImageDirectoryUrl(Blog));

                    // Get the uploaded file name.
                    sFileName = Path.GetFileName(oFile.FileName);

                    int iCounter = 0;

                    while (true)
                    {
                        string sFilePath = Path.Combine(sServerDir, sFileName);

                        if (File.Exists(sFilePath))
                        {
                            iCounter++;
                            sFileName =
                                Path.GetFileNameWithoutExtension(oFile.FileName)
                                + "(" + iCounter + ")"
                                + Path.GetExtension(oFile.FileName);

                            sErrorNumber = "201";
                        }
                        else
                        {
                            oFile.SaveAs(sFilePath);
                            break;
                        }
                    }
                }
                else
                {
                    sErrorNumber = "202";
                }
            }
            else
            {
                sErrorNumber = "203";
            }

            Response.Clear();
            Response.Write("<script type=\"text/javascript\">");
            Response.Write("window.parent.frames['frmUpload'].OnUploadCompleted(" + sErrorNumber + ",'" +
                           sFileName.Replace("'", "\\'") + "') ;");
            Response.Write("</script>");

            Response.End();
        }

        private XmlNode CreateBaseXml(XmlDocument xml, string command, string resourceType, string currentFolder)
        {
            // Create the XML document header.
            xml.AppendChild(xml.CreateXmlDeclaration("1.0", "utf-8", null));

            // Create the main "Connector" node.
            XmlNode connectorNode = XmlUtil.AppendElement(xml, "Connector");
            XmlUtil.SetAttribute(connectorNode, "command", command);
            XmlUtil.SetAttribute(connectorNode, "resourceType", resourceType);

            // Add the current folder node.
            if (!resourceType.Equals("Posts"))
            {
                XmlNode oCurrentNode = XmlUtil.AppendElement(connectorNode, "CurrentFolder");
                XmlUtil.SetAttribute(oCurrentNode, "path", currentFolder);
                XmlUtil.SetAttribute(oCurrentNode, "url", Url.ImageDirectoryUrl(Blog) + currentFolder);
            }
            else
            {
                XmlNode currentNode = XmlUtil.AppendElement(connectorNode, "CurrentFolder");
                XmlUtil.SetAttribute(currentNode, "path", currentFolder);
                XmlUtil.SetAttribute(currentNode, "url", "");
            }

            return connectorNode;
        }

        private string ServerMapFolder(string folderPath, string imageDirectoryUrl)
        {
            // Get the resource type directory.
            string imageDirectoryPath = Server.MapPath(imageDirectoryUrl);

            // Return the resource type directory combined with the required path.
            return Path.Combine(imageDirectoryPath, folderPath.TrimStart('/'));
        }

        private static string GetUrlFromPath(string folderPath, string imageDirectoryUrl)
        {
            return imageDirectoryUrl + folderPath.Substring(1);
        }

        private static string GetAllowedExtension(string resourceType)
        {
            string extStr = string.Empty;
            if (resourceType.Equals("File"))
            {
                extStr = FckBlogEntryEditorProvider.FileAllowedExtensions;
            }
            else if (resourceType.Equals("Image"))
            {
                extStr = FckBlogEntryEditorProvider.ImageAllowedExtensions;
            }
            return extStr;
        }

        private bool CreateImageFolder(XmlNode connectorNode)
        {
            bool retval;
            string imageDirectoryPath = Url.ImageDirectoryPath(Blog);
            try
            {
                if (!Directory.Exists(imageDirectoryPath))
                {
                    Directory.CreateDirectory(imageDirectoryPath);
                }
                retval = true;
            }
            catch (Exception)
            {
                // Create the "Error" node.
                XmlNode errorNode = XmlUtil.AppendElement(connectorNode, "Error");
                XmlUtil.SetAttribute(errorNode, "number", "1");
                XmlUtil.SetAttribute(errorNode, "text",
                                     "Cannot create folder: " + imageDirectoryPath + "." + Environment.NewLine +
                                     "Write access to this folder is required to initialize the image storage");
                retval = false;
            }
            return retval;
        }

        #region Post Type Handler

        private void GetCategories(XmlNode connectorNode, string currentFolder)
        {
            if (currentFolder.Equals("/"))
            {
                ICollection<LinkCategory> catList = Repository.GetCategories(CategoryType.PostCollection, ActiveFilter.None);

                // Create the "Folders" node.
                XmlNode oFoldersNode = XmlUtil.AppendElement(connectorNode, "Folders");

                foreach (LinkCategory category in catList)
                {
                    // Create the "Folders" node.
                    XmlNode oFolderNode = XmlUtil.AppendElement(oFoldersNode, "Folder");
                    XmlUtil.SetAttribute(oFolderNode, "name", category.Title);
                }
            }
        }

        private void GetPosts(XmlNode connectorNode, string currentFolder)
        {
            IPagedCollection<EntryStatsView> posts;
            if (currentFolder.Equals("/"))
            {
                posts = Repository.GetEntries(PostType.BlogPost, -1, 0, 1000);
            }
            else
            {
                string categoryName = currentFolder.Substring(1, currentFolder.Length - 2);
                LinkCategory category = Repository.GetLinkCategory(categoryName, false);
                posts = Repository.GetEntries(PostType.BlogPost, category.Id, 0, 1000);
            }

            // Create the "Files" node.
            XmlNode oFilesNode = XmlUtil.AppendElement(connectorNode, "Files");
            foreach (var entry in posts)
            {
                // Create the "File" node.
                if (entry.IsActive)
                {
                    XmlNode oFileNode = XmlUtil.AppendElement(oFilesNode, "File");

                    //TODO: Seriously refactor.
                    var urlHelper = new BlogUrlHelper(null, null);

                    XmlUtil.SetAttribute(oFileNode, "name",
                                         string.Format(CultureInfo.InvariantCulture, "{0}|{1}", entry.Title,
                                                       urlHelper.EntryUrl(entry).ToFullyQualifiedUrl(Config.CurrentBlog)));
                    XmlUtil.SetAttribute(oFileNode, "size", entry.DateModifiedUtc.ToShortDateString());
                }
            }
        }

        #endregion
    }
}


text:
package runtime

type uintreg uint32
type intptr int32 // TODO(rsc): remove


text:
package com.tle.common;

import java.io.Serializable;
import java.util.concurrent.TimeUnit;

public final class ExpiringValue<T> implements Serializable {
  private static final long serialVersionUID = 1L;

  private final long timeout;
  private final T value;

  public static <U> ExpiringValue<U> expireAt(U value, long exactTime) {
    return new ExpiringValue<U>(value, exactTime);
  }

  public static <U> ExpiringValue<U> expireAfter(U value, long duration, TimeUnit unit) {
    return new ExpiringValue<U>(value, System.currentTimeMillis() + unit.toMillis(duration));
  }

  private ExpiringValue(T value, long expiresAtMillisSinceEpoch) {
    this.value = value;
    this.timeout = expiresAtMillisSinceEpoch;
  }

  public boolean isTimedOut() {
    return System.currentTimeMillis() > timeout;
  }

  public T getValue() {
    return isTimedOut() ? null : value;
  }
}


text:
1. Consulta la documentación de la clase `Random`. Aunque habrá mucho contenido de la documentación que no entiendas, deberías ser capaz de contestar estas preguntas:

  1. ¿En qué paquete (package) está esta clase?

  2. ¿Cuántos constructores tiene la clase?

  3. ¿De qué tipo de datos podemos generar valores aleatorios?

2. Escribe en el CodePad el código necesario para generar e imprimir por pantalla 3 números enteros aleatorios.

3. Escribe en el CodePad el código necesario para generar e imprimir por pantalla 20 números enteros aleatorios entre 0 y 100 ambos inclusive.

4. Escribe en el CodePad el código necesario para generar e imprimir 10 valores booleanos aleatorios.

5. Escribe en el CodePad el código necesario para imprimir por pantalla aleatoriamente una de estas cadenas: "si", "no", "tal vez".

6. Escribe en el CodePad el código necesario para imprimir por pantalla aleatoriamente una de las cadenas contenidas en un `ArrayList` de `String` que crees previamente. No se permite escribir en el código ningún número de forma literal.

7. Escribe en el CodePad el código necesario para imprimir por pantalla aleatoriamente una de las cadenas contenidas en array tradicional que crees previamente. No se permite escribir en el código ningún número de forma literal.


text:
@interface APHistoryMessage () {
 @public
  jint senderUid_;
  jlong rid_;
  jlong date_;
  APMessage *message_;
  APMessageStateEnum *state_;
}

@end

J2OBJC_FIELD_SETTER(APHistoryMessage, message_, APMessage *)
J2OBJC_FIELD_SETTER(APHistoryMessage, state_, APMessageStateEnum *)

@implementation APHistoryMessage

- (instancetype)initWithInt:(jint)senderUid
                   withLong:(jlong)rid
                   withLong:(jlong)date
              withAPMessage:(APMessage *)message
     withAPMessageStateEnum:(APMessageStateEnum *)state {
  APHistoryMessage_initWithInt_withLong_withLong_withAPMessage_withAPMessageStateEnum_(self, senderUid, rid, date, message, state);
  return self;
}

- (instancetype)init {
  APHistoryMessage_init(self);
  return self;
}

- (jint)getSenderUid {
  return self->senderUid_;
}

- (jlong)getRid {
  return self->rid_;
}

- (jlong)getDate {
  return self->date_;
}

- (APMessage *)getMessage {
  return self->message_;
}

- (APMessageStateEnum *)getState {
  return self->state_;
}

- (void)parseWithBSBserValues:(BSBserValues *)values {
  self->senderUid_ = [((BSBserValues *) nil_chk(values)) getIntWithInt:1];
  self->rid_ = [values getLongWithInt:2];
  self->date_ = [values getLongWithInt:3];
  self->message_ = APMessage_fromBytesWithByteArray_([values getBytesWithInt:5]);
  jint val_state = [values getIntWithInt:6 withInt:0];
  if (val_state != 0) {
    self->state_ = APMessageStateEnum_parseWithInt_(val_state);
  }
}

- (void)serializeWithBSBserWriter:(BSBserWriter *)writer {
  [((BSBserWriter *) nil_chk(writer)) writeIntWithInt:1 withInt:self->senderUid_];
  [writer writeLongWithInt:2 withLong:self->rid_];
  [writer writeLongWithInt:3 withLong:self->date_];
  if (self->message_ == nil) {
    @throw new_JavaIoIOException_init();
  }
  [writer writeBytesWithInt:5 withByteArray:[((APMessage *) nil_chk(self->message_)) buildContainer]];
  if (self->state_ != nil) {
    [writer writeIntWithInt:6 withInt:[self->state_ getValue]];
  }
}

- (NSString *)description {
  NSString *res = @"struct HistoryMessage{";
  res = JreStrcat("$$", res, JreStrcat("$I", @"senderUid=", self->senderUid_));
  res = JreStrcat("$$", res, JreStrcat("$J", @", rid=", self->rid_));
  res = JreStrcat("$$", res, JreStrcat("$J", @", date=", self->date_));
  res = JreStrcat("$$", res, JreStrcat("$@", @", message=", self->message_));
  res = JreStrcat("$C", res, '}');
  return res;
}

@end

void APHistoryMessage_initWithInt_withLong_withLong_withAPMessage_withAPMessageStateEnum_(APHistoryMessage *self, jint senderUid, jlong rid, jlong date, APMessage *message, APMessageStateEnum *state) {
  (void) BSBserObject_init(self);
  self->senderUid_ = senderUid;
  self->rid_ = rid;
  self->date_ = date;
  self->message_ = message;
  self->state_ = state;
}

APHistoryMessage *new_APHistoryMessage_initWithInt_withLong_withLong_withAPMessage_withAPMessageStateEnum_(jint senderUid, jlong rid, jlong date, APMessage *message, APMessageStateEnum *state) {
  APHistoryMessage *self = [APHistoryMessage alloc];
  APHistoryMessage_initWithInt_withLong_withLong_withAPMessage_withAPMessageStateEnum_(self, senderUid, rid, date, message, state);
  return self;
}

void APHistoryMessage_init(APHistoryMessage *self) {
  (void) BSBserObject_init(self);
}

APHistoryMessage *new_APHistoryMessage_init() {
  APHistoryMessage *self = [APHistoryMessage alloc];
  APHistoryMessage_init(self);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(APHistoryMessage)


text:
<?php

namespace Sculpin\Bundle\StandaloneBundle\Command;

use Sculpin\Core\Console\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Clear and Warmup the cache.
 *
 * Originally from FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php
 *
 * @author Francis Besset <francis.besset@gmail.com>
 * @author Fabien Potencier <fabien@symfony.com>
 */
class CacheClearCommand extends ContainerAwareCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('cache:clear')
            ->setDescription('Clears the cache')
            ->setHelp(<<<EOF
The <info>%command.name%</info> command clears the application cache for a given environment
and debug mode:

<info>php %command.full_name% --env=dev</info>
<info>php %command.full_name% --env=prod --no-debug</info>

EOF
            )
        ;
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $cacheDir = $this->getContainer()->getParameter('kernel.cache_dir');
        $filesystem   = $this->getContainer()->get('filesystem');

        if (!is_writable($cacheDir)) {
            throw new \RuntimeException(sprintf('Unable to write in the "%s" directory', $cacheDir));
        }

        if ($filesystem->exists($cacheDir)) {
            $filesystem->remove($cacheDir);
        }
    }
}


text:
package com.lightbend.lagom.spi.persistence

import akka.Done
import akka.persistence.query.NoOffset
import akka.persistence.query.Offset

import scala.concurrent.Future
import scala.collection.concurrent

/**
 * Offset store implementation.
 */
trait OffsetStore {
  /**
   * Prepare this offset store to process the given ID and tag.
   *
   * @param eventProcessorId The ID of the event processor.
   * @param tag The tag to prepare for.
   * @return The DAO, with the loaded offset.
   */
  def prepare(eventProcessorId: String, tag: String): Future[OffsetDao]
}

/**
 * A prepared DAO for storing offsets.
 */
trait OffsetDao {
  /**
   * The last offset processed.
   */
  val loadedOffset: Offset

  /**
   * Save the given offset.
   *
   * @param offset The offset to save.
   * @return A future that is redeemed when the offset has been saved.
   */
  def saveOffset(offset: Offset): Future[Done]
}

/**
 * Not for production use.
 */
class InMemoryOffsetStore extends OffsetStore {
  private final val store: concurrent.Map[String, Offset] = concurrent.TrieMap.empty

  override def prepare(eventProcessorId: String, tag: String): Future[OffsetDao] = {
    val key = s"$eventProcessorId-$tag"
    Future.successful(new OffsetDao {
      override def saveOffset(offset: Offset): Future[Done] = {
        store.put(key, offset)
        Future.successful(Done)
      }
      override val loadedOffset: Offset = store.getOrElse(key, NoOffset)
    })
  }
}


text:
\section{Logger\+S\+M\+Queue Class Reference}
\label{classLoggerSMQueue}\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}

{\ttfamily \#include $<$Logger\+S\+M\+Queue.\+h$>$}

\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item
typedef {\bf Unbounded\+S\+M\+Queue}$<$ {\bf Log\+Message} $>$ {\bf L\+O\+G\+G\+E\+R\+S\+M\+Q\+U\+E\+UE}
\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
{\bf Logger\+S\+M\+Queue} (const char $\ast$queue\+Name, const char $\ast$coordinating\+Mutex\+Name)
\item
virtual {\bf $\sim$\+Logger\+S\+M\+Queue} ()
\item
int {\bf setup\+Queue} ()
\item
int {\bf enqueue\+Log} ({\bf Log\+Message} \&message)
\item
int {\bf dequeue\+Log} ({\bf Log\+Message} \&message)
\item
void {\bf clear\+Queue} ()
\item
bool {\bf is\+Empty} ()
\item
string {\bf to\+String} ()
\end{DoxyCompactItemize}

\subsection{Detailed Description}
\doxyref{Logger\+S\+M\+Queue}{p.}{classLoggerSMQueue} sets up an Unbounded Queue in Shared Memory for the purpose of exchanging Logger\+Message\+Type messages between processes and the Logger\+Processor which controls the output flow of logs to log files.

This shared memory queue uses the Position Independent Malloc/\+Allocation factory in A\+CE, and it handles queue growth using the automatic OS exception handling facilities to trap S\+I\+G\+S\+E\+GV and perform an A\+C\+E\+::remap.

\begin{DoxyParagraph}{Author}
Stephen Horton
\end{DoxyParagraph}
\begin{DoxyParagraph}{Revision}
1
\end{DoxyParagraph}

\subsection{Member Typedef Documentation}
\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!L\+O\+G\+G\+E\+R\+S\+M\+Q\+U\+E\+UE@{L\+O\+G\+G\+E\+R\+S\+M\+Q\+U\+E\+UE}}
\index{L\+O\+G\+G\+E\+R\+S\+M\+Q\+U\+E\+UE@{L\+O\+G\+G\+E\+R\+S\+M\+Q\+U\+E\+UE}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{L\+O\+G\+G\+E\+R\+S\+M\+Q\+U\+E\+UE}]{\setlength{\rightskip}{0pt plus 5cm}typedef {\bf Unbounded\+S\+M\+Queue}$<${\bf Log\+Message}$>$ {\bf Logger\+S\+M\+Queue\+::\+L\+O\+G\+G\+E\+R\+S\+M\+Q\+U\+E\+UE}}\label{classLoggerSMQueue_ac0c8ddf74f30ae5ce5f1d6ee7d622664}
Shared Memory Queue type for Log\+Messages

\subsection{Constructor \& Destructor Documentation}
\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{Logger\+S\+M\+Queue(const char $\ast$queue\+Name, const char $\ast$coordinating\+Mutex\+Name)}]{\setlength{\rightskip}{0pt plus 5cm}Logger\+S\+M\+Queue\+::\+Logger\+S\+M\+Queue (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{queue\+Name, }
\item[{const char $\ast$}]{coordinating\+Mutex\+Name}
\end{DoxyParamCaption}
)}\label{classLoggerSMQueue_a8d08c61f9b64a3da0b86700bf8aba526}
Constructor \index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!````~Logger\+S\+M\+Queue@{$\sim$\+Logger\+S\+M\+Queue}}
\index{````~Logger\+S\+M\+Queue@{$\sim$\+Logger\+S\+M\+Queue}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{$\sim$\+Logger\+S\+M\+Queue()}]{\setlength{\rightskip}{0pt plus 5cm}Logger\+S\+M\+Queue\+::$\sim$\+Logger\+S\+M\+Queue (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [virtual]}}\label{classLoggerSMQueue_a0ea356fde9f86e06fbddb4777680391e}
Virtual Destructor

\subsection{Member Function Documentation}
\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!clear\+Queue@{clear\+Queue}}
\index{clear\+Queue@{clear\+Queue}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{clear\+Queue()}]{\setlength{\rightskip}{0pt plus 5cm}void Logger\+S\+M\+Queue\+::clear\+Queue (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classLoggerSMQueue_a12ca163cbafbaf4d11c138d4d081b31f}
Clears the contents (logs) of the shared memory queue

References Unbounded\+S\+M\+Queue$<$ T $>$\+::delete\+\_\+nodes().

\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!dequeue\+Log@{dequeue\+Log}}
\index{dequeue\+Log@{dequeue\+Log}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{dequeue\+Log(\+Log\+Message \&message)}]{\setlength{\rightskip}{0pt plus 5cm}int Logger\+S\+M\+Queue\+::dequeue\+Log (
\begin{DoxyParamCaption}
\item[{{\bf Log\+Message} \&}]{message}
\end{DoxyParamCaption}
)}\label{classLoggerSMQueue_a52f6d49a3114caf909dd1fe2aa8f93a4}
Dequeue a \doxyref{Log\+Message}{p.}{structLogMessage} from the shared memory queue. The calling code is responsible for allocating the \doxyref{Log\+Message}{p.}{structLogMessage} and passing it in as a reference to be populated. \begin{DoxyReturn}{Returns}
OK on success; otherwise E\+R\+R\+OR
\end{DoxyReturn}

References Unbounded\+S\+M\+Queue$<$ T $>$\+::dequeue\+\_\+head(), and Unbounded\+S\+M\+Queue$<$ T $>$\+::is\+\_\+empty().

Referenced by Log\+Processor\+::catch\+Shutdown\+Signal(), and Log\+Processor\+::process\+Logs().

\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!enqueue\+Log@{enqueue\+Log}}
\index{enqueue\+Log@{enqueue\+Log}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{enqueue\+Log(\+Log\+Message \&message)}]{\setlength{\rightskip}{0pt plus 5cm}int Logger\+S\+M\+Queue\+::enqueue\+Log (
\begin{DoxyParamCaption}
\item[{{\bf Log\+Message} \&}]{message}
\end{DoxyParamCaption}
)}\label{classLoggerSMQueue_ab2539f17ac4b58f91f65349137bd9c13}
Enqueue a \doxyref{Log\+Message}{p.}{structLogMessage} to the shared memory queue \begin{DoxyReturn}{Returns}
OK on success; otherwise E\+R\+R\+OR
\end{DoxyReturn}

References Unbounded\+S\+M\+Queue$<$ T $>$\+::enqueue\+\_\+tail().

\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!is\+Empty@{is\+Empty}}
\index{is\+Empty@{is\+Empty}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{is\+Empty()}]{\setlength{\rightskip}{0pt plus 5cm}bool Logger\+S\+M\+Queue\+::is\+Empty (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classLoggerSMQueue_a7f54c4c4b6f846f12cd1f8f6d1526c39}
Returns true if the queue is empty

References Unbounded\+S\+M\+Queue$<$ T $>$\+::is\+\_\+empty().

Referenced by Log\+Processor\+::catch\+Shutdown\+Signal(), and Log\+Processor\+::process\+Logs().

\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!setup\+Queue@{setup\+Queue}}
\index{setup\+Queue@{setup\+Queue}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{setup\+Queue()}]{\setlength{\rightskip}{0pt plus 5cm}int Logger\+S\+M\+Queue\+::setup\+Queue (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classLoggerSMQueue_a3fd01297f9acb1aa11b3a566644745d2}
Create the (or get a reference to an already created) queue \begin{DoxyReturn}{Returns}
OK on success; otherwise E\+R\+R\+OR
\end{DoxyReturn}

References Shared\+Memory\+Manager\+::get\+Allocator().

Referenced by Log\+Processor\+::initialize().

\index{Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}!to\+String@{to\+String}}
\index{to\+String@{to\+String}!Logger\+S\+M\+Queue@{Logger\+S\+M\+Queue}}
\subsubsection[{to\+String()}]{\setlength{\rightskip}{0pt plus 5cm}string Logger\+S\+M\+Queue\+::to\+String (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{classLoggerSMQueue_af79c9bafd20b3fdc0bdf874196d8a5ad}
String\textquotesingle{}ized debugging method \begin{DoxyReturn}{Returns}
string representation of the contents of this object
\end{DoxyReturn}

The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item
Logger\+S\+M\+Queue.\+h\item
Logger\+S\+M\+Queue.\+cpp\end{DoxyCompactItemize}


text:
require 'data_mapper'

class Case
  include DataMapper::Resource
  property :id, Serial
  property :court, Integer
  property :docket_number, String, :index => true
  property :style, Text

  has n, :opinions
end

class Opinion
  include DataMapper::Resource
  property :id, Serial
  property :date, Date
  property :type, String
  property :url, Text
  property :md5sum, String, :length => 32

  belongs_to :case
end

class Log
  include DataMapper::Resource
  property :id, Serial
  property :court, Integer
  property :date, Date
end

DataMapper::Model.raise_on_save_failure = true
DataMapper.finalize