text:
source "$(dirname "$0")"/common.sh
source "$(dirname "$0")"/common_docker.sh

CONTAINER_SCRIPTS=${END_TO_END_DIR}/test-scripts/container-scripts
MINIKUBE_START_RETRIES=3
MINIKUBE_START_BACKOFF=5
RESULT_HASH="e682ec6622b5e83f2eb614617d5ab2cf"
MINIKUBE_VERSION="v1.8.2"
MINIKUBE_PATH="/usr/local/bin/minikube-$MINIKUBE_VERSION"

NON_LINUX_ENV_NOTE="****** Please start/stop minikube manually in non-linux environment. ******"

# If running tests on non-linux os, the kubectl and minikube should be installed manually
function setup_kubernetes_for_linux {
    if [[ `uname -i` == 'aarch64' ]]; then
        local arch='arm64'
    else
        local arch='amd64'
    fi
    # Download kubectl, which is a requirement for using minikube.
    if ! [ -x "$(command -v kubectl)" ]; then
        echo "Installing kubectl ..."
        local version=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
        curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$version/bin/linux/$arch/kubectl && \
            chmod +x kubectl && sudo mv kubectl /usr/local/bin/
    fi
    # Download minikube.
    if ! [ -x "$(command -v minikube)" ] || ! [[ $(minikube version) =~ "$MINIKUBE_VERSION" ]]; then
        echo "Installing minikube to $MINIKUBE_PATH ..."
        curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-$arch && \
            chmod +x minikube && sudo mv minikube $MINIKUBE_PATH
    fi
}

function check_kubernetes_status {
    $MINIKUBE_PATH status
    return $?
}

function start_kubernetes_if_not_running {
    if ! check_kubernetes_status; then
        echo "Starting minikube ..."
        # We need sudo permission to set vm-driver to none in linux os.
        # tl;dr: Configure minikube for a low disk space environment
        #
        # The VMs provided by azure have ~100GB of disk space, out of which
        # 85% are allocated, only 15GB are free. That's enough space
        # for our purposes. However, the kubernetes nodes running during
        # the k8s tests believe that 85% are not enough free disk space,
        # so they start garbage collecting their host. During GCing, they
        # are deleting all docker images currently not in use.
        # However, the k8s test is first building a flink image, then launching
        # stuff on k8s. Sometimes, k8s deletes the new Flink images,
        # thus it can not find them anymore, letting the test fail /
        # timeout. That's why we have set the GC threshold to 98% and 99%
        # here.
        # Similarly, the kubelets are marking themself as "low disk space",
        # causing Flink to avoid this node (again, failing the test)
        sudo CHANGE_MINIKUBE_NONE_USER=true $MINIKUBE_PATH start --vm-driver=none \
            --extra-config=kubelet.image-gc-high-threshold=99 \
            --extra-config=kubelet.image-gc-low-threshold=98 \
            --extra-config=kubelet.minimum-container-ttl-duration=120m \
            --extra-config=kubelet.eviction-hard="memory.available<5Mi,nodefs.available<1Mi,imagefs.available<1Mi" \
            --extra-config=kubelet.eviction-soft="memory.available<5Mi,nodefs.available<2Mi,imagefs.available<2Mi" \
            --extra-config=kubelet.eviction-soft-grace-period="memory.available=2h,nodefs.available=2h,imagefs.available=2h"
        # Fix the kubectl context, as it's often stale.
        $MINIKUBE_PATH update-context
    fi

    check_kubernetes_status
    return $?
}

function start_kubernetes {
    if [[ "${OS_TYPE}" != "linux" ]]; then
        if ! check_kubernetes_status; then
            echo "$NON_LINUX_ENV_NOTE"
            exit 1
        fi
        # Mount Flink dist into minikube virtual machine because we need to mount hostPath as usrlib
        minikube mount $FLINK_DIR:$FLINK_DIR &
        export minikube_mount_pid=$!
    else
        setup_kubernetes_for_linux
        if ! retry_times ${MINIKUBE_START_RETRIES} ${MINIKUBE_START_BACKOFF} start_kubernetes_if_not_running; then
            echo "Could not start minikube. Aborting..."
            exit 1
        fi
    fi
    eval $($MINIKUBE_PATH docker-env)
}

function stop_kubernetes {
    if [[ "${OS_TYPE}" != "linux" ]]; then
        echo "$NON_LINUX_ENV_NOTE"
        kill $minikube_mount_pid 2> /dev/null
    else
        echo "Stopping minikube ..."
        stop_command="sudo $MINIKUBE_PATH stop"
        if ! retry_times ${MINIKUBE_START_RETRIES} ${MINIKUBE_START_BACKOFF} "${stop_command}"; then
            echo "Could not stop minikube. Aborting..."
            exit 1
        fi
    fi
}

function debug_and_show_logs {
    echo "Debugging failed Kubernetes test:"
    echo "Currently existing Kubernetes resources"
    kubectl get all
    kubectl describe all

    echo "Flink logs:"
    kubectl get pods -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | while read pod;do
        kubectl logs $pod;
    done
}

function wait_rest_endpoint_up_k8s {
  local jm_pod_name=$1
  local successful_response_regex="Rest endpoint listening at"

  echo "Waiting for jobmanager pod ${jm_pod_name} ready."
  kubectl wait --for=condition=Ready --timeout=30s pod/$jm_pod_name || exit 1

  # wait at most 30 seconds until the endpoint is up
  local TIMEOUT=30
  for i in $(seq 1 ${TIMEOUT}); do
    if check_logs_output $jm_pod_name $successful_response_regex; then
      echo "REST endpoint is up."
      return
    fi

    echo "Waiting for REST endpoint to come up..."
    sleep 1
  done
  echo "REST endpoint has not started within a timeout of ${TIMEOUT} sec"
  exit 1
}

function check_logs_output {
  local pod_name=$1
  local successful_response_regex=$2
  LOG_CONTENT=$(kubectl logs $pod_name 2> /dev/null)

  # ensure the log content adapts with the successful regex
  if [[ ${LOG_CONTENT} =~ ${successful_response_regex} ]]; then
    return 0
  fi
  return 1
}

function cleanup {
    if [ $TRAPPED_EXIT_CODE != 0 ];then
      debug_and_show_logs
    fi
    internal_cleanup
    kubectl wait --for=delete pod --all=true
    stop_kubernetes
}

function setConsoleLogging {
    cat >> $FLINK_DIR/conf/log4j.properties <<END
rootLogger.appenderRef.console.ref = ConsoleAppender

# Log all infos to the console
appender.console.name = ConsoleAppender
appender.console.type = CONSOLE
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t] %-60c %x - %m%n
END
}

function get_host_machine_address {
    if [[ "${OS_TYPE}" != "linux" ]]; then
        echo $(minikube ssh "route -n | grep ^0.0.0.0 | awk '{ print \$2 }' | tr -d '[:space:]'")
    else
        echo "localhost"
    fi
}

on_exit cleanup


text:
<?php
/**
 * Created by PhpStorm.
 * User: mhh1422
 * Date: 03/01/2017
 * Time: 10:58 AM
 */

namespace ItvisionSy\Payment\PayFort\Traits;

trait NotTokenizableImplementation
{

    /** @var callable */
    protected $successCallback;
    /** @var callable */
    protected $failedCallback;

    /**
     * @return callable
     */
    public function getSuccessCallback()
    {
        return $this->successCallback;
    }

    /**
     * @param callable $success
     * @return Authorize
     */
    public function setSuccessCallback(callable $success)
    {
        $this->successCallback = $success;
        return $this;
    }

    /**
     * @return callable
     */
    public function getFailedCallback()
    {
        return $this->failedCallback;
    }

    /**
     * @param callable $failed
     * @return Authorize
     */
    public function setFailedCallback(callable $failed)
    {
        $this->failedCallback = $failed;
        return $this;
    }

    public static function execute($reference, callable $successCallback, callable $failedCallback, Config $config = null)
    {
        static::make($config)->setSuccessCallback($successCallback)->setFailedCallback($failedCallback)->process(['merchant_reference' => $reference]);
    }

    public function success(PaymentModel $model, $payfortReference, array $responseData)
    {
        $callable = $this->successCallback;
        if (!$callable) {
            throw new \Exception("Success callback should be set first using ->setSuccessCallbackCallback(callable) function");
        }
        return $callable($model, $payfortReference, $responseData);
    }

    public function failed($statusCode, $statusMessage, $responseCode, $responseMessage, $responseData, PaymentModel $paymentModel = null)
    {
        $callable = $this->failedCallback;
        if (!$callable) {
            throw new \Exception("Failed callback should be set first using ->setFailedCallbackCallback(callable) function");
        }
        return $callable($statusCode, $statusMessage, $responseCode, $responseMessage, $responseData, $paymentModel);
    }

}

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Eating My House Deposit</title>

    <meta name="msapplication-tap-highlight" content="no">

    <link rel="manifest" href="manifest.json">

    <meta name="mobile-web-app-capable" content="No">
    <meta name="application-name" content="Eating My House Deposit">
    <link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png">

    <meta name="apple-mobile-web-app-capable" content="No">
    <meta name="apple-mobile-web-app-status-bar-style" content="#78A4C0">
    <meta name="apple-mobile-web-app-title" content="Eating My House Deposit">
    <link rel="apple-touch-icon" href="images/touch/apple-touch-icon.png">

    <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
    <meta name="msapplication-TileColor" content="#78A4C0">

    <meta name="theme-color" content="#78A4C0">

    <link href="https://fonts.googleapis.com/css?family=Hind+Guntur:300,400,600" rel="stylesheet">

    <link rel="stylesheet" type="text/css" href="styles/main.css">

Loading...

                  Young people and prospective first home owners have consistently been told to curb
                  their spending on $4 coffees, smashed avo on toast at hispter cafes and other "luxuries"
                  if they want to be able to afford a house in the current market. We're bringing it on ourselves right? If we took that advice would it make any difference?

                  In 8 short questions, you'll understand how our "exuberant" lifestyle is a "direct correlation" to impending homelessness.
(ps Words inside quotations may also directly correlate with bullshit)

Let's find out in inner Brisbane

                    <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                    </path></svg>

Where do you want to live?

                    <input type="text" class="dropdown-input" id="input_suburbname" data-list="#listsuburbs" name="suburb" placeholder="e.g. Newstead" onfocus="this.placeholder = ''" onblur="this.placeholder = 'e.g. Newstead'" required />
                    <button type="button" name="button" class="dropdown-btn">
                      <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                      </path></svg>
                    </button>

                  <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                  </path></svg>

Which do you want to live in?

House

Unit

                <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                </path></svg>

What is your annual salary?

                  <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                  </path></svg>

Do you use a music streaming service?

Yes

No

                  <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                  </path></svg>

Do you use a movie/TV show streaming service?

Yes

No

                <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                  </path></svg>

Do you have a gym membership?

Yes

No

                  <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                  </path></svg>

How many coffees do you buy a week?

                  <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                  </path></svg>

How many times a week do you buy smashed avo on toast?

                  <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                  </path></svg>

All Done!

View results

                    Reset

                    <svg width="512" height="512" viewbox="0 0 512 512" preservea xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M 96.00,96.00l-96.00,96.00l 256.00,256.00l 256.00-256.00l-96.00-96.00L 256.00,256.00L 96.00,96.00z" >
                    </path></svg>

Loading...

To view results, you need to compete the questions above!
 Feel free to browse the map by itself though.

Your annual expenses

Suburb Overview

Welcome to the suburb overview. Here you can explore the profile of each suburb, as well as the median sell price (for both houses and units together) for each suburb. If you completed the questionnaire above, you'll also see how long it will take you to pay off property!

 Clicking on a suburb will expand its profile.

Loading...

Mortgage length

Toggle the expenses to see the difference. (Note: some assuptions were made to calculate the time. See them below)

Expenses

On

Off

House

Unit

With your lifestyle, its going to take you an extra ...

House:

Unit:

to pay off this suburb. Let's be honest. When compared against the full term of the morgage... the extra time is hardly significant.

Suburb Sell Price

House:

Current:
$ 1000,000

5 years ago:
$ 1000,000

Unit:

Current:
$ 1000,000

5 years ago:
$ 1000,000

Assumptions

Fixed interst rate of 4%

Single point of income (only your salary)

No set loan period from bank. You pay the loan at your lesuire

40% of salary goes into paying of morgage

                    <canvas id="chartSuburbProfile"></canvas>

Your lifestyle isn't the real reason you can't afford a home

Next time you read an article complaining about millennials complaining about
                not be able to afford a home remember that in the long run your lifestyle choices aren't the main reasons you can't afford a home.
                Houses and units are becoming unaffordable because
              of the increasing price bubble. One day it will burst and we might just get an apology. . .

              <canvas id="chartSuburbsPrice"></canvas>

About

Eating My House Deposit (reference to Smashed Avocado on Toast and its ludicrous price) is a data Visualisation that aims to debunk the allegations suggesting that millennials lifestyles are to blame for the inability to afford property in the Brisbane Market. The user is asked various lifestyle questions and a mortgage repayment period is calculated with and without these lifestyle expenses. The difference in time between both values is likely to be insignificant when compared against the usual term of a mortgage and therefore suggests that lifestyle, cannot be blamed for the inability to purchase property.

This piece has also formed a formal piece of assessment for the course DXB502 – Visual Information Design taught at The Queensland University of Technology.

 with  by

Mitchel Williams

mitchell-williams.com.au

github.com/mitchello77

me@mitchell-williams.com.au

Kelvin O'Shea

kelvinoshea.com

github.com/kelvinoshea

@kelvin__oshea

Technologies Used

HTML5

CSS3

PHP

JavaScript

JQuery

Restler

MySQL

NodeJS

D3JS

TopoJSON

ChromaJS

Awesomplete

MomentJS

ChartJS

Source

Please feel free to check out the sourcecode of the project:

                    github.com/mitchello77/Eating-My-House-Deposit


text:
require "ruboty/repeat/version"
require "ruboty/handlers/repeat"

module Ruboty
  module Repeat
    # Your code goes here...
  end
end


text:
module Fog
  module Storage
    class StormOnDemand
      class Volume < Fog::Model
        identity :uniq_id
        attribute :attachedTo
        attribute :cross_attach
        attribute :domain
        attribute :label
        attribute :size
        attribute :status
        attribute :zone

        def attach_to(server_id)
          requires :identity
          service.attach_volume_to_server(:uniq_id => identity,
                                          :to => server_id).body
        end

        def destroy
          requires :identity
          service.delete_volume(:uniq_id => identity)
          true
        end

        def detach_from(server_id)
          requires :identity
          service.detach_volume_from_server(:uniq_id => identity,
                                            :detach_from => server_id).body
        end

        def resize(new_size)
          requires :identity
          service.resize_volume(:uniq_id => identity,
                                :new_size => new_size).body
        end

        def update(options = {})
          requires :identity
          service.update_volume({:uniq_id => identity}.merge!(options))
        end
      end
    end
  end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Shopify SDK for Unity: Shopify.Unity.ProductVariantConnection Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Shopify SDK for Unity

Shopify

Unity

ProductVariantConnection

Public Member Functions |
Static Public Member Functions |
Protected Attributes |
List of all members

Shopify.Unity.ProductVariantConnection Class Reference

An auto-generated type for paginating through multiple ProductVariants. . ProductVariantConnection can be cast to List<ProductVariant>.
 More...

Inheritance diagram for Shopify.Unity.ProductVariantConnection:

  <map id="Shopify.Unity.ProductVariantConnection_map" name="Shopify.Unity.ProductVariantConnection_map">
<area href="class_shopify_1_1_unity_1_1_s_d_k_1_1_abstract_response.html" alt="Shopify.Unity.SDK.AbstractResponse" shape="rect" coords="0,0,240,24"/>
  </map>

Public Member Functions

 	ProductVariantConnection (Dictionary< string, object > dataJSON)

 	Accepts deserialized json data.  Will further parse passed in data.  More...

IEnumerator 	GetEnumerator ()

List< ProductVariantEdge > 	edges ()

 	A list of edges.  More...

PageInfo 	pageInfo ()

 	Information to aid in pagination.  More...

object 	Clone ()

void 	AddFromConnection (ProductVariantConnection connection)

 	This is a utility function that allows you to append newly queried data from a connection into this one. The passed in Connection will be appended into this Connection. The edges will receive all new nodes, and both the cursors and pageInfo will be updated based on the passed Connection.  More...

Static Public Member Functions

static 	operator List< ProductVariant > (ProductVariantConnection connection)

 	Adds the ability to cast ProductVariantConnection to List<ProductVariant>.  More...

Protected Attributes

List< ProductVariant > 	Nodes

 Protected Attributes inherited from Shopify.Unity.SDK.AbstractResponse

Dictionary< string, object > 	Data

Additional Inherited Members

 Protected Member Functions inherited from Shopify.Unity.SDK.AbstractResponse

T 	Get< T > (string field, string alias=null)

 Properties inherited from Shopify.Unity.SDK.AbstractResponse

Dictionary< string, object > 	DataJSON [get, protected set]

Detailed Description

An auto-generated type for paginating through multiple ProductVariants. . ProductVariantConnection can be cast to List<ProductVariant>.

Constructor & Destructor Documentation

◆ ProductVariantConnection()

          Shopify.Unity.ProductVariantConnection.ProductVariantConnection
          (
          Dictionary< string, object >
          dataJSON	)

inline

Accepts deserialized json data.  Will further parse passed in data.

Parameters

dataJSON	Deserialized JSON data for ProductVariantConnection

Member Function Documentation

◆ AddFromConnection()

          void Shopify.Unity.ProductVariantConnection.AddFromConnection
          (
          ProductVariantConnection
          connection	)

inline

This is a utility function that allows you to append newly queried data from a connection into this one. The passed in Connection will be appended into this Connection. The edges will receive all new nodes, and both the cursors and pageInfo will be updated based on the passed Connection.

Parameters

connection	response

◆ edges()

          List<ProductVariantEdge> Shopify.Unity.ProductVariantConnection.edges
          (
          	)

inline

A list of edges.

◆ operator List< ProductVariant >()

          static Shopify.Unity.ProductVariantConnection.operator List< ProductVariant >
          (
          ProductVariantConnection
          connection	)

inlineexplicitstatic

Adds the ability to cast ProductVariantConnection to List<ProductVariant>.

◆ pageInfo()

          PageInfo Shopify.Unity.ProductVariantConnection.pageInfo
          (
          	)

inline

Information to aid in pagination.

The documentation for this class was generated from the following file:

Assets/Shopify/Unity/Generated/ProductVariantConnection.cs

<address class="footer">

</address>


text:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen android:title="@string/ambient_display_pickup_title"
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
    <com.android.settings.widget.VideoPreference android:key="gesture_pick_up_video" app:animation="@raw/gesture_ambient_lift" app:preview="@drawable/gesture_ambient_lift" />
    <SwitchPreference android:title="@string/ambient_display_pickup_title" android:key="gesture_pick_up" android:summary="@string/ambient_display_pickup_summary" />
</PreferenceScreen>


text:
package com.zollty.mvcdemo.unittest.aop;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.zollty.framework.mvc.View;
import org.zollty.framework.mvc.aop.MvcBeforeRender;

public class YxxxBeforeRender implements MvcBeforeRender {

    @Override
    public View doBeforeRender(HttpServletRequest request, HttpServletResponse response) {
        System.out.println(toString() + "++++++++++++++++++execute.....++++++++++++++++++");

        return null;
    }

    @Override
    public String toString() {
        return getClass().getName();
    }

}


text:
package com.axway.ats.agent.core.model;

import com.axway.ats.agent.core.exceptions.InternalComponentException;

/**
 * This interface should be implemented by the component
 * under test, it is responsible for restoring a clean
 * environment after the component did some work. This
 * may include deleting content in certain tables, restoring
 * files on the file system or any other necessary activity
 */
public interface EnvironmentCleanupHandler {

    /**
     * Clean the component environment
     */
    public void clean() throws InternalComponentException;

}


text:
<link rel="import" href="../../bower_components/polymer/polymer.html">

<dom-module id="loading-spinner">
  <template>
    <style>
      :host {
        display: block;
        background: white;
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        border-radius: 3px;
        z-index: 100;
      }

      paper-spinner {
        margin: auto;
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        max-height: 100px;
        max-width: 100px;
      }
    </style>
    <paper-spinner active></paper-spinner>
  </template>

  <script>
    (function() {
      'use strict';

      Polymer({
        is: 'loading-spinner',
        behaviors: [
          Polymer.NeonAnimationRunnerBehavior
        ],
        properties: {
          animationConfig: {
            value: function() {
              return {
                'exit': {
                  name: 'fade-out-animation',
                  node: this
                }
              };
            }
          },
          running: {
            type: Boolean,
            notify: true,
            readOnly: false,
            observer: '_onRunningChange'
          }
        },
        listeners: {
          'neon-animation-finish': '_onNeonAnimationFinish'
        },
        ready: function() {
        },
        readyForStart: true,
        _onRunningChange: function() {
          if (!this.running && this.readyForStart) {
            this.readyForStart = false;
          } else if (!this.running && !this.readyForStart) {
            this.async(function() {
              this.playAnimation('exit');
            }, 300);
          }
        },
        _onNeonAnimationFinish: function() {
          if (!this.running) {
            this.style.display = 'none';
          }
        }
      });
    })();
  </script>
</dom-module>


text:
var BaseFactory = require("./base"),
factories       = require("factories");

/**
 * @module
 * @submodule mojo-core
 */

/**

### Example

```javascript
var nofactor = require("nofactor");

// use string factory
customNodeFactory = nofactor.custom(nofactor.string);

// register BR void element
customNodeFactory.registerElement("br", nofactor.string.Element.extend({
	toString: function () {
		return "<" + this.name + ">";
	}
}));
// <br>
console.log(customNodeFactory.createElement("br").toString());
```

 @class CustomNodeFactory
 @extends BaseNodeFactory
 @constructor
 @param {BaseNodeFactory} nodeFactory the main node factory to call
*/

function CustomFactory (mainFactory, elements) {
	BaseFactory.call(this);
	this._mainFactory = mainFactory;

	if (!mainFactory) {
		throw new Error("main factory must be provided. User string, or dom");
	}

	this._factories = {
		element: {}
	}

	if (elements) {
		for (var name in elements) {
			this.registerElement(name, elements[name]);
		}
	}
}

BaseFactory.extend(CustomFactory, {

	/**
	 * Registers a new element class
	 * @method registerElement
	 * @param {String} name name of the element
	 * @param {Class} The element class
	 */

	registerElement: function (name, factory) {
		this._factories.element[name] = factories.factory.create(factory);
		return this;
	},

	/*
	 */

	createElement: function (name) {
		var factory = this._factories.element[name];
		if (factory) return factory.create(name);
		return this._mainFactory.createElement(name);
	},

	/*
	 */

	createComment: function (text) {
		return this._mainFactory.createComment(text);
	},

	/*
	 */

	createTextNode: function (text) {
		return this._mainFactory.createTextNode(text);
	},

	/*
	 */

	createDocumentFragment: function () {
		return this._mainFactory.createDocumentFragment();
	},

	/**
	 */

	parseHtml: function (source) {
		return this._mainFactory.parseHtml(source);
	}
});

module.exports = function (mainFactory, elements) {
	return new CustomFactory(mainFactory, elements);
};


text:
#include "userprog/process.h"
#include <debug.h>
#include <inttypes.h>
#include <round.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "userprog/gdt.h"
#include "userprog/pagedir.h"
#include "userprog/tss.h"
#include "filesys/directory.h"
#include "filesys/file.h"
#include "filesys/filesys.h"
#include "threads/flags.h"
#include "threads/init.h"
#include "threads/interrupt.h"
#include "threads/palloc.h"
#include "threads/thread.h"
#include "threads/vaddr.h"

#include "threads/malloc.h"

#include "vm/suppage.h"

static thread_func start_process NO_RETURN;
static bool load (const char *cmdline, void (**eip) (void), void **esp);

/* Starts a new thread running a user program loaded from
   FILENAME.  The new thread may be scheduled (and may even exit)
   before process_execute() returns.  Returns the new process's
   thread id, or TID_ERROR if the thread cannot be created. */
tid_t
process_execute (const char *file_name)
{
  char *fn_copy, *real_fn;
  tid_t tid;
  int i;

  /* Make a copy of FILE_NAME.
     Otherwise there's a race between the caller and load(). */
  fn_copy = palloc_get_page (0);
  if (fn_copy == NULL)
    return TID_ERROR;
  strlcpy (fn_copy, file_name, PGSIZE);

  real_fn = palloc_get_page (0);
  if (real_fn == NULL)
    return TID_ERROR;
  for (i = 0;
       file_name[i] != '\0' && file_name[i] != ' ' && file_name[i] != '\t';
       ++i)
    real_fn[i] = file_name[i];
  real_fn[i] = 0;

  //printf ("[Debug] process_execute () - before thread_create()\n");

  /* Create a new thread to execute FILE_NAME. */
  tid = thread_create (real_fn, PRI_DEFAULT, start_process, fn_copy);

  palloc_free_page (real_fn);
  if (tid == TID_ERROR)
    palloc_free_page (fn_copy);
  else
    {
      struct thread *cur = thread_current ();
      struct list_elem *e = list_pop_back (&cur->child_list);
      struct thread *child = list_entry (e, struct thread, child_elem);

      sema_down (&child->wait_sema);
      if (!child->load_success)
        tid = TID_ERROR;
      else
        list_push_back (&cur->child_list, e);
    }

  return tid;
}

/* A thread function that loads a user process and starts it
   running. */
static void
start_process (void *file_name_)
{
  struct thread *cur;
  char *file_name = file_name_;
  struct intr_frame if_;
  bool success;

  //printf ("[Debug] start process?!\n");

  /* Initialize interrupt frame and load executable. */
  memset (&if_, 0, sizeof if_);
  if_.gs = if_.fs = if_.es = if_.ds = if_.ss = SEL_UDSEG;
  if_.cs = SEL_UCSEG;
  if_.eflags = FLAG_IF | FLAG_MBS;
  success = load (file_name, &if_.eip, &if_.esp);
  //printf ("[Debug]  outside of load??! success : %s\n", success ? "true" : "false");

  cur = thread_current ();
  cur->load_success = success;
  sema_up (&cur->wait_sema);

  /* If load failed, quit. */
  palloc_free_page (file_name);
  if (!success)
    thread_exit ();

  //printf ("[Debug] ~start process?!\n");

  /* Start the user process by simulating a return from an
     interrupt, implemented by intr_exit (in
     threads/intr-stubs.S).  Because intr_exit takes all of its
     arguments on the stack in the form of a `struct intr_frame',
     we just point the stack pointer (%esp) to our stack frame
     and jump to it. */
  asm volatile ("movl %0, %%esp; jmp intr_exit" : : "g" (&if_) : "memory");
  NOT_REACHED ();
}

/* Waits for thread TID to die and returns its exit status.  If
   it was terminated by the kernel (i.e. killed due to an
   exception), returns -1.  If TID is invalid or if it was not a
   child of the calling process, or if process_wait() has already
   been successfully called for the given TID, returns -1
   immediately, without waiting.

   This function will be implemented in problem 2-2.  For now, it
   does nothing. */
int
process_wait (tid_t child_tid)
{
  /*
   * child_tid -> invalid ( nothing or not child ) : return -1
   * child_tid -> child is terminated without exit : return -1
   * parent is blocking until child is terminated with exit...
   * if child state is terminated, return child's return address.
   */

  struct thread *cur, *child = NULL;
  struct list_elem *e;
  int exit_code;

  cur = thread_current ();

  for (e = list_begin (&cur->child_list);
       e != list_end (&cur->child_list); e = list_next(e))
    {
      struct thread *c = list_entry (e, struct thread, child_elem);
      if (c->tid == child_tid)
        {
          child = c;
          break;
        }
    }

  if (child == NULL)
      return -1;

  list_remove (e);

  if (child->status == THREAD_DYING)
    {
      if (child->normal_exit == true)
        {
          exit_code = child->exit_code;
          sema_up (&child->exit_sema);
        }
      else
        {
          sema_up (&child->exit_sema);
          return -1;
        }
    }
  else
    {
      sema_down (&child->wait_sema);
      exit_code = child->exit_code;
      sema_up (&child->exit_sema);
    }

  return exit_code;
}

static void
process_file_close (struct file *f, void *aux UNUSED)
{
  lock_acquire (&filesys_lock);
  file_close (f);
  lock_release (&filesys_lock);
}

/* Free the current process's resources. */
void
process_exit (void)
{
  struct thread *cur = thread_current ();
  struct list_elem *e;
  uint32_t *pd;

#ifdef VM
  suppage_clear ();
#endif

  /* Destroy the current process's page directory and switch back
     to the kernel-only page directory. */
  pd = cur->pagedir;
  if (pd != NULL)
    {
      /* Correct ordering here is crucial.  We must set
         cur->pagedir to NULL before switching page directories,
         so that a timer interrupt can't switch back to the
         process page directory.  We must activate the base page
         directory before destroying the process's page
         directory, or our active page directory will be one
         that's been freed (and cleared). */
      cur->pagedir = NULL;
      pagedir_activate (NULL);
      pagedir_destroy (pd);
    }

  /*
   * free resources that current process owned.
   */

  if (lock_held_by_current_thread (&filesys_lock))
    lock_release (&filesys_lock);

  thread_clear_file_list (cur, process_file_close);

  for (e = list_begin (&cur->child_list);
       e != list_end (&cur->child_list); e = list_next(e))
    {
      struct thread *c = list_entry (e, struct thread, child_elem);
      sema_up (&c->exit_sema);
    }

  if (cur->self_file)
    {
      lock_acquire (&filesys_lock);
      file_close (cur->self_file);
      lock_release (&filesys_lock);
    }

  printf ("%s: exit(%d)\n", cur->name, cur->exit_code);

  /*
   * if parent is blocking for waiting me, wake parent.
   */
  sema_up (&cur->wait_sema);
  sema_down (&cur->exit_sema);
}

/* Sets up the CPU for running user code in the current
   thread.
   This function is called on every context switch. */
void
process_activate (void)
{
  struct thread *t = thread_current ();

  /* Activate thread's page tables. */
  pagedir_activate (t->pagedir);

  /* Set thread's kernel stack for use in processing
     interrupts. */
  tss_update ();
}

/* We load ELF binaries.  The following definitions are taken
   from the ELF specification, [ELF1], more-or-less verbatim.  */

/* ELF types.  See [ELF1] 1-2. */
typedef uint32_t Elf32_Word, Elf32_Addr, Elf32_Off;
typedef uint16_t Elf32_Half;

/* For use with ELF types in printf(). */
#define PE32Wx PRIx32   /* Print Elf32_Word in hexadecimal. */
#define PE32Ax PRIx32   /* Print Elf32_Addr in hexadecimal. */
#define PE32Ox PRIx32   /* Print Elf32_Off in hexadecimal. */
#define PE32Hx PRIx16   /* Print Elf32_Half in hexadecimal. */

/* Executable header.  See [ELF1] 1-4 to 1-8.
   This appears at the very beginning of an ELF binary. */
struct Elf32_Ehdr
  {
    unsigned char e_ident[16];
    Elf32_Half    e_type;
    Elf32_Half    e_machine;
    Elf32_Word    e_version;
    Elf32_Addr    e_entry;
    Elf32_Off     e_phoff;
    Elf32_Off     e_shoff;
    Elf32_Word    e_flags;
    Elf32_Half    e_ehsize;
    Elf32_Half    e_phentsize;
    Elf32_Half    e_phnum;
    Elf32_Half    e_shentsize;
    Elf32_Half    e_shnum;
    Elf32_Half    e_shstrndx;
  };

/* Program header.  See [ELF1] 2-2 to 2-4.
   There are e_phnum of these, starting at file offset e_phoff
   (see [ELF1] 1-6). */
struct Elf32_Phdr
  {
    Elf32_Word p_type;
    Elf32_Off  p_offset;
    Elf32_Addr p_vaddr;
    Elf32_Addr p_paddr;
    Elf32_Word p_filesz;
    Elf32_Word p_memsz;
    Elf32_Word p_flags;
    Elf32_Word p_align;
  };

/* Values for p_type.  See [ELF1] 2-3. */
#define PT_NULL    0            /* Ignore. */
#define PT_LOAD    1            /* Loadable segment. */
#define PT_DYNAMIC 2            /* Dynamic linking info. */
#define PT_INTERP  3            /* Name of dynamic loader. */
#define PT_NOTE    4            /* Auxiliary info. */
#define PT_SHLIB   5            /* Reserved. */
#define PT_PHDR    6            /* Program header table. */
#define PT_STACK   0x6474e551   /* Stack segment. */

/* Flags for p_flags.  See [ELF3] 2-3 and 2-4. */
#define PF_X 1          /* Executable. */
#define PF_W 2          /* Writable. */
#define PF_R 4          /* Readable. */

static bool setup_stack (void **esp);
static bool validate_segment (const struct Elf32_Phdr *, struct file *);
static bool load_segment (struct file *file, off_t ofs, uint8_t *upage,
                          uint32_t read_bytes, uint32_t zero_bytes,
                          bool writable);
static bool construct_stack (const char *file_name, void **esp);

static bool construct_stack (const char *file_name, void **esp)
{
  bool success = false;
  char *cpy_file_name = NULL;
  bool skip_flag;
  int argv_size, align_size;
  char *argv_ptr, *name_ptr;
  int argc; char **argv;
  int i, j;

  cpy_file_name = palloc_get_page (0);
  if (cpy_file_name == NULL)
    goto done;

  skip_flag = false;
  argc = 0;
  for (i = 0, j = 0; file_name[i]; ++i)
    {
      if (file_name[i] == ' ' || file_name[i] == '\t')
        {
          if (skip_flag)
              continue;
          cpy_file_name[j++] = 0;
          ++argc;
          skip_flag = true;
        }
      else
        {
          cpy_file_name[j++] = file_name[i];
          skip_flag = false;
        }
    }

  if (!skip_flag)
    {
      cpy_file_name[j++] = 0;
      ++argc;
    }

  argv_size = j;

  argv_ptr = (char*) *esp - argv_size;
  *esp = (void*) ((uintptr_t) argv_ptr & 0xfffffffc);
  align_size = (uintptr_t) argv_ptr & 0x00000003;
  for (i = 0; i < align_size; ++i)
      * ((char*) *esp + i) = 0;

  *esp = (void*) ((void**) *esp - argc - 2);
  argv = * ((char***) *esp) = (char**) ((void**) *esp + 1);

  name_ptr = cpy_file_name;
  for (i = 0; i < argc; ++i)
    {
      argv[i] = argv_ptr;
      j = 0;
      do
        {
          argv[i][j] = name_ptr[j];
        }
      while (name_ptr[j++]);
      name_ptr = name_ptr+j;
      argv_ptr += j;
    }
  argv[argc] = NULL;
  * ( (int32_t*) ((void**) *esp - 1) ) = argc;
  * ( (void (**) (void)) ((void**) *esp - 2) ) = NULL;

  *esp = (void*) ((void**) *esp - 2);

  //hex_dump((uintptr_t) *esp, (const char *) *esp, (uintptr_t) PHYS_BASE - (uintptr_t) *esp, true);

  success = true;

done:

  if (cpy_file_name != NULL)
    palloc_free_page (cpy_file_name);

  return success;
}

/* Loads an ELF executable from FILE_NAME into the current thread.
   Stores the executable's entry point into *EIP
   and its initial stack pointer into *ESP.
   Returns true if successful, false otherwise. */
bool
load (const char *file_name, void (**eip) (void), void **esp)
{
  struct thread *t = thread_current ();
  struct Elf32_Ehdr ehdr;
  struct file *file = NULL;
  off_t file_ofset;
  bool hold_file_lock = false;
  bool success = false;
  int i;

  //printf ("[Debug] load()\n");

  /* Allocate and activate page directory. */
  t->pagedir = pagedir_create ();
  if (t->pagedir == NULL)
    goto done;
  process_activate ();

  /* Open executable file. */
  lock_acquire (&filesys_lock);
  file = filesys_open (t->name);
  lock_release (&filesys_lock);
  if (file == NULL)
    {
      printf ("load: %s: open failed\n", t->name);
      goto done;
    }

  file_acquire_lock (file);
  hold_file_lock = true;

  /* Read and verify executable header. */
  if (file_read (file, &ehdr, sizeof ehdr) != sizeof ehdr
      || memcmp (ehdr.e_ident, "\177ELF\1\1\1", 7)
      || ehdr.e_type != 2
      || ehdr.e_machine != 3
      || ehdr.e_version != 1
      || ehdr.e_phentsize != sizeof (struct Elf32_Phdr)
      || ehdr.e_phnum > 1024)
    {
      printf ("load: %s: error loading executable\n", t->name);
      goto done;
    }

  //printf ("[Debug] hello!\n");

  /* Read program headers. */
  file_ofset = ehdr.e_phoff;
  for (i = 0; i < ehdr.e_phnum; i++)
    {
      //printf ("[Debug]  loop #%d\n", i);
      struct Elf32_Phdr phdr;

      if (file_ofset < 0 || file_ofset > file_length (file))
        goto done;
      file_seek (file, file_ofset);

      if (file_read (file, &phdr, sizeof phdr) != sizeof phdr)
        goto done;
      file_ofset += sizeof phdr;
      switch (phdr.p_type)
        {
        case PT_NULL:
        case PT_NOTE:
        case PT_PHDR:
        case PT_STACK:
        default:
          /* Ignore this segment. */
          break;
        case PT_DYNAMIC:
        case PT_INTERP:
        case PT_SHLIB:
          goto done;
        case PT_LOAD:
          if (validate_segment (&phdr, file))
            {
              bool writable = (phdr.p_flags & PF_W) != 0;
              uint32_t file_page = phdr.p_offset & ~PGMASK;
              uint32_t mem_page = phdr.p_vaddr & ~PGMASK;
              uint32_t page_offset = phdr.p_vaddr & PGMASK;
              uint32_t read_bytes, zero_bytes;
              if (mem_page == 0)
                mem_page = 0x1000;
              if (phdr.p_filesz > 0)
                {
                  /* Normal segment.
                     Read initial part from disk and zero the rest. */
                  read_bytes = page_offset + phdr.p_filesz;
                  zero_bytes = (ROUND_UP (page_offset + phdr.p_memsz, PGSIZE)
                                - read_bytes);
                }
              else
                {
                  /* Entirely zero.
                     Don't read anything from disk. */
                  read_bytes = 0;
                  zero_bytes = ROUND_UP (page_offset + phdr.p_memsz, PGSIZE);
                }
              if (!load_segment (file, file_page, (void *) mem_page,
                                 read_bytes, zero_bytes, writable))
                goto done;
            }
          else
            goto done;
          break;
        }
    }

  //printf ("[Debug]  before setup_stack()\n");

  /* Set up stack. */
  if (!setup_stack (esp))
    goto done;

  //printf ("[Debug]  after setup_stack()\n");

  /* Start address. */
  *eip = (void (*) (void)) ehdr.e_entry;

  if (!construct_stack (file_name, esp))
    goto done;

   success = true;

done:

   //printf ("[Debug]  load success : %s\n", success ? "true" : "false");

  /* We arrive here whether the load is successful or not. */

  if (success)
    {
      file_deny_write (file);
      t->self_file = file;
    }

  if (hold_file_lock)
    file_release_lock (file);

  return success;
}

/* load() helpers. */

static bool install_page (void *upage, void *kpage, bool writable);

/* Checks whether PHDR describes a valid, loadable segment in
   FILE and returns true if so, false otherwise. */
static bool
validate_segment (const struct Elf32_Phdr *phdr, struct file *file)
{
  /* p_offset and p_vaddr must have the same page offset. */
  if ((phdr->p_offset & PGMASK) != (phdr->p_vaddr & PGMASK))
    return false;

  /* p_offset must point within FILE. */
  if (phdr->p_offset > (Elf32_Off) file_length (file))
    return false;

  /* p_memsz must be at least as big as p_filesz. */
  if (phdr->p_memsz < phdr->p_filesz)
    return false;

  /* The segment must not be empty. */
  if (phdr->p_memsz == 0)
    return false;

  /* The virtual memory region must both start and end within the
     user address space range. */
  if (!is_user_vaddr ((void *) phdr->p_vaddr))
    return false;
  if (!is_user_vaddr ((void *) (phdr->p_vaddr + phdr->p_memsz)))
    return false;

  /* The region cannot "wrap around" across the kernel virtual
     address space. */
  if (phdr->p_vaddr + phdr->p_memsz < phdr->p_vaddr)
    return false;

  /* Disallow mapping page 0.
     Not only is it a bad idea to map page 0, but if we allowed
     it then user code that passed a null pointer to system calls
     could quite likely panic the kernel by way of null pointer
     assertions in memcpy(), etc. */
  //if (phdr->p_vaddr < PGSIZE)
  if (phdr->p_offset < PGSIZE)
    return false;

  /* It's okay. */
  return true;
}

/* Loads a segment starting at offset OFS in FILE at address
   UPAGE.  In total, READ_BYTES + ZERO_BYTES bytes of virtual
   memory are initialized, as follows:

        - READ_BYTES bytes at UPAGE must be read from FILE
          starting at offset OFS.

        - ZERO_BYTES bytes at UPAGE + READ_BYTES must be zeroed.

   The pages initialized by this function must be writable by the
   user process if WRITABLE is true, read-only otherwise.

   Return true if successful, false if a memory allocation error
   or disk read error occurs. */
static bool
load_segment (struct file *file, off_t ofs, uint8_t *upage,
              uint32_t read_bytes, uint32_t zero_bytes, bool writable)
{
  ASSERT ((read_bytes + zero_bytes) % PGSIZE == 0);
  ASSERT (pg_ofs (upage) == 0);
  ASSERT (ofs % PGSIZE == 0);

  //printf ("[Debug] load_segment() upage : 0x%08x\n", upage);

  file_seek (file, ofs);
  while (read_bytes > 0 || zero_bytes > 0)
    {
      /* Calculate how to fill this page.
         We will read PAGE_READ_BYTES bytes from FILE
         and zero the final PAGE_ZERO_BYTES bytes. */
      size_t page_read_bytes = read_bytes < PGSIZE ? read_bytes : PGSIZE;
      size_t page_zero_bytes = PGSIZE - page_read_bytes;

#ifndef VM
      /* Get a page of memory. */
      uint8_t *knpage = palloc_get_page (PAL_USER);
      if (knpage == NULL)
        return false;

      /* Load this page. */
      if (file_read (file, knpage, page_read_bytes) != (int) page_read_bytes)
        {
          palloc_free_page (knpage);
          return false;
        }
      memset (knpage + page_read_bytes, 0, page_zero_bytes);

      /* Add the page to the process's address space. */
      if (!install_page (upage, knpage, writable))
        {
          palloc_free_page (knpage);
          return false;
        }
#else
      ////printf ("[Debug]  loop of load_segment() upage : 0x%08x\n", upage);

      /* Allocate page */
      if (!suppage_alloc (upage, writable))
        return false;

      ////printf ("[Debug]   fuck.\n");

      uint8_t *knpage =
        list_entry(list_rbegin (&thread_current ()->suppage_list), struct suppage, elem)
        ->frame->kpage;

      /* Load this page */
      if (file_read (file, knpage, page_read_bytes) != (int) page_read_bytes)
        {
          ////printf ("[Debug]   fuck2.\n");
          suppage_dealloc (upage);
          return false;
        }
      ////printf ("[Debug]   fuck3.\n");
      memset (knpage + page_read_bytes, 0, page_zero_bytes);
      //list_entry(list_rbegin (&thread_current ()->suppage_list), struct suppage, elem)
      //  ->writable = writable;
      ////printf ("[Debug]  loop of ~load_segment()\n");
#endif

      /* Advance. */
      read_bytes -= page_read_bytes;
      zero_bytes -= page_zero_bytes;
      upage += PGSIZE;
    }

  //printf ("[Debug] ~load_segment() upage : 0x%08x\n", upage);
  return true;
}

/* Create a minimal stack by mapping a zeroed page at the top of
   user virtual memory. */
static bool
setup_stack (void **esp)
{
  uint8_t *kpage;
  bool success = false;

#ifndef VM
  kpage = palloc_get_page (PAL_USER | PAL_ZERO);
  if (kpage != NULL)
    {
      success = install_page (((uint8_t *) PHYS_BASE) - PGSIZE, kpage, true);
      if (success)
        *esp = PHYS_BASE;
      else
        palloc_free_page (kpage);
    }
#else
  if (suppage_alloc (((uint8_t *) PHYS_BASE) - PGSIZE, true))
    {
      success = true;
      *esp = PHYS_BASE;
    }
#endif
  return success;
}

/* Adds a mapping from user virtual address UPAGE to kernel
   virtual address KPAGE to the page table.
   If WRITABLE is true, the user process may modify the page;
   otherwise, it is read-only.
   UPAGE must not already be mapped.
   KPAGE should probably be a page obtained from the user pool
   with palloc_get_page().
   Returns true on success, false if UPAGE is already mapped or
   if memory allocation fails. */
static bool
install_page (void *upage, void *kpage, bool writable)
{
  struct thread *th = thread_current ();

  /* Verify that there's not already a page at that virtual
     address, then map our page there. */
  return (pagedir_get_page (th->pagedir, upage) == NULL
          && pagedir_set_page (th->pagedir, upage, kpage, writable));
}


text:
Error Connecting to Server

      <button class="btn btn-danger" type="button" (click)="refresh()"> Reload</button>

      <ba-card title="Penentuan Kolokium" baCardClass="with-scroll table-panel">

Upload File Jadwal Kolokium

              <alert type="danger" *ngIf="!preview">
                Belum upload Jadwal Kolokium
              </alert>
              <alert type="success" *ngIf="preview">
                Jadwal Kolokium bisa dilihat

 Disini
              </alert>

                  <input class="button" type="file"
                         ngFileSelect
                         [options]="options"
                         (onUpload)="handleUpload($event)"
                         (beforeUpload)="beforeUpload($event)">

                  <progress class="progress progress-striped" value="{{progress}}" max="100" type="warning">{{progress}}%</progress>{{progress}}%

            <button type="button" class="btn btn-primary btn-lg" (click)="simpan()">Simpan</button>

      </ba-card>

    <ba-card title="Rekapitulasi Kolokium" baCardClass="with-scroll table-panel">

          Tahun Angkatan : {{i}}
          <canvas baseChart
                  [data]="dataKolokium[i]"
                  [labels]="dataLabel"
                  [chartType]="pieChartType">
          </canvas>

          Sudah Kolokium : {{dataKolokium[i][0]}}

          Belum Kolokium : {{dataKolokium[i][1]}}

    </ba-card>

    <ba-card title="Rekap File Kolokium" class="col-md-12" baCardClass="with-scroll table-panel">

        <ng2-smart-table (userRowSelect)="test($event)" (userRowSelect)="smModal.show()" [settings]="settings" [source]="source"></ng2-smart-table>

    </ba-card>

Konfirmasi Kolokium

        <button type="button" class="close pull-right" aria-label="Close" (click)="smModal.hide()">
          ×
        </button>

          <button class="btn btn-primary" (click)="confirm(1)" (click)="smModal.hide()">Konfirmasi Sudah Kolokium</button>

          <button class="btn btn-danger" (click)="confirm(0)" (click)="smModal.hide()">Batalkan Konfirmasi Kolokium</button>

          Belum Upload


text:
FOUNDATION_EXPORT double Pods_TelegramAppKit_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_TelegramAppKit_TestsVersionString[];


text:
<?php

namespace VintageWest\AdminBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Page
 *
 * @ORM\Table(name="page")
 * @ORM\Entity(repositoryClass="VintageWest\AdminBundle\Repository\PageRepository")
 */
class Page
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

    /**
     * @ORM\ManyToOne(targetEntity="Language", inversedBy="pages")
     * @ORM\JoinColumn(name="language_id", referencedColumnName="id")
     */
    protected $lang;

    /**
     * @ORM\OneToMany(targetEntity="Block", mappedBy="blocks")
     */
    protected $blocks;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Page
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    public function __toString(){
        return $this->name;
    }
}


text:
package com.opengamma.master.region;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.joda.beans.BeanBuilder;
import org.joda.beans.BeanDefinition;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaProperty;
import org.joda.beans.impl.direct.DirectBeanBuilder;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;

import com.opengamma.OpenGammaRuntimeException;
import com.opengamma.master.AbstractHistoryResult;
import com.opengamma.util.PublicSPI;

/**
 * Result providing the history of a region.
 *

 * The returned documents may be a mixture of versions and corrections.
 * The document instant fields are used to identify which are which.
 * See {@link RegionHistoryRequest} for more details.
 */
@PublicSPI
@BeanDefinition
public class RegionHistoryResult extends AbstractHistoryResult<RegionDocument> {

  /**
   * Creates an instance.
   */
  public RegionHistoryResult() {
  }

  /**
   * Creates an instance from a collection of documents.
   *
   * @param coll  the collection of documents to add, not null
   */
  public RegionHistoryResult(Collection<RegionDocument> coll) {
    super(coll);
  }

  //-------------------------------------------------------------------------
  /**
   * Gets the returned regions from within the documents.
   *
   * @return the regions, not null
   */
  public List<ManageableRegion> getRegions() {
    List<ManageableRegion> result = new ArrayList<ManageableRegion>();
    if (getDocuments() != null) {
      for (RegionDocument doc : getDocuments()) {
        result.add(doc.getRegion());
      }
    }
    return result;
  }

  /**
   * Gets the first region, or null if no documents.
   *
   * @return the first region, null if none
   */
  public ManageableRegion getFirstRegion() {
    return getDocuments().size() > 0 ? getDocuments().get(0).getRegion() : null;
  }

  /**
   * Gets the single result expected from a query.
   *

   * This throws an exception if more than 1 result is actually available.
   * Thus, this method implies an assumption about uniqueness of the queried region.
   *
   * @return the matching region, not null
   * @throws IllegalStateException if no region was found
   */
  public ManageableRegion getSingleRegion() {
    if (getDocuments().size() != 1) {
      throw new OpenGammaRuntimeException("Expecting zero or single resulting match, and was " + getDocuments().size());
    } else {
      return getDocuments().get(0).getRegion();
    }
  }

  //------------------------- AUTOGENERATED START -------------------------
  ///CLOVER:OFF
  /**
   * The meta-bean for {@code RegionHistoryResult}.
   * @return the meta-bean, not null
   */
  public static RegionHistoryResult.Meta meta() {
    return RegionHistoryResult.Meta.INSTANCE;
  }

  static {
    JodaBeanUtils.registerMetaBean(RegionHistoryResult.Meta.INSTANCE);
  }

  @Override
  public RegionHistoryResult.Meta metaBean() {
    return RegionHistoryResult.Meta.INSTANCE;
  }

  //-----------------------------------------------------------------------
  @Override
  public RegionHistoryResult clone() {
    return JodaBeanUtils.cloneAlways(this);
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if (obj != null && obj.getClass() == this.getClass()) {
      return super.equals(obj);
    }
    return false;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    return hash ^ super.hashCode();
  }

  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(32);
    buf.append("RegionHistoryResult{");
    int len = buf.length();
    toString(buf);
    if (buf.length() > len) {
      buf.setLength(buf.length() - 2);
    }
    buf.append('}');
    return buf.toString();
  }

  @Override
  protected void toString(StringBuilder buf) {
    super.toString(buf);
  }

  //-----------------------------------------------------------------------
  /**
   * The meta-bean for {@code RegionHistoryResult}.
   */
  public static class Meta extends AbstractHistoryResult.Meta<RegionDocument> {
    /**
     * The singleton instance of the meta-bean.
     */
    static final Meta INSTANCE = new Meta();

    /**
     * The meta-properties.
     */
    private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
        this, (DirectMetaPropertyMap) super.metaPropertyMap());

    /**
     * Restricted constructor.
     */
    protected Meta() {
    }

    @Override
    public BeanBuilder<? extends RegionHistoryResult> builder() {
      return new DirectBeanBuilder<RegionHistoryResult>(new RegionHistoryResult());
    }

    @Override
    public Class<? extends RegionHistoryResult> beanType() {
      return RegionHistoryResult.class;
    }

    @Override
    public Map<String, MetaProperty<?>> metaPropertyMap() {
      return _metaPropertyMap$;
    }

    //-----------------------------------------------------------------------
  }

  ///CLOVER:ON
  //-------------------------- AUTOGENERATED END --------------------------
}


text:
using System;

class Program
{
    static void Main(string[] args)
    {
        double lenght = double.Parse(Console.ReadLine());
        double width = double.Parse(Console.ReadLine());
        double height = double.Parse(Console.ReadLine());

        try
        {
            Box box = new Box(lenght, width, height);
            Console.WriteLine(box);
        }
        catch (ArgumentException argEx)
        {
            Console.WriteLine(argEx.Message);
        }

    }
}


text:
==================
Installation Guide
==================

.. toctree::

   get_started.rst
   install-obs.rst
   install-rdo.rst
   install-ubuntu.rst
   next-steps.rst
.. verify.rst

This chapter assumes a working setup of OpenStack following the
`OpenStack Installation Tutorials and Guides <https://docs.openstack.org/#install-guides>`_.


text:
#ifndef _PKCS11N_H_
#define _PKCS11N_H_

#ifdef DEBUG
static const char CKT_CVS_ID[] = "@(#) $RCSfile: pkcs11n.h,v $ $Revision: 1.8 $ $Date: 2003/01/22 03:13:04 $ $Name:  $";
#endif /* DEBUG */

/*
 * pkcs11n.h
 *
 * This file contains the NSS-specific type definitions for Cryptoki
 * (PKCS#11).
 */

/*
 * NSSCK_VENDOR_NETSCAPE
 *
 * Cryptoki reserves the high half of all the number spaces for
 * vendor-defined use.  I'd like to keep all of our Netscape-
 * specific values together, but not in the oh-so-obvious
 * 0x80000001, 0x80000002, etc. area.  So I've picked an offset,
 * and constructed values for the beginnings of our spaces.
 *
 * Note that some "historical" Netscape values don't fall within
 * this range.
 */
#define NSSCK_VENDOR_NETSCAPE 0x4E534350 /* NSCP */

/*
 * Netscape-defined object classes
 *
 */
#define CKO_NETSCAPE (CKO_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)

#define CKO_NETSCAPE_CRL                (CKO_NETSCAPE + 1)
#define CKO_NETSCAPE_SMIME              (CKO_NETSCAPE + 2)
#define CKO_NETSCAPE_TRUST              (CKO_NETSCAPE + 3)
#define CKO_NETSCAPE_BUILTIN_ROOT_LIST  (CKO_NETSCAPE + 4)

/*
 * Netscape-defined key types
 *
 */
#define CKK_NETSCAPE (CKK_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)

#define CKK_NETSCAPE_PKCS8              (CKK_NETSCAPE + 1)
/*
 * Netscape-defined certificate types
 *
 */
#define CKC_NETSCAPE (CKC_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)

/*
 * Netscape-defined object attributes
 *
 */
#define CKA_NETSCAPE (CKA_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)

#define CKA_NETSCAPE_URL                (CKA_NETSCAPE +  1)
#define CKA_NETSCAPE_EMAIL              (CKA_NETSCAPE +  2)
#define CKA_NETSCAPE_SMIME_INFO         (CKA_NETSCAPE +  3)
#define CKA_NETSCAPE_SMIME_TIMESTAMP    (CKA_NETSCAPE +  4)
#define CKA_NETSCAPE_PKCS8_SALT         (CKA_NETSCAPE +  5)
#define CKA_NETSCAPE_PASSWORD_CHECK     (CKA_NETSCAPE +  6)
#define CKA_NETSCAPE_EXPIRES            (CKA_NETSCAPE +  7)
#define CKA_NETSCAPE_KRL                (CKA_NETSCAPE +  8)

#define CKA_NETSCAPE_PQG_COUNTER        (CKA_NETSCAPE +  20)
#define CKA_NETSCAPE_PQG_SEED           (CKA_NETSCAPE +  21)
#define CKA_NETSCAPE_PQG_H              (CKA_NETSCAPE +  22)
#define CKA_NETSCAPE_PQG_SEED_BITS      (CKA_NETSCAPE +  23)

/*
 * Trust attributes:
 *
 * If trust goes standard, these probably will too.  So I'll
 * put them all in one place.
 */

#define CKA_TRUST (CKA_NETSCAPE + 0x2000)

/* "Usage" key information */
#define CKA_TRUST_DIGITAL_SIGNATURE     (CKA_TRUST +  1)
#define CKA_TRUST_NON_REPUDIATION       (CKA_TRUST +  2)
#define CKA_TRUST_KEY_ENCIPHERMENT      (CKA_TRUST +  3)
#define CKA_TRUST_DATA_ENCIPHERMENT     (CKA_TRUST +  4)
#define CKA_TRUST_KEY_AGREEMENT         (CKA_TRUST +  5)
#define CKA_TRUST_KEY_CERT_SIGN         (CKA_TRUST +  6)
#define CKA_TRUST_CRL_SIGN              (CKA_TRUST +  7)

/* "Purpose" trust information */
#define CKA_TRUST_SERVER_AUTH           (CKA_TRUST +  8)
#define CKA_TRUST_CLIENT_AUTH           (CKA_TRUST +  9)
#define CKA_TRUST_CODE_SIGNING          (CKA_TRUST + 10)
#define CKA_TRUST_EMAIL_PROTECTION      (CKA_TRUST + 11)
#define CKA_TRUST_IPSEC_END_SYSTEM      (CKA_TRUST + 12)
#define CKA_TRUST_IPSEC_TUNNEL          (CKA_TRUST + 13)
#define CKA_TRUST_IPSEC_USER            (CKA_TRUST + 14)
#define CKA_TRUST_TIME_STAMPING         (CKA_TRUST + 15)
#define CKA_CERT_SHA1_HASH	        (CKA_TRUST + 100)
#define CKA_CERT_MD5_HASH		(CKA_TRUST + 101)

/* Netscape trust stuff */
/* XXX fgmr new ones here-- step-up, etc. */

/* HISTORICAL: define used to pass in the database key for DSA private keys */
#define CKA_NETSCAPE_DB                 0xD5A0DB00L
#define CKA_NETSCAPE_TRUST              0x80000001L

/*
 * Netscape-defined crypto mechanisms
 *
 */
#define CKM_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)

#define CKM_NETSCAPE_AES_KEY_WRAP      (CKM_NETSCAPE + 1)
#define CKM_NETSCAPE_AES_KEY_WRAP_PAD  (CKM_NETSCAPE + 2)

/*
 * HISTORICAL:
 * Do not attempt to use these. They are only used by NETSCAPE's internal
 * PKCS #11 interface. Most of these are place holders for other mechanism
 * and will change in the future.
 */
#define CKM_NETSCAPE_PBE_SHA1_DES_CBC           0x80000002L
#define CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC    0x80000003L
#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC    0x80000004L
#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC   0x80000005L
#define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4        0x80000006L
#define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4       0x80000007L
#define CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC   0x80000008L
#define CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN      0x80000009L
#define CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN       0x8000000aL
#define CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN       0x8000000bL

#define CKM_TLS_PRF_GENERAL                     0x80000373L

/*
 * Netscape-defined return values
 *
 */
#define CKR_NETSCAPE (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)

/*
 * Trust info
 *
 * This isn't part of the Cryptoki standard (yet), so I'm putting
 * all the definitions here.  Some of this would move to nssckt.h
 * if trust info were made part of the standard.  In view of this
 * possibility, I'm putting my (Netscape) values in the netscape
 * vendor space, like everything else.
 */

typedef CK_ULONG          CK_TRUST;

/* The following trust types are defined: */
#define CKT_VENDOR_DEFINED     0x80000000

#define CKT_NETSCAPE (CKT_VENDOR_DEFINED|NSSCK_VENDOR_NETSCAPE)

/* If trust goes standard, these'll probably drop out of vendor space. */
#define CKT_NETSCAPE_TRUSTED            (CKT_NETSCAPE + 1)
#define CKT_NETSCAPE_TRUSTED_DELEGATOR  (CKT_NETSCAPE + 2)
#define CKT_NETSCAPE_UNTRUSTED          (CKT_NETSCAPE + 3)
#define CKT_NETSCAPE_MUST_VERIFY        (CKT_NETSCAPE + 4)
#define CKT_NETSCAPE_TRUST_UNKNOWN      (CKT_NETSCAPE + 5) /* default */

/*
 * These may well remain Netscape-specific; I'm only using them
 * to cache resolution data.
 */
#define CKT_NETSCAPE_VALID              (CKT_NETSCAPE + 10)
#define CKT_NETSCAPE_VALID_DELEGATOR    (CKT_NETSCAPE + 11)

/*
 * These are not really PKCS #11 values specifically. They are the 'loadable'
 * module spec NSS uses. The are available for others to use as well, but not
 * part of the formal PKCS #11 spec.
 *
 * The function 'FIND' returns an array of PKCS #11 initialization strings
 * The function 'ADD' takes a PKCS #11 initialization string and stores it.
 * The function 'DEL' takes a 'name= library=' value and deletes the associated
 *  string.
 * The function 'RELEASE' frees the array returned by 'FIND'
 */
#define SECMOD_MODULE_DB_FUNCTION_FIND  0
#define SECMOD_MODULE_DB_FUNCTION_ADD   1
#define SECMOD_MODULE_DB_FUNCTION_DEL   2
#define SECMOD_MODULE_DB_FUNCTION_RELEASE 3
typedef char ** (PR_CALLBACK *SECMODModuleDBFunc)(unsigned long function,
                                        char *parameters, void *moduleSpec);

#endif /* _PKCS11N_H_ */


text:
using System;
using System.Runtime.CompilerServices;

namespace jQueryApi.UI.Effects {

    /// <summary>
    /// Options used to initialize or customize Scale.
    /// </summary>
    [ScriptImport]
    [ScriptIgnoreNamespace]
    [ScriptName("Object")]
    public sealed class ScaleOptions {

        public ScaleOptions() {
        }

        public ScaleOptions(params object[] nameValuePairs) {
        }

        /// <summary>
        /// A callback function, executed when the effect completes
        /// </summary>
        [ScriptField]
        public Action Complete {
            get {
                return null;
            }
            set {
            }
        }

        /// <summary>
        /// The direction of the effect. Can be "both", "vertical" or "horizontal".
        /// </summary>
        [ScriptField]
        public string Direction {
            get {
                return null;
            }
            set {
            }
        }

        /// <summary>
        /// The number of ms the animation will run for
        /// </summary>
        [ScriptField]
        public int Duration {
            get {
                return 0;
            }
            set {
            }
        }

        /// <summary>
        /// The easing function to use
        /// </summary>
        [ScriptField]
        public string Easing {
            get {
                return null;
            }
            set {
            }
        }

        /// <summary>
        /// The vanishing point, default for show/hide.
        /// </summary>
        [ScriptField]
        public Array Origin {
            get {
                return null;
            }
            set {
            }
        }

        /// <summary>
        /// The percentage to scale to.
        /// </summary>
        [ScriptField]
        public int Percent {
            get {
                return 0;
            }
            set {
            }
        }

        /// <summary>
        /// Which areas of the element will be resized: 'both', 'box', 'content' Box resizes the border and padding of the element Content resizes any content inside of the element
        /// </summary>
        [ScriptField]
        public string Scale {
            get {
                return null;
            }
            set {
            }
        }
    }
}


text:
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Http, Headers, Response } from '@angular/http';
import { User } from '../model/user-model';

@Component({
  selector: 'app-user-info',
  templateUrl: './user-info.component.html',
  styleUrls: ['./user-info.component.scss']
})
export class UserInfoComponent implements OnInit {
	  @Input()
    public panelTitle:string;

    @Input()
    public userId:string;

    @Output()
    public follow = new EventEmitter<string>();

  	public currentUser: User;
    public userInfoURL = 'user/getUserInfo';

  	constructor(public http:Http) {
      //构造组件的时候,@Input的属性还没有值
      console.log(this.panelTitle);
    }

    ngOnInit() {
      //组件初始化完成之后,panelTitle才会有值
      console.log(this.panelTitle);
  	}

    public loadUserInfo(){
      this.userInfoURL=this.userInfoURL+"/"+this.userId;
      return this.http
            .get(this.userInfoURL)
            .map((response: Response) => {
              let user = response.json();
              return user;
            })
            .subscribe(
                data => {
                    console.log("用户信息>"+data);
                },
                error => {
                    console.error(error);
                }
            );
    }

    public followBtnClick(){
        this.follow.emit("follow");
    }
}


text:
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#include <stdarg.h>
#include <stdio.h>

#include "core/strings/stringFunctions.h"
#include "platform/platform.h"

#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
// This standard function is not defined when compiling with VC7...
#define vsnprintf	_vsnprintf
#endif

//-----------------------------------------------------------------------------

// Original code from: http://sourcefrog.net/projects/natsort/
// Somewhat altered here.
//TODO: proper UTF8 support; currently only working for single-byte characters

/* partial change history:
 *
 * 2004-10-10 mbp: Lift out character type dependencies into macros.
 *
 * Eric Sosman pointed out that ctype functions take a parameter whose
 * value must be that of an unsigned int, even on platforms that have
 * negative chars in their default char type.
 */

typedef char nat_char;

/* These are defined as macros to make it easier to adapt this code to
 * different characters types or comparison functions. */
static inline int
nat_isdigit( nat_char a )
{
   return dIsdigit( a );
}

static inline int
nat_isspace( nat_char a )
{
   return dIsspace( a );
}

static inline nat_char
nat_toupper( nat_char a )
{
   return dToupper( a );
}

static int
compare_right(const nat_char* a, const nat_char* b)
{
   int bias = 0;

   /* The longest run of digits wins.  That aside, the greatest
   value wins, but we can't know that it will until we've scanned
   both numbers to know that they have the same magnitude, so we
   remember it in BIAS. */
   for (;; a++, b++) {
      if (!nat_isdigit(*a)  &&  !nat_isdigit(*b))
         return bias;
      else if (!nat_isdigit(*a))
         return -1;
      else if (!nat_isdigit(*b))
         return +1;
      else if (*a < *b) {
         if (!bias)
            bias = -1;
      } else if (*a > *b) {
         if (!bias)
            bias = +1;
      } else if (!*a  &&  !*b)
         return bias;
   }

   return 0;
}

static int
compare_left(const nat_char* a, const nat_char* b)
{
   /* Compare two left-aligned numbers: the first to have a
   different value wins. */
   for (;; a++, b++) {
      if (!nat_isdigit(*a)  &&  !nat_isdigit(*b))
         return 0;
      else if (!nat_isdigit(*a))
         return -1;
      else if (!nat_isdigit(*b))
         return +1;
      else if (*a < *b)
         return -1;
      else if (*a > *b)
         return +1;
   }

   return 0;
}

static int strnatcmp0(const nat_char* a, const nat_char* b, int fold_case)
{
   int ai, bi;
   nat_char ca, cb;
   int fractional, result;

   ai = bi = 0;
   while (1) {
      ca = a[ai]; cb = b[bi];

      /* skip over leading spaces or zeros */
      while (nat_isspace(ca))
         ca = a[++ai];

      while (nat_isspace(cb))
         cb = b[++bi];

      /* process run of digits */
      if (nat_isdigit(ca)  &&  nat_isdigit(cb)) {
         fractional = (ca == '0' || cb == '0');

         if (fractional) {
            if ((result = compare_left(a+ai, b+bi)) != 0)
               return result;
         } else {
            if ((result = compare_right(a+ai, b+bi)) != 0)
               return result;
         }
      }

      if (!ca && !cb) {
         /* The strings compare the same.  Perhaps the caller
         will want to call strcmp to break the tie. */
         return 0;
      }

      if (fold_case) {
         ca = nat_toupper(ca);
         cb = nat_toupper(cb);
      }

      if (ca < cb)
         return -1;
      else if (ca > cb)
         return +1;

      ++ai; ++bi;
   }
}

int dStrnatcmp(const nat_char* a, const nat_char* b) {
   return strnatcmp0(a, b, 0);
}

/* Compare, recognizing numeric string and ignoring case. */
int dStrnatcasecmp(const nat_char* a, const nat_char* b) {
   return strnatcmp0(a, b, 1);
}

//------------------------------------------------------------------------------
// non-standard string functions

char *dStrdup_r(const char *src, const char *fileName, dsize_t lineNumber)
{
   char *buffer = (char *) dMalloc_r(dStrlen(src) + 1, fileName, lineNumber);
   dStrcpy(buffer, src);
   return buffer;
}

char* dStrichr( char* str, char ch )
{
   AssertFatal( str != NULL, "dStrichr - NULL string" );

   if( !ch )
      return dStrchr( str, ch );

   char c = dToupper( ch );
   while( *str )
   {
      if( dToupper( *str ) == c )
         return str;

      ++ str;
   }

   return NULL;
}

const char* dStrichr( const char* str, char ch )
{
   AssertFatal( str != NULL, "dStrichr - NULL string" );

   if( !ch )
      return dStrchr( str, ch );

   char c = dToupper( ch );
   while( *str )
   {
      if( dToupper( *str ) == c )
         return str;

      ++ str;
   }

   return NULL;
}

// concatenates a list of src's onto the end of dst
// the list of src's MUST be terminated by a NULL parameter
// dStrcatl(dst, sizeof(dst), src1, src2, NULL);
char* dStrcatl(char *dst, dsize_t dstSize, ...)
{
   const char* src = NULL;
   char *p = dst;

   AssertFatal(dstSize > 0, "dStrcatl: destination size is set zero");
   dstSize--;  // leave room for string termination

   // find end of dst
   while (dstSize && *p++)
      dstSize--;

   va_list args;
   va_start(args, dstSize);

   // concatenate each src to end of dst
   while ( (src = va_arg(args, const char*)) != NULL )
   {
      while( dstSize && *src )
      {
         *p++ = *src++;
         dstSize--;
      }
   }

   va_end(args);

   // make sure the string is terminated
   *p = 0;

   return dst;
}

// copy a list of src's into dst
// the list of src's MUST be terminated by a NULL parameter
// dStrccpyl(dst, sizeof(dst), src1, src2, NULL);
char* dStrcpyl(char *dst, dsize_t dstSize, ...)
{
   const char* src = NULL;
   char *p = dst;

   AssertFatal(dstSize > 0, "dStrcpyl: destination size is set zero");
   dstSize--;  // leave room for string termination

   va_list args;
   va_start(args, dstSize);

   // concatenate each src to end of dst
   while ( (src = va_arg(args, const char*)) != NULL )
   {
      while( dstSize && *src )
      {
         *p++ = *src++;
         dstSize--;
      }
   }

   va_end(args);

   // make sure the string is terminated
   *p = 0;

   return dst;
}

int dStrcmp( const UTF16 *str1, const UTF16 *str2)
{
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
   return wcscmp( reinterpret_cast<const wchar_t *>( str1 ), reinterpret_cast<const wchar_t *>( str2 ) );
#else
   int ret;
   const UTF16 *a, *b;
   a = str1;
   b = str2;

   while( ((ret = *a - *b) == 0) && *a && *b )
      a++, b++;

   return ret;
#endif
}

char* dStrupr(char *str)
{
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
   return _strupr(str);
#else
   if (str == NULL)
      return(NULL);

   char* saveStr = str;
   while (*str)
   {
      *str = toupper(*str);
      str++;
   }
   return saveStr;
#endif
}

char* dStrlwr(char *str)
{
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
   return _strlwr(str);
#else
   if (str == NULL)
      return(NULL);

   char* saveStr = str;
   while (*str)
   {
      *str = tolower(*str);
      str++;
   }
   return saveStr;
#endif
}

//------------------------------------------------------------------------------
// standard I/O functions

void dPrintf(const char *format, ...)
{
   va_list args;
   va_start(args, format);
   vprintf(format, args);
}

S32 dVprintf(const char *format, void *arglist)
{
   return vprintf(format, (char*)arglist);
}

S32 dSprintf(char *buffer, U32 bufferSize, const char *format, ...)
{
   va_list args;
   va_start(args, format);

   S32 len = vsnprintf(buffer, bufferSize, format, args);

   AssertWarn( len < bufferSize, "Buffer too small in call to dSprintf!" );

   return (len);
}

S32 dVsprintf(char *buffer, U32 bufferSize, const char *format, void *arglist)
{
   S32 len = vsnprintf(buffer, bufferSize, format, (char*)arglist);

   AssertWarn( len < bufferSize, "Buffer too small in call to dVsprintf!" );

   return (len);
}

S32 dSscanf(const char *buffer, const char *format, ...)
{
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
   va_list args;
   va_start(args, format);

   // Boy is this lame.  We have to scan through the format string, and find out how many
   //  arguments there are.  We'll store them off as void*, and pass them to the sscanf
   //  function through specialized calls.  We're going to have to put a cap on the number of args that
   //  can be passed, 8 for the moment.  Sigh.
   static void* sVarArgs[20];
   U32 numArgs = 0;

   for (const char* search = format; *search != '\0'; search++) {
      if (search[0] == '%' && search[1] != '%')
         numArgs++;
   }
   AssertFatal(numArgs <= 20, "Error, too many arguments to lame implementation of dSscanf.  Fix implmentation");

   // Ok, we have the number of arguments...
   for (U32 i = 0; i < numArgs; i++)
      sVarArgs[i] = va_arg(args, void*);
   va_end(args);

   switch (numArgs) {
     case 0: return 0;
     case 1:  return sscanf(buffer, format, sVarArgs[0]);
     case 2:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1]);
     case 3:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2]);
     case 4:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3]);
     case 5:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4]);
     case 6:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5]);
     case 7:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6]);
     case 8:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7]);
     case 9:  return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8]);
     case 10: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9]);
     case 11: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10]);
     case 12: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11]);
     case 13: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12]);
     case 14: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12], sVarArgs[13]);
     case 15: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12], sVarArgs[13], sVarArgs[14]);
     case 16: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12], sVarArgs[13], sVarArgs[14], sVarArgs[15]);
     case 17: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12], sVarArgs[13], sVarArgs[14], sVarArgs[15], sVarArgs[16]);
     case 18: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12], sVarArgs[13], sVarArgs[14], sVarArgs[15], sVarArgs[16], sVarArgs[17]);
     case 19: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12], sVarArgs[13], sVarArgs[14], sVarArgs[15], sVarArgs[16], sVarArgs[17], sVarArgs[18]);
     case 20: return sscanf(buffer, format, sVarArgs[0], sVarArgs[1], sVarArgs[2], sVarArgs[3], sVarArgs[4], sVarArgs[5], sVarArgs[6], sVarArgs[7], sVarArgs[8], sVarArgs[9], sVarArgs[10], sVarArgs[11], sVarArgs[12], sVarArgs[13], sVarArgs[14], sVarArgs[15], sVarArgs[16], sVarArgs[17], sVarArgs[18], sVarArgs[19]);
   }
   return 0;
#else
   va_list args;
   va_start(args, format);
   return vsscanf(buffer, format, args);
#endif
}

/// Safe form of dStrcmp: checks both strings for NULL before comparing
bool dStrEqual(const char* str1, const char* str2)
{
   if (!str1 || !str2)
      return false;
   else
      return (dStrcmp(str1, str2) == 0);
}

/// Check if one string starts with another
bool dStrStartsWith(const char* str1, const char* str2)
{
   return !dStrnicmp(str1, str2, dStrlen(str2));
}

/// Check if one string ends with another
bool dStrEndsWith(const char* str1, const char* str2)
{
   const char *p = str1 + dStrlen(str1) - dStrlen(str2);
   return ((p >= str1) && !dStricmp(p, str2));
}

/// Strip the path from the input filename
char* dStripPath(const char* filename)
{
   const char* itr = filename + dStrlen(filename);
   while(--itr != filename) {
      if (*itr == '/' || *itr == '\\') {
         itr++;
         break;
      }
   }
   return dStrdup(itr);
}

char* dStristr( char* str1, const char* str2 )
{
   if( !str1 || !str2 )
      return NULL;

   // Slow but at least we have it.

   U32 str2len = strlen( str2 );
   while( *str1 )
   {
      if( strncasecmp( str1, str2, str2len ) == 0 )
         return str1;

      ++ str1;
   }

   return NULL;
}

const char* dStristr( const char* str1, const char* str2 )
{
   return dStristr( const_cast< char* >( str1 ), str2 );
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>U-Index</title>
<meta name="date" content="2015-08-31">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A C D E F G H I N P R S T U V W

U

Use - Annotation Type in net.cassite.pure.ioc.annotations

Force a setter or one of method's parameter to use the given class's instance
 / constant / variable.

 It's similar to Force but it is not limited to primitives or Strings.

 Constants and variables can be registered in IOCController

A C D E F G H I N P R S T U V W

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
<?xml version="1.0" encoding="UTF-8"?>
<workingSetManager>
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1475740821255_0" label="Window Working Set" name="Aggregate for window 1475740821255"/>
</workingSetManager>


text:
package ar.com.javacuriosities.nio.zero_copy;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.channels.FileChannel;
import java.util.Arrays;

/*
 * Zero copy es una técnica que nos permite evitar la copia
 * redundante de datos entre buffers intermedios y asi reducir
 * el numero de context switch en la aplicación entre el user-space
 * y kernel-space.
 *
 * Enviar datos de un archivo a un socket
 *
 * Version sin Zero Copy:
 *
 * 1- Al ejecutar un read() se genera un context switch del User mode al Kernel mode, internamente se ejecuta
 * un sys_read(), lo que copia la información del disco a un Read buffer del Kernel.
 * 2- Se ejecuta otro context switch y ahora se copian los datos del buffer desde el Kernel al User space y ahí termina el llamado
 * al read().
 * 3- Ahora al ejecutar un send() para el Socket se genera otro context switch al Kernel mode y una tercera copia de los
 * datos es realizada para dejarlos en el buffer que utiliza el Socket
 * 4- Ahora el llamado a send() retorna y en paralelo y de forma asincronica una cuarta copia es realizada desde el Socket buffer al NIC buffer por medio de DMA
 *
 * Se ejecutan 4 context switch, 2 copias por DMA y 2 copias por el CPU
 *
 * Usando Zero copy:
 *
 * 1- Al ejecutar un transferTo() se genera un context switch del User mode al Kernel mode, y se copia la información
 * a un Read buffer del Kernel por medio de DMA
 * 2- Ahora se copia la información del Read buffer directamente al Socket Buffer (Esta copia la hace el CPU) y luego una tercera copia al NIC buffer usando DMA
 *
 * Se ejecutan 2 context switch, 2 copias por DMA y 1 copia por el CPU
 *
 * Usando Zero copy (Hardware con soporte para Scatter/Gather operations):
 *
 * 1-Al ejecutar un transferTo() se genera un context switch del User mode al Kernel mode, y se copia la información
 * a un buffer del Kernel por medio de DMA.
 * 2- Ahora en lugar de copiar la información del buffer del Kernel a otro lado, se agrega la información con la ubicación y longitud de los datos, el DMA engine
 * se encarga de pasar esta información al engine del protocolo
 *
 * Se ejecuta 1 context switch y 2 copias por DMA
 *
 * Uso:
 *
 * Para utilizar zero copy desde Java podemos utilizar los métodos transferTo y transferFrom
 *
 * Limitaciones:
 *
 * 	- Solo es aplicable a contenido estático
 * 	- No podemos aplicar si los datos tienen que ser modificados o con algún agregado adicional
 * 	- FileChannel solo puede ser usado para transferir datos de File -> File o File -> Socket
 *
 */
public class ZeroCopy {

	private static final int BUFFER_SIZE = 8 * 1024;

	public static void main(String[] args) {
		try {
			// Creamos un archivo grande para la prueba, hay que incrementar el tamaño para ir viendo la diferencia
			File bigFile = createBigFile(100);

			File outputNormalCopy = new File("output_normal_copy.txt");
			File outputZeroCopy = new File("output_zero_copy.txt");

			outputNormalCopy.deleteOnExit();
			outputZeroCopy.deleteOnExit();

			copy(bigFile, outputNormalCopy);
			zeroCopy(bigFile, outputZeroCopy);
		} catch (IOException e) {
			// Log and Handle exception
			e.printStackTrace();
		}
	}

	public static File createBigFile(int sizeInMb) throws IOException {
		File file = File.createTempFile("data", ".txt");
	    file.deleteOnExit();

	    char[] chars = new char[1024];
	    Arrays.fill(chars, 'A');
	    String longLine = new String(chars);

	    long startTime = System.nanoTime();
	    PrintWriter printWriter = new PrintWriter(new FileWriter(file));

	    for (int i = 0; i < sizeInMb * 1024; i++) {
	    	printWriter.println(longLine);
	    }

	    printWriter.close();
	    long totalTime = System.nanoTime() - startTime;

	    System.out.printf("Took %.3f seconds to write to a %d MB, file rate: %.1f MB/s%n", totalTime / 1e9, file.length() >> 20, file.length() * 1000.0 / totalTime);

	    return file;
	}

	public static void copy(File from, File to) throws IOException {
		long startTime = System.nanoTime();
		byte[] data = new byte[BUFFER_SIZE];

		long bytesCopied = 0;
		long bytesToCopy = from.length();

		try (FileInputStream fis = new FileInputStream(from); FileOutputStream fos = new FileOutputStream(to)) {
			while (bytesCopied < bytesToCopy) {
				fis.read(data);
				fos.write(data);
				bytesCopied += data.length;
			}
			fos.flush();
		}

		long totalTime = System.nanoTime() - startTime;
		System.out.printf("Copy - Took %.3f seconds%n", totalTime / 1e9);
	}

	public static void zeroCopy(File from, File to) throws IOException {
		long startTime = System.nanoTime();

		try (FileInputStream fis = new FileInputStream(from); FileOutputStream fos = new FileOutputStream(to)) {
			FileChannel sourceChannel = fis.getChannel();
			FileChannel destinationChannel = fos.getChannel();
			sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
		}

		long totalTime = System.nanoTime() - startTime;
		System.out.printf("Zero Copy - Took %.3f seconds%n", totalTime / 1e9);
	}
}


text:
import moment from "moment";
import { getMinutesFromMidnightFromDate, getMinutesFromMidnightFromString } from "../utils/TimeUtils";

export default class PresenceRepository {
    db;

    constructor({ db, idGenerator }) {
        this.db = db;
        this.idGenerator = idGenerator;
    }

    getDocType() {
        return "presence";
    }

    async findEventPresences(event) {
        // TODO: adaptar formato do json de resposta
        return this.db.find({
            selector: {
                type: this.getDocType(),
                "event._id": event._id,
            },
        });
    }

    async findPresencesByInterval({
        startDate,
        endDate,
        startTime,
        endTime,
        dayOfWeek,
    }) {
        // basic validation
        if (!startDate || !endDate) {
            return Promise.reject(
                "É obrigatório passar uma data inicial e uma data final."
            );
        }

        // datetime interval
        let startOfStartDateMoment = moment(startDate).startOf("day");
        let endOfEndDateMoment = moment(endDate).endOf("day");

        if (startOfStartDateMoment.isAfter(endOfEndDateMoment)) {
            return Promise.reject("Período de busca inválido.");
        }

        let selectorObject = {
            type: this.getDocType(),
            dateTime: {
                $gte: startOfStartDateMoment.toDate(),
                $lte: endOfEndDateMoment.toDate(),
            },
        };

        if (startTime || endTime) {

            let startMinutesFromMidnight = getMinutesFromMidnightFromString(startTime);
            let endMinutesFromMidnight = getMinutesFromMidnightFromString(endTime);

            if((startMinutesFromMidnight >= endMinutesFromMidnight) || !(startTime && endTime)){
                return Promise.reject("Intervalo de horário inválido.");
            }

            selectorObject.minutesFromMidnight = {
                $gte: startMinutesFromMidnight,
                $lte: endMinutesFromMidnight,
            }
        }

        // day of week optional filter
        if (dayOfWeek && dayOfWeek.value) {
            selectorObject.dayOfWeek = { $eq: `${dayOfWeek.value}` };
        }

        return this.db.find({
            selector: selectorObject,
        });
    }

    async savePresence({ person, event, isFirstTime }) {
        let momentEventDate = moment(event.date);

        // creating a new presence
        let newPresence = {
            person: person,
            type: "presence",
            event: event,
            isFirstTime: isFirstTime,
            dateTime: moment(new Date())
                .year(momentEventDate.year())
                .month(momentEventDate.month())
                .date(momentEventDate.date())
                .toDate(),
            registrationDateTime: new Date(),
            minutesFromMidnight: getMinutesFromMidnightFromDate(new Date()),
            dayOfWeek: moment(event.date).format("E"), // ISO day of week: 1..7 = Sun..Sat
        };

        newPresence._id = this.idGenerator.generatePresenceId(newPresence);

        // saving
        await this.db.put(newPresence);

        return newPresence;
    }

    removePresence(presence) {
        this.db.remove(presence);
    }
}


text:
.navbar-default {
    background-color: #000000;
    border-color: #262626;
}
.navbar-default .navbar-brand {
    color: #00bf00;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
    color: #00ff00;
}
.navbar-default .navbar-nav > li > a {
    color: #00bf00;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
    color: #00ff00;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
    color: #00ff00;
    background-color: #262626;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
    color: #00ff00;
    background-color: #262626;
}
.navbar-default .navbar-nav > .dropdown > a .caret {
    border-top-color: #00bf00;
    border-bottom-color: #00bf00;
}
.navbar-default .navbar-nav > .dropdown > a:hover .caret,
.navbar-default .navbar-nav > .dropdown > a:focus .caret {
    border-top-color: #00ff00;
    border-bottom-color: #00ff00;
}
.navbar-default .navbar-nav > .open > a .caret,
.navbar-default .navbar-nav > .open > a:hover .caret,
.navbar-default .navbar-nav > .open > a:focus .caret {
    border-top-color: #00ff00;
    border-bottom-color: #00ff00;
}
.navbar-default .navbar-toggle {
    border-color: #262626;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
    background-color: #262626;
}
.navbar-default .navbar-toggle .icon-bar {
    background-color: #00bf00;
}
@media (max-width: 767px) {
    .navbar-default .navbar-nav .open .dropdown-menu > li > a {
        color: #00bf00;
    }
    .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
    .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
        color: #00ff00;
    }
}

.dropdown-menu {
	background-color: #000000;
	border-color: #262626;
}
.dropdown-menu button {
	background-color: lime;
	border-color: #00ff00;
	color: #262626;
}
.dropdown-menu button:hover {
	background-color: black;
	border-color: #00ff00;
	color: lime;
}
.dropdown-menu button:active {
	background-color: black;
	border-color: #00ff00;
	color: lime;
}

.dropdown-menu button:focus {
	background-color: black;
	border-color: #00ff00;
	color: lime;
}

.dropdown-menu a {
	color: #00ff00;
}
.dropdown-menu > li > a {
	color: #00bf00;
}
.dropdown-menu > li > a:hover {
	color: lime;
	background-color: black;
}

.dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, .dropdown-menu > .active > a:focus {
color: lime;
background-color: #262626;
}
.dropdown-menu .form-control:focus {
	border-color: #000000;
	-webkit-box-shadow: rgba(0, 0, 0, 0.0745098) 0px 1px 1px 0px inset, rgba(0, 128, 0, 0.6) 0px 0px 8px 0px;
}

.dropdown-menu input {
	background: #262626;
	color: lime;
	border-color: black;
}
.alert-danger {
color: lime;
background-color: #262626;
border-color: black;
}

#login-username::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
  color: green;
}
#login-username:-moz-placeholder, textarea:-moz-placeholder {
  color: green;
}
#login-password::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
  color: green;
}
#login-password:-moz-placeholder, textarea:-moz-placeholder {
  color: green;
}

#login-old-password::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
  color: green;
}
#login-old-password:-moz-placeholder, textarea:-moz-placeholder {
  color: green;
}

#login-password-again::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
  color: green;
}
#login-password-again:-moz-placeholder, textarea:-moz-placeholder {
  color: green;
}