text
stringlengths 2
1.04M
| meta
dict |
---|---|
FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER [email protected]
RUN go get github.com/json-iterator/go
RUN mkdir fuzz
COPY fuzz_json.go fuzz
COPY build.sh $SRC/
WORKDIR fuzz
| {
"content_hash": "c5340ebf77ee20f1d1266a30ae93e019",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 38,
"avg_line_length": 22.25,
"alnum_prop": 0.7921348314606742,
"repo_name": "FeliciaLim/oss-fuzz",
"id": "78972b689157932a62a6c7ab926fe40b35a7d859",
"size": "838",
"binary": false,
"copies": "1",
"ref": "refs/heads/opus",
"path": "projects/go-json-iterator/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "7113"
},
{
"name": "C++",
"bytes": "29021"
},
{
"name": "Groovy",
"bytes": "8689"
},
{
"name": "HTML",
"bytes": "603"
},
{
"name": "Python",
"bytes": "25585"
},
{
"name": "Shell",
"bytes": "70002"
}
],
"symlink_target": ""
} |
package com.digitalpetri.opcua.stack.core.types.builtin;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
import com.digitalpetri.opcua.stack.core.Identifiers;
import com.digitalpetri.opcua.stack.core.serialization.UaEnumeration;
import com.digitalpetri.opcua.stack.core.serialization.UaStructure;
import com.digitalpetri.opcua.stack.core.util.ArrayUtil;
import com.digitalpetri.opcua.stack.core.util.TypeUtil;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
public final class Variant {
public static final Variant NULL_VALUE = new Variant(null);
private final Object value;
/**
* Create a new Variant with a given value.
*
* @param value the value this Variant holds.
*/
public Variant(@Nullable Object value) {
if (value != null) {
boolean clazzIsArray = value.getClass().isArray();
Class<?> componentClazz = clazzIsArray ?
ArrayUtil.getType(value) : value.getClass();
checkArgument(clazzIsArray || !Variant.class.equals(componentClazz), "Variant cannot contain Variant");
checkArgument(!DataValue.class.equals(componentClazz), "Variant cannot contain DataValue");
checkArgument(!DiagnosticInfo.class.equals(componentClazz), "Variant cannot contain DiagnosticInfo");
}
this.value = value;
}
public Optional<NodeId> getDataType() {
if (value == null) return Optional.empty();
if (value instanceof UaStructure) {
return Optional.of(((UaStructure) value).getTypeId());
} else if (value instanceof UaEnumeration) {
return Optional.of(Identifiers.Int32);
} else {
Class<?> clazz = value.getClass().isArray() ?
ArrayUtil.getType(value) : value.getClass();
int typeId = TypeUtil.getBuiltinTypeId(clazz);
return typeId == -1 ?
Optional.empty() : Optional.of(new NodeId(0, typeId));
}
}
public Object getValue() {
return value;
}
public boolean isNull() {
return value == null;
}
public boolean isNotNull() {
return !isNull();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Variant variant = (Variant) o;
return Objects.deepEquals(value, variant.value);
}
@Override
public int hashCode() {
return Objects.hash(valueHash());
}
private int valueHash() {
if (value instanceof Object[]) {
return Arrays.deepHashCode((Object[]) value);
} else if (value instanceof boolean[]) {
return Arrays.hashCode((boolean[]) value);
} else if (value instanceof byte[]) {
return Arrays.hashCode((byte[]) value);
} else if (value instanceof short[]) {
return Arrays.hashCode((short[]) value);
} else if (value instanceof int[]) {
return Arrays.hashCode((int[]) value);
} else if (value instanceof long[]) {
return Arrays.hashCode((long[]) value);
} else if (value instanceof float[]) {
return Arrays.hashCode((float[]) value);
} else if (value instanceof double[]) {
return Arrays.hashCode((double[]) value);
} else {
return Objects.hashCode(value);
}
}
@Override
public String toString() {
ToStringHelper helper = MoreObjects.toStringHelper(this);
helper.add("value", value);
return helper.toString();
}
}
| {
"content_hash": "8648daff3a9259461e819988b1550a64",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 115,
"avg_line_length": 31.25409836065574,
"alnum_prop": 0.6228691319171257,
"repo_name": "digitalpetri/opc-ua-stack",
"id": "940d6917d6de82a05b2e751f19c69d0e506a64b0",
"size": "4408",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "stack-core/src/main/java/com/digitalpetri/opcua/stack/core/types/builtin/Variant.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2325879"
}
],
"symlink_target": ""
} |
/*
Poll Pipeline resources
After creating Pipeline resources or making changes to them, you will need to
wait for the system to realize those changes. You can use polling methods to
check the resources reach the desired state.
The WaitFor* functions use the kubernetes
wait package (https://godoc.org/k8s.io/apimachinery/pkg/util/wait). To poll
they use
PollImmediate (https://godoc.org/k8s.io/apimachinery/pkg/util/wait#PollImmediate)
and the return values of the function you provide behave the same as
ConditionFunc (https://godoc.org/k8s.io/apimachinery/pkg/util/wait#ConditionFunc):
a boolean to indicate if the function should stop or continue polling, and an
error to indicate if there has been an error.
For example, you can poll a TaskRun object to wait for it to have a Status.Condition:
err = WaitForTaskRunState(c, hwTaskRunName, func(tr *v1alpha1.TaskRun) (bool, error) {
if len(tr.Status.Conditions) > 0 {
return true, nil
}
return false, nil
}, "TaskRunHasCondition")
*/
package test
import (
"context"
"fmt"
"strings"
"time"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"go.opencensus.io/trace"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
"knative.dev/pkg/apis"
)
const (
interval = 1 * time.Second
timeout = 10 * time.Minute
)
// ConditionAccessorFn is a condition function used polling functions
type ConditionAccessorFn func(ca apis.ConditionAccessor) (bool, error)
func pollImmediateWithContext(ctx context.Context, fn func() (bool, error)) error {
return wait.PollImmediate(interval, timeout, func() (bool, error) {
select {
case <-ctx.Done():
return true, ctx.Err()
default:
}
return fn()
})
}
// WaitForTaskRunState polls the status of the TaskRun called name from client every
// interval until inState returns `true` indicating it is done, returns an
// error or timeout. desc will be used to name the metric that is emitted to
// track how long it took for name to get into the state checked by inState.
func WaitForTaskRunState(ctx context.Context, c *clients, name string, inState ConditionAccessorFn, desc string) error {
metricName := fmt.Sprintf("WaitForTaskRunState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
defer span.End()
return pollImmediateWithContext(ctx, func() (bool, error) {
r, err := c.V1beta1TaskRunClient.Get(ctx, name, metav1.GetOptions{})
if err != nil {
return true, err
}
return inState(&r.Status)
})
}
// WaitForRunState polls the status of the Run called name from client every
// interval until inState returns `true` indicating it is done, returns an
// error or timeout. desc will be used to name the metric that is emitted to
// track how long it took for name to get into the state checked by inState.
func WaitForRunState(ctx context.Context, c *clients, name string, polltimeout time.Duration, inState ConditionAccessorFn, desc string) error {
metricName := fmt.Sprintf("WaitForRunState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
defer span.End()
ctx, cancel := context.WithTimeout(ctx, polltimeout)
defer cancel()
return pollImmediateWithContext(ctx, func() (bool, error) {
r, err := c.V1alpha1RunClient.Get(ctx, name, metav1.GetOptions{})
if err != nil {
return true, err
}
return inState(&r.Status)
})
}
// WaitForDeploymentState polls the status of the Deployment called name
// from client every interval until inState returns `true` indicating it is done,
// returns an error or timeout. desc will be used to name the metric that is emitted to
// track how long it took for name to get into the state checked by inState.
func WaitForDeploymentState(ctx context.Context, c *clients, name string, namespace string, inState func(d *appsv1.Deployment) (bool, error), desc string) error {
metricName := fmt.Sprintf("WaitForDeploymentState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
defer span.End()
return pollImmediateWithContext(ctx, func() (bool, error) {
d, err := c.KubeClient.AppsV1().Deployments(namespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return true, err
}
return inState(d)
})
}
// WaitForPodState polls the status of the Pod called name from client every
// interval until inState returns `true` indicating it is done, returns an
// error or timeout. desc will be used to name the metric that is emitted to
// track how long it took for name to get into the state checked by inState.
func WaitForPodState(ctx context.Context, c *clients, name string, namespace string, inState func(r *corev1.Pod) (bool, error), desc string) error {
metricName := fmt.Sprintf("WaitForPodState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
defer span.End()
return pollImmediateWithContext(ctx, func() (bool, error) {
r, err := c.KubeClient.CoreV1().Pods(namespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return true, err
}
return inState(r)
})
}
// WaitForPipelineRunState polls the status of the PipelineRun called name from client every
// interval until inState returns `true` indicating it is done, returns an
// error or timeout. desc will be used to name the metric that is emitted to
// track how long it took for name to get into the state checked by inState.
func WaitForPipelineRunState(ctx context.Context, c *clients, name string, polltimeout time.Duration, inState ConditionAccessorFn, desc string) error {
metricName := fmt.Sprintf("WaitForPipelineRunState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
defer span.End()
ctx, cancel := context.WithTimeout(ctx, polltimeout)
defer cancel()
return pollImmediateWithContext(ctx, func() (bool, error) {
r, err := c.V1beta1PipelineRunClient.Get(ctx, name, metav1.GetOptions{})
if err != nil {
return true, err
}
return inState(&r.Status)
})
}
// WaitForServiceExternalIPState polls the status of the a k8s Service called name from client every
// interval until an external ip is assigned indicating it is done, returns an
// error or timeout. desc will be used to name the metric that is emitted to
// track how long it took for name to get into the state checked by inState.
func WaitForServiceExternalIPState(ctx context.Context, c *clients, namespace, name string, inState func(s *corev1.Service) (bool, error), desc string) error {
metricName := fmt.Sprintf("WaitForServiceExternalIPState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
defer span.End()
return pollImmediateWithContext(ctx, func() (bool, error) {
r, err := c.KubeClient.CoreV1().Services(namespace).Get(ctx, name, metav1.GetOptions{})
if err != nil {
return true, err
}
return inState(r)
})
}
// Succeed provides a poll condition function that checks if the ConditionAccessor
// resource has successfully completed or not.
func Succeed(name string) ConditionAccessorFn {
return func(ca apis.ConditionAccessor) (bool, error) {
c := ca.GetCondition(apis.ConditionSucceeded)
if c != nil {
if c.Status == corev1.ConditionTrue {
return true, nil
} else if c.Status == corev1.ConditionFalse {
return true, fmt.Errorf("%q failed", name)
}
}
return false, nil
}
}
// Failed provides a poll condition function that checks if the ConditionAccessor
// resource has failed or not.
func Failed(name string) ConditionAccessorFn {
return func(ca apis.ConditionAccessor) (bool, error) {
c := ca.GetCondition(apis.ConditionSucceeded)
if c != nil {
if c.Status == corev1.ConditionTrue {
return true, fmt.Errorf("%q succeeded", name)
} else if c.Status == corev1.ConditionFalse {
return true, nil
}
}
return false, nil
}
}
// FailedWithReason provides a poll function that checks if the ConditionAccessor
// resource has failed with the TimeoudOut reason
func FailedWithReason(reason, name string) ConditionAccessorFn {
return func(ca apis.ConditionAccessor) (bool, error) {
c := ca.GetCondition(apis.ConditionSucceeded)
if c != nil {
if c.Status == corev1.ConditionFalse {
if c.Reason == reason {
return true, nil
}
return true, fmt.Errorf("%q completed with the wrong reason: %s (message: %s)", name, c.Reason, c.Message)
} else if c.Status == corev1.ConditionTrue {
return true, fmt.Errorf("%q completed successfully, should have been failed with reason %q", name, reason)
}
}
return false, nil
}
}
// FailedWithMessage provides a poll function that checks if the ConditionAccessor
// resource has failed with the TimeoudOut reason
func FailedWithMessage(message, name string) ConditionAccessorFn {
return func(ca apis.ConditionAccessor) (bool, error) {
c := ca.GetCondition(apis.ConditionSucceeded)
if c != nil {
if c.Status == corev1.ConditionFalse {
if strings.Contains(c.Message, message) {
return true, nil
}
return true, fmt.Errorf("%q completed with the wrong message: %s", name, c.Message)
} else if c.Status == corev1.ConditionTrue {
return true, fmt.Errorf("%q completed successfully, should have been failed with message %q", name, message)
}
}
return false, nil
}
}
// Running provides a poll condition function that checks if the ConditionAccessor
// resource is currently running.
func Running(name string) ConditionAccessorFn {
return func(ca apis.ConditionAccessor) (bool, error) {
c := ca.GetCondition(apis.ConditionSucceeded)
if c != nil {
if c.Status == corev1.ConditionTrue || c.Status == corev1.ConditionFalse {
return true, fmt.Errorf(`%q already finished`, name)
} else if c.Status == corev1.ConditionUnknown && (c.Reason == "Running" || c.Reason == "Pending") {
return true, nil
}
}
return false, nil
}
}
// TaskRunSucceed provides a poll condition function that checks if the TaskRun
// has successfully completed.
func TaskRunSucceed(name string) ConditionAccessorFn {
return Succeed(name)
}
// TaskRunFailed provides a poll condition function that checks if the TaskRun
// has failed.
func TaskRunFailed(name string) ConditionAccessorFn {
return Failed(name)
}
// PipelineRunSucceed provides a poll condition function that checks if the PipelineRun
// has successfully completed.
func PipelineRunSucceed(name string) ConditionAccessorFn {
return Succeed(name)
}
// PipelineRunFailed provides a poll condition function that checks if the PipelineRun
// has failed.
func PipelineRunFailed(name string) ConditionAccessorFn {
return Failed(name)
}
// PipelineRunPending provides a poll condition function that checks if the PipelineRun
// has been marked pending by the Tekton controller.
func PipelineRunPending(name string) ConditionAccessorFn {
running := Running(name)
return func(ca apis.ConditionAccessor) (bool, error) {
c := ca.GetCondition(apis.ConditionSucceeded)
if c != nil {
if c.Status == corev1.ConditionUnknown && c.Reason == string(v1beta1.PipelineRunReasonPending) {
return true, nil
}
}
status, err := running(ca)
if status {
reason := ""
// c _should_ never be nil if we get here, but we have this check just in case.
if c != nil {
reason = c.Reason
}
return false, fmt.Errorf("status should be %s, but it is %s", v1beta1.PipelineRunReasonPending, reason)
}
return status, err
}
}
// Chain allows multiple ConditionAccessorFns to be chained together, checking the condition of each in order.
func Chain(fns ...ConditionAccessorFn) ConditionAccessorFn {
return func(ca apis.ConditionAccessor) (bool, error) {
for _, fn := range fns {
status, err := fn(ca)
if err != nil || !status {
return status, err
}
}
return true, nil
}
}
| {
"content_hash": "9aa6920a2ab69670f213b97d79f67eaf",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 162,
"avg_line_length": 36.31384615384616,
"alnum_prop": 0.7323335027961363,
"repo_name": "tektoncd/pipeline",
"id": "ffd161b20776abbbaf70dcb04df54e43ad080577",
"size": "12366",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "test/wait.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "282"
},
{
"name": "Go",
"bytes": "5173860"
},
{
"name": "Makefile",
"bytes": "5967"
},
{
"name": "Mustache",
"bytes": "1078"
},
{
"name": "Shell",
"bytes": "36398"
},
{
"name": "Smarty",
"bytes": "3940"
}
],
"symlink_target": ""
} |
module Fog
module AWS
class IAM
class Real
require 'fog/aws/parsers/iam/list_account_aliases'
def list_account_aliases(options = {})
request({
'Action' => 'ListAccountAliases',
:parser => Fog::Parsers::AWS::IAM::ListAccountAliases.new
}.merge!(options))
end
end
end
end
end
| {
"content_hash": "c87caee1916de362e67ee907e62e2db7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.5510752688172043,
"repo_name": "NETWAYS/fog",
"id": "ce5d7ae8ffde33b59aa62ab2c40523c182ad6d8e",
"size": "372",
"binary": false,
"copies": "2",
"ref": "refs/heads/net-v1.22.0",
"path": "lib/fog/aws/requests/iam/list_account_aliases.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "8442221"
},
{
"name": "Shell",
"bytes": "562"
}
],
"symlink_target": ""
} |
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
| {
"content_hash": "c4103e9cb50bac9b0525de079a3a1f3c",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.5161290322580645,
"repo_name": "billxinli/momentum_cms",
"id": "e430150b19a27469cc972e2c1c20be1de531e83a",
"size": "473",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/assets/javascripts/momentum_cms/admin/application.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7957"
},
{
"name": "JavaScript",
"bytes": "7665"
},
{
"name": "Perl",
"bytes": "40"
},
{
"name": "Ruby",
"bytes": "176740"
}
],
"symlink_target": ""
} |
var assert = require("assert");
var Line = require("../lib/line");
describe('Line', function(){
var line = new Line([1,-2], [2, -2.5]);
it('should initialize with points', function(){
assert.deepEqual(line.p1, [1, -2]);
assert.deepEqual(line.p2, [2, -2.5]);
});
describe('#rise()', function(){
it('should return the correct rise of the given line', function(){
assert.equal(line.rise(), -0.5);
});
});
describe('#run()', function(){
it('should return the correct run of the given line', function(){
assert.equal(line.run(), 1);
});
});
describe('#slope()', function(){
it('should return the correct slope of the given line', function(){
assert.equal(line.slope(), -0.5);
});
});
describe('#yIntercept()', function(){
it('should return the correct y intercept of the given line', function(){
assert.equal(line.yIntercept(), -1.5);
});
});
describe('#isVertical()', function(){
it('should return true if the line is vertical', function(){
var vertical_line = new Line([0,0], [0, 5]);
assert.equal(vertical_line.isVertical(), true);
});
it('should return false if the line is not vertical', function(){
assert.equal(line.isVertical(), false);
});
});
describe('#isHorizontal()', function(){
it('should return true if the line is horizontal', function(){
var horizontal_line = new Line([0,1], [6, 1]);
assert.equal(horizontal_line.isHorizontal(), true);
});
it('should return false if the line is not vertical', function(){
assert.equal(line.isHorizontal(), false);
});
});
describe('#_perpendicularDistanceHasSlope()', function(){
it('should return the correct perpendicular distance of a given point from the given line with slope', function(){
assert.equal(line._perpendicularDistanceHasSlope([1,2]), 8 / Math.sqrt(5));
});
});
describe('#_perpendicularDistanceVertical()', function(){
it('should return the correct perpendicular distance of a given point from the given vertical line', function(){
var vertical_line = new Line([0,0], [0, 5]);
assert.equal(vertical_line._perpendicularDistanceVertical([3,2]), 3);
});
});
describe('#_perpendicularDistanceHorizontal()', function(){
it('should return the correct perpendicular distance of a given point from the given horizontal line', function(){
var horizontal_line = new Line([0,1], [6, 1]);
assert.equal(horizontal_line._perpendicularDistanceHorizontal([3,2]), 1);
});
});
describe('#perpendicularDistance()', function(){
it('should return the correct perpendicular distance if line has a slope', function(){
assert.equal(line.perpendicularDistance([1,2]), line._perpendicularDistanceHasSlope([1,2]));
});
it('should return the correct perpendicular distance if line is horizontal', function(){
var vertical_line = new Line([0,0], [0, 5]);
assert.equal(vertical_line.perpendicularDistance([3,2]), vertical_line._perpendicularDistanceVertical([3,2]));
});
it('should return the correct perpendicular distance if line is vertical', function(){
var horizontal_line = new Line([0,1], [6, 1]);
assert.equal(horizontal_line.perpendicularDistance([3,2]), horizontal_line._perpendicularDistanceHorizontal([3,2]));
});
});
});
| {
"content_hash": "fcf35f6e5c08a59920e56059f847b2c8",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 122,
"avg_line_length": 35.88297872340426,
"alnum_prop": 0.6445300919063148,
"repo_name": "seabre/simplify-geometry",
"id": "1053c987af4391b721652030bdd819f0a6a19fd2",
"size": "3373",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/line_test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11222"
},
{
"name": "JavaScript",
"bytes": "13731"
},
{
"name": "Makefile",
"bytes": "317"
}
],
"symlink_target": ""
} |
define(['exports', 'module'], function (exports, module) {
// Element.prototype.matches may not be available under that name
// expose polyfill as a function because we might need to apply it to an iframe
'use strict';
module.exports = polyfill;
function polyfill(root) {
if (root.Element.prototype.matches) {
return;
}
// first try to unprefix an existing implementation
'webkitMatchesSelector mozMatchesSelector msMatchesSelector'.split(' ').some(function (key) {
// NOTE: IE9 requires the Node to be part of a document, detached Nodes always return false
if (!root.Element.prototype[key]) {
return false;
}
root.Element.prototype.matches = root.Element.prototype[key];
return true;
});
}
typeof window !== 'undefined' && polyfill(window);
});
//# sourceMappingURL=element.prototype.matches.js.map | {
"content_hash": "3f40a21bb36b8010cdfb187e1bbcd48d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 97,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.6848072562358276,
"repo_name": "DNACodeStudios/ally.js",
"id": "b7115e352e33a47e0268aa821d335ecf9751094e",
"size": "882",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dist/amd/prototype/element.prototype.matches.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7365"
},
{
"name": "HTML",
"bytes": "262538"
},
{
"name": "JavaScript",
"bytes": "1024274"
}
],
"symlink_target": ""
} |
import time
from collections import defaultdict
import operator
# Below are two codes to read the file, we will be going with the non list comprehension version
def readtext(filename):
with open(filename) as f:
txtlines = [[str(s) for s in line.rstrip("\n").split(" ")] for line in f]
return txtlines
def readtext2(filename):
data = open(filename, "r")
txtlines = list()
for line in data:
line = line.rstrip("\n")
lst = [str(s) for s in line.split(" ")]
# print(lst)
txtlines.append(lst)
return txtlines
def getdictoffreqwords(listoflines):
fullwordlist = defaultdict(int)
for line in listoflines:
for word in line:
fullwordlist[word] +=1
return fullwordlist
def getreducedwordlist(worddict,minsup):
return {k:v for k,v in worddict.items() if v >= minsup}
def getpatternsgivenline(line):
linelen = len(line)
# print(linelen)
patterns = set()
for i in range(1,linelen):
for j in range(0,linelen-i+1):
patterns.add(" ".join(line[j:j+i]))
# print(patterns)
# print(len(patterns))
return(patterns)
def getpatternsforeachline(alltext):
listoflinesets = []
i = 0
for line in alltext:
listoflinesets.append(getpatternsgivenline(line))
# print(i)
i += 1
return listoflinesets
def getphrasefreq(listoflinesets):
# print(listoflinesets)
phrasedict = defaultdict(int)
for lineset in listoflinesets:
# print(lineset)
if lineset is not None:
# print("inside")
for element in lineset:
phrasedict[element] +=1
return phrasedict
def filterbyfrequency(phrasefrequencydict,minsup):
return {k:v for k,v in phrasefrequencydict.items() if v >= minsup}
def filterbywordlength(phrasefrequencydict,minlength):
return {k: v for k, v in phrasefrequencydict.items() if len(k.split(" ")) >= minlength}
def printreturnfile(inputdict,outputfile):
# inputlist.sort(key=lambda x: -x[1])
inputlist = [(k,v) for k,v in inputdict.items()]
# print(inputlist)
inputlist.sort(key=operator.itemgetter(1),reverse=True)
with open(outputfile, 'w') as the_file:
for element in inputlist:
the_file.write(str(element[1]) + ":" + element[0].replace(" ",";") + '\n')
if __name__ == "__main__":
#testing time for reading
times = time.time()
txtlines = readtext2("rawdata/yelp_reviews.txt")
# print("timetaken by longer code = ",time.time() - times)
# time taken by the list comprehension is 0.18secs
# times = time.time()
# txtlines = readtext("rawdata/yelp_reviews.txt")
# print("timetaken by shorter code = ", time.time() - times)
# time taken by normal loop is 0.15secs
# going with normal code
# print(txtlines)
worddict = getdictoffreqwords(txtlines)
# print("worddict is ",worddict )
# print("len of worddict is ", len(worddict))
# worddict = getreducedwordlist(worddict,100)
# print("reduced worddict is ", worddict)
# print("len of reduced worddict is ", len(worddict))
# Test whether single line comprehension works
# getpatternsgivenline(txtlines[0])
# Get list of sets for each line
# times = time.time()
listoflinesets = getpatternsforeachline(txtlines)
# print("Got list of line phrases in ", time.time() - times, "seconds")
# Get list of all phrases
# times = time.time()
phrasesfreq = getphrasefreq(listoflinesets)
print("number of all phrases checked:",len(phrasesfreq))
frequentphrases = filterbyfrequency(phrasesfreq,100)
# print(frequentphrases)
# print(len(frequentphrases))
frequentphrases = filterbywordlength(frequentphrases, 2)
# print(frequentphrases)
# print(len(frequentphrases))
print("Ran Algo for yelp in ", time.time() - times, "seconds")
printreturnfile(frequentphrases, "output/yelpcontiguouspatterns.txt")
| {
"content_hash": "6cd26ac6850215abb1d9d0bc756b45ec",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 96,
"avg_line_length": 32.467213114754095,
"alnum_prop": 0.6574097450138854,
"repo_name": "p10rahulm/Dmage",
"id": "28bb2d41d9b97784363d8074fcbf87069b823271",
"size": "3961",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "contiguous_patterns.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "7184"
},
{
"name": "R",
"bytes": "4642"
}
],
"symlink_target": ""
} |
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
.. _howto/operator:MySqlOperator:
MySqlOperator
=============
Use the :class:`~airflow.providers.mysql.operators.MySqlOperator` to execute
SQL commands in a `MySql <https://dev.mysql.com/doc/>`__ database.
Using the Operator
^^^^^^^^^^^^^^^^^^
Use the ``mysql_conn_id`` argument to connect to your MySql instance where
the connection metadata is structured as follows:
.. list-table:: MySql Airflow Connection Metadata
:widths: 25 25
:header-rows: 1
* - Parameter
- Input
* - Host: string
- MySql hostname
* - Schema: string
- Set schema to execute Sql operations on by default
* - Login: string
- MySql user
* - Password: string
- MySql user password
* - Port: int
- MySql port
An example usage of the MySqlOperator is as follows:
.. exampleinclude:: /../../airflow/providers/mysql/example_dags/example_mysql.py
:language: python
:start-after: [START howto_operator_mysql]
:end-before: [END howto_operator_mysql]
You can also use an external file to execute the SQL commands. Script folder must be at the same level as DAG.py file.
.. exampleinclude:: /../../airflow/providers/mysql/example_dags/example_mysql.py
:language: python
:start-after: [START howto_operator_mysql_external_file]
:end-before: [END howto_operator_mysql_external_file]
.. note::
Parameters that can be passed onto the operator will be given priority over the parameters already given
in the Airflow connection metadata (such as ``schema``, ``login``, ``password`` and so forth).
| {
"content_hash": "d9a9fd863732c39f063d74dd99cfb4d0",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 118,
"avg_line_length": 34.231884057971016,
"alnum_prop": 0.7112616426756986,
"repo_name": "bolkedebruin/airflow",
"id": "27166e503e6e4dce10a57649fb3cbd0bdf8b5326",
"size": "2362",
"binary": false,
"copies": "19",
"ref": "refs/heads/master",
"path": "docs/apache-airflow-providers-mysql/operators.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25286"
},
{
"name": "Dockerfile",
"bytes": "40459"
},
{
"name": "HCL",
"bytes": "3786"
},
{
"name": "HTML",
"bytes": "157840"
},
{
"name": "JavaScript",
"bytes": "167972"
},
{
"name": "Jinja",
"bytes": "33382"
},
{
"name": "Jupyter Notebook",
"bytes": "2933"
},
{
"name": "Mako",
"bytes": "1339"
},
{
"name": "Python",
"bytes": "19287942"
},
{
"name": "Shell",
"bytes": "645244"
},
{
"name": "TypeScript",
"bytes": "173854"
}
],
"symlink_target": ""
} |
namespace net {
class QuicServerId;
class MockCryptoClientStreamFactory : public QuicCryptoClientStreamFactory {
public:
MockCryptoClientStreamFactory();
~MockCryptoClientStreamFactory() override;
QuicCryptoClientStream* CreateQuicCryptoClientStream(
const QuicServerId& server_id,
QuicChromiumClientSession* session,
scoped_ptr<ProofVerifyContext> proof_verify_context,
QuicCryptoClientConfig* crypto_config) override;
void set_handshake_mode(
MockCryptoClientStream::HandshakeMode handshake_mode) {
handshake_mode_ = handshake_mode;
}
// The caller keeps ownership of |proof_verify_details|.
void AddProofVerifyDetails(const ProofVerifyDetails* proof_verify_details) {
proof_verify_details_queue_.push(proof_verify_details);
}
MockCryptoClientStream* last_stream() const { return last_stream_; }
private:
MockCryptoClientStream::HandshakeMode handshake_mode_;
MockCryptoClientStream* last_stream_;
std::queue<const ProofVerifyDetails*> proof_verify_details_queue_;
DISALLOW_COPY_AND_ASSIGN(MockCryptoClientStreamFactory);
};
} // namespace net
#endif // NET_QUIC_TEST_TOOLS_MOCK_CRYPTO_CLIENT_STREAM_FACTORY_H_
| {
"content_hash": "0ea75f3e7919f569f3f440ed381fb0e6",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 78,
"avg_line_length": 31.342105263157894,
"alnum_prop": 0.7716204869857263,
"repo_name": "js0701/chromium-crosswalk",
"id": "5ca04bfbaa1339a0e7a98db58c045d2a2be170b3",
"size": "1717",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "net/quic/test_tools/mock_crypto_client_stream_factory.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
title: Build Tools
---
# Build Tools
Java build tools allow you to customize your builds to do things such as specifying which files need to be included in your jar, adding dependencies from the internet, and automatically executing tasks like tests or github commits. Build tools also make it easy to modularize your projects. Popular build tools include [Gradle](https://gradle.org/) and [Maven](https://maven.apache.org/)
## Gradle
Gradle build scripts can be written in Groovy or Kotlin and are highly customizable. Most projects use the Gradle wrapper, allowing them to be built on any system, even without Gradle installed. Gradle is the recommended build tool for Android development.
## Maven
Maven build files are written with XML. Like Gradle, many plugins are written for Maven to customize your builds, however Maven is not as customizable because you cannot directly interact with a Maven API.
### More Information:
https://gradle.org/
https://en.wikipedia.org/wiki/Gradle
https://maven.apache.org/what-is-maven.html
https://en.wikipedia.org/wiki/Apache_Maven
| {
"content_hash": "a81f82e95372f8da6a4eda5b0c86bf06",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 387,
"avg_line_length": 56.78947368421053,
"alnum_prop": 0.788693234476367,
"repo_name": "otavioarc/freeCodeCamp",
"id": "1ef7c61d1f659d48f2a1555f00faa0f9f2c7e864",
"size": "1083",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "guide/english/java/build-tools/index.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "35491"
},
{
"name": "HTML",
"bytes": "17600"
},
{
"name": "JavaScript",
"bytes": "777274"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:paddingEnd="@dimen/fab_margin_ver"
android:paddingRight="@dimen/fab_margin_ver"
tools:ignore="RtlSymmetry,UnusedAttribute">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/fab_margin_hor"
android:layout_marginEnd="6dip"
android:layout_marginLeft="@dimen/fab_margin_ver"
android:layout_marginRight="6dip"
android:layout_marginStart="@dimen/fab_margin_ver"
android:layout_marginTop="@dimen/fab_margin_hor"
android:layout_weight="1">
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:fontFamily="sans-serif"
android:gravity="start"
android:singleLine="true"
android:textAlignment="viewStart"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/title_textsize"
tools:text="Title" />
<TextView
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@android:id/title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignStart="@android:id/title"
android:layout_below="@android:id/title"
android:layout_marginTop="2dp"
android:fontFamily="sans-serif"
android:gravity="start"
android:maxLines="6"
android:textAlignment="viewStart"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/content_textsize"
tools:text="Summary" />
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
<LinearLayout
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:orientation="vertical" />
<com.afollestad.cabinet.views.BorderCircleView
android:id="@+id/circle"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical|end"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout> | {
"content_hash": "069ac06b45c0da9abb709c4a5fbe8173",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 72,
"avg_line_length": 40.177215189873415,
"alnum_prop": 0.643037177063642,
"repo_name": "BioHaZard1/cabinet",
"id": "97f62c22d4313a74ac01ff3588b78bde514af595",
"size": "3174",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/preference_custom.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "2211"
},
{
"name": "Java",
"bytes": "400107"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<meta name="collection" content="api">
<!-- Generated by javadoc (build 1.5.0-rc) on Wed Aug 11 07:24:01 PDT 2004 -->
<TITLE>
DocFlavor.INPUT_STREAM (Java 2 Platform SE 5.0)
</TITLE>
<META NAME="keywords" CONTENT="javax.print.DocFlavor.INPUT_STREAM class">
<META NAME="keywords" CONTENT="TEXT_PLAIN_HOST">
<META NAME="keywords" CONTENT="TEXT_PLAIN_UTF_8">
<META NAME="keywords" CONTENT="TEXT_PLAIN_UTF_16">
<META NAME="keywords" CONTENT="TEXT_PLAIN_UTF_16BE">
<META NAME="keywords" CONTENT="TEXT_PLAIN_UTF_16LE">
<META NAME="keywords" CONTENT="TEXT_PLAIN_US_ASCII">
<META NAME="keywords" CONTENT="TEXT_HTML_HOST">
<META NAME="keywords" CONTENT="TEXT_HTML_UTF_8">
<META NAME="keywords" CONTENT="TEXT_HTML_UTF_16">
<META NAME="keywords" CONTENT="TEXT_HTML_UTF_16BE">
<META NAME="keywords" CONTENT="TEXT_HTML_UTF_16LE">
<META NAME="keywords" CONTENT="TEXT_HTML_US_ASCII">
<META NAME="keywords" CONTENT="PDF">
<META NAME="keywords" CONTENT="POSTSCRIPT">
<META NAME="keywords" CONTENT="PCL">
<META NAME="keywords" CONTENT="GIF">
<META NAME="keywords" CONTENT="JPEG">
<META NAME="keywords" CONTENT="PNG">
<META NAME="keywords" CONTENT="AUTOSENSE">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="DocFlavor.INPUT_STREAM (Java 2 Platform SE 5.0)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DocFlavor.INPUT_STREAM.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Standard Ed. 5.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../javax/print/DocFlavor.CHAR_ARRAY.html" title="class in javax.print"><B>PREV CLASS</B></A>
<A HREF="../../javax/print/DocFlavor.READER.html" title="class in javax.print"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?javax/print/DocFlavor.INPUT_STREAM.html" target="_top"><B>FRAMES</B></A>
<A HREF="DocFlavor.INPUT_STREAM.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_javax.print.DocFlavor">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#methods_inherited_from_class_javax.print.DocFlavor">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.print</FONT>
<BR>
Class DocFlavor.INPUT_STREAM</H2>
<PRE>
<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
<IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../javax/print/DocFlavor.html" title="class in javax.print">javax.print.DocFlavor</A>
<IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>javax.print.DocFlavor.INPUT_STREAM</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../java/lang/Cloneable.html" title="interface in java.lang">Cloneable</A></DD>
</DL>
<DL>
<DT><B>Enclosing class:</B><DD><A HREF="../../javax/print/DocFlavor.html" title="class in javax.print">DocFlavor</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public static class <B>DocFlavor.INPUT_STREAM</B><DT>extends <A HREF="../../javax/print/DocFlavor.html" title="class in javax.print">DocFlavor</A></DL>
</PRE>
<P>
Class DocFlavor.INPUT_STREAM provides predefined static constant
DocFlavor objects for example doc flavors using a byte stream (<A HREF="../../java/io/InputStream.html" title="class in java.io"><CODE><CODE>java.io.InputStream</CODE></CODE></A>) as the print
data representation class.
<P>
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../serialized-form.html#javax.print.DocFlavor.INPUT_STREAM">Serialized Form</A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_javax.print.DocFlavor"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class javax.print.<A HREF="../../javax/print/DocFlavor.html" title="class in javax.print">DocFlavor</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../javax/print/DocFlavor.BYTE_ARRAY.html" title="class in javax.print">DocFlavor.BYTE_ARRAY</A>, <A HREF="../../javax/print/DocFlavor.CHAR_ARRAY.html" title="class in javax.print">DocFlavor.CHAR_ARRAY</A>, <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A>, <A HREF="../../javax/print/DocFlavor.READER.html" title="class in javax.print">DocFlavor.READER</A>, <A HREF="../../javax/print/DocFlavor.SERVICE_FORMATTED.html" title="class in javax.print">DocFlavor.SERVICE_FORMATTED</A>, <A HREF="../../javax/print/DocFlavor.STRING.html" title="class in javax.print">DocFlavor.STRING</A>, <A HREF="../../javax/print/DocFlavor.URL.html" title="class in javax.print">DocFlavor.URL</A></CODE></TD>
</TR>
</TABLE>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#AUTOSENSE">AUTOSENSE</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"application/octet-stream"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#GIF">GIF</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"image/gif"</CODE>, print data
representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#JPEG">JPEG</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"image/jpeg"</CODE>, print data
representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#PCL">PCL</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"application/vnd.hp-PCL"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#PDF">PDF</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"application/pdf"</CODE>, print
data representation class name = <CODE>"java.io.InputStream"</CODE>
(byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#PNG">PNG</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"image/png"</CODE>, print data
representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#POSTSCRIPT">POSTSCRIPT</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"application/postscript"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_HTML_HOST">TEXT_HTML_HOST</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"text/html"</CODE>,
encoded in the host platform encoding.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_HTML_US_ASCII">TEXT_HTML_US_ASCII</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/html; charset=us-ascii"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_HTML_UTF_16">TEXT_HTML_UTF_16</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/html; charset=utf-16"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_HTML_UTF_16BE">TEXT_HTML_UTF_16BE</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/html; charset=utf-16be"</CODE>
(big-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_HTML_UTF_16LE">TEXT_HTML_UTF_16LE</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/html; charset=utf-16le"</CODE>
(little-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_HTML_UTF_8">TEXT_HTML_UTF_8</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/html; charset=utf-8"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_PLAIN_HOST">TEXT_PLAIN_HOST</A></B></CODE>
<BR>
Doc flavor with MIME type = <CODE>"text/plain"</CODE>,
encoded in the host platform encoding.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_PLAIN_US_ASCII">TEXT_PLAIN_US_ASCII</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/plain; charset=us-ascii"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_PLAIN_UTF_16">TEXT_PLAIN_UTF_16</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-16"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_PLAIN_UTF_16BE">TEXT_PLAIN_UTF_16BE</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-16be"</CODE>
(big-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_PLAIN_UTF_16LE">TEXT_PLAIN_UTF_16LE</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-16le"</CODE>
(little-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#TEXT_PLAIN_UTF_8">TEXT_PLAIN_UTF_8</A></B></CODE>
<BR>
Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-8"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_javax.print.DocFlavor"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class javax.print.<A HREF="../../javax/print/DocFlavor.html" title="class in javax.print">DocFlavor</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../javax/print/DocFlavor.html#hostEncoding">hostEncoding</A></CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html#DocFlavor.INPUT_STREAM(java.lang.String)">DocFlavor.INPUT_STREAM</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> mimeType)</CODE>
<BR>
Constructs a new doc flavor with the given MIME type and a print
data representation class name of
<CODE>"java.io.InputStream"</CODE> (byte stream).</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.print.DocFlavor"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class javax.print.<A HREF="../../javax/print/DocFlavor.html" title="class in javax.print">DocFlavor</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../javax/print/DocFlavor.html#equals(java.lang.Object)">equals</A>, <A HREF="../../javax/print/DocFlavor.html#getMediaSubtype()">getMediaSubtype</A>, <A HREF="../../javax/print/DocFlavor.html#getMediaType()">getMediaType</A>, <A HREF="../../javax/print/DocFlavor.html#getMimeType()">getMimeType</A>, <A HREF="../../javax/print/DocFlavor.html#getParameter(java.lang.String)">getParameter</A>, <A HREF="../../javax/print/DocFlavor.html#getRepresentationClassName()">getRepresentationClassName</A>, <A HREF="../../javax/print/DocFlavor.html#hashCode()">hashCode</A>, <A HREF="../../javax/print/DocFlavor.html#toString()">toString</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="TEXT_PLAIN_HOST"><!-- --></A><H3>
TEXT_PLAIN_HOST</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_PLAIN_HOST</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"text/plain"</CODE>,
encoded in the host platform encoding.
See <A HREF="../../javax/print/DocFlavor.html#hostEncoding"><CODE><CODE>hostEncoding</CODE></CODE></A>
Print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_PLAIN_UTF_8"><!-- --></A><H3>
TEXT_PLAIN_UTF_8</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_PLAIN_UTF_8</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-8"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_PLAIN_UTF_16"><!-- --></A><H3>
TEXT_PLAIN_UTF_16</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_PLAIN_UTF_16</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-16"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_PLAIN_UTF_16BE"><!-- --></A><H3>
TEXT_PLAIN_UTF_16BE</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_PLAIN_UTF_16BE</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-16be"</CODE>
(big-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_PLAIN_UTF_16LE"><!-- --></A><H3>
TEXT_PLAIN_UTF_16LE</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_PLAIN_UTF_16LE</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/plain; charset=utf-16le"</CODE>
(little-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_PLAIN_US_ASCII"><!-- --></A><H3>
TEXT_PLAIN_US_ASCII</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_PLAIN_US_ASCII</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/plain; charset=us-ascii"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_HTML_HOST"><!-- --></A><H3>
TEXT_HTML_HOST</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_HTML_HOST</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"text/html"</CODE>,
encoded in the host platform encoding.
See <A HREF="../../javax/print/DocFlavor.html#hostEncoding"><CODE><CODE>hostEncoding</CODE></CODE></A>
Print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_HTML_UTF_8"><!-- --></A><H3>
TEXT_HTML_UTF_8</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_HTML_UTF_8</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/html; charset=utf-8"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_HTML_UTF_16"><!-- --></A><H3>
TEXT_HTML_UTF_16</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_HTML_UTF_16</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/html; charset=utf-16"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_HTML_UTF_16BE"><!-- --></A><H3>
TEXT_HTML_UTF_16BE</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_HTML_UTF_16BE</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/html; charset=utf-16be"</CODE>
(big-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_HTML_UTF_16LE"><!-- --></A><H3>
TEXT_HTML_UTF_16LE</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_HTML_UTF_16LE</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/html; charset=utf-16le"</CODE>
(little-endian byte ordering),
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="TEXT_HTML_US_ASCII"><!-- --></A><H3>
TEXT_HTML_US_ASCII</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>TEXT_HTML_US_ASCII</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"text/html; charset=us-ascii"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="PDF"><!-- --></A><H3>
PDF</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>PDF</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"application/pdf"</CODE>, print
data representation class name = <CODE>"java.io.InputStream"</CODE>
(byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="POSTSCRIPT"><!-- --></A><H3>
POSTSCRIPT</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>POSTSCRIPT</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"application/postscript"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="PCL"><!-- --></A><H3>
PCL</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>PCL</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"application/vnd.hp-PCL"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="GIF"><!-- --></A><H3>
GIF</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>GIF</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"image/gif"</CODE>, print data
representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="JPEG"><!-- --></A><H3>
JPEG</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>JPEG</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"image/jpeg"</CODE>, print data
representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="PNG"><!-- --></A><H3>
PNG</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>PNG</B></PRE>
<DL>
<DD>Doc flavor with MIME type = <CODE>"image/png"</CODE>, print data
representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="AUTOSENSE"><!-- --></A><H3>
AUTOSENSE</H3>
<PRE>
public static final <A HREF="../../javax/print/DocFlavor.INPUT_STREAM.html" title="class in javax.print">DocFlavor.INPUT_STREAM</A> <B>AUTOSENSE</B></PRE>
<DL>
<DD>Doc flavor with MIME type =
<CODE>"application/octet-stream"</CODE>,
print data representation class name =
<CODE>"java.io.InputStream"</CODE> (byte stream).
The client must determine that data described
using this DocFlavor is valid for the printer.
<P>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="DocFlavor.INPUT_STREAM(java.lang.String)"><!-- --></A><H3>
DocFlavor.INPUT_STREAM</H3>
<PRE>
public <B>DocFlavor.INPUT_STREAM</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A> mimeType)</PRE>
<DL>
<DD>Constructs a new doc flavor with the given MIME type and a print
data representation class name of
<CODE>"java.io.InputStream"</CODE> (byte stream).
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>mimeType</CODE> - MIME media type string.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../java/lang/NullPointerException.html" title="class in java.lang">NullPointerException</A></CODE> - (unchecked exception) Thrown if <CODE>mimeType</CODE> is null.
<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - (unchecked exception) Thrown if <CODE>mimeType</CODE> does not
obey the syntax for a MIME media type string.</DL>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DocFlavor.INPUT_STREAM.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Standard Ed. 5.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../javax/print/DocFlavor.CHAR_ARRAY.html" title="class in javax.print"><B>PREV CLASS</B></A>
<A HREF="../../javax/print/DocFlavor.READER.html" title="class in javax.print"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?javax/print/DocFlavor.INPUT_STREAM.html" target="_top"><B>FRAMES</B></A>
<A HREF="DocFlavor.INPUT_STREAM.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_javax.print.DocFlavor">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#methods_inherited_from_class_javax.print.DocFlavor">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="../../../relnotes/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to <a href="../../../relnotes/license.html">license terms</a>. Also see the <a href="http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font>
<!-- Start SiteCatalyst code -->
<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code_download.js"></script>
<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code.js"></script>
<!-- ********** DO NOT ALTER ANYTHING BELOW THIS LINE ! *********** -->
<!-- Below code will send the info to Omniture server -->
<script language="javascript">var s_code=s.t();if(s_code)document.write(s_code)</script>
<!-- End SiteCatalyst code -->
</body>
</HTML>
| {
"content_hash": "251919592774cb9c5b8961fab464ad18",
"timestamp": "",
"source": "github",
"line_count": 823,
"max_line_length": 771,
"avg_line_length": 45.83232077764277,
"alnum_prop": 0.6691145281018027,
"repo_name": "Smolations/more-dash-docsets",
"id": "4a2a9efd400ff834d950ec11f6a35aff440dd83f",
"size": "37720",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docsets/Java 5.docset/Contents/Resources/Documents/javax/print/DocFlavor.INPUT_STREAM.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1456655"
},
{
"name": "Emacs Lisp",
"bytes": "3680"
},
{
"name": "JavaScript",
"bytes": "139712"
},
{
"name": "Puppet",
"bytes": "15851"
},
{
"name": "Ruby",
"bytes": "66500"
},
{
"name": "Shell",
"bytes": "11437"
}
],
"symlink_target": ""
} |
module.exports = function (grunt) {
var _type = grunt.option('type');
console.log(_type)
var cacheBustConst = '-' + new Date().getTime();
var jsFiles=[];
var cssFiles=[];
if(_type==='widgets'){
//Below js and css set of files will be used to minify widgets only sdk
jsFiles=[
'libs/kore-no-conflict-start.js',
'libs/jquery.js',
'libs/jquery.tmpl.min.js',
'libs/jquery-ui.min.js',
'../libs/jstz.js',
'../libs/perfect-scrollbar.js',
'kore-widgets.js',
'kore-widgets-config.js',
'kore-widgets-main.js',
'../libs/ie11CustomProperties.js',
'libs/kore-no-conflict-end.js'
];
cssFiles=[
'libs/jquery-ui.min.css',
'../libs/prefect-scrollbar.css',
'kore-widgets.css'
]
}else if(_type==='widgets_chat'){
//Below js and css set of files will be used to minify Widgets with chat window sdk
jsFiles=[
'libs/kore-no-conflict-start.js',
'libs/jquery.js',
'libs/jquery.tmpl.min.js',
'libs/jquery-ui.min.js',
'../libs/lodash.min.js',
'../libs/d3.v4.min.js',
'../libs/KoreGraphAdapter.js',
'../libs/anonymousassertion.js',
'../kore-bot-sdk-client.js',
'../libs/perfect-scrollbar.js',
'kore-widgets.js',
'chatWindow.js',
'../libs/emoji.js',
'../libs/recorder.js',
'../libs/recorderWorker.js',
'../libs/purejscarousel.js',
'custom/customTemplate.js',
'../libs/ie11CustomProperties.js',
'../libs/speech/app.js',
'../libs/speech/key.js',
'../libs/client_api.js',
'kore-config.js',
'kore-widgets-config.js',
'kore-widgets-chat-main.js',
'libs/kore-no-conflict-end.js'
];
cssFiles=[
'libs/jquery-ui.min.css',
'libs/emojione.sprites.css',
'../libs/purejscarousel.css',
'chatWindow.css',
'custom/customTemplate.css',
'../libs/prefect-scrollbar.css',
'kore-widgets.css'
]
}else{
//Below js and css set of files will be used to minify chatwindow sdk
jsFiles=[
'libs/kore-no-conflict-start.js',
'libs/jquery.js',
'libs/jquery.tmpl.min.js',
'libs/jquery-ui.min.js',
'../libs/lodash.min.js',
'../libs/d3.v4.min.js',
'../libs/KoreGraphAdapter.js',
'../libs/anonymousassertion.js',
'../kore-bot-sdk-client.js',
'../libs/perfect-scrollbar.js',
'../libs/emoji.js',
'../libs/purejscarousel.js',
'chatWindow.js',
'custom/customTemplate.js',
'../libs/ie11CustomProperties.js',
'../libs/recorder.js',
'../libs/recorderWorker.js',
'../libs/speech/app.js',
'../libs/speech/key.js',
'../libs/client_api.js',
'kore-config.js',
'kore-main.js',
'libs/kore-no-conflict-end.js'
];
cssFiles=[
'libs/jquery-ui.min.css',
'libs/emojione.sprites.css',
'../libs/purejscarousel.css',
'../libs/prefect-scrollbar.css',
'chatWindow.css',
'custom/customTemplate.css'
]
}
// Project configuration.
grunt.initConfig({
//uglify task definition
uglify: {
options:{
maxLineLen:320000000000000
},
js: {
src: jsFiles,
dest: 'dist/kore-ai-sdk' + '.min.js'
}
},
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'dist/kore-ai-sdk.min.css':cssFiles
}
}
},
//clean task definition
clean: {
dist: {
options: {
force: true
},
src: ['dist']
}
},
});
// Load the plugin that provides the "clean" task.
grunt.loadNpmTasks('grunt-contrib-clean');
// Load the plugin that provides the "concat" task.
grunt.loadNpmTasks('grunt-contrib-concat');
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
// the default task can be run just by typing "grunt" on the command line
grunt.registerTask('default', ['clean', 'uglify','cssmin']);
}; | {
"content_hash": "045da783f573e5ac124d92fd5e4a5be7",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 93,
"avg_line_length": 31.272151898734176,
"alnum_prop": 0.4820886460230723,
"repo_name": "Koredotcom/web-kore-sdk",
"id": "7651d626b6e964ea13cf49f0a64e5748f7ac685d",
"size": "4941",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "UI/gruntFile.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "667489"
},
{
"name": "HTML",
"bytes": "12607"
},
{
"name": "JavaScript",
"bytes": "2892304"
}
],
"symlink_target": ""
} |
+++
Talk_date = ""
Talk_start_time = ""
Talk_end_time = ""
Title = "Estratégias de deployment utilizando somente o Kubernetes"
Type = "talk"
Speakers = ["jeferson-fernando"]
youtube = ""
slideshare = ""
slides = ""
+++
Durante o talk vamos abordar de maneira prática as diversas estratégias de deployment utilizando somente o Kubernetes. Vamos falar sobre Canary Deployment, A/B Deployment, Ramped e muito mais! A ideia é mostrar que é totalmente possível utilizar diferentes técnicas de deployment, mesmo sem utilizar algum service mesh como o Istio.
| {
"content_hash": "df2e228e397123bb0499c30ce9a7c486",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 332,
"avg_line_length": 42.53846153846154,
"alnum_prop": 0.7576853526220615,
"repo_name": "gomex/devopsdays-web",
"id": "f0f347aa337baed4962f1bb8f3f7404246c69250",
"size": "560",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "content/events/2019-salvador/program/jeferson-fernando.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1568"
},
{
"name": "HTML",
"bytes": "1937025"
},
{
"name": "JavaScript",
"bytes": "14313"
},
{
"name": "PowerShell",
"bytes": "291"
},
{
"name": "Ruby",
"bytes": "650"
},
{
"name": "Shell",
"bytes": "12282"
}
],
"symlink_target": ""
} |
angular.module('Mivir.ApiORM').service('ApiORM.repository', [
'$injector', '$q', 'ApiORM.relationships',
function($injector, $q, relationships) {
/**
* Tracks the number of loaded relationships
*/
var Tracker = function() {
this.loaded = 0;
this.listeners = [];
};
Tracker.prototype.addLoaded = function() {
this.loaded++;
for (var i = 0; i < this.listeners.length; i++) {
this.listeners[i](this.loaded);
}
};
Tracker.prototype.onAdd = function(cb) {
this.listeners.push(cb);
};
/**
* A base repository
*/
var Repository = function() {
this.pendingRelations = [];
// If this is enabled, the original repository result will be returned before fetching the relations, which are then fetched after
this.loadRelationsOnSide = false;
// If we're loading the relations on the side, we can also add promises for each item's immediate relationships.
// When enabled, each object will have the following properties:
// $relationPromises {object} Contains promises for each relation, indexed by the relation's "root" (e.g. 'test' in 'test.nested.deep')
// $relationStatus {object} Contains a boolean status for each relation, easy to use in Angular templates
this.trackRelationLoading = false;
// Used for tracking the number of relationships loaded so far.
// Is NOT affected by this.trackRelationLoading.
this.tracker = null;
this.onFinishListeners = [];
};
/**
* UTILITY FUNCTIONS
*/
Repository.prototype._applyToClone = function(cb) {
var clone = angular.copy(this);
cb(clone);
return clone;
};
/**
* RELATIONSHIPS
*/
Repository.prototype._hasOne = function(params) {
return new relationships.HasOne(params);
};
Repository.prototype._belongsTo = function(params) {
return new relationships.BelongsTo(params);
};
Repository.prototype._hasMany = function(params) {
return new relationships.HasMany(params);
};
Repository.prototype._manyToMany = function(params) {
return new relationships.ManyToMany(params);
};
Repository.prototype.with = function() {
var args = Array.prototype.slice.call(arguments);
if (angular.isArray(args[0])) args = args[0];
return this._applyToClone(function(clone) {
clone.pendingRelations = clone.pendingRelations.concat(args);
});
};
Repository.prototype.track = function(tracker) {
return this._applyToClone(function(clone) {
clone.tracker = tracker;
});
};
Repository.prototype.onFinish = function(cb) {
return this._applyToClone(function(clone) {
clone.onFinishListeners.push(cb);
});
};
Repository.prototype._handleResult = function(result) {
var deferred = $q.defer(),
self = this;
var isArray = angular.isArray(result);
if (! isArray) result = [result];
this._fetchRelations(result).then(function(result) {
if (isArray) {
deferred.resolve(result);
} else {
deferred.resolve(result[0]);
}
});
if (this.loadRelationsOnSide) {
// When loading relations on the side, return the result before fetching the relations
if (isArray) {
return result;
} else {
return result[0];
}
} else {
// Otherwise return the promise that will resolve once all relations are loaded
return deferred.promise;
}
};
Repository.prototype._fetchRelations = function(collection) {
var self = this,
deferred = $q.defer(),
promises = [], // Used to find out when all of the immediate/root relations have been loaded
relationsWithNested = {}, // Relations split to a "root" key (the first part of the relation) and the value that contains the rest
// Used for marking specific relations as "loaded", see this.trackRelationLoading
relationDeferred = {},
relationPromises = {},
relationStatus = {},
// How many relations need to be loaded before firing onFinish callbacks
// In contrast to above, this also takes into account nested (non-immediate) relations and doesn't get marked on specific objects.
trackLimit = 0,
uniqueRelationPaths,
path,
i, len,
loadRelation,
parts, root;
// Start with an empty tracker if we don't have one yet (we would have one if we're passed one by a relationship)
// This tracks the number of relations loaded and fires onFinish listeners when done.
if (! this.tracker) {
this.tracker = new Tracker();
this.tracker.onAdd(function(loaded) {
// Once every relation has loaded, call the onFinish listeners
if (loaded >= trackLimit) {
for (i = 0; i < self.onFinishListeners.length; i++) {
self.onFinishListeners[i]();
}
}
});
}
// Gather all nested relations of a single "root relation" together.
// This helps later on when we need to pass the nested relationships onward.
relationsWithNested = this._getRelationsWithNested(this.pendingRelations);
// Find unique relation paths and add their amount to the track limit.
// This is to find out the total number of relations that need to be fetched, taking into account shared parts in some of the relations.
uniqueRelationPaths = this._getUniqueRelationPaths(this.pendingRelations);
for (path in uniqueRelationPaths) {
trackLimit++;
}
// If "track relation loading" is set, attach promises on each of the items for each immediate/root relationship
if (this.trackRelationLoading) {
// Set up promises for each root relationship
for (root in relationsWithNested) {
if (! relationsWithNested.hasOwnProperty(root)) continue;
relationDeferred[root] = $q.defer();
relationPromises[root] = relationDeferred[root].promise;
relationStatus[root] = false;
}
// Add those promises to a special property on each member in the collection
for (i = 0, len = collection.length; i < len; i++) {
if (typeof collection[i] !== 'object' || collection[i] === null) continue;
collection[i]['$relationPromises'] = relationPromises;
collection[i]['$relationStatus'] = relationStatus;
}
}
var loadRelation = function(root, nested) {
if (typeof self[root] !== "function") {
throw new Error("Relationship '" + root + "' not found.");
}
var relationPromise = self[root]().fetchRelations(collection, root, nested, self.tracker),
i, len;
if (self.trackRelationLoading) {
// Mark this relation as loaded for each member in the collection
relationPromise.then(function() {
relationDeferred[root].resolve();
relationStatus[root] = true;
});
}
// Add one to the "loaded" counter
relationPromise.then(function() {
self.tracker.addLoaded();
});
return relationPromise;
};
// Fire the requests for the relations concurrently
for (root in relationsWithNested) {
promises.push(loadRelation(root, relationsWithNested[root]));
}
$q.all(promises).then(function() {
deferred.resolve(collection);
});
return deferred.promise;
};
/**
* Formats the given relations into an object with each relation's root (= immediate relation) as the key
* and the rest of the relation path as a string value.
* @param {array} relations The relations to format
* @return {object} The new object
*/
Repository.prototype._getRelationsWithNested = function(relations) {
var relationsWithNested = {};
for (i = 0, len = relations.length; i < len; i++) {
parts = relations[i].split('.');
root = parts.shift();
if (! relationsWithNested[root]) relationsWithNested[root] = [];
if (parts.length > 0) relationsWithNested[root].push(parts.join('.'));
}
return relationsWithNested;
};
/**
* Finds the unique relation paths in the given relations.
* E.g., for root.nest1.nest2, unique paths would be 'root', 'root.nest1' and 'root.nest1.nest2'
* @param {array} relations The relations to find the paths in
* @return {array} An array of unique relation paths
*/
Repository.prototype._getUniqueRelationPaths = function(relations) {
var uniquePaths = {},
uniquePathArray = [],
path, pathParts, curPath, pathPartIndex;
for (i = 0; i < relations.length; i++) {
path = relations[i];
pathParts = path.split('.');
curPath = pathParts.shift();
uniquePaths[curPath] = true;
for (pathPartIndex = 0; pathPartIndex < pathParts.length; pathPartIndex++) {
curPath += '.' + pathParts[pathPartIndex];
uniquePaths[curPath] = true;
}
}
for (path in uniquePaths) {
uniquePathArray.push(path);
}
return uniquePathArray;
};
return Repository;
}
]); | {
"content_hash": "f6e119a412aa81fee0be7b54421041a8",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 139,
"avg_line_length": 31.33812949640288,
"alnum_prop": 0.6659779614325069,
"repo_name": "Dragory/angular-api-orm",
"id": "d45b947233a686d68c5a981af318bc33780b2a31",
"size": "8712",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/repository.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "50441"
}
],
"symlink_target": ""
} |
500 Error, Oops we made a boo boo.
| {
"content_hash": "b5fae0a2aa62ae50c2c1f1677f6f06cf",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 34,
"avg_line_length": 35,
"alnum_prop": 0.7142857142857143,
"repo_name": "pizzapanther/Neutron-IDE",
"id": "67947ee86934c517809fd9dc27a476a46ac4a202",
"size": "35",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "neutron/ide/templates/500.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "5422"
},
{
"name": "C#",
"bytes": "166"
},
{
"name": "C++",
"bytes": "386"
},
{
"name": "Clojure",
"bytes": "1588"
},
{
"name": "CoffeeScript",
"bytes": "806"
},
{
"name": "ColdFusion",
"bytes": "172"
},
{
"name": "Go",
"bytes": "641"
},
{
"name": "Groovy",
"bytes": "1531"
},
{
"name": "Haxe",
"bytes": "894"
},
{
"name": "Java",
"bytes": "792"
},
{
"name": "JavaScript",
"bytes": "23062144"
},
{
"name": "Lua",
"bytes": "1918"
},
{
"name": "OCaml",
"bytes": "1078"
},
{
"name": "Objective-C",
"bytes": "6117"
},
{
"name": "PHP",
"bytes": "3498"
},
{
"name": "Perl",
"bytes": "32978"
},
{
"name": "PowerShell",
"bytes": "836"
},
{
"name": "Python",
"bytes": "215279"
},
{
"name": "Ruby",
"bytes": "3002"
},
{
"name": "Scala",
"bytes": "1919"
},
{
"name": "Shell",
"bytes": "1142"
},
{
"name": "XQuery",
"bytes": "114"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ConexiónSQL;
using System.Data.SqlClient;
namespace Grupos
{
public partial class BallenasDePoblacione : UserControl, Interfacecita
{
public BallenasDePoblacione()
{
InitializeComponent();
}
private void BallenasDePoblacione_Load(object sender, EventArgs e)
{
Poblacion poblacion=Delegados.ePoblacion();
DataTable dt = ParaConectar.Consultar("TRB_MUESTRAS", poblacion.id.ToString(), "ID_POBLACION");
dgv_Ballenas.DataSource = dt;
dgv_Ballenas.Columns["ID_ESPECIE"].Visible = false;
dgv_Ballenas.Columns["ID_POBLACION"].Visible = false;
dgv_Ballenas.Columns["ID_EVIDA"].Visible = false;
dgv_Ballenas.Columns["ULT_ACT"].Visible = false;
dgv_Ballenas.Columns["ID"].Visible = false;
dgv_Ballenas.Columns["SEXO"].Visible = false;
dgv_Ballenas.Columns.Add("sexoE", "GENERO");
dgv_Ballenas.Columns.Add("etapa", "ETAPA");
Delegados.llenarConEntero(dgv_Ballenas.RowCount - 1);
}
private void btn_Agregar_Click(object sender, EventArgs e)
{
Delegados.UserControlSiguiente = delegate {return new Agregar_Ballena(); };
Delegados.pequeñaAccion();
}
private void BallenasDePoblacione_Enter(object sender, EventArgs e)
{
int registros = dgv_Ballenas.RowCount - 1;
for (int i = 0; i < registros; i++)
{
int etapa = (int)dgv_Ballenas["ID_EVIDA", i].Value;
switch (etapa)
{
case 1:
dgv_Ballenas["etapa", i].Value = "Cria";
break;
case 4:
dgv_Ballenas["etapa", i].Value = "Juvenil";
break;
case 5:
dgv_Ballenas["etapa", i].Value = "Reproductor";
break;
}
bool s = (bool)dgv_Ballenas["SEXO", i].Value;
if (s)
dgv_Ballenas["sexoE", i].Value = "Hembra";
else
dgv_Ballenas["sexoE", i].Value = "Macho";
}
}
}
}
| {
"content_hash": "257936eb769e41467d38b73a942dd0b3",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 107,
"avg_line_length": 30.71604938271605,
"alnum_prop": 0.5321543408360129,
"repo_name": "Ookamigmr/Proyecto-ballenas",
"id": "e8c08c9f0ecaa965d2935146b833f7c06b2b0f10",
"size": "2492",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ProyectoFinal Base de datos en linea/Investigacion/Investigacion/BallenasDePoblacione.cs",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
@interface ODSearchViewController : ODHomeViewController
@end
| {
"content_hash": "a5f8498211aaf90dfdf41fcdb5220482",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 56,
"avg_line_length": 21,
"alnum_prop": 0.8571428571428571,
"repo_name": "xispower/ODVideoForLive",
"id": "02fb541ea0476ca10039bada5ffc8333a69909ee",
"size": "236",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "odvideoforlive/Classes/Search/ODSearchViewController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1079203"
},
{
"name": "Objective-C",
"bytes": "429340"
},
{
"name": "Ragel",
"bytes": "128173"
},
{
"name": "Ruby",
"bytes": "170"
}
],
"symlink_target": ""
} |
package betterwithmods.common.blocks;
import betterwithmods.client.BWCreativeTabs;
import betterwithmods.common.world.gen.feature.WorldGenBloodTree;
import betterwithmods.util.DirUtils;
import com.google.common.collect.Lists;
import net.minecraft.block.BlockLog;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
public class BlockBloodLog extends BlockLog {
public static final PropertyBool EXPANDABLE = PropertyBool.create("expandable");
public BlockBloodLog() {
this.setDefaultState(this.blockState.getBaseState().withProperty(LOG_AXIS, EnumAxis.Y).withProperty(EXPANDABLE, false));
this.setTickRandomly(true);
this.setCreativeTab(BWCreativeTabs.BWTAB);
this.setSoundType(SoundType.SLIME);
}
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
world.playSound(null, pos, SoundEvents.ENTITY_GHAST_HURT, SoundCategory.BLOCKS, 1f,0.2f);
return super.removedByPlayer(state, world, pos, player, willHarvest);
}
@Override
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing facing) {
return false;
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if (!world.isRemote && world.provider.isNether() && state.getValue(EXPANDABLE)) {
for (EnumFacing face : DirUtils.NOT_DOWN) {
if (rand.nextInt(20) == 0)
expandTree(world, pos, face);
}
}
}
private void expandTree(World world, BlockPos pos, EnumFacing facing) {
WorldGenBloodTree tree = new WorldGenBloodTree();
tree.generateBranch(world, pos, facing);
}
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState state = this.getDefaultState().withProperty(EXPANDABLE, (meta & 3) % 4 == 1);
switch (meta & 12)
{
case 0:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case 4:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case 8:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
return state;
}
@Override
public int getMetaFromState(IBlockState state) {
int meta = state.getValue(EXPANDABLE) ? 1 : 0;
switch (state.getValue(LOG_AXIS))
{
case X:
meta |= 4;
break;
case Z:
meta |= 8;
break;
case NONE:
meta |= 12;
}
return meta;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, EXPANDABLE, LOG_AXIS);
}
}
| {
"content_hash": "09fcadd91f436d9ad07ddd0d943408ea",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 128,
"avg_line_length": 34.372549019607845,
"alnum_prop": 0.6534512264689104,
"repo_name": "BetterWithMods/BetterWithMods",
"id": "6e9b00109b76e8507952eda7dd8c3c8eb9c31dc1",
"size": "3506",
"binary": false,
"copies": "2",
"ref": "refs/heads/1.12",
"path": "src/main/java/betterwithmods/common/blocks/BlockBloodLog.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "2460129"
}
],
"symlink_target": ""
} |
namespace blink {
struct TestCase {
const char* baseURL;
const char* inputHTML;
const char* preloadedURL; // Or nullptr if no preload is expected.
const char* outputBaseURL;
Resource::Type type;
int resourceWidth;
ClientHintsPreferences preferences;
};
struct PreconnectTestCase {
const char* baseURL;
const char* inputHTML;
const char* preconnectedHost;
CrossOriginAttributeValue crossOrigin;
};
struct ReferrerPolicyTestCase {
const char* baseURL;
const char* inputHTML;
const char* preloadedURL; // Or nullptr if no preload is expected.
const char* outputBaseURL;
Resource::Type type;
int resourceWidth;
ReferrerPolicy referrerPolicy;
};
class MockHTMLResourcePreloader : public ResourcePreloader {
public:
void preloadRequestVerification(Resource::Type type, const char* url, const char* baseURL, int width, const ClientHintsPreferences& preferences)
{
if (!url) {
EXPECT_FALSE(m_preloadRequest);
return;
}
ASSERT(m_preloadRequest.get());
EXPECT_FALSE(m_preloadRequest->isPreconnect());
EXPECT_EQ(type, m_preloadRequest->resourceType());
EXPECT_STREQ(url, m_preloadRequest->resourceURL().ascii().data());
EXPECT_STREQ(baseURL, m_preloadRequest->baseURL().string().ascii().data());
EXPECT_EQ(width, m_preloadRequest->resourceWidth());
EXPECT_EQ(preferences.shouldSendDPR(), m_preloadRequest->preferences().shouldSendDPR());
EXPECT_EQ(preferences.shouldSendResourceWidth(), m_preloadRequest->preferences().shouldSendResourceWidth());
EXPECT_EQ(preferences.shouldSendViewportWidth(), m_preloadRequest->preferences().shouldSendViewportWidth());
}
void preloadRequestVerification(Resource::Type type, const char* url, const char* baseURL, int width, ReferrerPolicy referrerPolicy)
{
preloadRequestVerification(type, url, baseURL, width, ClientHintsPreferences());
EXPECT_EQ(referrerPolicy, m_preloadRequest->referrerPolicy());
}
void preconnectRequestVerification(const String& host, CrossOriginAttributeValue crossOrigin)
{
if (!host.isNull()) {
EXPECT_TRUE(m_preloadRequest->isPreconnect());
EXPECT_STREQ(m_preloadRequest->resourceURL().ascii().data(), host.ascii().data());
EXPECT_EQ(m_preloadRequest->crossOrigin(), crossOrigin);
}
}
protected:
void preload(PassOwnPtr<PreloadRequest> preloadRequest, const NetworkHintsInterface&) override
{
m_preloadRequest = preloadRequest;
}
private:
OwnPtr<PreloadRequest> m_preloadRequest;
};
class HTMLPreloadScannerTest : public testing::Test {
protected:
enum ViewportState {
ViewportEnabled,
ViewportDisabled,
};
enum PreloadState {
PreloadEnabled,
PreloadDisabled,
};
HTMLPreloadScannerTest()
: m_dummyPageHolder(DummyPageHolder::create())
{
}
PassRefPtrWillBeRawPtr<MediaValues> createMediaValues()
{
MediaValuesCached::MediaValuesCachedData data;
data.viewportWidth = 500;
data.viewportHeight = 600;
data.deviceWidth = 700;
data.deviceHeight = 800;
data.devicePixelRatio = 2.0;
data.colorBitsPerComponent = 24;
data.monochromeBitsPerComponent = 0;
data.primaryPointerType = PointerTypeFine;
data.defaultFontSize = 16;
data.threeDEnabled = true;
data.mediaType = MediaTypeNames::screen;
data.strictMode = true;
data.displayMode = WebDisplayModeBrowser;
return MediaValuesCached::create(data);
}
void runSetUp(ViewportState viewportState, PreloadState preloadState = PreloadEnabled)
{
HTMLParserOptions options(&m_dummyPageHolder->document());
KURL documentURL(ParsedURLString, "http://whatever.test/");
m_dummyPageHolder->document().settings()->setViewportEnabled(viewportState == ViewportEnabled);
m_dummyPageHolder->document().settings()->setViewportMetaEnabled(viewportState == ViewportEnabled);
m_dummyPageHolder->document().settings()->setDoHtmlPreloadScanning(preloadState == PreloadEnabled);
m_scanner = HTMLPreloadScanner::create(options, documentURL, CachedDocumentParameters::create(&m_dummyPageHolder->document(), createMediaValues()));
}
void SetUp() override
{
runSetUp(ViewportEnabled);
}
void test(TestCase testCase)
{
MockHTMLResourcePreloader preloader;
KURL baseURL(ParsedURLString, testCase.baseURL);
m_scanner->appendToEnd(String(testCase.inputHTML));
m_scanner->scan(&preloader, baseURL);
preloader.preloadRequestVerification(testCase.type, testCase.preloadedURL, testCase.outputBaseURL, testCase.resourceWidth, testCase.preferences);
}
void test(PreconnectTestCase testCase)
{
MockHTMLResourcePreloader preloader;
KURL baseURL(ParsedURLString, testCase.baseURL);
m_scanner->appendToEnd(String(testCase.inputHTML));
m_scanner->scan(&preloader, baseURL);
preloader.preconnectRequestVerification(testCase.preconnectedHost, testCase.crossOrigin);
}
void test(ReferrerPolicyTestCase testCase)
{
MockHTMLResourcePreloader preloader;
KURL baseURL(ParsedURLString, testCase.baseURL);
m_scanner->appendToEnd(String(testCase.inputHTML));
m_scanner->scan(&preloader, baseURL);
preloader.preloadRequestVerification(testCase.type, testCase.preloadedURL, testCase.outputBaseURL, testCase.resourceWidth, testCase.referrerPolicy);
}
private:
OwnPtr<DummyPageHolder> m_dummyPageHolder;
OwnPtr<HTMLPreloadScanner> m_scanner;
};
TEST_F(HTMLPreloadScannerTest, testImages)
{
TestCase testCases[] = {
{"http://example.test", "<img src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img sizes='50vw' src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 1x'>", "bla2.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 0.5x'>", "bla.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 100w'>", "bla2.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 100w, bla3.gif 250w'>", "bla3.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img src='bla.gif' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' sizes='50vw'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img src='bla.gif' sizes='50vw' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' src='bla.gif'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' src='bla.gif' sizes='50vw'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' sizes='50vw' src='bla.gif'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img src='bla.gif' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w'>", "bla4.gif", "http://example.test/", Resource::Image, 0},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testImagesWithViewport)
{
TestCase testCases[] = {
{"http://example.test", "<meta name=viewport content='width=160'><img srcset='bla.gif 320w, blabla.gif 640w'>", "bla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img sizes='50vw' src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 1x'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 0.5x'>", "bla.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 160w'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 160w, bla3.gif 250w'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img src='bla.gif' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' sizes='50vw'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img src='bla.gif' sizes='50vw' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img sizes='50vw' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' src='bla.gif'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' src='bla.gif' sizes='50vw'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
{"http://example.test", "<img srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' sizes='50vw' src='bla.gif'>", "bla2.gif", "http://example.test/", Resource::Image, 80},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testImagesWithViewportDeviceWidth)
{
TestCase testCases[] = {
{"http://example.test", "<meta name=viewport content='width=device-width'><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img sizes='50vw' src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 1x'>", "bla2.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 0.5x'>", "bla.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 160w'>", "bla2.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 160w, bla3.gif 250w'>", "bla3.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w'>", "bla4.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img src='bla.gif' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' sizes='50vw'>", "bla4.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img src='bla.gif' sizes='50vw' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w'>", "bla4.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img sizes='50vw' srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' src='bla.gif'>", "bla4.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' src='bla.gif' sizes='50vw'>", "bla4.gif", "http://example.test/", Resource::Image, 350},
{"http://example.test", "<img srcset='bla2.gif 160w, bla3.gif 250w, bla4.gif 500w' sizes='50vw' src='bla.gif'>", "bla4.gif", "http://example.test/", Resource::Image, 350},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testImagesWithViewportDisabled)
{
runSetUp(ViewportDisabled);
TestCase testCases[] = {
{"http://example.test", "<meta name=viewport content='width=160'><img src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<img sizes='50vw' src='bla.gif'>", "bla.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 1x'>", "bla2.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 0.5x'>", "bla.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 100w'>", "bla2.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 100w, bla3.gif 250w'>", "bla3.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' src='bla.gif' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img src='bla.gif' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' sizes='50vw'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img src='bla.gif' sizes='50vw' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img sizes='50vw' srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' src='bla.gif'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' src='bla.gif' sizes='50vw'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<img srcset='bla2.gif 100w, bla3.gif 250w, bla4.gif 500w' sizes='50vw' src='bla.gif'>", "bla4.gif", "http://example.test/", Resource::Image, 250},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testViewportNoContent)
{
TestCase testCases[] = {
{"http://example.test", "<meta name=viewport><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<meta name=viewport content=sdkbsdkjnejjha><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testMetaAcceptCH)
{
ClientHintsPreferences dpr;
ClientHintsPreferences resourceWidth;
ClientHintsPreferences all;
ClientHintsPreferences viewportWidth;
dpr.setShouldSendDPR(true);
all.setShouldSendDPR(true);
resourceWidth.setShouldSendResourceWidth(true);
all.setShouldSendResourceWidth(true);
viewportWidth.setShouldSendViewportWidth(true);
all.setShouldSendViewportWidth(true);
TestCase testCases[] = {
{"http://example.test", "<meta http-equiv='accept-ch' content='bla'><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<meta http-equiv='accept-ch' content='dprw'><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<meta http-equiv='accept-ch'><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<meta http-equiv='accept-ch' content='dpr \t'><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0, dpr},
{"http://example.test", "<meta http-equiv='accept-ch' content='bla,dpr \t'><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0, dpr},
{"http://example.test", "<meta http-equiv='accept-ch' content=' width '><img sizes='100vw' srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 500, resourceWidth},
{"http://example.test", "<meta http-equiv='accept-ch' content=' width , wutever'><img sizes='300px' srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 300, resourceWidth},
{"http://example.test", "<meta http-equiv='accept-ch' content=' viewport-width '><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0, viewportWidth},
{"http://example.test", "<meta http-equiv='accept-ch' content=' viewport-width , wutever'><img srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 0, viewportWidth},
{"http://example.test", "<meta http-equiv='accept-ch' content=' viewport-width ,width, wutever, dpr \t'><img sizes='90vw' srcset='bla.gif 320w, blabla.gif 640w'>", "blabla.gif", "http://example.test/", Resource::Image, 450, all},
};
for (const auto& testCase : testCases) {
runSetUp(ViewportDisabled);
test(testCase);
}
}
TEST_F(HTMLPreloadScannerTest, testPreconnect)
{
PreconnectTestCase testCases[] = {
{"http://example.test", "<link rel=preconnect href=http://example2.test>", "http://example2.test", CrossOriginAttributeNotSet},
{"http://example.test", "<link rel=preconnect href=http://example2.test crossorigin=anonymous>", "http://example2.test", CrossOriginAttributeAnonymous},
{"http://example.test", "<link rel=preconnect href=http://example2.test crossorigin='use-credentials'>", "http://example2.test", CrossOriginAttributeUseCredentials},
{"http://example.test", "<link rel=preconnected href=http://example2.test crossorigin='use-credentials'>", nullptr, CrossOriginAttributeNotSet},
{"http://example.test", "<link rel=preconnect href=ws://example2.test crossorigin='use-credentials'>", nullptr, CrossOriginAttributeNotSet},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testDisables)
{
runSetUp(ViewportEnabled, PreloadDisabled);
TestCase testCases[] = {
{"http://example.test", "<img src='bla.gif'>"},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testPicture)
{
TestCase testCases[] = {
{"http://example.test", "<picture><source srcset='srcset_bla.gif'><img src='bla.gif'></picture>", "srcset_bla.gif", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<picture><source sizes='50vw' srcset='srcset_bla.gif'><img src='bla.gif'></picture>", "srcset_bla.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<picture><source sizes='50vw' srcset='srcset_bla.gif'><img sizes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<picture><source srcset='srcset_bla.gif' sizes='50vw'><img sizes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://example.test/", Resource::Image, 250},
{"http://example.test", "<picture><source srcset='srcset_bla.gif'><img sizes='50w' src='bla.gif'></picture>", "srcset_bla.gif", "http://example.test/", Resource::Image, 0},
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testReferrerPolicy)
{
ReferrerPolicyTestCase testCases[] = {
{ "http://example.test", "<img src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyDefault },
{ "http://example.test", "<img referrerpolicy='origin' src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyOrigin },
{ "http://example.test", "<meta name='referrer' content='not-a-valid-policy'><img src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyDefault },
{ "http://example.test", "<img referrerpolicy='origin' referrerpolicy='origin-when-crossorigin' src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyOrigin },
{ "http://example.test", "<img referrerpolicy='not-a-valid-policy' src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyDefault },
{ "http://example.test", "<meta name='referrer' content='no-referrer'><img referrerpolicy='origin' src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyOrigin },
// The scanner's state is not reset between test cases, so all subsequent test cases have a document referrer policy of no-referrer.
{ "http://example.test", "<img referrerpolicy='not-a-valid-policy' src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyNever },
{ "http://example.test", "<img src='bla.gif'/>", "bla.gif", "http://example.test/", Resource::Image, 0, ReferrerPolicyNever }
};
for (const auto& testCase : testCases)
test(testCase);
}
TEST_F(HTMLPreloadScannerTest, testLinkRelPreload)
{
TestCase testCases[] = {
{"http://example.test", "<link rel=preload href=bla>", "bla", "http://example.test/", Resource::LinkSubresource, 0},
{"http://example.test", "<link rel=preload href=bla as=script>", "bla", "http://example.test/", Resource::Script, 0},
{"http://example.test", "<link rel=preload href=bla as=style>", "bla", "http://example.test/", Resource::CSSStyleSheet, 0},
{"http://example.test", "<link rel=preload href=bla as=image>", "bla", "http://example.test/", Resource::Image, 0},
{"http://example.test", "<link rel=preload href=bla as=font>", "bla", "http://example.test/", Resource::Font, 0},
{"http://example.test", "<link rel=preload href=bla as=audio>", "bla", "http://example.test/", Resource::Media, 0},
{"http://example.test", "<link rel=preload href=bla as=video>", "bla", "http://example.test/", Resource::Media, 0},
{"http://example.test", "<link rel=preload href=bla as=track>", "bla", "http://example.test/", Resource::TextTrack, 0},
};
for (const auto& testCase : testCases)
test(testCase);
}
} // namespace blink
| {
"content_hash": "9fb4585cf527fab541583e150fcdb9e0",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 239,
"avg_line_length": 63.64207650273224,
"alnum_prop": 0.6521272485296011,
"repo_name": "joone/chromium-crosswalk",
"id": "d1196194f72074621c85582d2dd802089d34b241",
"size": "23896",
"binary": false,
"copies": "6",
"ref": "refs/heads/2016.04.css-round-display-edtior-draft-1",
"path": "third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
CATALINA_OPTS=$CATALINA_OPTS" -server"
CATALINA_OPTS=$CATALINA_OPTS" -Xms30m -Xmx150m"
CATALINA_OPTS=$CATALINA_OPTS" -XX:NewRatio=8 -XX:SurvivorRatio=8"
#CATALINA_OPTS=$CATALINA_OPTS" -XX:MaxPermSize=256M -XX:PermSize=128M"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+ScavengeBeforeFullGC -XX:+CMSScavengeBeforeRemark"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+ExplicitGCInvokesConcurrent"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+CMSClassUnloadingEnabled"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+UseCMSInitiatingOccupancyOnly"
CATALINA_OPTS=$CATALINA_OPTS" -XX:CMSInitiatingOccupancyFraction=80"
CATALINA_OPTS=$CATALINA_OPTS" -Djava.net.preferIPv4Stack=true"
CATALINA_OPTS=$CATALINA_OPTS" -Dsun.net.inetaddr.ttl=60"
CATALINA_OPTS=$CATALINA_OPTS" -Djava.rmi.server.hostname=127.0.0.1" # External ADMIN IP IN PREFERENCE !
CATALINA_OPTS=$CATALINA_OPTS" -Dcom.sun.management.jmxremote"
CATALINA_OPTS=$CATALINA_OPTS" -Dcom.sun.management.jmxremote.port=4501"
CATALINA_OPTS=$CATALINA_OPTS" -Dcom.sun.management.jmxremote.ssl=false"
CATALINA_OPTS=$CATALINA_OPTS" -Dcom.sun.management.jmxremote.authenticate=false"
CATALINA_OPTS=$CATALINA_OPTS" -verbose:gc"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+PrintGCDetails"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+PrintGCDateStamps"
CATALINA_OPTS=$CATALINA_OPTS" -Xloggc:$CATALINA_BASE/logs/GC_`date '+%y%m%d_%H%M%S'`.log"
CATALINA_OPTS=$CATALINA_OPTS" -XX:+HeapDumpOnOutOfMemoryError"
CATALINA_OPTS=$CATALINA_OPTS" -XX:HeapDumpPath=$CATALINA_BASE/logs"
| {
"content_hash": "0f52a47f542a6661a10f57c6f5ac606b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 103,
"avg_line_length": 55.607142857142854,
"alnum_prop": 0.791907514450867,
"repo_name": "dacr/primesui-deploy",
"id": "f6863d6f667c2be1595e27caf122328fb9e2e943",
"size": "1558",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "simplestack/tomcatpui/setenv.sh",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Shell",
"bytes": "1640"
}
],
"symlink_target": ""
} |
package com.eaw1805.www.fieldbattle.views.layout.infopanels;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.*;
import com.eaw1805.www.fieldbattle.remote.EmpireFieldBattleRpcService;
import com.eaw1805.www.fieldbattle.remote.EmpireFieldBattleRpcServiceAsync;
import com.eaw1805.www.fieldbattle.stores.BaseStore;
import com.eaw1805.www.fieldbattle.stores.dto.SocialFriend;
import com.eaw1805.www.fieldbattle.stores.SocialStore;
import com.eaw1805.www.fieldbattle.stores.dto.SocialGame;
import com.eaw1805.www.fieldbattle.stores.dto.SocialPosition;
import com.eaw1805.www.fieldbattle.views.layout.social.StandAloneSocialPanel;
import com.eaw1805.www.fieldbattle.widgets.shared.TextBoxEditable;
import com.eaw1805.www.fieldbattle.widgets.shared.TextBoxFilterList;
public class NationSocialInfoPanel extends AbsolutePanel {
private final static EmpireFieldBattleRpcServiceAsync service = GWT.create(EmpireFieldBattleRpcService.class);
Label nameLbl = new Label("Loading...");
SocialPosition pos;
public NationSocialInfoPanel(final SocialGame socialGame, final SocialPosition position, final boolean isNewGame) {
pos = position;
setSize("126px", "76px");
final Image nationImg = new Image("http://static.eaw1805.com/images/nations/nation-" + position.getNation().getNationId() + "-120.png");
nationImg.setHeight("45px");
add(nationImg, 3, 3);
final Image img;
if (position.getFacebookId() == null) {
img = new Image("http://graph.facebook.com//picture?type=square");
} else {
img = new Image("http://graph.facebook.com/" + position.getFacebookId() + "/picture?type=square");
}
img.setHeight("45px");
add(img, 76, 3);
if (isNewGame) {
//if this is a newly created game, then you need to show selections for other players.
final TextBoxEditable player = new TextBoxEditable("Select Player");
TextBoxFilterList<SocialFriend> filterList = new TextBoxFilterList<SocialFriend>(player) {
@Override
public void onChange(final Widget option, final SocialFriend value) {
position.setFacebookId(value.getId());
img.setUrl("http://graph.facebook.com/" + position.getFacebookId() + "/picture?type=square");
player.setText(value.getName());
hidePanel();
}
};
if (position.getFacebookId() != null && !position.getFacebookId().isEmpty()) {
player.setText(position.getFacebookId());
}
filterList.setSize(200, 200);
player.setWidth("120px");
add(player, 3, 48);
filterList.addOption(new SocialPlayerInfoPanel(SocialStore.getInstance().getNone()), SocialStore.getInstance().getNone(), SocialStore.getInstance().getNone().getName());
filterList.addOption(new SocialPlayerInfoPanel(SocialStore.getInstance().getMe()), SocialStore.getInstance().getMe(), SocialStore.getInstance().getMe().getName());
for (SocialFriend friend : SocialStore.getInstance().getFriends()) {
filterList.addOption(new SocialPlayerInfoPanel(friend), friend, friend.getName());
}
} else {
if (position.getFacebookId() != null && !position.getFacebookId().isEmpty()) {
if (position.getFacebookId().equals(BaseStore.getInstance().getFacebookId())) {
//if this is my game
if (position.getPlayerId() == 2) {
//if i haven't accepted this game yet.
Button button = new Button("Accept Position");
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent clickEvent) {
service.pickupPosition(BaseStore.getInstance().getScenarioId(), socialGame.getId(), position.getNation().getNationId(), new AsyncCallback<Integer>() {
@Override
public void onFailure(Throwable throwable) {
Window.alert("Failed to pickup position");
}
@Override
public void onSuccess(Integer result) {
if (result == 0) {
Window.alert("Position already taken");
} else if (result == -1) {
Window.alert("You already have a nation in this battle");
} else {
if (getParent().getParent() instanceof StandAloneSocialPanel) {
((StandAloneSocialPanel) (getParent().getParent())).updateMyGames();
((StandAloneSocialPanel) (getParent().getParent())).updatePending();
((StandAloneSocialPanel) (getParent().getParent())).updateAvailableGames();
}
}
}
});
}
});
add(button, 3, 48);
} else {
//if i have accepted this game.
img.setUrl("http://graph.facebook.com/" + position.getFacebookId() + "/picture?type=square");
if (SocialStore.getInstance().getUser(position.getFacebookId()) == null) {
SocialStore.getInstance().getUser(position.getFacebookId(), SocialStore.getInstance(), this);
} else {
nameLbl.setText(SocialStore.getInstance().getUser(position.getFacebookId()).getName());
}
add(nameLbl, 3, 48);
}
} else {
img.setUrl("http://graph.facebook.com/" + position.getFacebookId() + "/picture?type=square");
if (SocialStore.getInstance().getUser(position.getFacebookId()) == null) {
SocialStore.getInstance().getUser(position.getFacebookId(), SocialStore.getInstance(), this);
} else {
nameLbl.setText(SocialStore.getInstance().getUser(position.getFacebookId()).getName());
}
add(nameLbl, 3, 48);
}
} else if (!socialGame.isUserPlaying(BaseStore.getInstance().getFacebookId())) {
Button button = new Button("Play Position");
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent clickEvent) {
service.pickupPosition(BaseStore.getInstance().getScenarioId(), socialGame.getId(), position.getNation().getNationId(), new AsyncCallback<Integer>() {
@Override
public void onFailure(Throwable throwable) {
Window.alert("Failed to pickup position");
}
@Override
public void onSuccess(Integer result) {
if (result == 0) {
Window.alert("Position already taken");
} else if (result == -1) {
Window.alert("You already have a nation in this battle");
} else {
Window.alert("Yeee!! picked up position");
if (getParent().getParent() instanceof StandAloneSocialPanel) {
Window.alert("update games");
((StandAloneSocialPanel) (getParent().getParent())).updateMyGames();
((StandAloneSocialPanel) (getParent().getParent())).updatePending();
((StandAloneSocialPanel) (getParent().getParent())).updateAvailableGames();
}
}
}
});
}
});
add(button, 3, 48);
}
}
}
/**
* Use this function to update the name of the owner position
*/
public void updateLabel() {
nameLbl.setText(SocialStore.getInstance().getUser(pos.getFacebookId()).getName());
}
}
| {
"content_hash": "e248b56c86df0f874629ab8838c5bf6a",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 182,
"avg_line_length": 55.047904191616766,
"alnum_prop": 0.5256173175242032,
"repo_name": "EaW1805/www",
"id": "2a5be0b3a68031a3587df02b3d619da07805381c",
"size": "9193",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/eaw1805/www/fieldbattle/views/layout/infopanels/NationSocialInfoPanel.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "787819"
},
{
"name": "HTML",
"bytes": "78978"
},
{
"name": "Java",
"bytes": "8253857"
},
{
"name": "JavaScript",
"bytes": "1170858"
}
],
"symlink_target": ""
} |
package gw.servlet;
import gw.core.LoginContext;
import gw.core.RepositoryContext;
import gw.model.UserAccount;
import gw.model.pk.RepositoryPK;
import gw.service.RepositoryController;
import java.io.File;
import java.io.IOException;
import java.util.Base64;
import java.util.Optional;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.inject.Provider;
import org.eclipse.jgit.http.server.GitServlet;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.resolver.FileResolver;
import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
@WebServlet(urlPatterns = { "/git/*" }, initParams = { /* @WebInitParam(name = "base-path", value = "d:/dev2") */})
public class GitRepositoryServlet extends GitServlet {
private static final long serialVersionUID = 1L;
@Inject
private Provider<EntityManager> emProvider;
@Inject
private RepositoryController repositoryController;
@Override
public void init(ServletConfig config) throws ServletException {
String basePath = config.getInitParameter("base-path");
File dir;
if (basePath != null) {
dir = new File(basePath);
} else {
dir = new File(System.getProperty("user.home"), ".gitapp/repos");
}
setRepositoryResolver(new FileResolver<HttpServletRequest>(dir, true));
setReceivePackFactory(new GitReceivePackFactory());
super.init(config);
GuiceListener.get().injectMembers(this);
}
@Override
protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
System.out.println(request.getServletPath());
System.out.println(request.getPathInfo());
Optional<RepositoryPK> repositoryPK = parsePK(request);
if (!repositoryPK.isPresent()) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
gw.model.Repository repository = emProvider.get().find(gw.model.Repository.class, repositoryPK.get());
if (repository == null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
if (authRequired(request, repository)) {
if (!enable(request, repository)) {
response.setHeader("WWW-Authenticate", "BASIC realm=\"GitApp\"");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return;
}
}
super.service(req, res);
}
// instead of DefaultReceivePackFactory
private static class GitReceivePackFactory implements ReceivePackFactory<HttpServletRequest> {
@Override
public ReceivePack create(HttpServletRequest req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException {
ReceivePack receivePack = new ReceivePack(db);
GwReceiveHook hook = new GwReceiveHook(parsePK(req).get());
GuiceListener.get().injectMembers(hook);
receivePack.setPreReceiveHook(hook);
receivePack.setPostReceiveHook(hook);
return receivePack;
}
}
private boolean authRequired(HttpServletRequest request, gw.model.Repository repository) {
// case push
if (request.getRequestURI().endsWith("/git-receive-pack") || "service=git-receive-pack".equals(request.getQueryString())) {
return true;
}
// case private
return repository.isPrivateRepo();
}
private boolean enable(HttpServletRequest request, gw.model.Repository repository) {
String auth = request.getHeader("Authorization");
if (auth == null || auth.trim().equals("")) {
return false;
}
String[] array = new String(Base64.getDecoder().decode(auth.substring(6))).split(":");
if (array.length != 2 || array[0].length() == 0 || array[1].length() == 0) {
return false;
}
return checkAvailable(request, array[0], array[1], repository);
}
private boolean checkAvailable(HttpServletRequest request, String username, String password, gw.model.Repository repository) {
UserAccount account = emProvider.get().find(UserAccount.class, username);
if (account == null || !account.authenticate(password)) {
return false;
}
request.setAttribute(LoginContext.SESSION_KEY, new LoginContext(account)); // for EntityOperator
Optional<RepositoryContext> context = repositoryController.getContext(repository.getPk(), account.getName());
return context.filter(c -> c.canAccess(true)).isPresent();
}
private static Optional<RepositoryPK> parsePK(HttpServletRequest request) {
String[] paths = request.getPathInfo().split("/");
if (paths.length < 3) {
return Optional.empty();
}
String owner = paths[1];
String repos = paths[2].replaceFirst("\\.wiki\\.git$|\\.git$", "");
return Optional.of(new RepositoryPK(owner, repos));
}
}
| {
"content_hash": "ad4fcfcfecc5ab76a119f62e76a1bf49",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 135,
"avg_line_length": 35.82876712328767,
"alnum_prop": 0.728923723953355,
"repo_name": "kamegu/git-webapp",
"id": "888b91303b544d067a1d5535fb4a284465494edf",
"size": "5231",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/gw/servlet/GitRepositoryServlet.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24862"
},
{
"name": "Java",
"bytes": "209154"
},
{
"name": "JavaScript",
"bytes": "23133"
}
],
"symlink_target": ""
} |
class CreateSettings < ActiveRecord::Migration[5.1]
def change
create_table :settings do |t|
t.string :name, null: false, default: 'Settings'
t.string :slug, null: false
t.timestamps
end
end
end
| {
"content_hash": "c14346fc1d1610fd426a56f07287c173",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 25,
"alnum_prop": 0.6577777777777778,
"repo_name": "95kach/rails-react-starter",
"id": "3f21dccfc4b173004587c8720493820fbdf5ccbf",
"size": "225",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/002_create_settings.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "22448"
},
{
"name": "HTML",
"bytes": "1212"
},
{
"name": "JavaScript",
"bytes": "151663"
},
{
"name": "Ruby",
"bytes": "41022"
}
],
"symlink_target": ""
} |
package org.jbpm.console.ng.pr.forms.client.display.providers;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.IsWidget;
import org.jboss.errai.common.client.api.Caller;
import org.jboss.errai.common.client.api.RemoteCallback;
import org.jboss.errai.ioc.client.container.IOCBeanDef;
import org.jboss.errai.ioc.client.container.SyncBeanManager;
import org.jbpm.console.ng.gc.forms.client.display.views.GenericFormDisplayView;
import org.uberfire.mvp.Command;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.util.*;
import org.jbpm.console.ng.ga.forms.display.view.FormContentResizeListener;
import org.jbpm.console.ng.ga.forms.display.view.FormDisplayerView;
import org.jbpm.console.ng.ga.forms.service.FormServiceEntryPoint;
import org.jbpm.console.ng.pr.forms.client.i18n.Constants;
import org.jbpm.console.ng.pr.forms.display.process.api.ProcessDisplayerConfig;
import org.jbpm.console.ng.pr.forms.display.process.api.StartProcessFormDisplayProvider;
import org.jbpm.console.ng.pr.forms.display.process.api.StartProcessFormDisplayer;
@ApplicationScoped
public class StartProcessFormDisplayProviderImpl implements StartProcessFormDisplayProvider {
protected Constants constants = GWT.create(Constants.class);
@Inject
protected SyncBeanManager iocManager;
@Inject
private GenericFormDisplayView view;
@Inject
private Caller<FormServiceEntryPoint> formServices;
private String currentProcessId;
private String currentDeploymentId;
protected String opener;
private Command onClose;
private Command onRefresh;
private List<StartProcessFormDisplayer> processDisplayers = new ArrayList<StartProcessFormDisplayer>();
private FormContentResizeListener resizeListener;
@PostConstruct
public void init() {
processDisplayers.clear();
final Collection<IOCBeanDef<StartProcessFormDisplayer>> processDisplayersBeans = iocManager.lookupBeans(StartProcessFormDisplayer.class);
if (processDisplayersBeans != null) {
for (final IOCBeanDef displayerDef : processDisplayersBeans) {
processDisplayers.add((StartProcessFormDisplayer) displayerDef.getInstance());
}
}
Collections.sort(processDisplayers, new Comparator<StartProcessFormDisplayer>() {
@Override
public int compare(StartProcessFormDisplayer o1, StartProcessFormDisplayer o2) {
if (o1.getPriority() < o2.getPriority()) {
return -1;
} else if (o1.getPriority() > o2.getPriority()) {
return 1;
} else {
return 0;
}
}
});
}
@Override
public void setup(final ProcessDisplayerConfig config, final FormDisplayerView view) {
display(config, view);
}
protected void display(final ProcessDisplayerConfig config, final FormDisplayerView view) {
if (processDisplayers != null) {
formServices.call(new RemoteCallback<String>() {
@Override
public void callback(String form) {
for (final StartProcessFormDisplayer d : processDisplayers) {
if (d.supportsContent(form)) {
config.setFormContent(form);
d.init(config, view.getOnCloseCommand(), new Command() {
@Override public void execute() {
display(config, view);
}
} , view.getResizeListener());
view.display(d);
return;
}
}
}
}).getFormDisplayProcess(config.getKey().getDeploymentId(), config.getKey().getProcessId());
}
}
public IsWidget getView() {
return view;
}
}
| {
"content_hash": "211b419dbd0d8c3664533ef63ec81398",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 145,
"avg_line_length": 36.86363636363637,
"alnum_prop": 0.6564734895191122,
"repo_name": "cristianonicolai/jbpm-wb",
"id": "2f42c4b24eaa289d5bd84bf407c352b8b844ec17",
"size": "4605",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "jbpm-console-ng-process-runtime-forms/jbpm-console-ng-process-runtime-forms-client/src/main/java/org/jbpm/console/ng/pr/forms/client/display/providers/StartProcessFormDisplayProviderImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "27085"
},
{
"name": "HTML",
"bytes": "47992"
},
{
"name": "Java",
"bytes": "2068224"
}
],
"symlink_target": ""
} |
package de.lessvoid.nifty.controls.dynamic;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.controls.dynamic.attributes.ControlAttributes;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.loaderv2.types.ControlType;
import de.lessvoid.nifty.loaderv2.types.ElementType;
import de.lessvoid.nifty.screen.Screen;
import javax.annotation.Nonnull;
public class CustomControlCreator extends ControlAttributes {
public CustomControlCreator(@Nonnull final ControlType source) {
super(source);
}
public CustomControlCreator(@Nonnull final String name) {
setAutoId();
setName(name);
}
public CustomControlCreator(@Nonnull final String id, @Nonnull final String name) {
setId(id);
setName(name);
}
public void parameter(@Nonnull final String name, @Nonnull final String value) {
set(name, value);
}
@Nonnull
public Element create(
@Nonnull final Nifty nifty,
@Nonnull final Screen screen,
@Nonnull final Element parent) {
return nifty.addControl(screen, parent, getStandardControl());
}
@Nonnull
@Override
public ElementType createType() {
return new ControlType(getAttributes());
}
}
| {
"content_hash": "2e91d7d0cd19ae8ff9d9716ac61dfc05",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 85,
"avg_line_length": 28.022727272727273,
"alnum_prop": 0.7193836171938361,
"repo_name": "gouessej/nifty-gui",
"id": "dc3c1a15759bf8a2485dd361835ad29d7fd56934",
"size": "1233",
"binary": false,
"copies": "9",
"ref": "refs/heads/1.4",
"path": "nifty-core/src/main/java/de/lessvoid/nifty/controls/dynamic/CustomControlCreator.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "F#",
"bytes": "685"
},
{
"name": "Java",
"bytes": "3129114"
}
],
"symlink_target": ""
} |
using System;
using System.Diagnostics;
namespace BackupSharp.Destinations
{
/// <summary>
/// A base class for backup destinations.
/// </summary>
public abstract class BackupDestinationBase : IBackupDestination
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="BackupDestinationBase"/> class.
/// </summary>
/// <param name="id">The identifier.</param>
protected BackupDestinationBase(string id)
{
Id = id;
}
#endregion
#region Events
/// <summary>
/// Occurs when an item is stored.
/// </summary>
public event EventHandler<BackupItemStoredEventArgs> ItemStored;
#endregion
#region Properties
/// <summary>
/// Gets the identifier.
/// </summary>
public string Id { get; private set; }
/// <summary>
/// Gets the context.
/// </summary>
/// <value>The context.</value>
protected BackupContext Context { get; private set; }
#endregion
#region IBackupSource implementation
/// <summary>
/// Initializes the destination step.
/// </summary>
/// <param name="context">The backup context.</param>
public virtual void Initialize(BackupContext context)
{
Context = context;
}
/// <summary>
/// Stores the item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="data">The data.</param>
public abstract void StoreItem(IBackupItem item, byte[] data);
/// <summary>
/// Terminates the destination step.
/// </summary>
/// <param name="context">The backup context.</param>
public virtual void Terminate(BackupContext context)
{
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
}
/// <summary>
/// Raises the <see cref="E:ItemStored" /> event.
/// </summary>
/// <param name="args">The <see cref="BackupItemStoredEventArgs"/> instance containing the event data.</param>
protected virtual void OnItemStored(BackupItemStoredEventArgs args)
{
if (ItemStored != null)
{
ItemStored(this, args);
}
}
#endregion
}
}
| {
"content_hash": "2c00f2f723c353324825480c0fd96911",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 154,
"avg_line_length": 31.43877551020408,
"alnum_prop": 0.5361895488477767,
"repo_name": "giacomelli/BackupSharp",
"id": "6fd62d160e29aac2a34c4da5267fd41cb29f4425",
"size": "3083",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/BackupSharp/Destinations/BackupDestinationBase.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "115084"
}
],
"symlink_target": ""
} |
'''Trains a stacked what-where autoencoder built on residual blocks on the
MNIST dataset. It exemplifies two influential methods that have been developed
in the past few years.
The first is the idea of properly "unpooling." During any max pool, the
exact location (the "where") of the maximal value in a pooled receptive field
is lost, however it can be very useful in the overall reconstruction of an
input image. Therefore, if the "where" is handed from the encoder
to the corresponding decoder layer, features being decoded can be "placed" in
the right location, allowing for reconstructions of much higher fidelity.
References:
[1]
"Visualizing and Understanding Convolutional Networks"
Matthew D Zeiler, Rob Fergus
https://arxiv.org/abs/1311.2901v3
[2]
"Stacked What-Where Auto-encoders"
Junbo Zhao, Michael Mathieu, Ross Goroshin, Yann LeCun
https://arxiv.org/abs/1506.02351v8
The second idea exploited here is that of residual learning. Residual blocks
ease the training process by allowing skip connections that give the network
the ability to be as linear (or non-linear) as the data sees fit. This allows
for much deep networks to be easily trained. The residual element seems to
be advantageous in the context of this example as it allows a nice symmetry
between the encoder and decoder. Normally, in the decoder, the final
projection to the space where the image is reconstructed is linear, however
this does not have to be the case for a residual block as the degree to which
its output is linear or non-linear is determined by the data it is fed.
However, in order to cap the reconstruction in this example, a hard softmax is
applied as a bias because we know the MNIST digits are mapped to [0,1].
References:
[3]
"Deep Residual Learning for Image Recognition"
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
https://arxiv.org/abs/1512.03385v1
[4]
"Identity Mappings in Deep Residual Networks"
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
https://arxiv.org/abs/1603.05027v3
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Model
from keras.layers import Activation, merge
from keras.layers import UpSampling2D, Convolution2D, MaxPooling2D
from keras.layers import Input, BatchNormalization
import matplotlib.pyplot as plt
import keras.backend as K
def convresblock(x, nfeats=8, ksize=3, nskipped=2):
''' The proposed residual block from [4]'''
y0 = Convolution2D(nfeats, ksize, ksize, border_mode='same')(x)
y = y0
for i in range(nskipped):
y = BatchNormalization(mode=0, axis=1)(y)
y = Activation('relu')(y)
y = Convolution2D(nfeats, ksize, ksize, border_mode='same')(y)
return merge([y0, y], mode='sum')
def getwhere(x):
''' Calculate the "where" mask that contains switches indicating which
index contained the max value when MaxPool2D was applied. Using the
gradient of the sum is a nice trick to keep everything high level.'''
y_prepool, y_postpool = x
return K.gradients(K.sum(y_postpool), y_prepool)
# input image dimensions
img_rows, img_cols = 28, 28
# the data, shuffled and split between train and test sets
(X_train, _), (X_test, _) = mnist.load_data()
X_train = X_train.reshape(X_train.shape[0], 1, img_rows, img_cols)
X_test = X_test.reshape(X_test.shape[0], 1, img_rows, img_cols)
X_train = X_train.astype('float32')
X_test = X_test.astype('float32')
X_train /= 255
X_test /= 255
print('X_train shape:', X_train.shape)
print(X_train.shape[0], 'train samples')
print(X_test.shape[0], 'test samples')
# The size of the kernel used for the MaxPooling2D
pool_size = 2
# The total number of feature maps at each layer
nfeats = [8, 16, 32, 64, 128]
# The sizes of the pooling kernel at each layer
pool_sizes = np.array([1, 1, 1, 1, 1]) * pool_size
# The convolution kernel size
ksize = 3
# Number of epochs to train for
nb_epoch = 5
# Batch size during training
batch_size = 128
if pool_size == 2:
# if using a 5 layer net of pool_size = 2
X_train = np.pad(X_train, [[0, 0], [0, 0], [2, 2], [2, 2]],
mode='constant')
X_test = np.pad(X_test, [[0, 0], [0, 0], [2, 2], [2, 2]], mode='constant')
nlayers = 5
elif pool_size == 3:
# if using a 3 layer net of pool_size = 3
X_train = X_train[:, :, :-1, :-1]
X_test = X_test[:, :, :-1, :-1]
nlayers = 3
else:
import sys
sys.exit("Script supports pool_size of 2 and 3.")
# Shape of input to train on (note that model is fully convolutional however)
input_shape = X_train.shape[1:]
# The final list of the size of axis=1 for all layers, including input
nfeats_all = [input_shape[0]] + nfeats
# First build the encoder, all the while keeping track of the "where" masks
img_input = Input(shape=input_shape)
# We push the "where" masks to the following list
wheres = [None] * nlayers
y = img_input
for i in range(nlayers):
y_prepool = convresblock(y, nfeats=nfeats_all[i + 1], ksize=ksize)
y = MaxPooling2D(pool_size=(pool_sizes[i], pool_sizes[i]))(y_prepool)
wheres[i] = merge([y_prepool, y], mode=getwhere,
output_shape=lambda x: x[0])
# Now build the decoder, and use the stored "where" masks to place the features
for i in range(nlayers):
ind = nlayers - 1 - i
y = UpSampling2D(size=(pool_sizes[ind], pool_sizes[ind]))(y)
y = merge([y, wheres[ind]], mode='mul')
y = convresblock(y, nfeats=nfeats_all[ind], ksize=ksize)
# Use hard_simgoid to clip range of reconstruction
y = Activation('hard_sigmoid')(y)
# Define the model and it's mean square error loss, and compile it with Adam
model = Model(img_input, y)
model.compile('adam', 'mse')
# Fit the model
model.fit(X_train, X_train, validation_data=(X_test, X_test),
batch_size=batch_size, nb_epoch=nb_epoch)
# Plot
X_recon = model.predict(X_test[:25])
X_plot = np.concatenate((X_test[:25], X_recon), axis=1)
X_plot = X_plot.reshape((5, 10, input_shape[-2], input_shape[-1]))
X_plot = np.vstack([np.hstack(x) for x in X_plot])
plt.figure()
plt.axis('off')
plt.title('Test Samples: Originals/Reconstructions')
plt.imshow(X_plot, interpolation='none', cmap='gray')
plt.savefig('reconstructions.png')
| {
"content_hash": "6b1e1f16b1f7a7ccb32a01f29b62d3ad",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 38.4251497005988,
"alnum_prop": 0.6909770920991117,
"repo_name": "dolaameng/keras",
"id": "56919072c9801ef8a82f19fa778833dcad5e821e",
"size": "6417",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "examples/mnist_swwae.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "697"
},
{
"name": "Python",
"bytes": "1135820"
}
],
"symlink_target": ""
} |
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M21.6,38.75V25.9H3.6V22.05H21.6V9.25L44.75,24Z"/>
</vector>
| {
"content_hash": "a309f955d8af7cf029265dd61496c1c4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 73,
"avg_line_length": 36.5,
"alnum_prop": 0.7041095890410959,
"repo_name": "google/material-design-icons",
"id": "5d9f889e49bb569c6f088955fc137f430b7babcb",
"size": "365",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "symbols/android/line_end_arrow/materialsymbolssharp/line_end_arrow_wght500grad200fill1_48px.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
var map;
var gcMarker;
var curposMarker;
var wptmarkers = [];
var custonOverlays = [];
var activeInfoWindow = null;
var blueIcon = new google.maps.MarkerImage("http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png");
//icons
function init() {
/*
Build list of map types.
You can also use var mapTypeIds = ["roadmap", "satellite", "hybrid", "terrain", "OSM"]
but static lists sucks when google updates the default list of map types.
*/
var mapTypeIds = [];
for(var type in google.maps.MapTypeId) {
mapTypeIds.push(google.maps.MapTypeId[type]);
}
mapTypeIds.push("OSM");
var myOptions = {
zoom: 13,
scaleControl: true,
center: new google.maps.LatLng(0.0, 0.0),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: { mapTypeIds: mapTypeIds }
};
map = new google.maps.Map(document.getElementById("map"), myOptions);
//Define OSM map type pointing at the OpenStreetMap tile server
map.mapTypes.set("OSM", new google.maps.ImageMapType({
getTileUrl: function(coord, zoom) {
return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
},
tileSize: new google.maps.Size(256, 256),
name: "OpenStreetMap",
maxZoom: 18
}));
map.enableKeyDragZoom({
visualEnabled: false,
visualPosition: google.maps.ControlPosition.LEFT,
visualPositionOffset: new google.maps.Size(35, 0),
visualPositionIndex: null,
visualSprite: "http://maps.gstatic.com/mapfiles/ftr/controls/dragzoom_btn.png",
visualSize: new google.maps.Size(20, 20),
visualTips: {
off: "Turn on",
on: "Turn off"
}
});
gcMarker = new google.maps.Marker({ title: 'none', 'map': map, draggable: false, icon: blueIcon, position: map.getCenter(), flat: false, visible: true });
curposMarker = new google.maps.Marker({ title: 'none', 'map': map, draggable: false, icon: curposIcon, position: map.getCenter(), flat: true, visible: false });
}
function setCurrentPosition(valid, lat, lon) {
if (valid) {
curposMarker.setPosition(new google.maps.LatLng(lat, lon));
curposMarker.setVisible(true);
}
else {
curposMarker.setVisible(false);
}
}
function setMapCenter(lat, lon) {
map.setCenter(new google.maps.LatLng(lat, lon));
}
function setGeocache(cacheType, gccode, name, lat, lon, gcic) {
if (gccode.toString().length > 0) {
$("#title").html('<img src="' + cacheType + '" />' + gccode + ': ' + name);
gcMarker.setPosition(new google.maps.LatLng(lat, lon));
gcMarker.setVisible(true);
gcMarker.setTitle(gccode);
gcMarker.setIcon(eval(gcic));
map.setCenter(new google.maps.LatLng(lat, lon));
}
else {
$("#title").html('');
gcMarker.setVisible(false);
}
}
function updateWaypoints(wpList) {
for (var i = 0; i < wptmarkers.length; i++) {
wptmarkers[i].setMap(null);
}
wptmarkers.length = 0;
eval("var wps = " + wpList); //wpcode (a), lat (b), lon (c), wpic (d)
for (var i = 0; i < wps.length; i++) {
wptmarkers.push(createWaypoint(wps[i].a,new google.maps.LatLng(wps[i].b, wps[i].c), wps[i].d, wps[i].e));
}
}
function createWaypoint(id,point,ic,balloonCnt) {
var marker = new google.maps.Marker({ 'title': id, map: map, draggable: false, icon: ic, position: point, flat: false, visible: true });
var iw = new google.maps.InfoWindow();
iw.setContent(balloonCnt);
google.maps.event.addListener(marker, 'click', function () {
if (activeInfoWindow!=null) activeInfoWindow.close();
activeInfoWindow = iw;
iw.open(map, marker);
});
return marker;
}
function addPolygons(polys) {
eval("var ps = " + polys);
for (var i=0; i<ps.length; i++) {
createArea(ps[i]);
}
}
function zoomToBounds(minlat, minlon, maxlat, maxlon) {
map.fitBounds(new google.maps.LatLngBounds(new google.maps.LatLng(minlat, minlon), new google.maps.LatLng(maxlat, maxlon)));
}
function createArea(area) {
var points = [];
for (var i = 0; i < area.points.length; i++) {
points.push(new google.maps.LatLng(area.points[i].lat, area.points[i].lon));
}
custonOverlays.push(new google.maps.Polygon({ clickable: false, paths: points, map: map, fillOpacity: 0.1 }));
}
function setCenter(lat, lon) {
map.setCenter(new google.maps.LatLng(lat, lon));
}
function onResize() {
$('#map').width($(document).width()-40);
$('#map').height($(document).height()-80);
}
$(window).resize(function() {
onResize();
});
$(document).ready(function() {
init();
onResize();
}); | {
"content_hash": "2b895a7623eeae3a9dc8ce624ecffc08",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 164,
"avg_line_length": 31.636986301369863,
"alnum_prop": 0.6410478458540809,
"repo_name": "RH-Code/GAPP",
"id": "f622504e6b36acb7d5405537410a413df58a724f",
"size": "4621",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GAPPSF/UIControls/GMap/SingleGeocache.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "356"
},
{
"name": "C#",
"bytes": "27428180"
},
{
"name": "HTML",
"bytes": "1064161"
},
{
"name": "JavaScript",
"bytes": "28729"
}
],
"symlink_target": ""
} |
$(function () {
var myMap;
var dates=[],temperature=[],tempF=[], anomalyDates=[], anomaliesF=[], anomaliesC=[]
var previousTemp=tempStandard;
var dataLength;
var target= document.getElementById("temperature-chart");
var opts={
lines: 13, // The number of lines to draw
length: 38, // The length of each line
width: 17, // The line thickness
radius: 45, // The radius of the inner circle
scale: 1, // Scales overall size of the spinner
corners: 1, // Corner roundness (0..1)
color: '#000000', // CSS color or array of colors
fadeColor: 'transparent', // CSS color or array of colors
speed: 1, // Rounds per second
rotate: 0, // The rotation offset
animation: 'spinner-line-fade-quick', // The CSS animation name for the lines
direction: 1, // 1: clockwise, -1: counterclockwise
zIndex: 2e9, // The z-index (defaults to 2000000000)
className: 'spinner', // The CSS class to assign to the spinner
top: '50%', // Top position relative to parent
left: '50%', // Left position relative to parent
shadow: '0 0 1px transparent', // Box-shadow for the lines
position: 'absolute' // Element positioning
};
function buildMap() {
myMap = createMap();
$('#basemaps').on('change', function() {
changeBasemap(myMap, this.value);
})
}
function populateSite() {
$.ajax({
method: 'post',
url: "/cocotemp/site/" + siteID + "/info.json",
success: function (data) {
if (data.length === 0) {
dataLength=0;
return;
} else {
dataLength = data.length;
}
var myMarker = L.marker([data.siteLatitude, data.siteLongitude]).addTo(myMap);
myMap.setView([data.siteLatitude, data.siteLongitude], 6);
}
});
}
function getDateRange() {
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
var year_ago = new Date();
year_ago.setFullYear(today.getFullYear() - 1)
var olddd = String(year_ago.getDate()).padStart(2, '0');
var oldmm = String(year_ago.getMonth() + 1).padStart(2, '0');
var oldyyyy = year_ago.getFullYear();
today = yyyy + '-' + mm + '-' + dd;
year_ago = oldyyyy + '-' + oldmm + '-' + olddd;
return {today, year_ago};
}
function populateChart() {
var spinner = new Spinner(opts).spin(target);
getSiteData();
//NOTE NOAA DOES NOT CONTAIN DATA UP TO CURRENT DAY
function compareNOAA(NOAAdates,NOAAtemp, NOAAtempF) {
let siteDates = dates;
let siteTemp = temperature;
let siteTempF = tempF;
let anomalyDate = [];
let anomalyTemp = [];
let anomalyTempF = [];
//let NOAALength = NOAAdates.length;
///hour in ms = 3600000
let NOAATestTemps = [];
for(let i = 0; i < siteDates.length; i++){
//Find a NOAA temperature value within an hour of this value
//Binary search through NOAA temp to find index value for comparison
let x = findCloseVal(NOAAdates,0, NOAAdates.length, siteDates[i].getTime())
NOAATestTemps.push(NOAAtempF[x]);
if(Math.abs(NOAAtempF[x] - siteTempF[i]) > 30 ){ //if more than 30 degree difference count as anamolies
anomalyDate.push(siteDates[i]);
anomalyTemp.push(siteTemp[i]);
anomalyTempF.push(siteTempF[i]);
} else {
anomalyDate.push(siteDates[i]);
anomalyTemp.push(null);
anomalyTempF.push(null);
}
}
function findCloseVal(NOAAdates, l, r, time){
let start = l;
let end = r;
while (start < end) {
let mid = Math.floor(((start + (end - 1)) / 2));
if(Math.abs(NOAAdates[mid].getTime() - time) < 3600000)//If within an hour use this value
return mid;
if(NOAAdates[mid].getTime() < time){
start = mid + 1;
} else {
end = mid - 1;
}
}
}
anomalyDates = anomalyDate;
anomaliesF = anomalyTempF;
anomaliesC = anomalyTemp;
buildChart()
}
function getSiteData(NOAAdata) {
$.ajax({
method: 'get',
url: "/cocotemp/site/" + siteID + "/temperature.json",
success: function (data) {
dataLength = data.length;
data.forEach(function (datum) {
dates.push(new Date(datum['dateTime']));
temperature.push(datum['temperature'].toFixed(1));
tempF.push((datum['temperature']*(9/5)+32).toFixed(1));
});
getNOAATemp();
}
});
};
function getNOAATemp(){
/*Check to see if site has any data to begin with. If site has no data don't
begin comparison*/
if(dates.length == 0){
buildChart();
}
$.ajax({
method: 'post',
url: "/cocotemp/site/"+siteID+"/info.json",
success: function (data) {
siteData = data;
return getClosestNOAA(data);
}
});
}
function getNOAATemperatureHelper(site) {
let station = site.stations[0].id;
let startDateTemp = dates[dates.length-1].toString().split(' ');
let endDateTemp = dates[0].toString().split( ' ');
function monthToNum(month){
switch (month) {
case "Jan":
return "01";
case "Feb":
return "02";
case "Mar":
return "03";
case "Apr":
return "04";
case "May":
return "05";
case "Jun":
return "06";
case "Jul":
return "07";
case "Aug":
return "08";
case "Sep":
return "09";
case "Oct":
return "10";
case "Nov":
return "11";
case "Dec":
return "12";
}
}
let startDate = startDateTemp[3]+"-"
+monthToNum(startDateTemp[1])+"-"
+startDateTemp[2].padStart(2,"0")
// +"T"+startDateTemp[4]
// +encodeURIComponent("-")
// +"04:00";
let endDate = endDateTemp[3]+"-"
+monthToNum(endDateTemp[1])+"-"
+endDateTemp[2].padStart(2,"0");
// +"T"+endDateTemp[4]
// + encodeURIComponent("-")
// +"04:00";
//Check if there is only data for one day if start on previous date if so add 1
if(endDate === startDate){
let monthNum = parseInt(monthToNum(startDateTemp[1])) - 1;
let month = monthNum.toString().padStart(2,"0");
startDate = startDateTemp[3]+"-"
+month+"-"
+startDateTemp[2];
}
$.ajax({
method: 'get',
datatype: 'json',
headers: {"Token": NOAAToken},
url: 'https://cocotemp-proxy.herokuapp.com/https://www.ncei.noaa.gov/access/services/data/v1?startDate='+startDate+'&endDate='+endDate+'&dataset=global-hourly&dataTypes=TMP&stations='+station+'&format=json&units=metric&includeStationName=1&includeStationLocation=1&includeAttributes=1',
success: function (data) {
if (data.length === 0) {
length = 0;
return;
}
var numberOfDataPoints = Object.keys(data).length;
length = Object.keys(data).length;
let temperature = [];
let dates = [];
let tempF = [];
for (var i = 0; i < numberOfDataPoints; i++) {
var tmp = data[i].TMP;
var tempSplit = tmp.split(',');
var nonconvertedtemp = tempSplit[0];
var convertedTemp = nonconvertedtemp / 10;
if (convertedTemp != 999.9) {
dates.push(new Date(data[i].DATE));
temperature.push(parseFloat(convertedTemp.toFixed(1)));
tempF.push(parseFloat((convertedTemp * (9 / 5) + 32).toFixed(1)));
}
}
compareNOAA(dates,temperature,tempF);
}
});
}
/*Uses the nearest NOAA site as comparison to check for anomolous data*/
function getClosestNOAA(site){
let siteLong = site.siteLongitude;
let siteLat = site.siteLatitude
let {today, year_ago} = getDateRange();
let north = siteLat + 2;
let south = siteLat - 2;
let east = siteLong + 2;
let west = siteLong - 2;
let offset = 0;
$.ajax({
method: 'get',
datatype: 'json',
headers: {"Token": NOAAToken},
async: true,
url: 'https://cocotemp-proxy.herokuapp.com/https://www.ncei.noaa.gov/access/services/search/v1/data?dataset=global-hourly&startDate='+year_ago+'&endDate='+today+'&dataTypes=TMP&limit=1000&offset='+offset+'&bbox='+north+','+west+','+south+','+east,
success: function (data) {
let closest = {
index: 0,
distance: 99999,
}
for( let i = 0; i < data.count;i++){
let lat = data.results[i].location.coordinates[0];
let long = data.results[i].location.coordinates[1];
let distance = Math.sqrt(Math.pow((siteLong-long),2)- Math.pow((siteLat-lat),2) );
if (distance < closest.distance){
closest.index = i;
closest.distance = distance;
}
}
//return data.results[closest.index];
return getNOAATemperatureHelper(data.results[closest.index])
}
});
}
function differenceHours(date1,date2) {
var diff =(date2.getTime() - date1.getTime()) / 1000;
diff /= (60 * 60);
return Math.abs(Math.round(diff));
}
function changeTemperaturePreference() {
if(tempStandard=='F')
{
tempStandard='C';
previousTemp='F';
buildChart();
}
else
{
tempStandard='F';
previousTemp='C';
buildChart();
}
}
function buildChart() {
spinner.stop();
if(anomalyDates.length != 0 && document.getElementById("anomalyMessage") == null){//Check if anamolies were detected and if so display a message explaining it
let p = document.createElement("P");
p.id = "anomalyMessage";
let text = document.createTextNode("The anomalies shown on the graph were found by comparing" +
" the data from this site to that of the nearest NOAA site and found a discrepancy of at least 30 degrees Fahrenheit." +
" Note that the NOAA site may not have data up to the current date.");
p.appendChild(text);
let x = document.getElementById("plot-area")
x.appendChild(p);
}
var innerContainer = document.querySelector('#plot-area');
var tempeSelect = innerContainer.querySelector('#temperature-select');
var tempPlot = innerContainer.querySelector('#temperature-chart');
var select = $('#temperature-select');
if(tempStandard=='C'){
select.empty();
select.append('<option value="C">Celsius</option>');
select.append('<option value="F">Fahrenheit</option>');
}
tempeSelect.addEventListener('change', changeTemperaturePreference, false);
var CelsiusThresholds=[
{thresholdValue:"0", thresholdName:"Freezing"},
{thresholdValue:"35", thresholdName:"<a href='https://www.weather.gov/ama/heatindex'>NWS Heat Caution</a>"},
{thresholdValue:"56", thresholdName:"<a href='https://www.weather.gov/ama/heatindex'>NWS Heat Danger</a>"}
];
var FahrenheitThresholds=[
{thresholdValue:"32", thresholdName:"Freezing"},
{thresholdValue:"95", thresholdName:"<a href='https://www.weather.gov/ama/heatindex'>NWS Heat Caution</a>"},
{thresholdValue:"132.8", thresholdName:"<a href='https://www.weather.gov/ama/heatindex'>NWS Heat Danger</a>"}
];
if(tempStandard =='F') {
if(dataLength===0||dataLength===undefined){
document.getElementById('max-temp').innerText='0 °F';
document.getElementById('min-temp').innerText='0 °F';
document.getElementById('avg-temp').innerText='0 °F';
document.getElementById('std-temp').innerText='0 °F';
}
else if(previousTemp=='C')
{
var stdF=(stdTemp*(9/5)+32).toFixed(1);
var maxF=(maxTemp*(9/5)+32).toFixed(1);
var minF=(minTemp*(9/5)+32).toFixed(1);
var avgF=(avgTemp*(9/5)+32).toFixed(1);
stdTemp=stdF;
maxTemp=maxF;
minTemp=minF;
avgTemp=avgF;
if(stdF==0)
{
stdTemp=0;
stdF=0;
}
if(maxF==0){
maxTemp=0;
maxF=0;
}
if(minF==0)
{
minTemp=0;
minF=0;
}
if(avgF==0){
avgTemp=0;
avgF=0;
}
console.log(maxF,minF,avgF,stdF);
document.getElementById('max-temp').innerText=maxF+' °F'
document.getElementById('min-temp').innerText=minF+' °F'
document.getElementById('avg-temp').innerText=avgF+' °F'
document.getElementById('std-temp').innerText=stdF+' °F'
}
var anomaliesFLine = {
hoverinfo: "none",
visible: true,
x: anomalyDates,
y: anomaliesF,
name: 'site\'s anomalies F',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
}
var anomaliesCLine = {
hoverinfo: "none",
visible: false,
x: anomalyDates,
y: anomaliesC,
name: 'site\'s anomalies C',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
}
var collectedTempF = {
hoverinfo: "y+x",
visible: true,
x: dates,
y: tempF,
name: 'site\'s temperature F',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
}
var collectedTempsC = {
hoverinfo: "y+x",
visible: false,
x: dates,
y: temperature,
name: 'site\'s temperature C',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
};
var data = [collectedTempsC, collectedTempF, anomaliesCLine, anomaliesFLine];
var layout = {
xaxis: {
fixedrange: false,
title: 'Time (24hrs)',
titlefont: {
family: 'Open Sans',
size: 12,
color: '#7f7f7f'
}
},
yaxis: {
title: 'F°',
titlefont: {
family: 'Open Sans',
size: 16,
color: '#7f7f7f'
}
},
shapes: [],
annotations: [],
showlegend: true,
legend: {
x: 1.2,
y: 1
},
margin: {r: 200}
};
FahrenheitThresholds.forEach(function (threshold) {
var lines;
if(threshold.thresholdValue==32)
{
lines = {
type: 'line',
xref: 'paper',
yref: 'y',
x0: 0,
y0: threshold.thresholdValue,
x1: 1,
y1: threshold.thresholdValue,
line: {
color: 'rgb(51, 175, 255)',
width: 1
}
};
}
else if(threshold.thresholdValue==95)
{
lines = {
type: 'line',
xref: 'paper',
yref: 'y',
x0: 0,
y0: threshold.thresholdValue,
x1: 1,
y1: threshold.thresholdValue,
line: {
color: 'rgb(255,102,0)',
width: 1
}
};
}
else{
lines = {
type: 'line',
xref: 'paper',
yref: 'y',
x0: 0,
y0: threshold.thresholdValue,
x1: 1,
y1: threshold.thresholdValue,
line: {
color: 'rgb(206,0,1)',
width: 1
}
};
}
layout.shapes.push(lines);
var annotations = {
xref: 'paper',
x: 1,
y: threshold.thresholdValue,
xanchor: 'left',
yanchor: 'middle',
text: threshold.thresholdName,
showarrow: false,
font: {
family: 'Open Sans',
size: 14,
color: '#7f7f7f'
}
};
layout.annotations.push(annotations);
});
Plotly.newPlot('temperature-chart', data, layout,{responsive:true,scrollZoom:true});
}
else if(tempStandard =='C') {
if(dataLength==0||dataLength==undefined){
document.getElementById('max-temp').innerText='0 °C';
document.getElementById('min-temp').innerText='0 °C';
document.getElementById('avg-temp').innerText='0 °C';
document.getElementById('std-temp').innerText='0 °C';
}
else if(previousTemp=='F'){
var stdC = ((stdTemp - 32) * 5 / 9).toFixed(1);
var maxC = ((maxTemp - 32) * 5 / 9).toFixed(1);
var minC = ((minTemp - 32) * 5 / 9).toFixed(1);
var avgC = ((avgTemp - 32) * 5 / 9).toFixed(1);
stdTemp = stdC;
maxTemp = maxC;
minTemp = minC;
avgTemp = avgC;
if (stdC == 0) {
stdTemp = 0;
stdC = 0;
}
if (maxC == 0) {
maxTemp = 0;
maxC = 0;
}
if (minC == 0) {
minTemp = 0;
minC = 0;
}
if (avgC == 0) {
avgTemp = 0;
avgC = 0;
}
document.getElementById('max-temp').innerText=maxC+' °C'
document.getElementById('min-temp').innerText=minC+' °C'
document.getElementById('avg-temp').innerText=avgC+' °C'
document.getElementById('std-temp').innerText=stdC+' °C'
}
var anomaliesFLine = {
hoverinfo: "none",
visible: false,
x: anomalyDates,
y: anomaliesF,
name: 'site\'s anomalies F',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
}
var anomaliesCLine = {
hoverinfo: "none",
visible: true,
x: anomalyDates,
y: anomaliesC,
name: 'site\'s anomalies C',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
}
var collectedTempF = {
hoverinfo: "none",
visible: false,
x: dates,
y: tempF,
name: 'site\'s temperature F',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
}
var collectedTempsC = {
hoverinfo: "y+x",
visible: true,
x: dates,
y: temperature,
name: 'site\'s temperature C',
mode: 'lines+markers',
type:'scattergl',
connectgaps: false
};
var data = [collectedTempsC, collectedTempF, anomaliesCLine];
var layout = {
xaxis: {
fixedrange: false,
title: 'Time (24hrs)',
titlefont: {
family: 'Open Sans',
size: 12,
color: '#7f7f7f'
}
},
yaxis: {
title: 'C°',
titlefont: {
family: 'Open Sans',
size: 16,
color: '#7f7f7f'
}
},
shapes: [],
annotations: [],
showlegend: true,
legend: {
x: 1.2,
y: 1
},
margin: {r: 200}
};
CelsiusThresholds.forEach(function (threshold) {
var lines;
if(threshold.thresholdValue==0)
{
lines = {
type: 'line',
xref: 'paper',
yref: 'y',
x0: 0,
y0: threshold.thresholdValue,
x1: 1,
y1: threshold.thresholdValue,
line: {
color: 'rgb(51, 175, 255)',
width: 1
}
};
}
else if(threshold.thresholdValue==35)
{
lines = {
type: 'line',
xref: 'paper',
yref: 'y',
x0: 0,
y0: threshold.thresholdValue,
x1: 1,
y1: threshold.thresholdValue,
line: {
color: 'rgb(255,102,0)',
width: 1
}
};
}
else{
lines = {
type: 'line',
xref: 'paper',
yref: 'y',
x0: 0,
y0: threshold.thresholdValue,
x1: 1,
y1: threshold.thresholdValue,
line: {
color: 'rgb(206,0,1)',
width: 1
}
};
}
layout.shapes.push(lines);
var annotations = {
xref: 'paper',
x: 1,
y: threshold.thresholdValue,
xanchor: 'left',
yanchor: 'middle',
text: threshold.thresholdName,
showarrow: false,
font: {
family: 'Open Sans',
size: 14,
color: '#7f7f7f'
}
};
layout.annotations.push(annotations);
});
Plotly.newPlot('temperature-chart', data, layout,{responsive:true,scrollZoom:true});
}
}
}
_.defer(buildMap);
_.defer(populateSite);
_.defer(populateChart);
});
| {
"content_hash": "91ba518d4ad2a83561223d0a342f2840",
"timestamp": "",
"source": "github",
"line_count": 751,
"max_line_length": 302,
"avg_line_length": 37.60452729693742,
"alnum_prop": 0.3875570978364789,
"repo_name": "MTUHIDE/CoCoTemp",
"id": "50a55bdb50eecaf89087077c6cd68e9ad4e09419",
"size": "28259",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/resources/static/js/site.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "9708"
},
{
"name": "C++",
"bytes": "43296"
},
{
"name": "CSS",
"bytes": "7174"
},
{
"name": "HTML",
"bytes": "265575"
},
{
"name": "Java",
"bytes": "403954"
},
{
"name": "JavaScript",
"bytes": "319202"
},
{
"name": "Sass",
"bytes": "15781"
}
],
"symlink_target": ""
} |
class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
{
public:
// creation
// --------
wxTextCtrl() { Init(); }
wxTextCtrl(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr)
{
Init();
Create(parent, id, value, pos, size, style, validator, name);
}
virtual ~wxTextCtrl();
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTextCtrlNameStr);
// overridden wxTextEntry methods
// ------------------------------
virtual wxString GetValue() const;
virtual wxString GetRange(long from, long to) const;
virtual bool IsEmpty() const;
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text);
virtual void Clear();
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const;
virtual void SetMaxLength(unsigned long len);
virtual void GetSelection(long *from, long *to) const;
virtual void Redo();
virtual bool CanRedo() const;
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual wxTextPos GetLastPosition() const;
// implement base class pure virtuals
// ----------------------------------
virtual bool IsModified() const;
virtual void MarkDirty();
virtual void DiscardEdits();
#ifdef __WIN32__
virtual bool EmulateKeyPress(const wxKeyEvent& event);
#endif // __WIN32__
#if wxUSE_RICHEDIT
// apply text attribute to the range of text (only works with richedit
// controls)
virtual bool SetStyle(long start, long end, const wxTextAttr& style);
virtual bool SetDefaultStyle(const wxTextAttr& style);
virtual bool GetStyle(long position, wxTextAttr& style);
#endif // wxUSE_RICHEDIT
// translate between the position (which is just an index in the text ctrl
// considering all its contents as a single strings) and (x, y) coordinates
// which represent column and line.
virtual long XYToPosition(long x, long y) const;
virtual bool PositionToXY(long pos, long *x, long *y) const;
virtual void ShowPosition(long pos);
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const
{
return wxTextCtrlBase::HitTest(pt, col, row);
}
#ifndef __WXWINCE__
virtual void SetLayoutDirection(wxLayoutDirection dir) wxOVERRIDE;
virtual wxLayoutDirection GetLayoutDirection() const wxOVERRIDE;
#endif // !__WXWINCE__
// Caret handling (Windows only)
bool ShowNativeCaret(bool show = true);
bool HideNativeCaret() { return ShowNativeCaret(false); }
// Implementation from now on
// --------------------------
#if wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT
virtual void SetDropTarget(wxDropTarget *dropTarget);
#endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT
virtual void SetWindowStyleFlag(long style);
virtual void Command(wxCommandEvent& event);
virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd);
#if wxUSE_RICHEDIT
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
int GetRichVersion() const { return m_verRichEdit; }
bool IsRich() const { return m_verRichEdit != 0; }
// rich edit controls are not compatible with normal ones and we must set
// the colours and font for them otherwise
virtual bool SetBackgroundColour(const wxColour& colour);
virtual bool SetForegroundColour(const wxColour& colour);
virtual bool SetFont(const wxFont& font);
#else
bool IsRich() const { return false; }
#endif // wxUSE_RICHEDIT
#if wxUSE_INKEDIT && wxUSE_RICHEDIT
bool IsInkEdit() const { return m_isInkEdit != 0; }
#else
bool IsInkEdit() const { return false; }
#endif
virtual void AdoptAttributesFromHWND();
virtual bool AcceptsFocusFromKeyboard() const;
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const;
// callbacks
void OnDropFiles(wxDropFilesEvent& event);
void OnChar(wxKeyEvent& event); // Process 'enter' if required
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnDelete(wxCommandEvent& event);
void OnSelectAll(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnUpdateDelete(wxUpdateUIEvent& event);
void OnUpdateSelectAll(wxUpdateUIEvent& event);
// Show a context menu for Rich Edit controls (the standard
// EDIT control has one already)
void OnContextMenu(wxContextMenuEvent& event);
// Create context menu for RICHEDIT controls. This may be called once during
// the control's lifetime or every time the menu is shown, depending on
// implementation.
virtual wxMenu *MSWCreateContextMenu();
// be sure the caret remains invisible if the user
// called HideNativeCaret() before
void OnSetFocus(wxFocusEvent& event);
// intercept WM_GETDLGCODE
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg);
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
protected:
// common part of all ctors
void Init();
// creates the control of appropriate class (plain or rich edit) with the
// styles corresponding to m_windowStyle
//
// this is used by ctor/Create() and when we need to recreate the control
// later
bool MSWCreateText(const wxString& value,
const wxPoint& pos,
const wxSize& size);
virtual void DoSetValue(const wxString &value, int flags = 0);
virtual wxPoint DoPositionToCoords(long pos) const;
// return true if this control has a user-set limit on amount of text (i.e.
// the limit is due to a previous call to SetMaxLength() and not built in)
bool HasSpaceLimit(unsigned int *len) const;
#if wxUSE_RICHEDIT && !wxUSE_UNICODE
// replace the selection or the entire control contents with the given text
// in the specified encoding
bool StreamIn(const wxString& value, wxFontEncoding encoding, bool selOnly);
// get the contents of the control out as text in the given encoding
wxString StreamOut(wxFontEncoding encoding, bool selOnly = false) const;
#endif // wxUSE_RICHEDIT
// replace the contents of the selection or of the entire control with the
// given text
void DoWriteText(const wxString& text,
int flags = SetValue_SendEvent | SetValue_SelectionOnly);
// set the selection (possibly without scrolling the caret into view)
void DoSetSelection(long from, long to, int flags);
// get the length of the line containing the character at the given
// position
long GetLengthOfLineContainingPos(long pos) const;
// send TEXT_UPDATED event, return true if it was handled, false otherwise
bool SendUpdateEvent();
virtual wxSize DoGetBestSize() const;
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
#if wxUSE_RICHEDIT
// Apply the character-related parts of wxTextAttr to the given selection
// or the entire control if start == end == -1.
//
// This function is private and should only be called for rich edit
// controls and with (from, to) already in correct order, i.e. from <= to.
bool MSWSetCharFormat(const wxTextAttr& attr, long from = -1, long to = -1);
// Same as above for paragraph-related parts of wxTextAttr. Note that this
// can only be applied to the selection as RichEdit doesn't support setting
// the paragraph styles globally.
bool MSWSetParaFormat(const wxTextAttr& attr, long from, long to);
// we're using RICHEDIT (and not simple EDIT) control if this field is not
// 0, it also gives the version of the RICHEDIT control being used
// (although not directly: 1 is for 1.0, 2 is for either 2.0 or 3.0 as we
// can't nor really need to distinguish between them and 4 is for 4.1)
int m_verRichEdit;
#endif // wxUSE_RICHEDIT
// number of EN_UPDATE events sent by Windows when we change the controls
// text ourselves: we want this to be exactly 1
int m_updatesCount;
private:
virtual void EnableTextChangedEvents(bool enable)
{
m_updatesCount = enable ? -1 : -2;
}
// implement wxTextEntry pure virtual: it implements all the operations for
// the simple EDIT controls
virtual WXHWND GetEditHWND() const { return m_hWnd; }
void OnKeyDown(wxKeyEvent& event);
// Used by EN_MAXTEXT handler to increase the size limit (will do nothing
// if the current limit is big enough). Should never be called directly.
//
// Returns true if we increased the limit to allow entering more text,
// false if we hit the limit set by SetMaxLength() and so didn't change it.
bool AdjustSpaceLimit();
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl);
wxMenu* m_privateContextMenu;
bool m_isNativeCaretShown;
#if wxUSE_INKEDIT && wxUSE_RICHEDIT
int m_isInkEdit;
#endif
};
#endif // _WX_TEXTCTRL_H_
| {
"content_hash": "77832a9a0337f6fa2c60dc688200b452",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 83,
"avg_line_length": 36.07017543859649,
"alnum_prop": 0.6846303501945525,
"repo_name": "emoon/prodbg-third-party",
"id": "cc62128c7ea5f74418e25543bccea9ea9eda0a88",
"size": "10690",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/wxWidgets/include/wx/msw/textctrl.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AppleScript",
"bytes": "10241"
},
{
"name": "Assembly",
"bytes": "16038"
},
{
"name": "Awk",
"bytes": "42674"
},
{
"name": "Batchfile",
"bytes": "32509"
},
{
"name": "C",
"bytes": "7545991"
},
{
"name": "C++",
"bytes": "39378425"
},
{
"name": "CMake",
"bytes": "20962"
},
{
"name": "CSS",
"bytes": "4659"
},
{
"name": "DIGITAL Command Language",
"bytes": "41524"
},
{
"name": "Groff",
"bytes": "479741"
},
{
"name": "HTML",
"bytes": "1110831"
},
{
"name": "Inno Setup",
"bytes": "6562"
},
{
"name": "JavaScript",
"bytes": "1375"
},
{
"name": "Lua",
"bytes": "7205"
},
{
"name": "Makefile",
"bytes": "100395"
},
{
"name": "Module Management System",
"bytes": "226048"
},
{
"name": "Nemerle",
"bytes": "28217"
},
{
"name": "Objective-C",
"bytes": "5572961"
},
{
"name": "Objective-C++",
"bytes": "818606"
},
{
"name": "Perl",
"bytes": "33572"
},
{
"name": "Python",
"bytes": "108744"
},
{
"name": "R",
"bytes": "672260"
},
{
"name": "Rebol",
"bytes": "1286"
},
{
"name": "Shell",
"bytes": "1074413"
},
{
"name": "TeX",
"bytes": "5028"
},
{
"name": "XSLT",
"bytes": "44320"
}
],
"symlink_target": ""
} |
import Subscriber from '../Subscriber';
import Subject from '../Subject';
export default function window(closingNotifier) {
return this.lift(new WindowOperator(closingNotifier));
}
class WindowOperator {
constructor(closingNotifier) {
this.closingNotifier = closingNotifier;
}
call(subscriber) {
return new WindowSubscriber(subscriber, this.closingNotifier);
}
}
class WindowSubscriber extends Subscriber {
constructor(destination, closingNotifier) {
super(destination);
this.closingNotifier = closingNotifier;
this.window = new Subject();
this.add(closingNotifier._subscribe(new WindowClosingNotifierSubscriber(this)));
this.openWindow();
}
_next(value) {
this.window.next(value);
}
_error(err) {
this.window.error(err);
this.destination.error(err);
}
_complete() {
this.window.complete();
this.destination.complete();
}
openWindow() {
const prevWindow = this.window;
if (prevWindow) {
prevWindow.complete();
}
this.destination.next(this.window = new Subject());
}
}
class WindowClosingNotifierSubscriber extends Subscriber {
constructor(parent) {
super(null);
this.parent = parent;
}
_next() {
this.parent.openWindow();
}
_error(err) {
this.parent._error(err);
}
_complete() {
this.parent._complete();
}
}
//# sourceMappingURL=window.js.map | {
"content_hash": "65fa81e97b218f345eabc3e1e45429e9",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 88,
"avg_line_length": 27.035714285714285,
"alnum_prop": 0.6241743725231176,
"repo_name": "binariedMe/blogging",
"id": "6ff7b48699e265bde067f8820b60f372a6bfb358",
"size": "1514",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "node_modules/angular2/node_modules/@reactivex/rxjs/dist/es6/operators/window.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2143"
},
{
"name": "HTML",
"bytes": "15744"
},
{
"name": "JavaScript",
"bytes": "288352"
},
{
"name": "TypeScript",
"bytes": "18086"
}
],
"symlink_target": ""
} |
import React, { Component } from "react";
import { Checkbox } from "@patternfly/react-core";
import AddressesComponent from "../common/addressesComponent";
import PropTypes from "prop-types";
class OptionsComponent extends Component {
static propTypes = {
isRate: PropTypes.bool.isRequired,
handleChangeOption: PropTypes.func.isRequired,
byAddress: PropTypes.bool.isRequired,
addresses: PropTypes.object.isRequired,
addressColors: PropTypes.object.isRequired,
handleChangeAddress: PropTypes.func.isRequired,
handleHoverAddress: PropTypes.func.isRequired
};
constructor(props) {
super(props);
this.state = {};
}
render() {
const addressInfo = {};
for (const address in this.props.addressColors) {
addressInfo[address] = {
color: this.props.addressColors[address],
checked: this.props.addresses[address]
};
}
return (
<React.Fragment>
<Checkbox
label="Show rates"
isChecked={this.props.isRate}
onChange={this.props.handleChangeOption}
aria-label="show rates"
id="check-rates"
name="isRate"
/>
<Checkbox
label="Show by address"
isChecked={this.props.byAddress}
onChange={this.props.handleChangeOption}
aria-label="show by address"
id="check-address"
name="byAddress"
/>
{this.props.byAddress && (
<div className="chord-addresses">
<AddressesComponent
addressColors={addressInfo}
handleChangeAddress={this.props.handleChangeAddress}
handleHoverAddress={this.props.handleHoverAddress}
/>
</div>
)}
</React.Fragment>
);
}
}
export default OptionsComponent;
| {
"content_hash": "47e57a3d279792c05a3d7df3a94f32c9",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 66,
"avg_line_length": 28.421875,
"alnum_prop": 0.6239692138537658,
"repo_name": "kgiusti/dispatch",
"id": "a56e037c1384e986e0b552578d7ca723319735fb",
"size": "2579",
"binary": false,
"copies": "11",
"ref": "refs/heads/main",
"path": "console/react/src/chord/optionsComponent.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "2348012"
},
{
"name": "C++",
"bytes": "549820"
},
{
"name": "CMake",
"bytes": "54770"
},
{
"name": "CSS",
"bytes": "49129"
},
{
"name": "Dockerfile",
"bytes": "3323"
},
{
"name": "HTML",
"bytes": "2320"
},
{
"name": "JavaScript",
"bytes": "734276"
},
{
"name": "Python",
"bytes": "2571746"
},
{
"name": "Shell",
"bytes": "34107"
}
],
"symlink_target": ""
} |
#if defined(_MSC_VER)
#define NOMINMAX
#pragma once
#endif
#ifndef PBRT_CORE_INTERACTION_H
#define PBRT_CORE_INTERACTION_H
// core/interaction.h*
#include "pbrt.h"
#include "geometry.h"
#include "transform.h"
#include "medium.h"
#include "material.h"
// Interaction Declarations
struct Interaction {
// Interaction Public Methods
Interaction() : time(0) {}
Interaction(const Point3f &p, const Normal3f &n, const Vector3f &pError,
const Vector3f &wo, Float time,
const MediumInterface &mediumInterface)
: p(p),
time(time),
pError(pError),
wo(Normalize(wo)),
n(n),
mediumInterface(mediumInterface) {}
bool IsSurfaceInteraction() const { return n != Normal3f(); }
Ray SpawnRay(const Vector3f &d) const {
Point3f o = OffsetRayOrigin(p, pError, n, d);
return Ray(o, d, Infinity, time, GetMedium(d));
}
Ray SpawnRayTo(const Point3f &p2) const {
Point3f origin = OffsetRayOrigin(p, pError, n, p2 - p);
Vector3f d = p2 - p;
return Ray(origin, d, 1 - ShadowEpsilon, time, GetMedium(d));
}
Ray SpawnRayTo(const Interaction &it) const {
Point3f origin = OffsetRayOrigin(p, pError, n, it.p - p);
Point3f target = OffsetRayOrigin(it.p, it.pError, it.n, origin - it.p);
Vector3f d = target - origin;
return Ray(origin, d, 1 - ShadowEpsilon, time, GetMedium(d));
}
Interaction(const Point3f &p, const Vector3f &wo, Float time,
const MediumInterface &mediumInterface)
: p(p), time(time), wo(wo), mediumInterface(mediumInterface) {}
Interaction(const Point3f &p, Float time,
const MediumInterface &mediumInterface)
: p(p), time(time), mediumInterface(mediumInterface) {}
bool IsMediumInteraction() const { return !IsSurfaceInteraction(); }
const Medium *GetMedium(const Vector3f &w) const {
return Dot(w, n) > 0 ? mediumInterface.outside : mediumInterface.inside;
}
const Medium *GetMedium() const {
Assert(mediumInterface.inside == mediumInterface.outside);
return mediumInterface.inside;
}
// Interaction Public Data
Point3f p;
Float time;
Vector3f pError;
Vector3f wo;
Normal3f n;
MediumInterface mediumInterface;
};
class MediumInteraction : public Interaction {
public:
// MediumInteraction Public Methods
MediumInteraction() : phase(nullptr) {}
MediumInteraction(const Point3f &p, const Vector3f &wo, Float time,
const Medium *medium, const PhaseFunction *phase)
: Interaction(p, wo, time, medium), phase(phase) {}
bool IsValid() const { return phase != nullptr; }
// MediumInteraction Public Data
const PhaseFunction *phase;
};
// SurfaceInteraction Declarations
class SurfaceInteraction : public Interaction {
public:
// SurfaceInteraction Public Methods
SurfaceInteraction() {}
SurfaceInteraction(const Point3f &p, const Vector3f &pError,
const Point2f &uv, const Vector3f &wo,
const Vector3f &dpdu, const Vector3f &dpdv,
const Normal3f &dndu, const Normal3f &dndv, Float time,
const Shape *sh);
void SetShadingGeometry(const Vector3f &dpdu, const Vector3f &dpdv,
const Normal3f &dndu, const Normal3f &dndv,
bool orientationIsAuthoritative);
void ComputeScatteringFunctions(
const RayDifferential &ray, MemoryArena &arena,
bool allowMultipleLobes = false,
TransportMode mode = TransportMode::Radiance);
void ComputeDifferentials(const RayDifferential &r) const;
Spectrum Le(const Vector3f &w) const;
// SurfaceInteraction Public Data
Point2f uv;
Vector3f dpdu, dpdv;
Normal3f dndu, dndv;
const Shape *shape = nullptr;
struct {
Normal3f n;
Vector3f dpdu, dpdv;
Normal3f dndu, dndv;
} shading;
const Primitive *primitive = nullptr;
BSDF *bsdf = nullptr;
BSSRDF *bssrdf = nullptr;
mutable Vector3f dpdx, dpdy;
mutable Float dudx = 0, dvdx = 0, dudy = 0, dvdy = 0;
};
#endif // PBRT_CORE_INTERACTION_H
| {
"content_hash": "a3a0f6ad10c0a6536426d9e6e9e4ead0",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 80,
"avg_line_length": 34.942622950819676,
"alnum_prop": 0.6389866291344124,
"repo_name": "ambakshi/pbrt-v3",
"id": "6df301d405312b33b3c28d49682cb3c277176534",
"size": "5736",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/core/interaction.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "733122"
},
{
"name": "C++",
"bytes": "5322721"
},
{
"name": "CMake",
"bytes": "7937"
},
{
"name": "LLVM",
"bytes": "6635"
},
{
"name": "Python",
"bytes": "71115"
},
{
"name": "Yacc",
"bytes": "22723"
}
],
"symlink_target": ""
} |
package org.dcm4chee.xds.common.infoset;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AuditableEventQueryType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AuditableEventQueryType">
* <complexContent>
* <extension base="{urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0}RegistryObjectQueryType">
* <sequence>
* <element name="AffectedObjectQuery" type="{urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0}RegistryObjectQueryType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="EventTypeQuery" type="{urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0}ClassificationNodeQueryType" minOccurs="0"/>
* <element name="UserQuery" type="{urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0}UserQueryType" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AuditableEventQueryType", namespace = "urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0", propOrder = {
"affectedObjectQuery",
"eventTypeQuery",
"userQuery"
})
public class AuditableEventQueryType
extends RegistryObjectQueryType
{
@XmlElement(name = "AffectedObjectQuery")
protected List<RegistryObjectQueryType> affectedObjectQuery;
@XmlElement(name = "EventTypeQuery")
protected ClassificationNodeQueryType eventTypeQuery;
@XmlElement(name = "UserQuery")
protected UserQueryType userQuery;
/**
* Gets the value of the affectedObjectQuery property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the affectedObjectQuery property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getAffectedObjectQuery().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link RegistryObjectQueryType }
*
*
*/
public List<RegistryObjectQueryType> getAffectedObjectQuery() {
if (affectedObjectQuery == null) {
affectedObjectQuery = new ArrayList<RegistryObjectQueryType>();
}
return this.affectedObjectQuery;
}
/**
* Gets the value of the eventTypeQuery property.
*
* @return
* possible object is
* {@link ClassificationNodeQueryType }
*
*/
public ClassificationNodeQueryType getEventTypeQuery() {
return eventTypeQuery;
}
/**
* Sets the value of the eventTypeQuery property.
*
* @param value
* allowed object is
* {@link ClassificationNodeQueryType }
*
*/
public void setEventTypeQuery(ClassificationNodeQueryType value) {
this.eventTypeQuery = value;
}
/**
* Gets the value of the userQuery property.
*
* @return
* possible object is
* {@link UserQueryType }
*
*/
public UserQueryType getUserQuery() {
return userQuery;
}
/**
* Sets the value of the userQuery property.
*
* @param value
* allowed object is
* {@link UserQueryType }
*
*/
public void setUserQuery(UserQueryType value) {
this.userQuery = value;
}
}
| {
"content_hash": "2cb78903f52f106f9ee6906882bc332d",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 165,
"avg_line_length": 29.913385826771652,
"alnum_prop": 0.6496446433271914,
"repo_name": "medicayun/medicayundicom",
"id": "e1bdf7252efe578aab8c833753fec3422b188fac",
"size": "3799",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "dcm4chee-xds/tags/DCM4CHEE_XDS_0_0_2_SNAPSHOT_TEST_STORAGE/dcm4chee-xds-common/src/main/java/org/dcm4chee/xds/common/infoset/AuditableEventQueryType.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.apache.cassandra.db;
import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.Iterator;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.concurrent.ConcurrentSkipListMap;
import org.apache.cassandra.db.marshal.AbstractType;
import org.apache.cassandra.utils.Allocator;
public class ThreadSafeSortedColumns extends ConcurrentSkipListMap<ByteBuffer, IColumn> implements ISortedColumns
{
public static final ISortedColumns.Factory factory = new Factory()
{
public ISortedColumns create(AbstractType<?> comparator, boolean insertReversed)
{
return new ThreadSafeSortedColumns(comparator);
}
public ISortedColumns fromSorted(SortedMap<ByteBuffer, IColumn> sortedMap, boolean insertReversed)
{
return new ThreadSafeSortedColumns(sortedMap);
}
};
public static ISortedColumns.Factory factory()
{
return factory;
}
public AbstractType<?> getComparator()
{
return (AbstractType)comparator();
}
private ThreadSafeSortedColumns(AbstractType<?> comparator)
{
super(comparator);
}
private ThreadSafeSortedColumns(SortedMap<ByteBuffer, IColumn> columns)
{
super(columns);
}
public ISortedColumns.Factory getFactory()
{
return factory();
}
public ISortedColumns cloneMe()
{
return new ThreadSafeSortedColumns(this);
}
public boolean isInsertReversed()
{
return false;
}
/*
* If we find an old column that has the same name
* the ask it to resolve itself else add the new column
*/
public void addColumn(IColumn column, Allocator allocator)
{
ByteBuffer name = column.name();
IColumn oldColumn;
while ((oldColumn = putIfAbsent(name, column)) != null)
{
if (oldColumn instanceof SuperColumn)
{
assert column instanceof SuperColumn;
((SuperColumn) oldColumn).putColumn((SuperColumn)column, allocator);
break; // Delegated to SuperColumn
}
else
{
// calculate reconciled col from old (existing) col and new col
IColumn reconciledColumn = column.reconcile(oldColumn, allocator);
if (replace(name, oldColumn, reconciledColumn))
break;
// We failed to replace column due to a concurrent update or a concurrent removal. Keep trying.
// (Currently, concurrent removal should not happen (only updates), but let us support that anyway.)
}
}
}
/**
* We need to go through each column in the column container and resolve it before adding
*/
public void addAll(ISortedColumns cm, Allocator allocator)
{
for (IColumn column : cm.getSortedColumns())
addColumn(column, allocator);
}
public boolean replace(IColumn oldColumn, IColumn newColumn)
{
if (!oldColumn.name().equals(newColumn.name()))
throw new IllegalArgumentException();
return replace(oldColumn.name(), oldColumn, newColumn);
}
public IColumn getColumn(ByteBuffer name)
{
return get(name);
}
public void removeColumn(ByteBuffer name)
{
remove(name);
}
public Collection<IColumn> getSortedColumns()
{
return values();
}
public Collection<IColumn> getReverseSortedColumns()
{
return descendingMap().values();
}
public SortedSet<ByteBuffer> getColumnNames()
{
return keySet();
}
public int getEstimatedColumnCount()
{
return size();
}
public Iterator<IColumn> iterator()
{
return values().iterator();
}
public Iterator<IColumn> reverseIterator()
{
return getReverseSortedColumns().iterator();
}
}
| {
"content_hash": "cd2c9a1470b4ebd4f37a8b08f80373b2",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 116,
"avg_line_length": 26.59731543624161,
"alnum_prop": 0.6320968962906889,
"repo_name": "shookari/cassandra",
"id": "1b2f9d3fd5e2af944f39669f541bccbd004baf3d",
"size": "4769",
"binary": false,
"copies": "5",
"ref": "refs/heads/cassandra-1.0",
"path": "src/java/org/apache/cassandra/db/ThreadSafeSortedColumns.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "GAP",
"bytes": "36822"
},
{
"name": "Java",
"bytes": "5797531"
},
{
"name": "PigLatin",
"bytes": "2449"
},
{
"name": "Python",
"bytes": "243836"
},
{
"name": "Shell",
"bytes": "64358"
},
{
"name": "Thrift",
"bytes": "29664"
}
],
"symlink_target": ""
} |
from __future__ import absolute_import, division, print_function
from collections import namedtuple
from itertools import starmap
from timeit import default_timer
from time import sleep
from multiprocessing import Process, Pipe, current_process
from ..callbacks import Callback
from ..utils import import_required
# Stores execution data for each task
TaskData = namedtuple('TaskData', ('key', 'task', 'start_time',
'end_time', 'worker_id'))
class Profiler(Callback):
"""A profiler for dask execution at the task level.
Records the following information for each task:
1. Key
2. Task
3. Start time in seconds since the epoch
4. Finish time in seconds since the epoch
5. Worker id
Examples
--------
>>> from operator import add, mul
>>> from dask.threaded import get
>>> dsk = {'x': 1, 'y': (add, 'x', 10), 'z': (mul, 'y', 2)}
>>> with Profiler() as prof:
... get(dsk, 'z')
22
>>> prof.results # doctest: +SKIP
[('y', (add, 'x', 10), 1435352238.48039, 1435352238.480655, 140285575100160),
('z', (mul, 'y', 2), 1435352238.480657, 1435352238.480803, 140285566707456)]
These results can be visualized in a bokeh plot using the ``visualize``
method. Note that this requires bokeh to be installed.
>>> prof.visualize() # doctest: +SKIP
You can activate the profiler globally
>>> prof.register() # doctest: +SKIP
If you use the profiler globally you will need to clear out old results
manually.
>>> prof.clear()
"""
def __init__(self):
self._results = {}
self.results = []
self._dsk = {}
def __enter__(self):
self.clear()
return super(Profiler, self).__enter__()
def _start(self, dsk):
self._dsk.update(dsk)
def _pretask(self, key, dsk, state):
start = default_timer()
self._results[key] = (key, dsk[key], start)
def _posttask(self, key, value, dsk, state, id):
end = default_timer()
self._results[key] += (end, id)
def _finish(self, dsk, state, failed):
results = dict((k, v) for k, v in self._results.items() if len(v) == 5)
self.results += list(starmap(TaskData, results.values()))
self._results.clear()
def _plot(self, **kwargs):
from .profile_visualize import plot_tasks
return plot_tasks(self.results, self._dsk, **kwargs)
def visualize(self, **kwargs):
"""Visualize the profiling run in a bokeh plot.
See also
--------
dask.diagnostics.profile_visualize.visualize
"""
from .profile_visualize import visualize
return visualize(self, **kwargs)
def clear(self):
"""Clear out old results from profiler"""
self._results.clear()
del self.results[:]
self._dsk = {}
ResourceData = namedtuple('ResourceData', ('time', 'mem', 'cpu'))
class ResourceProfiler(Callback):
"""A profiler for resource use.
Records the following each timestep
1. Time in seconds since the epoch
2. Memory usage in MB
3. % CPU usage
Examples
--------
>>> from operator import add, mul
>>> from dask.threaded import get
>>> dsk = {'x': 1, 'y': (add, 'x', 10), 'z': (mul, 'y', 2)}
>>> with ResourceProfiler() as prof: # doctest: +SKIP
... get(dsk, 'z')
22
These results can be visualized in a bokeh plot using the ``visualize``
method. Note that this requires bokeh to be installed.
>>> prof.visualize() # doctest: +SKIP
You can activate the profiler globally
>>> prof.register() # doctest: +SKIP
If you use the profiler globally you will need to clear out old results
manually.
>>> prof.clear() # doctest: +SKIP
"""
def __init__(self, dt=1):
self._tracker = _Tracker(dt)
self._tracker.start()
self.results = []
self._entered = False
def _start_collect(self):
assert self._tracker.is_alive(), "Resource tracker is shutdown"
self._tracker.parent_conn.send('collect')
def _stop_collect(self):
if self._tracker.is_alive():
self._tracker.parent_conn.send('send_data')
self.results.extend(starmap(ResourceData, self._tracker.parent_conn.recv()))
def __enter__(self):
self.clear()
self._entered = True
self._start_collect()
return super(ResourceProfiler, self).__enter__()
def __exit__(self, *args):
self._entered = False
self._stop_collect()
super(ResourceProfiler, self).__exit__(*args)
def _start(self, dsk):
self._start_collect()
def _finish(self, dsk, state, failed):
if not self._entered:
self._stop_collect()
def close(self):
"""Shutdown the resource tracker process"""
self._tracker.shutdown()
__del__ = close
def clear(self):
self.results = []
def _plot(self, **kwargs):
from .profile_visualize import plot_resources
return plot_resources(self.results, **kwargs)
def visualize(self, **kwargs):
"""Visualize the profiling run in a bokeh plot.
See also
--------
dask.diagnostics.profile_visualize.visualize
"""
from .profile_visualize import visualize
return visualize(self, **kwargs)
class _Tracker(Process):
"""Background process for tracking resource usage"""
def __init__(self, dt=1):
psutil = import_required("psutil", "Tracking resource usage requires "
"`psutil` to be installed")
Process.__init__(self)
self.daemon = True
self.dt = dt
self.parent = psutil.Process(current_process().pid)
self.parent_conn, self.child_conn = Pipe()
def shutdown(self):
if not self.parent_conn.closed:
self.parent_conn.send('shutdown')
self.parent_conn.close()
self.join()
def _update_pids(self, pid):
return [self.parent] + [p for p in self.parent.children()
if p.pid != pid and p.status() != 'zombie']
def run(self):
pid = current_process()
ps = self._update_pids(pid)
data = []
while True:
try:
msg = self.child_conn.recv()
except KeyboardInterrupt:
continue
if msg == 'shutdown':
break
elif msg == 'collect':
ps = self._update_pids(pid)
while not self.child_conn.poll():
tic = default_timer()
mem = sum(p.memory_info().rss for p in ps) / 1e6
cpu = sum(p.cpu_percent() for p in ps)
data.append((tic, mem, cpu))
sleep(self.dt)
elif msg == 'send_data':
self.child_conn.send(data)
data = []
self.child_conn.close()
CacheData = namedtuple('CacheData', ('key', 'task', 'metric', 'cache_time',
'free_time'))
class CacheProfiler(Callback):
"""A profiler for dask execution at the scheduler cache level.
Records the following information for each task:
1. Key
2. Task
3. Size metric
4. Cache entry time in seconds since the epoch
5. Cache exit time in seconds since the epoch
Examples
--------
>>> from operator import add, mul
>>> from dask.threaded import get
>>> dsk = {'x': 1, 'y': (add, 'x', 10), 'z': (mul, 'y', 2)}
>>> with CacheProfiler() as prof:
... get(dsk, 'z')
22
>>> prof.results # doctest: +SKIP
[CacheData('y', (add, 'x', 10), 1, 1435352238.48039, 1435352238.480655),
CacheData('z', (mul, 'y', 2), 1, 1435352238.480657, 1435352238.480803)]
The default is to count each task (``metric`` is 1 for all tasks). Other
functions may used as a metric instead through the ``metric`` keyword. For
example, the ``nbytes`` function found in ``cachey`` can be used to measure
the number of bytes in the cache.
>>> from cachey import nbytes # doctest: +SKIP
>>> with CacheProfiler(metric=nbytes) as prof: # doctest: +SKIP
... get(dsk, 'z')
The profiling results can be visualized in a bokeh plot using the
``visualize`` method. Note that this requires bokeh to be installed.
>>> prof.visualize() # doctest: +SKIP
You can activate the profiler globally
>>> prof.register() # doctest: +SKIP
If you use the profiler globally you will need to clear out old results
manually.
>>> prof.clear()
"""
def __init__(self, metric=None, metric_name=None):
self._metric = metric if metric else lambda value: 1
if metric_name:
self._metric_name = metric_name
elif metric:
self._metric_name = metric.__name__
else:
self._metric_name = 'count'
def __enter__(self):
self.clear()
return super(CacheProfiler, self).__enter__()
def _start(self, dsk):
self._dsk.update(dsk)
if not self._start_time:
self._start_time = default_timer()
def _posttask(self, key, value, dsk, state, id):
t = default_timer()
self._cache[key] = (self._metric(value), t)
for k in state['released'].intersection(self._cache):
metric, start = self._cache.pop(k)
self.results.append(CacheData(k, dsk[k], metric, start, t))
def _finish(self, dsk, state, failed):
t = default_timer()
for k, (metric, start) in self._cache.items():
self.results.append(CacheData(k, dsk[k], metric, start, t))
self._cache.clear()
def _plot(self, **kwargs):
from .profile_visualize import plot_cache
return plot_cache(self.results, self._dsk, self._start_time,
self._metric_name, **kwargs)
def visualize(self, **kwargs):
"""Visualize the profiling run in a bokeh plot.
See also
--------
dask.diagnostics.profile_visualize.visualize
"""
from .profile_visualize import visualize
return visualize(self, **kwargs)
def clear(self):
"""Clear out old results from profiler"""
self.results = []
self._cache = {}
self._dsk = {}
self._start_time = None
| {
"content_hash": "d5f2da82b0f2adf5da4e6bddd1ccf958",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 88,
"avg_line_length": 30.469565217391306,
"alnum_prop": 0.5716324200913242,
"repo_name": "chrisbarber/dask",
"id": "8690defb7b0b76dee618feb831d55ffe0d8e5ff1",
"size": "10512",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "dask/diagnostics/profile.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "4934"
},
{
"name": "Python",
"bytes": "1737672"
}
],
"symlink_target": ""
} |
local skynet = require "skynet"
local cluster = require "skynet.cluster"
skynet.start(function()
local proxy = cluster.proxy "db@sdb" -- cluster.proxy("db", "@sdb")
local largekey = string.rep("X", 128*1024)
local largevalue = string.rep("R", 100 * 1024)
skynet.call(proxy, "lua", "SET", largekey, largevalue)
local v = skynet.call(proxy, "lua", "GET", largekey)
assert(largevalue == v)
skynet.send(proxy, "lua", "PING", "proxy")
skynet.fork(function()
--skynet.trace("cluster")
print(cluster.call("db", "@sdb", "GET", "a"))
print(cluster.call("db2", "@sdb", "GET", "b"))
cluster.send("db2", "@sdb", "PING", "db2:longstring" .. largevalue)
end)
--临时关闭sender 可以自动重连
cluster.close_sender("db")
-- test snax service
skynet.timeout(300,function()
cluster.reload {
db = false, -- db is down
db3 = "127.0.0.1:2529"
}
print(pcall(cluster.call, "db", "@sdb", "GET", "a")) -- db is down
end)
cluster.reload { __nowaiting = false }
local pingserver = cluster.snax("db3", "pingserver")
print(pingserver.req.ping "hello")
end)
| {
"content_hash": "0f1d51a42294c5a44b709e2ea48d902b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 69,
"avg_line_length": 32,
"alnum_prop": 0.6496212121212122,
"repo_name": "wangyi0226/skynet",
"id": "fad1279c275d2d0292683cffb4f28a4f9711a739",
"size": "1076",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/cluster2.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1581419"
},
{
"name": "C++",
"bytes": "191"
},
{
"name": "HTML",
"bytes": "57977"
},
{
"name": "Lua",
"bytes": "574137"
},
{
"name": "Makefile",
"bytes": "14208"
},
{
"name": "SourcePawn",
"bytes": "56"
}
],
"symlink_target": ""
} |
class Birt::Core::Property < Birt::Core::BaseReport
attr_accessor :name
attr_accessor :text
def initialize(x_ele)
super(x_ele) do
self.name = x_ele.attribute(:name).value
self.text = x_ele.text
end
yield(self) if block_given?
end
end | {
"content_hash": "146fce07e4316401edd3652a7ddb1ec6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 51,
"avg_line_length": 17.933333333333334,
"alnum_prop": 0.6505576208178439,
"repo_name": "mumaoxi/birt",
"id": "367709a8a0a5bfb9cf75d07918b30c37e1dd9d66",
"size": "269",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/birt/core/table/property.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7831"
},
{
"name": "HTML",
"bytes": "898"
},
{
"name": "JavaScript",
"bytes": "5622"
},
{
"name": "Ruby",
"bytes": "22210"
}
],
"symlink_target": ""
} |
Project templates for experiments, static HTML5 sites, and WordPress theme development. | {
"content_hash": "6ad729a93c47bc2c5660d0d550613a85",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 87,
"avg_line_length": 87,
"alnum_prop": 0.8505747126436781,
"repo_name": "Mattyvac/Templates",
"id": "c184679edb448112fc011ad04dca1360f6454743",
"size": "87",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
This example illustrates usage of flatten-js library in a browser.
It works "as is" without transpiling in most of the modern browsers.
Project uses https://unpkg tool to deliver the package from npm.
Unpkg assigns package to the **window** global scope under the name ```@flatten-js/core```,
from where the namespace ```Flatten``` may be destructed.
## Usage
Move index.html file into browser and see svg graphics created
## Known issues
Does not work in IE.
## Credits
All credits to the [Turf](https://github.com/Turfjs/turf/blob/master/examples/es-modules/index.html) project,
where the idea of this code was forked.
| {
"content_hash": "9a776a4ea701b99f00011f1769f9dff0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 109,
"avg_line_length": 34.888888888888886,
"alnum_prop": 0.7579617834394905,
"repo_name": "alexbol99/flatten-js",
"id": "7ec748661047ce0bb40d6266758958b8b1615876",
"size": "664",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/browser/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "437284"
}
],
"symlink_target": ""
} |
using Microsoft.AspNet.Mvc;
namespace Library.WebApi
{
[AllowAnonymous]
public class VersionController : Controller
{
[HttpGet, Produces(typeof(string))]
public IActionResult Get()
{
return new ObjectResult( Service.Version );
}
}
}
| {
"content_hash": "2bbd97b04f1e0537d6153ff55e44bab8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 55,
"avg_line_length": 20.214285714285715,
"alnum_prop": 0.6395759717314488,
"repo_name": "zhangxin511/vNextLibraryReferenceExample",
"id": "6231e86b908f2abe509f848ade7049970ab0ad57",
"size": "285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/SampleWebApi/Controllers/VersionController.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "95442"
},
{
"name": "HTML",
"bytes": "7575"
}
],
"symlink_target": ""
} |
<?php
namespace lithium\tests\mocks\data\source\mongo_db;
class MockResult extends \lithium\data\source\Result {
protected $_data = array(
array('_id' => '4c8f86167675abfabdbf0300', 'title' => 'bar'),
array('_id' => '5c8f86167675abfabdbf0301', 'title' => 'foo'),
array('_id' => '6c8f86167675abfabdbf0302', 'title' => 'dib')
);
protected $_init = false;
protected $_autoConfig = array('data', 'name');
protected $_name = '';
public $query = array();
public function hasNext() {
return ($this->_iterator < count($this->_data));
}
public function getNext() {
$this->_fetchFromResource();
return $this->_current;
}
/**
* Fetches the result from the resource and caches it.
*
* @return boolean Return `true` on success or `false` if it is not valid.
*/
protected function _fetchFromResource() {
if ($this->_iterator < count($this->_data)) {
$result = current($this->_data);
$this->_key = $this->_iterator;
$this->_current = $this->_cache[$this->_iterator++] = $result;
next($this->_data);
return true;
}
return false;
}
public function getName() {
return $this->_name;
}
protected function _close() {
}
public function fields(array $fields = array()) {
$this->query[__FUNCTION__] = $fields;
return $this;
}
public function limit($num) {
$this->query[__FUNCTION__] = $num;
return $this;
}
public function skip($num) {
$this->query[__FUNCTION__] = $num;
return $this;
}
public function sort(array $fields = array()) {
$this->query[__FUNCTION__] = $fields;
return $this;
}
public function count() {
return reset($this->_data);
}
}
?> | {
"content_hash": "25aa89d751fea9c929c1bd65b65ca978",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 75,
"avg_line_length": 20.658227848101266,
"alnum_prop": 0.6231617647058824,
"repo_name": "pixelcog/lithium",
"id": "e319e9dc349eaab6df203812ac2cda8c6ac5a376",
"size": "1835",
"binary": false,
"copies": "2",
"ref": "refs/heads/dev",
"path": "tests/mocks/data/source/mongo_db/MockResult.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "2974152"
},
{
"name": "Shell",
"bytes": "549"
}
],
"symlink_target": ""
} |
/**
* @author Ashwin Hariharan
* @Details App execution starts from here. One of the entry points to begin execution. Renders the main app component.
*/
define(
[
'react',
'reactDom',
'jquery',
'./common-functions',
'./components/ui-elements'
],
function(React, ReactDOM, $, commonFunctions, UIElements) {
ReactDOM.render(<UIElements />, document.getElementById('ui-container'));
commonFunctions.initialize().bootstrapTooltips("[data-toggle='tooltip']");
}
) | {
"content_hash": "59274a627504e96632546684b84f2f42",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 119,
"avg_line_length": 29.263157894736842,
"alnum_prop": 0.6061151079136691,
"repo_name": "anbarasimanoharan/FocusDashboard",
"id": "75b51144a910abcaf6020e9fe1bccbf30e20e86e",
"size": "556",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "reactjs-adminlte/public/src/ui-elements/general/js/main.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "648576"
},
{
"name": "HTML",
"bytes": "1785324"
},
{
"name": "JavaScript",
"bytes": "6289623"
},
{
"name": "PHP",
"bytes": "1742"
}
],
"symlink_target": ""
} |
package atunit.easymock;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import org.easymock.EasyMock;
import atunit.Mock;
import atunit.Stub;
import atunit.core.MockFramework;
public class EasyMockFramework implements MockFramework {
public Map<Field, Object> getValues(Field[] fields) throws Exception {
Map<Field,Object> mocksAndStubs = new HashMap<Field,Object>();
for ( Field field : fields ) {
if ( field.getAnnotation(Mock.class) != null ) {
mocksAndStubs.put(field, EasyMock.createStrictMock(field.getType()));
} else if ( field.getAnnotation(Stub.class) != null ) {
mocksAndStubs.put(field, EasyMock.createNiceMock(field.getType()));
}
}
return mocksAndStubs;
}
}
| {
"content_hash": "1440f68f24ed1375c79046a620f5076b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 73,
"avg_line_length": 24.032258064516128,
"alnum_prop": 0.7315436241610739,
"repo_name": "loganj/atunit",
"id": "2296af07c6436a910048611bba6e20d18fff5b6a",
"size": "1342",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/atunit/easymock/EasyMockFramework.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "68770"
}
],
"symlink_target": ""
} |
package org.gradle.internal.classloader;
import java.io.Serializable;
/**
* An immutable description of a ClassLoader hierarchy that can be used to recreate the hierarchy in a different process.
*
* Subclasses should implement equals() and hashCode(), so that the spec can be used as a hashmap key.
*/
public abstract class ClassLoaderSpec implements Serializable {
public static final ClassLoaderSpec SYSTEM_CLASS_LOADER = new SystemClassLoaderSpec();
private static class SystemClassLoaderSpec extends ClassLoaderSpec {
@Override
public boolean equals(Object obj) {
return obj != null && obj.getClass().equals(getClass());
}
@Override
public String toString() {
return "system";
}
@Override
public int hashCode() {
return 121;
}
}
}
| {
"content_hash": "61923888369c0d3d9533b9ea3873705b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 121,
"avg_line_length": 27.93548387096774,
"alnum_prop": 0.6616628175519631,
"repo_name": "Pushjet/Pushjet-Android",
"id": "8b96204b0a4e8454e25cc25f7a7c394e20eb15eb",
"size": "1481",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "gradle/wrapper/dists/gradle-2.2.1-all/c64ydeuardnfqctvr1gm30w53/gradle-2.2.1/src/base-services/org/gradle/internal/classloader/ClassLoaderSpec.java",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "92331"
}
],
"symlink_target": ""
} |
<?php
namespace RdnDatabase;
use Zend\ModuleManager\ModuleManager;
class Module
{
public function getConfig()
{
return include __DIR__ .'/../../config/module.config.php';
}
public function init(ModuleManager $modules)
{
$modules->loadModule('RdnFactory');
}
}
| {
"content_hash": "9b79fa4e8fb64f751a7bff34cb99a38f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 60,
"avg_line_length": 15.222222222222221,
"alnum_prop": 0.7007299270072993,
"repo_name": "radnan/rdn-database",
"id": "20fc1d1137879345b312e62e6c0c69e8e1d9e333",
"size": "274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/RdnDatabase/Module.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "6232"
}
],
"symlink_target": ""
} |
Based on PHP5.6 + mysql5.5 + Apache
Powered by CodeIgniter
## Contributors
liuwenhanchen
zhangjiaheng | {
"content_hash": "c13fd2ff0c68d7bb3435224e1fdfc74f",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 37,
"avg_line_length": 21.4,
"alnum_prop": 0.7663551401869159,
"repo_name": "Illyrix/MeiBaiE",
"id": "84e02d27077c179084730929d26daaf30e1876b5",
"size": "133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "443"
},
{
"name": "CSS",
"bytes": "7039"
},
{
"name": "HTML",
"bytes": "22724"
},
{
"name": "JavaScript",
"bytes": "265"
},
{
"name": "PHP",
"bytes": "1784035"
}
],
"symlink_target": ""
} |
static NSString* const kInterestFeedSubendpoint = @"interestFeed";
static NSString* const kOwnedCollectionsSubendpoint = @"ownedCollections";
static NSString* const kSourceSettingsEndpoint = @"settings/sources";
static NSString* const kFollowingSubendpoint = @"following";
static NSString* const kLikingSubendpoint = @"liking";
static NSString* const kFollowersSubendpoint = @"followers";
static NSString* const kSuggestedSubendpoint = @"suggested";
static NSString* const kSetImageSubendpoint = @"uploadImage";
static NSString* const kSetPasswordSubendpoint = @"updatePassword";
//static NSString* const kFollowedCollectionsSubendpoint = @"followed";
static NSString* const kSuggestedRootSubendpoint = @"suggested";
static NSString* const kForgotUsernameRootSubendpoint = @"forgotusername";
static NSString* const kForgotPasswordRootSubendpoint = @"forgotpassword";
@implementation MHUser
@dynamic metadata;
+ (void)load
{
[self registerMHObject];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(userDidLogout:)
name:MHLoginSessionUserDidLogoutNotification
object:nil];
}
@declare_class_property (mhidPrefix, @"mhusr")
@declare_class_property (rootEndpoint, @"graph/user")
- (BOOL)isCurrentUser
{
return ([self isEqualToMHObject:[MHLoginSession currentUser]]);
}
- (AnyPromise*)setProfileImage:(UIImage*)image
{
if (!image) {
return [AnyPromise promiseWithValue:nil];
}
if (!self.isCurrentUser) {
@throw [NSException exceptionWithName:@"Cannot change the profile image"
reason:@"Only allowed to change the profile image of the currently logged in user."
userInfo:nil];
}
image = [MHUser imageBySqauareCroppingImage:image];
NSData* imageData = UIImageJPEGRepresentation(image, 1.0f);
return [[MHFetcher sharedFetcher] postAndFetchModel:MHImage.class
path:[self subendpoint:kSetImageSubendpoint]
keyPath:@"primaryImage"
parameters:nil
constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileData:imageData
name:@"data"
fileName:@"data"
mimeType:@"image/jpeg"];
}].thenInBackground(^(MHImage* primaryImage) {
if (![self.primaryImage isEqualToMHObject:primaryImage]) {
self.primaryImage = primaryImage;
}
return self.primaryImage;
});
}
- (AnyPromise*)setPassword:(NSString*)newPassword
currentPassword:(NSString*)currentPassword
{
if (!self.isCurrentUser) {
@throw [NSException exceptionWithName:@"Cannot change the password"
reason:@"Only allowed to change the password of the currently logged in user."
userInfo:nil];
}
return [[AVENetworkManager sharedManager] POST:[self subendpoint:kSetPasswordSubendpoint]
parameters:@{
@"oldPassword": currentPassword,
@"newPassword": newPassword
}
priority:nil
networkToken:nil
builder:[MHFetcher sharedFetcher].builder];
}
#pragma mark - Image Cropping
+ (UIImage*)imageBySqauareCroppingImage:(UIImage*)image
{
const CGSize size = image.size;
if (size.width == size.height) {
// If the image is already square, just return it.
return image;
}
else {
const CGRect originalRect = CGRectMake(0, 0, size.width, size.height);
CGRect squareRect;
// Center around the center of the image.
if (size.width > size.height) {
squareRect = CGRectInset(originalRect, (size.width - size.height) / 2.0f, 0);
}
else {
squareRect = CGRectInset(originalRect, 0, (size.height - size.width) / 2.0f);
}
squareRect.origin.x = floor(squareRect.origin.x);
squareRect.origin.y = floor(squareRect.origin.y);
CGImageRef squareImageRef = CGImageCreateWithImageInRect(image.CGImage, squareRect);
UIImage* squareImage = [UIImage imageWithCGImage:squareImageRef];
CGImageRelease(squareImageRef);
return squareImage;
}
}
#pragma mark - Notifications
+ (void)userDidLogout:(NSNotification*)notification
{
[self invalidateRootCacheForEndpoint:[self rootSubendpoint:kSuggestedRootSubendpoint]
parameters:nil];
}
@end
@implementation MHUser (Creating)
+ (AnyPromise*)createWithUsername:(NSString*)username
password:(NSString*)password
email:(NSString*)email
firstName:(NSString*)firstName
lastName:(NSString*)lastName
{
NSDictionary* parameters = @{
@"username": username,
@"password": password,
@"email": email,
@"firstName": firstName,
@"lastName": lastName
};
return [[AVENetworkManager sharedManager] POST:[self rootSubendpoint:kCreateRootSubendpoint]
parameters:parameters
priority:nil
networkToken:nil
builder:[MHFetcher sharedFetcher].builder];
}
@end
@implementation MHUser (Fetching)
+ (AnyPromise*)fetchByUsername:(NSString*)username
{
return [self fetchByUsername:username
priority:nil
networkToken:nil];
}
+ (AnyPromise*)fetchByUsername:(NSString*)username
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [[MHFetcher sharedFetcher] fetchModel:MHUser.class
path:[self rootSubendpointByLookup:username]
keyPath:nil
parameters:@{
MHFetchParameterView: MHFetchParameterViewFull
}
priority:priority
networkToken:networkToken];
}
- (AnyPromise*)fetchInterestFeed
{
return [self fetchInterestFeedForced:NO
priority:nil
networkToken:nil];
}
- (AnyPromise*)fetchInterestFeedForced:(BOOL)forced
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [self fetchPagedEndpoint:[self subendpoint:kInterestFeedSubendpoint]
forced:forced
priority:priority
networkToken:networkToken
next:nil];
}
- (AnyPromise*)fetchOwnedCollections
{
return [self fetchOwnedCollectionsForced:NO
priority:nil
networkToken:nil];
}
- (AnyPromise*)fetchOwnedCollectionsForced:(BOOL)forced
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [self fetchPagedEndpoint:[self subendpoint:kOwnedCollectionsSubendpoint]
forced:forced
priority:priority
networkToken:networkToken
next:nil];
}
- (AnyPromise*)fetchFollowing
{
return [self fetchFollowingForced:NO
priority:nil
networkToken:nil];
}
- (AnyPromise*)fetchFollowingForced:(BOOL)forced
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [self fetchPagedEndpoint:[self subendpoint:kFollowingSubendpoint]
forced:forced
priority:priority
networkToken:networkToken
next:nil];
}
- (AnyPromise*)fetchLiking
{
return [self fetchLikingForced:NO
priority:nil
networkToken:nil];
}
- (AnyPromise*)fetchLikingForced:(BOOL)forced
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [self fetchPagedEndpoint:[self subendpoint:kLikingSubendpoint]
forced:forced
priority:priority
networkToken:networkToken
next:nil];
}
- (AnyPromise*)fetchFollowers
{
return [self fetchFollowersForced:NO
priority:nil
networkToken:nil];
}
- (AnyPromise*)fetchFollowersForced:(BOOL)forced
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [self fetchPagedEndpoint:[self subendpoint:kFollowersSubendpoint]
forced:forced
priority:priority
networkToken:networkToken
next:nil];
}
+ (AnyPromise*)fetchSuggestedUsers
{
return [self fetchSuggestedUsersForced:NO
priority:nil
networkToken:nil];
}
+ (AnyPromise*)fetchSuggestedUsersForced:(BOOL)forced
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [self fetchRootPagedEndpoint:[self rootSubendpoint:kSuggestedRootSubendpoint]
forced:forced
parameters:nil
priority:priority
networkToken:networkToken
next:nil];
}
- (AnyPromise*)fetchSuggested
{
return [self fetchSuggestedForced:NO
priority:nil
networkToken:nil];
}
- (AnyPromise*)fetchSuggestedForced:(BOOL)forced
priority:(AVENetworkPriority*)priority
networkToken:(AVENetworkToken*)networkToken
{
return [self fetchPagedEndpoint:[self subendpoint:kSuggestedSubendpoint]
forced:forced
priority:priority
networkToken:networkToken
next:nil];
}
@end
@implementation MHUser (Forgetting)
+ (AnyPromise*)forgotPasswordWithEmail:(NSString*)email
{
return [[AVENetworkManager sharedManager] POST:[self rootSubendpoint:kForgotPasswordRootSubendpoint]
parameters:@{
@"email": email
}
priority:nil
networkToken:nil
builder:[MHFetcher sharedFetcher].builder];
}
+ (AnyPromise*)forgotPasswordWithUsername:(NSString*)username
{
return [[AVENetworkManager sharedManager] POST:[self rootSubendpoint:kForgotPasswordRootSubendpoint]
parameters:@{
@"username": username
}
priority:nil
networkToken:nil
builder:[MHFetcher sharedFetcher].builder];
}
@end
@implementation MHUser (Internal)
- (void)invalidateOwnedCollections
{
[self invalidateCacheForEndpoint:[self subendpoint:kOwnedCollectionsSubendpoint]];
[self fetchOwnedCollectionsForced:YES
priority:[AVENetworkPriority priorityWithLevel:AVENetworkPriorityLevelLow]
networkToken:nil];
}
- (void)invalidateFollowing
{
[self invalidateCacheForEndpoint:[self subendpoint:kFollowingSubendpoint]];
[self fetchFollowingForced:YES
priority:[AVENetworkPriority priorityWithLevel:AVENetworkPriorityLevelLow]
networkToken:nil];
}
//
//- (void)invalidateFollowedCollections
//{
// [self invalidateCacheForEndpoint:[self subendpoint:kFollowedCollectionsSubendpoint]];
// [self fetchFollowedCollectionsForced:YES
// priority:[AVENetworkPriority priorityWithLevel:AVENetworkPriorityLevelLow]
// networkToken:nil];
//}
@end
| {
"content_hash": "00c206fd89267b4e37784aa7603f0cd1",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 122,
"avg_line_length": 37.724043715846996,
"alnum_prop": 0.5302382849279351,
"repo_name": "MediaHound/CoreHound",
"id": "c7437b0165999663827c3f646f99a4e19b8f113a",
"size": "14187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Model/User/MHUser.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "244845"
},
{
"name": "Ruby",
"bytes": "2618"
}
],
"symlink_target": ""
} |
package com.orhanobut.wasp;
public interface NetworkStack {
void invokeRequest(RequestCreator requestCreator, InternalCallback<Response> waspCallback);
Object invokeRequest(RequestCreator requestCreator) throws Exception;
}
| {
"content_hash": "b2672bf618d10c808030e64170e0757d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 93,
"avg_line_length": 28.875,
"alnum_prop": 0.8354978354978355,
"repo_name": "wangkang0627/wasp",
"id": "1e8ff5fe681df6dfa3ff6cfb75557a00b9a2d28b",
"size": "231",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "wasp/src/main/java/com/orhanobut/wasp/NetworkStack.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "163085"
}
],
"symlink_target": ""
} |
package edu.uci.ics.jung.graph.decorators;
import java.awt.Shape;
import edu.uci.ics.jung.graph.Edge;
/**
* An interface for decorators that return a
* <code>Shape</code> for a specified edge.
*
* @author Tom Nelson
*/
public interface EdgeShapeFunction {
/**
* Returns the <code>Shape</code> associated with <code>e</code>.
*/
Shape getShape(Edge e);
}
| {
"content_hash": "29d592204ed548ad5fa570d6e1a3168d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 69,
"avg_line_length": 19.3,
"alnum_prop": 0.6658031088082902,
"repo_name": "markus1978/clickwatch",
"id": "cfe5d56fb52d554b7726e2ed8bc328b1d669e94d",
"size": "686",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "external/edu.uci.ics.jung/src/edu/uci/ics/jung/graph/decorators/EdgeShapeFunction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "10246972"
},
{
"name": "Matlab",
"bytes": "7054"
},
{
"name": "Shell",
"bytes": "256"
},
{
"name": "XML",
"bytes": "14136"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "d3e69cf23634cc06e60e559d463fa6ce",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "508ee4d0bdfa3b0f900d98fafea04832d8609262",
"size": "213",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Ranunculaceae/Ranunculus/Ranunculus auricomus/Ranunculus auricomus rubicundulus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
namespace DCarbone\PHPFHIRGenerated\R4\PHPFHIRTests\FHIRCodePrimitive;
use PHPUnit\Framework\TestCase;
use DCarbone\PHPFHIRGenerated\R4\FHIRCodePrimitive\FHIRCodeSearchSupportList;
/**
* Class FHIRCodeSearchSupportListTest
* @package \DCarbone\PHPFHIRGenerated\R4\PHPFHIRTests\FHIRCodePrimitive
*/
class FHIRCodeSearchSupportListTest extends TestCase
{
public function testCanConstructTypeNoArgs()
{
$type = new FHIRCodeSearchSupportList();
$this->assertInstanceOf('\DCarbone\PHPFHIRGenerated\R4\FHIRCodePrimitive\FHIRCodeSearchSupportList', $type);
}
}
| {
"content_hash": "6b39650a80427f826e73efaf5db144e5",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 116,
"avg_line_length": 29.75,
"alnum_prop": 0.7966386554621848,
"repo_name": "dcarbone/php-fhir-generated",
"id": "910262e8e425dc7fc95063bd6e8b58d0722b1f86",
"size": "3484",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/DCarbone/PHPFHIRGenerated/R4/PHPFHIRTests/FHIRCodePrimitive/FHIRCodeSearchSupportListTest.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "113066525"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "a0ad5246390e5da17e88eff1daadf0d8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "eeaa69a71a7cfadcfae00752789ba5bdd699e9ab",
"size": "189",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Magnoliales/Annonaceae/Monanthotaxis/Monanthotaxis klainii/ Syn. Atopostema angustifolia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import mskrange = require( './index' );
// TESTS //
// The function returns a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange( x.length, x, 1, mask, 1 ); // $ExpectType number
}
// The compiler throws an error if the function is provided a first argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange( '10', x, 1, mask, 1 ); // $ExpectError
mskrange( true, x, 1, mask, 1 ); // $ExpectError
mskrange( false, x, 1, mask, 1 ); // $ExpectError
mskrange( null, x, 1, mask, 1 ); // $ExpectError
mskrange( undefined, x, 1, mask, 1 ); // $ExpectError
mskrange( [], x, 1, mask, 1 ); // $ExpectError
mskrange( {}, x, 1, mask, 1 ); // $ExpectError
mskrange( ( x: number ): number => x, x, 1, mask, 1 ); // $ExpectError
}
// The compiler throws an error if the function is provided a second argument which is not a numeric array...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange( x.length, 10, 1, mask, 1 ); // $ExpectError
mskrange( x.length, '10', 1, mask, 1 ); // $ExpectError
mskrange( x.length, true, 1, mask, 1 ); // $ExpectError
mskrange( x.length, false, 1, mask, 1 ); // $ExpectError
mskrange( x.length, null, 1, mask, 1 ); // $ExpectError
mskrange( x.length, undefined, 1, mask, 1 ); // $ExpectError
mskrange( x.length, [ '1' ], 1, mask, 1 ); // $ExpectError
mskrange( x.length, {}, 1, mask, 1 ); // $ExpectError
mskrange( x.length, ( x: number ): number => x, 1, mask, 1 ); // $ExpectError
}
// The compiler throws an error if the function is provided a third argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange( x.length, x, '10', mask, 1 ); // $ExpectError
mskrange( x.length, x, true, mask, 1 ); // $ExpectError
mskrange( x.length, x, false, mask, 1 ); // $ExpectError
mskrange( x.length, x, null, mask, 1 ); // $ExpectError
mskrange( x.length, x, undefined, mask, 1 ); // $ExpectError
mskrange( x.length, x, [], mask, 1 ); // $ExpectError
mskrange( x.length, x, {}, mask, 1 ); // $ExpectError
mskrange( x.length, x, ( x: number ): number => x, mask, 1 ); // $ExpectError
}
// The compiler throws an error if the function is provided a fourth argument which is not a numeric array...
{
const x = new Float64Array( 10 );
mskrange( x.length, x, 1, 10, 1 ); // $ExpectError
mskrange( x.length, x, 1, '10', 1 ); // $ExpectError
mskrange( x.length, x, 1, true, 1 ); // $ExpectError
mskrange( x.length, x, 1, false, 1 ); // $ExpectError
mskrange( x.length, x, 1, null, 1 ); // $ExpectError
mskrange( x.length, x, 1, undefined, 1 ); // $ExpectError
mskrange( x.length, x, 1, [ '1' ], 1 ); // $ExpectError
mskrange( x.length, x, 1, {}, 1 ); // $ExpectError
mskrange( x.length, x, 1, ( x: number ): number => x, 1 ); // $ExpectError
}
// The compiler throws an error if the function is provided a fifth argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange( x.length, x, 1, mask, '10' ); // $ExpectError
mskrange( x.length, x, 1, mask, true ); // $ExpectError
mskrange( x.length, x, 1, mask, false ); // $ExpectError
mskrange( x.length, x, 1, mask, null ); // $ExpectError
mskrange( x.length, x, 1, mask, undefined ); // $ExpectError
mskrange( x.length, x, 1, mask, [] ); // $ExpectError
mskrange( x.length, x, 1, mask, {} ); // $ExpectError
mskrange( x.length, x, 1, mask, ( x: number ): number => x ); // $ExpectError
}
// The compiler throws an error if the function is provided an unsupported number of arguments...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange(); // $ExpectError
mskrange( x.length ); // $ExpectError
mskrange( x.length, x, 1 ); // $ExpectError
mskrange( x.length, x, 1, mask ); // $ExpectError
mskrange( x.length, x, 1, mask, 1, 10 ); // $ExpectError
}
// Attached to main export is an `ndarray` method which returns a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray( x.length, x, 1, 0, mask, 1, 0 ); // $ExpectType number
}
// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray( '10', x, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( true, x, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( false, x, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( null, x, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( undefined, x, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( [], x, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( {}, x, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( ( x: number ): number => x, x, 1, 0, mask, 1, 0 ); // $ExpectError
}
// The compiler throws an error if the `ndarray` method is provided a second argument which is not a numeric array...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray( x.length, 10, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, '10', 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, true, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, false, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, null, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, undefined, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, [ '1' ], 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, {}, 1, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, ( x: number ): number => x, 1, 0, mask, 1, 0 ); // $ExpectError
}
// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray( x.length, x, '10', 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, true, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, false, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, null, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, undefined, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, [], 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, {}, 0, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, ( x: number ): number => x, 0, mask, 1, 0 ); // $ExpectError
}
// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray( x.length, x, 1, '10', mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, true, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, false, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, null, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, undefined, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, [], mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, {}, mask, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, ( x: number ): number => x, mask, 1, 0 ); // $ExpectError
}
// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a numeric array...
{
const x = new Float64Array( 10 );
mskrange.ndarray( x.length, 1, 0, 10, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, '10', 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, true, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, false, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, null, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, undefined, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, [ '1' ], 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, {}, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError
}
// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray( x.length, x, 1, 0, mask, '10', 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, true, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, false, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, null, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, undefined, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, [], 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, {}, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, ( x: number ): number => x, 0 ); // $ExpectError
}
// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray( x.length, x, 1, 0, mask, 1, '10' ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, true ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, false ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, null ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, undefined ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, [] ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, {} ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, ( x: number ): number => x ); // $ExpectError
}
// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
{
const x = new Float64Array( 10 );
const mask = new Uint8Array( 10 );
mskrange.ndarray(); // $ExpectError
mskrange.ndarray( x.length ); // $ExpectError
mskrange.ndarray( x.length, x ); // $ExpectError
mskrange.ndarray( x.length, x, 1 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1 ); // $ExpectError
mskrange.ndarray( x.length, x, 1, 0, mask, 1, 0, 10 ); // $ExpectError
}
| {
"content_hash": "06b8829bbd50b0dfb6e7157613fc7d6d",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 117,
"avg_line_length": 44.42857142857143,
"alnum_prop": 0.6353892623989087,
"repo_name": "stdlib-js/stdlib",
"id": "d06fb23b3152b78a55be7c31affe02f7e858856b",
"size": "10878",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "lib/node_modules/@stdlib/stats/base/mskrange/docs/types/test.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "21739"
},
{
"name": "C",
"bytes": "15336495"
},
{
"name": "C++",
"bytes": "1349482"
},
{
"name": "CSS",
"bytes": "58039"
},
{
"name": "Fortran",
"bytes": "198059"
},
{
"name": "HTML",
"bytes": "56181"
},
{
"name": "Handlebars",
"bytes": "16114"
},
{
"name": "JavaScript",
"bytes": "85975525"
},
{
"name": "Julia",
"bytes": "1508654"
},
{
"name": "Makefile",
"bytes": "4806816"
},
{
"name": "Python",
"bytes": "3343697"
},
{
"name": "R",
"bytes": "576612"
},
{
"name": "Shell",
"bytes": "559315"
},
{
"name": "TypeScript",
"bytes": "19309407"
},
{
"name": "WebAssembly",
"bytes": "5980"
}
],
"symlink_target": ""
} |
<?php
/* This document is meant to follow PSR-1 and PSR-2 php-fig standards
http://www.php-fig.org/psr/psr-1/
http://www.php-fig.org/psr/psr-2/ */
/**
* Filter Interface
*
* A filter is more a predicate than a data type, but not quite a design
* pattern (to me). This allows you to define a filter that you can test values
* against.
*
* @copyright Copyright 2016 Asher Wolfstein
* @author Asher Wolfstein <[email protected]>
* @link http://wunk.me/ The author's URL
* @link http://wunk.me/programming-projects/phabstractic/ Framework URL
* @license http://opensource.org/licenses/MIT
* @package Data
* @subpackage Resource
*
*/
/**
* Falcraft Libraries Data Types Resource Namespace
*
*/
namespace Phabstractic\Data\Types\Resource
{
/**
* Filter Interface
*
* A filter is able to test a value against some internal logic. It will
* return true if it passes, false otherwise. There is also a static
* function that must be implemented that enables you to check an array
* of values against the internal test.
*
* CHANGELOG
*
* 1.0: Created FilterInterface - April 11th, 2015
* 2.0: reformatted for inclusion in phabstractic - July 13th, 2016
*
* @version 2.0
*
*/
interface FilterInterface
{
/**
* Is a value allowed through this filter?
*
* @param mixed $value The value to check
* @param bool $strict Should we throw errors?
*
* @return bool Allowed or not?
*
* @throws Phabstractic\Data\Types\Exception\InvalidArgumentException
*
*/
public function isAllowed($type, $strict = false);
/**
* Checks values to see if they fit 'through' the filter
*
* This goes through each value, grabs its type, and compares it
* against the filter
*
* @static
*
* @param array $values The values to check against the restrictions
* @param Resource\FilterInerface The filter to run them through
* @param bool $strict Throw errors?
*
* @return bool Valid types?
*
* @throws Phabstractic\Data\Types\Exception\InvalidArgumentException
* if the value is untypeable, or illegal (only strict)
*
*/
public static function checkElements(
array $values,
FilterInterface $filter,
$strict = false);
/**
* Retrieve default filter settings
*
* This should be just about any basic filter setting
*
* @static
*
* @return Phabstractic\Data\Types\Resource\FilterInterface
*
*/
public static function getDefaultRestrictions();
}
}
| {
"content_hash": "557cce83741f958403cbf3684aa928a1",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 80,
"avg_line_length": 29.571428571428573,
"alnum_prop": 0.588336783988958,
"repo_name": "asherwunk/phabstractic",
"id": "4495b1438904274a74583b82131d593c2f777e81",
"size": "2898",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Phabstractic/Data/Types/Resource/FilterInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "1288170"
}
],
"symlink_target": ""
} |
AutoGrow Node Plugin
====================
The AutoGrow Node Plugin makes textarea expand in height
to fit its contents automatically.
| {
"content_hash": "d97d5aaef690f171f3fbe504582f05fa",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 56,
"avg_line_length": 27,
"alnum_prop": 0.7037037037037037,
"repo_name": "inikoo/fact",
"id": "c7f97f9ab6a5c63473e48fcf840d1d5b0ec10de4",
"size": "135",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "libs/yui/yui3-gallery/src/gallery-node-autogrow/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "18806"
},
{
"name": "CSS",
"bytes": "9907391"
},
{
"name": "JavaScript",
"bytes": "100688322"
},
{
"name": "PHP",
"bytes": "4382356"
},
{
"name": "Perl",
"bytes": "414074"
},
{
"name": "Python",
"bytes": "28243"
},
{
"name": "Shell",
"bytes": "142079"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.apigateway.model.transform;
import static com.amazonaws.util.StringUtils.UTF8;
import static com.amazonaws.util.StringUtils.COMMA_SEPARATOR;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.regex.Pattern;
import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.apigateway.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.json.*;
/**
* GetModelTemplateRequest Marshaller
*/
public class GetModelTemplateRequestMarshaller implements
Marshaller<Request<GetModelTemplateRequest>, GetModelTemplateRequest> {
private static final String DEFAULT_CONTENT_TYPE = "";
public Request<GetModelTemplateRequest> marshall(
GetModelTemplateRequest getModelTemplateRequest) {
if (getModelTemplateRequest == null) {
throw new AmazonClientException(
"Invalid argument passed to marshall(...)");
}
Request<GetModelTemplateRequest> request = new DefaultRequest<GetModelTemplateRequest>(
getModelTemplateRequest, "AmazonApiGateway");
request.setHttpMethod(HttpMethodName.GET);
String uriResourcePath = "/restapis/{restapi_id}/models/{model_name}/default_template";
uriResourcePath = uriResourcePath.replace(
"{restapi_id}",
(getModelTemplateRequest.getRestApiId() == null) ? ""
: StringUtils.fromString(getModelTemplateRequest
.getRestApiId()));
uriResourcePath = uriResourcePath.replace(
"{model_name}",
(getModelTemplateRequest.getModelName() == null) ? ""
: StringUtils.fromString(getModelTemplateRequest
.getModelName()));
request.setResourcePath(uriResourcePath);
request.setContent(new ByteArrayInputStream(new byte[0]));
if (!request.getHeaders().containsKey("Content-Type")) {
request.addHeader("Content-Type", "binary/octet-stream");
}
return request;
}
}
| {
"content_hash": "04ece4108f9e2ec914b5d9531feb813f",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 95,
"avg_line_length": 36.11267605633803,
"alnum_prop": 0.6977379095163807,
"repo_name": "sdole/aws-sdk-java",
"id": "9458a2e0b6c9a15c7aeb1daa5b89c298d8b30556",
"size": "3148",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/transform/GetModelTemplateRequestMarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "97734456"
},
{
"name": "Scilab",
"bytes": "2354"
}
],
"symlink_target": ""
} |
<?php
defined('JPATH_PLATFORM') or die;
/**
* Class to handle dispatching of events.
*
* This is the Observable part of the Observer design pattern
* for the event architecture.
*
* @package Joomla.Platform
* @subpackage Event
* @link http://docs.joomla.org/Tutorial:Plugins Plugin tutorials
* @see JPlugin
* @since 12.1
*/
class JEventDispatcher extends JObject
{
/**
* An array of Observer objects to notify
*
* @var array
* @since 11.3
*/
protected $_observers = array();
/**
* The state of the observable object
*
* @var mixed
* @since 11.3
*/
protected $_state = null;
/**
* A multi dimensional array of [function][] = key for observers
*
* @var array
* @since 11.3
*/
protected $_methods = array();
/**
* Stores the singleton instance of the dispatcher.
*
* @var JEventDispatcher
* @since 11.3
*/
protected static $instance = null;
/**
* Returns the global Event Dispatcher object, only creating it
* if it doesn't already exist.
*
* @return JEventDispatcher The EventDispatcher object.
*
* @since 11.1
*/
public static function getInstance()
{
if (self::$instance === null)
{
self::$instance = new static;
}
return self::$instance;
}
/**
* Get the state of the JEventDispatcher object
*
* @return mixed The state of the object.
*
* @since 11.3
*/
public function getState()
{
return $this->_state;
}
/**
* Registers an event handler to the event dispatcher
*
* @param string $event Name of the event to register handler for
* @param string $handler Name of the event handler
*
* @return void
*
* @since 11.1
* @throws InvalidArgumentException
*/
public function register($event, $handler)
{
// Are we dealing with a class or callback type handler?
if (is_callable($handler))
{
// Ok, function type event handler... let's attach it.
$method = array('event' => $event, 'handler' => $handler);
$this->attach($method);
}
elseif (class_exists($handler))
{
// Ok, class type event handler... let's instantiate and attach it.
$this->attach(new $handler($this));
}
else
{
throw new InvalidArgumentException('Invalid event handler.');
}
}
/**
* Triggers an event by dispatching arguments to all observers that handle
* the event and returning their return values.
*
* @param string $event The event to trigger.
* @param array $args An array of arguments.
*
* @return array An array of results from each function call.
*
* @since 11.1
*/
public function trigger($event, $args = array())
{
$result = array();
/*
* If no arguments were passed, we still need to pass an empty array to
* the call_user_func_array function.
*/
$args = (array) $args;
$event = strtolower($event);
// Check if any plugins are attached to the event.
if (!isset($this->_methods[$event]) || empty($this->_methods[$event]))
{
// No Plugins Associated To Event!
return $result;
}
// Loop through all plugins having a method matching our event
foreach ($this->_methods[$event] as $key)
{
// Check if the plugin is present.
if (!isset($this->_observers[$key]))
{
continue;
}
// Fire the event for an object based observer.
if (is_object($this->_observers[$key]))
{
$args['event'] = $event;
$value = $this->_observers[$key]->update($args);
}
// Fire the event for a function based observer.
elseif (is_array($this->_observers[$key]))
{
$value = call_user_func_array($this->_observers[$key]['handler'], $args);
}
if (isset($value))
{
$result[] = $value;
}
}
return $result;
}
/**
* Attach an observer object
*
* @param object $observer An observer object to attach
*
* @return void
*
* @since 11.3
*/
public function attach($observer)
{
if (is_array($observer))
{
if (!isset($observer['handler']) || !isset($observer['event']) || !is_callable($observer['handler']))
{
return;
}
// Make sure we haven't already attached this array as an observer
foreach ($this->_observers as $check)
{
if (is_array($check) && $check['event'] == $observer['event'] && $check['handler'] == $observer['handler'])
{
return;
}
}
$this->_observers[] = $observer;
$methods = array($observer['event']);
}
else
{
if (!($observer instanceof JEvent))
{
return;
}
// Make sure we haven't already attached this object as an observer
$class = get_class($observer);
foreach ($this->_observers as $check)
{
if ($check instanceof $class)
{
return;
}
}
$this->_observers[] = $observer;
$methods = array_diff(get_class_methods($observer), get_class_methods('JPlugin'));
}
end($this->_observers);
$key = key($this->_observers);
foreach ($methods as $method)
{
$method = strtolower($method);
if (!isset($this->_methods[$method]))
{
$this->_methods[$method] = array();
}
$this->_methods[$method][] = $key;
}
}
/**
* Detach an observer object
*
* @param object $observer An observer object to detach.
*
* @return boolean True if the observer object was detached.
*
* @since 11.3
*/
public function detach($observer)
{
$retval = false;
$key = array_search($observer, $this->_observers);
if ($key !== false)
{
unset($this->_observers[$key]);
$retval = true;
foreach ($this->_methods as &$method)
{
$k = array_search($key, $method);
if ($k !== false)
{
unset($method[$k]);
}
}
}
return $retval;
}
}
| {
"content_hash": "49601934164b7d264d1da4e0cff43ef0",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 111,
"avg_line_length": 20.71167883211679,
"alnum_prop": 0.6026431718061674,
"repo_name": "mssnaveensharma/venison-jaqui",
"id": "ab1df5614b60c148c28181e0d2767e220dfdcb17",
"size": "5903",
"binary": false,
"copies": "257",
"ref": "refs/heads/master",
"path": "libraries/joomla/event/dispatcher.php",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1810540"
},
{
"name": "Erlang",
"bytes": "19643"
},
{
"name": "JavaScript",
"bytes": "2447041"
},
{
"name": "PHP",
"bytes": "15379259"
},
{
"name": "Perl",
"bytes": "231114"
}
],
"symlink_target": ""
} |
<sample>
<para>Demonstrates how to deploy and install to a Maven repository. Also demonstrates how to deploy a javadoc JAR
along with the main JAR, how to customize the contents of the generated POM, and how to deploy snapshots and
releases to different repositories.
</para>
</sample> | {
"content_hash": "23d35769a24d8bd1567d57ec89f5a801",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 117,
"avg_line_length": 52.333333333333336,
"alnum_prop": 0.7229299363057324,
"repo_name": "lsmaira/gradle",
"id": "61fd97ba9bac7b92cbda542bbd7668ec2345289f",
"size": "314",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "subprojects/docs/src/samples/maven/pomGeneration/readme.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "277"
},
{
"name": "Brainfuck",
"bytes": "54"
},
{
"name": "C",
"bytes": "98577"
},
{
"name": "C++",
"bytes": "1805943"
},
{
"name": "CSS",
"bytes": "169594"
},
{
"name": "CoffeeScript",
"bytes": "620"
},
{
"name": "GAP",
"bytes": "424"
},
{
"name": "Gherkin",
"bytes": "191"
},
{
"name": "Groovy",
"bytes": "23143304"
},
{
"name": "HTML",
"bytes": "90514"
},
{
"name": "Java",
"bytes": "22751766"
},
{
"name": "JavaScript",
"bytes": "206201"
},
{
"name": "Kotlin",
"bytes": "661239"
},
{
"name": "Objective-C",
"bytes": "840"
},
{
"name": "Objective-C++",
"bytes": "441"
},
{
"name": "Perl",
"bytes": "37849"
},
{
"name": "Python",
"bytes": "57"
},
{
"name": "Ruby",
"bytes": "16"
},
{
"name": "Scala",
"bytes": "27838"
},
{
"name": "Shell",
"bytes": "6768"
},
{
"name": "XSLT",
"bytes": "58117"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:background="@drawable/background" >
<ImageView
android:id="@+id/ultrasound12"
android:layout_width="@dimen/thumbnail_width"
android:layout_height="@dimen/thumbnail_height"
android:layout_gravity="center"
android:layout_marginBottom="4dp"
android:contentDescription="@string/metadata_image_preview_label" />
</ScrollView>
| {
"content_hash": "04a8cd5a54355cd4bb40873df5fe0421",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 30.09090909090909,
"alnum_prop": 0.6737160120845922,
"repo_name": "kqb/ultrasound-in-remote-maternal-healthcare",
"id": "7a4c1b080272dcf672485e040505cff8c6aef1c2",
"size": "662",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/csc301/ultrasound/android/res/layout/imagedisplay.xml",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?php
/**
* DO NOT EDIT!
* This file was automatically generated via bin/generate-validator-spec.php.
*/
namespace AmpProject\Validator\Spec\Tag;
use AmpProject\Format;
use AmpProject\Html\Attribute;
use AmpProject\Html\Tag as Element;
use AmpProject\Validator\Spec\Identifiable;
use AmpProject\Validator\Spec\SpecRule;
use AmpProject\Validator\Spec\Tag;
/**
* Tag class MetaNameAmpConsentBlocking.
*
* @package ampproject/amp-toolbox.
*
* @property-read string $tagName
* @property-read string $specName
* @property-read bool $unique
* @property-read string $mandatoryParent
* @property-read array $attrs
* @property-read array<string> $htmlFormat
* @property-read array<string> $satisfies
*/
final class MetaNameAmpConsentBlocking extends Tag implements Identifiable
{
/**
* ID of the tag.
*
* @var string
*/
const ID = 'meta name=amp-consent-blocking';
/**
* Array of spec rules.
*
* @var array
*/
const SPEC = [
SpecRule::TAG_NAME => Element::META,
SpecRule::SPEC_NAME => 'meta name=amp-consent-blocking',
SpecRule::UNIQUE => true,
SpecRule::MANDATORY_PARENT => Element::HEAD,
SpecRule::ATTRS => [
Attribute::CONTENT => [
SpecRule::MANDATORY => true,
],
Attribute::NAME => [
SpecRule::MANDATORY => true,
SpecRule::DISPATCH_KEY => 'NAME_VALUE_DISPATCH',
SpecRule::VALUE_CASEI => [
'amp-consent-blocking',
],
],
],
SpecRule::HTML_FORMAT => [
Format::AMP,
],
SpecRule::SATISFIES => [
'meta name=amp-consent-blocking',
],
];
}
| {
"content_hash": "1199b4960251cd1f6999377d35012daf",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 77,
"avg_line_length": 25.86764705882353,
"alnum_prop": 0.5901080159181353,
"repo_name": "ampproject/amp-toolbox-php",
"id": "1c9753d46ef8e20552861908130a7511c7552286",
"size": "1759",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/Validator/Spec/Tag/MetaNameAmpConsentBlocking.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "PHP",
"bytes": "1530243"
},
{
"name": "Shell",
"bytes": "653"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace ApiPlatform\GraphQl\Resolver\Stage;
use ApiPlatform\Metadata\GraphQl\Operation;
use GraphQL\Error\Error;
/**
* Validate stage of GraphQL resolvers.
*
* @author Alan Poulain <[email protected]>
*/
interface ValidateStageInterface
{
/**
* @throws Error
*/
public function __invoke(object $object, string $resourceClass, Operation $operation, array $context): void;
}
| {
"content_hash": "a9fc8343d1ce4ab6966619bbfd973c19",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 112,
"avg_line_length": 19.08695652173913,
"alnum_prop": 0.7175398633257403,
"repo_name": "soyuka/core",
"id": "092a1d5aee4bfa17941d4cade9fa4d5272b5a14a",
"size": "670",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "src/GraphQl/Resolver/Stage/ValidateStageInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15644"
},
{
"name": "Gherkin",
"bytes": "832270"
},
{
"name": "HTML",
"bytes": "2715"
},
{
"name": "JavaScript",
"bytes": "23790"
},
{
"name": "PHP",
"bytes": "4385149"
},
{
"name": "Shell",
"bytes": "4182"
},
{
"name": "Twig",
"bytes": "34863"
}
],
"symlink_target": ""
} |
goog.provide('thermo.api');
goog.require('thermo');
goog.require('thermo.EventDelegate');
goog.require('thermo.Model');
goog.require('thermo.View');
| {
"content_hash": "8594539985be3a6bb9f69b671e273170",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 37,
"avg_line_length": 25,
"alnum_prop": 0.7333333333333333,
"repo_name": "bfgeek/thermo-js",
"id": "3a4124c733a632cfb96bdd5a0bc352ec60f4605c",
"size": "150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "thermo/api.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "122251"
},
{
"name": "Emacs Lisp",
"bytes": "2410"
},
{
"name": "JavaScript",
"bytes": "14565981"
},
{
"name": "Python",
"bytes": "76518"
},
{
"name": "Shell",
"bytes": "8973"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.destroystokyo</groupId>
<artifactId>paperclip</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Paperclip</name>
<description>Launcher for the Paper Minecraft server</description>
<url>https://github.com/PaperMC/Paperclip</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.author>Kyle Wood (DemonWav)</project.author>
</properties>
<modules>
<module>java6</module>
<module>java8</module>
<module>java9</module>
<module>assembly</module>
</modules>
</project>
| {
"content_hash": "53c4223b6e5ad0698f39b28ed2a9372c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 108,
"avg_line_length": 34.851851851851855,
"alnum_prop": 0.6631243358129649,
"repo_name": "PaperSpigot/Paperclip",
"id": "b14f0196e453f649c9b4589a9e4294c9cc3be0f3",
"size": "941",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pom.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "10384"
}
],
"symlink_target": ""
} |
layout: default
---
<h1>The Holloways</h1>
<p>We are Mike & Amy, a Husband and Wife from Worcester UK and this is our shared blog.</p>
{% assign year = null %}
<dl class="posts">
{% for post in site.posts %}
{% assign data = site.data[post.data] %}
{% assign currentYear = data.reviewed_on | date: "%Y" %}
{% if currentYear != year %}
<dt class="year">{{ currentYear }}</dt>
{% assign year = currentYear %}
{% endif %}
{% if data.opinions.amy.isRecommended == data.opinions.mike.isRecommended %}
{% if data.opinions.amy.isRecommended %}
{% assign decision = "Recommended" %}
{% else %}
{% assign decision = "Disapproves" %}
{% endif %}
{% else %}
{% assign decision = "Split" %}
{% endif %}
<dd class="post"><a href="/{{ data.slug }}" class="post__link"><span class="post__date">{{ data.reviewed_on | date: "%d.%m" }}</span> <span class="post__title">{{ data.title }}</span> <span class="post__decision split">{{ decision }}</span></a></dd>
{% endfor %} | {
"content_hash": "eb4608049bb00c5c66420e8d84dccb05",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 251,
"avg_line_length": 40.24,
"alnum_prop": 0.5964214711729622,
"repo_name": "flyingbuddha/theholloways",
"id": "1516fc528a2c08ba7b481258f56e72cd13d0f76c",
"size": "1010",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3250"
},
{
"name": "HTML",
"bytes": "3760"
},
{
"name": "Ruby",
"bytes": "5963"
}
],
"symlink_target": ""
} |
//
// argument.cs: Argument expressions
//
// Author:
// Miguel de Icaza ([email protected])
// Marek Safar ([email protected])
//
// Dual licensed under the terms of the MIT X11 or GNU GPL
// Copyright 2003-2011 Novell, Inc.
// Copyright 2011 Xamarin Inc
//
using System;
using System.Collections.Generic;
#if STATIC
using IKVM.Reflection.Emit;
#else
using System.Reflection.Emit;
#endif
namespace Mono.CSharp
{
//
// Argument expression used for invocation
//
public class Argument
{
public enum AType : byte
{
None = 0,
Ref = 1, // ref modifier used
Out = 2, // out modifier used
Default = 3, // argument created from default parameter value
DynamicTypeName = 4, // System.Type argument for dynamic binding
ExtensionType = 5, // Instance expression inserted as the first argument
}
public readonly AType ArgType;
public Expression Expr;
public Argument (Expression expr, AType type)
{
this.Expr = expr;
this.ArgType = type;
}
public Argument (Expression expr)
{
this.Expr = expr;
}
#region Properties
public bool IsByRef {
get { return ArgType == AType.Ref || ArgType == AType.Out; }
}
public bool IsDefaultArgument {
get { return ArgType == AType.Default; }
}
public Parameter.Modifier Modifier {
get {
switch (ArgType) {
case AType.Out:
return Parameter.Modifier.OUT;
case AType.Ref:
return Parameter.Modifier.REF;
default:
return Parameter.Modifier.NONE;
}
}
}
public TypeSpec Type {
get { return Expr.Type; }
}
#endregion
public Argument Clone (Expression expr)
{
Argument a = (Argument) MemberwiseClone ();
a.Expr = expr;
return a;
}
public Argument Clone (CloneContext clonectx)
{
return Clone (Expr.Clone (clonectx));
}
public virtual Expression CreateExpressionTree (ResolveContext ec)
{
if (ArgType == AType.Default)
ec.Report.Error (854, Expr.Location, "An expression tree cannot contain an invocation which uses optional parameter");
return Expr.CreateExpressionTree (ec);
}
public virtual void Emit (EmitContext ec)
{
if (!IsByRef) {
Expr.Emit (ec);
return;
}
AddressOp mode = AddressOp.Store;
if (ArgType == AType.Ref)
mode |= AddressOp.Load;
IMemoryLocation ml = (IMemoryLocation) Expr;
ml.AddressOf (ec, mode);
}
public Argument EmitToField (EmitContext ec, bool cloneResult)
{
var res = Expr.EmitToField (ec);
if (cloneResult && res != Expr)
return new Argument (res, ArgType);
Expr = res;
return this;
}
public void FlowAnalysis (FlowAnalysisContext fc)
{
if (ArgType == AType.Out) {
var vr = Expr as VariableReference;
if (vr != null) {
if (vr.VariableInfo != null)
fc.SetVariableAssigned (vr.VariableInfo);
return;
}
var fe = Expr as FieldExpr;
if (fe != null) {
fe.SetFieldAssigned (fc);
return;
}
return;
}
Expr.FlowAnalysis (fc);
}
public string GetSignatureForError ()
{
if (Expr.eclass == ExprClass.MethodGroup)
return Expr.ExprClassName;
return Expr.Type.GetSignatureForError ();
}
public bool ResolveMethodGroup (ResolveContext ec)
{
SimpleName sn = Expr as SimpleName;
if (sn != null)
Expr = sn.GetMethodGroup ();
// FIXME: csc doesn't report any error if you try to use `ref' or
// `out' in a delegate creation expression.
Expr = Expr.Resolve (ec, ResolveFlags.VariableOrValue | ResolveFlags.MethodGroup);
if (Expr == null)
return false;
return true;
}
public void Resolve (ResolveContext ec)
{
// Verify that the argument is readable
if (ArgType != AType.Out)
Expr = Expr.Resolve (ec);
// Verify that the argument is writeable
if (Expr != null && IsByRef)
Expr = Expr.ResolveLValue (ec, EmptyExpression.OutAccess);
if (Expr == null)
Expr = ErrorExpression.Instance;
}
}
public class MovableArgument : Argument
{
LocalTemporary variable;
public MovableArgument (Argument arg)
: this (arg.Expr, arg.ArgType)
{
}
protected MovableArgument (Expression expr, AType modifier)
: base (expr, modifier)
{
}
public override void Emit (EmitContext ec)
{
// TODO: Should guard against multiple emits
base.Emit (ec);
// Release temporary variable when used
if (variable != null)
variable.Release (ec);
}
public void EmitToVariable (EmitContext ec)
{
var type = Expr.Type;
if (IsByRef) {
var ml = (IMemoryLocation) Expr;
ml.AddressOf (ec, AddressOp.LoadStore);
type = ReferenceContainer.MakeType (ec.Module, type);
} else {
Expr.Emit (ec);
}
variable = new LocalTemporary (type);
variable.Store (ec);
Expr = variable;
}
}
public class NamedArgument : MovableArgument
{
public readonly string Name;
readonly Location loc;
public NamedArgument (string name, Location loc, Expression expr)
: this (name, loc, expr, AType.None)
{
}
public NamedArgument (string name, Location loc, Expression expr, AType modifier)
: base (expr, modifier)
{
this.Name = name;
this.loc = loc;
}
public override Expression CreateExpressionTree (ResolveContext ec)
{
ec.Report.Error (853, loc, "An expression tree cannot contain named argument");
return base.CreateExpressionTree (ec);
}
public Location Location {
get { return loc; }
}
}
public class Arguments
{
sealed class ArgumentsOrdered : Arguments
{
readonly List<MovableArgument> ordered;
public ArgumentsOrdered (Arguments args)
: base (args.Count)
{
AddRange (args);
ordered = new List<MovableArgument> ();
}
public void AddOrdered (MovableArgument arg)
{
ordered.Add (arg);
}
public override Arguments Emit (EmitContext ec, bool dup_args, bool prepareAwait)
{
foreach (var a in ordered) {
if (prepareAwait)
a.EmitToField (ec, false);
else
a.EmitToVariable (ec);
}
return base.Emit (ec, dup_args, prepareAwait);
}
}
// Try not to add any more instances to this class, it's allocated a lot
List<Argument> args;
public Arguments (int capacity)
{
args = new List<Argument> (capacity);
}
private Arguments (List<Argument> args)
{
this.args = args;
}
public void Add (Argument arg)
{
args.Add (arg);
}
public void AddRange (Arguments args)
{
this.args.AddRange (args.args);
}
public bool ContainsEmitWithAwait ()
{
foreach (var arg in args) {
if (arg.Expr.ContainsEmitWithAwait ())
return true;
}
return false;
}
public ArrayInitializer CreateDynamicBinderArguments (ResolveContext rc)
{
Location loc = Location.Null;
var all = new ArrayInitializer (args.Count, loc);
MemberAccess binder = DynamicExpressionStatement.GetBinderNamespace (loc);
foreach (Argument a in args) {
Arguments dargs = new Arguments (2);
// CSharpArgumentInfoFlags.None = 0
const string info_flags_enum = "CSharpArgumentInfoFlags";
Expression info_flags = new IntLiteral (rc.BuiltinTypes, 0, loc);
if (a.Expr is Constant) {
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "Constant", loc));
} else if (a.ArgType == Argument.AType.Ref) {
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsRef", loc));
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc));
} else if (a.ArgType == Argument.AType.Out) {
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsOut", loc));
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc));
} else if (a.ArgType == Argument.AType.DynamicTypeName) {
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "IsStaticType", loc));
}
var arg_type = a.Expr.Type;
if (arg_type.BuiltinType != BuiltinTypeSpec.Type.Dynamic && arg_type != InternalType.NullLiteral) {
MethodGroupExpr mg = a.Expr as MethodGroupExpr;
if (mg != null) {
rc.Report.Error (1976, a.Expr.Location,
"The method group `{0}' cannot be used as an argument of dynamic operation. Consider using parentheses to invoke the method",
mg.Name);
} else if (arg_type == InternalType.AnonymousMethod) {
rc.Report.Error (1977, a.Expr.Location,
"An anonymous method or lambda expression cannot be used as an argument of dynamic operation. Consider using a cast");
} else if (arg_type.Kind == MemberKind.Void || arg_type == InternalType.Arglist || arg_type.IsPointer) {
rc.Report.Error (1978, a.Expr.Location,
"An expression of type `{0}' cannot be used as an argument of dynamic operation",
arg_type.GetSignatureForError ());
}
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "UseCompileTimeType", loc));
}
string named_value;
NamedArgument na = a as NamedArgument;
if (na != null) {
info_flags = new Binary (Binary.Operator.BitwiseOr, info_flags,
new MemberAccess (new MemberAccess (binder, info_flags_enum, loc), "NamedArgument", loc));
named_value = na.Name;
} else {
named_value = null;
}
dargs.Add (new Argument (info_flags));
dargs.Add (new Argument (new StringLiteral (rc.BuiltinTypes, named_value, loc)));
all.Add (new Invocation (new MemberAccess (new MemberAccess (binder, "CSharpArgumentInfo", loc), "Create", loc), dargs));
}
return all;
}
public static Arguments CreateForExpressionTree (ResolveContext ec, Arguments args, params Expression[] e)
{
Arguments all = new Arguments ((args == null ? 0 : args.Count) + e.Length);
for (int i = 0; i < e.Length; ++i) {
if (e [i] != null)
all.Add (new Argument (e[i]));
}
if (args != null) {
foreach (Argument a in args.args) {
Expression tree_arg = a.CreateExpressionTree (ec);
if (tree_arg != null)
all.Add (new Argument (tree_arg));
}
}
return all;
}
public void CheckArrayAsAttribute (CompilerContext ctx)
{
foreach (Argument arg in args) {
// Type is undefined (was error 246)
if (arg.Type == null)
continue;
if (arg.Type.IsArray)
ctx.Report.Warning (3016, 1, arg.Expr.Location, "Arrays as attribute arguments are not CLS-compliant");
}
}
public Arguments Clone (CloneContext ctx)
{
Arguments cloned = new Arguments (args.Count);
foreach (Argument a in args)
cloned.Add (a.Clone (ctx));
return cloned;
}
public int Count {
get { return args.Count; }
}
//
// Emits a list of resolved Arguments
//
public void Emit (EmitContext ec)
{
Emit (ec, false, false);
}
//
// if `dup_args' is true or any of arguments contains await.
// A copy of all arguments will be returned to the caller
//
public virtual Arguments Emit (EmitContext ec, bool dup_args, bool prepareAwait)
{
List<Argument> dups;
if ((dup_args && Count != 0) || prepareAwait)
dups = new List<Argument> (Count);
else
dups = null;
LocalTemporary lt;
foreach (Argument a in args) {
if (prepareAwait) {
dups.Add (a.EmitToField (ec, true));
continue;
}
a.Emit (ec);
if (!dup_args) {
continue;
}
if (a.Expr.IsSideEffectFree) {
//
// No need to create a temporary variable for side effect free expressions. I assume
// all side-effect free expressions are cheap, this has to be tweaked when we become
// more aggressive on detection
//
dups.Add (a);
} else {
ec.Emit (OpCodes.Dup);
// TODO: Release local temporary on next Emit
// Need to add a flag to argument to indicate this
lt = new LocalTemporary (a.Type);
lt.Store (ec);
dups.Add (new Argument (lt, a.ArgType));
}
}
if (dups != null)
return new Arguments (dups);
return null;
}
public void FlowAnalysis (FlowAnalysisContext fc)
{
bool has_out = false;
foreach (var arg in args) {
if (arg.ArgType == Argument.AType.Out) {
has_out = true;
continue;
}
arg.FlowAnalysis (fc);
}
if (!has_out)
return;
foreach (var arg in args) {
if (arg.ArgType != Argument.AType.Out)
continue;
arg.FlowAnalysis (fc);
}
}
public List<Argument>.Enumerator GetEnumerator ()
{
return args.GetEnumerator ();
}
//
// At least one argument is of dynamic type
//
public bool HasDynamic {
get {
foreach (Argument a in args) {
if (a.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && !a.IsByRef)
return true;
}
return false;
}
}
//
// At least one argument is named argument
//
public bool HasNamed {
get {
foreach (Argument a in args) {
if (a is NamedArgument)
return true;
}
return false;
}
}
public void Insert (int index, Argument arg)
{
args.Insert (index, arg);
}
public static System.Linq.Expressions.Expression[] MakeExpression (Arguments args, BuilderContext ctx)
{
if (args == null || args.Count == 0)
return null;
var exprs = new System.Linq.Expressions.Expression [args.Count];
for (int i = 0; i < exprs.Length; ++i) {
Argument a = args.args [i];
exprs[i] = a.Expr.MakeExpression (ctx);
}
return exprs;
}
//
// For named arguments when the order of execution is different
// to order of invocation
//
public Arguments MarkOrderedArgument (NamedArgument a)
{
//
// An expression has no effect on left-to-right execution
//
if (a.Expr.IsSideEffectFree)
return this;
ArgumentsOrdered ra = this as ArgumentsOrdered;
if (ra == null) {
ra = new ArgumentsOrdered (this);
for (int i = 0; i < args.Count; ++i) {
var la = args [i];
if (la == a)
break;
//
// When the argument is filled later by default expression
//
if (la == null)
continue;
var ma = la as MovableArgument;
if (ma == null) {
ma = new MovableArgument (la);
ra.args[i] = ma;
}
ra.AddOrdered (ma);
}
}
ra.AddOrdered (a);
return ra;
}
//
// Returns dynamic when at least one argument is of dynamic type
//
public void Resolve (ResolveContext ec, out bool dynamic)
{
dynamic = false;
foreach (Argument a in args) {
a.Resolve (ec);
if (a.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && !a.IsByRef)
dynamic = true;
}
}
public void RemoveAt (int index)
{
args.RemoveAt (index);
}
public Argument this [int index] {
get { return args [index]; }
set { args [index] = value; }
}
}
}
| {
"content_hash": "af0f96fadca0ca08ee21149d61d98ced",
"timestamp": "",
"source": "github",
"line_count": 640,
"max_line_length": 132,
"avg_line_length": 23.6984375,
"alnum_prop": 0.6455462517307312,
"repo_name": "rfguri/vimfiles",
"id": "13d0526cc2cd9c5a47e422bbdc2b9c763c2de9b4",
"size": "15169",
"binary": false,
"copies": "16",
"ref": "refs/heads/master",
"path": "bundle/ycm/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory.CSharp/Parser/mcs/argument.cs",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
#include "mpi-rdft.h"
/* use the apply() operation for MPI_RDFT problems */
void XM(rdft_solve)(const plan *ego_, const problem *p_)
{
const plan_mpi_rdft *ego = (const plan_mpi_rdft *) ego_;
const problem_mpi_rdft *p = (const problem_mpi_rdft *) p_;
ego->apply(ego_, UNTAINT(p->I), UNTAINT(p->O));
}
| {
"content_hash": "7b84bd8f88dde249aacddc2ba56f10ae",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 63,
"avg_line_length": 29,
"alnum_prop": 0.6269592476489029,
"repo_name": "cianfrocco-lab/cryoem-cloud-tools",
"id": "e8f4f5a8f45030ed2de79de54b396646f4a454a7",
"size": "1162",
"binary": false,
"copies": "29",
"ref": "refs/heads/master",
"path": "external_software/relion/external/fftw/fftw3/mpi/rdft-solve.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "27142"
},
{
"name": "C++",
"bytes": "3604037"
},
{
"name": "CMake",
"bytes": "178688"
},
{
"name": "Cuda",
"bytes": "2365383"
},
{
"name": "HTML",
"bytes": "161786"
},
{
"name": "Makefile",
"bytes": "772478"
},
{
"name": "Perl",
"bytes": "18396"
},
{
"name": "Python",
"bytes": "860642"
},
{
"name": "Shell",
"bytes": "21577"
},
{
"name": "TeX",
"bytes": "46998"
}
],
"symlink_target": ""
} |
module Tasuku
class TaskRequirement < ActiveRecord::Base
include Concerns::Models::Requirables::InverseRequirable
end
end
| {
"content_hash": "6128a34e56afd685b5a73228274eaacd",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 60,
"avg_line_length": 26,
"alnum_prop": 0.7923076923076923,
"repo_name": "hyperoslo/tasuku",
"id": "9e299c0cdfbef6cbd57cd802443988a47b3f8a10",
"size": "130",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/tasuku/task_requirement.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1366"
},
{
"name": "HTML",
"bytes": "15670"
},
{
"name": "JavaScript",
"bytes": "1198"
},
{
"name": "Ruby",
"bytes": "128660"
}
],
"symlink_target": ""
} |
using Moq;
using NUnit.Framework;
using SimpleMigrations;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Simple.Migrations.UnitTests
{
[TestFixture]
public class SimpleMigratorMigrateTests : AssertionHelper
{
private class Migration1 : Migration
{
public static bool UpCalled;
public static bool DownCalled;
public static Exception Exception;
public static Action<Migration1> Callback;
public new DbConnection Connection => base.Connection;
public new IMigrationLogger Logger => base.Logger;
public static void Reset()
{
UpCalled = false;
DownCalled = false;
Exception = null;
Callback = null;
}
protected override void Up()
{
UpCalled = true;
Callback?.Invoke(this);
if (Exception != null)
{
throw Exception;
}
}
protected override void Down()
{
DownCalled = true;
Callback?.Invoke(this);
if (Exception != null)
{
throw Exception;
}
}
}
private class Migration2 : Migration
{
public static bool UpCalled;
public static bool DownCalled;
public static void Reset()
{
UpCalled = false;
DownCalled = false;
}
protected override void Down() { DownCalled = true; }
protected override void Up() { UpCalled = true; }
}
private Mock<DbConnection> connection;
private Mock<IMigrationProvider> migrationProvider;
private Mock<MockDatabaseProvider> databaseProvider;
private Mock<ILogger> logger;
private List<MigrationData> migrations;
private SimpleMigrator<DbConnection, Migration> migrator;
[SetUp]
public void SetUp()
{
Migration1.Reset();
Migration2.Reset();
this.connection = new Mock<DbConnection>()
{
DefaultValue = DefaultValue.Mock,
};
this.migrationProvider = new Mock<IMigrationProvider>();
this.databaseProvider = new Mock<MockDatabaseProvider>()
{
CallBase = true,
};
this.databaseProvider.Object.Connection = this.connection.Object;
this.logger = new Mock<ILogger>();
this.migrator = new SimpleMigrator<DbConnection, Migration>(this.migrationProvider.Object, this.databaseProvider.Object, this.logger.Object);
this.migrations = new List<MigrationData>()
{
new MigrationData(1, "Migration 1", typeof(Migration1).GetTypeInfo()),
new MigrationData(2, "Migration 2", typeof(Migration2).GetTypeInfo()),
};
this.migrationProvider.Setup(x => x.LoadMigrations()).Returns(this.migrations);
}
[Test]
public void BaselineThrowsIfMigrationsHaveAlreadyBeenApplied()
{
this.LoadMigrator(1);
Expect(() => this.migrator.Baseline(1), Throws.InstanceOf<InvalidOperationException>());
}
[Test]
public void BaselineThrowsIfRequestedVersionDoesNotExist()
{
this.databaseProvider.Object.CurrentVersion = 0;
this.migrator.Load();
Expect(() => this.migrator.Baseline(3), Throws.InstanceOf<MigrationNotFoundException>().With.Property("Version").EqualTo(3));
}
[Test]
public void BaselineBaselinesDatabase()
{
this.LoadMigrator(0);
this.migrator.Baseline(1);
this.databaseProvider.Verify(x => x.UpdateVersion(0, 1, "Migration1 (Migration 1)"));
Expect(this.migrator.CurrentMigration, EqualTo(this.migrations[0]));
}
[Test]
public void MigrateToThrowsIfVersionNotFound()
{
this.LoadMigrator(0);
Expect(() => this.migrator.MigrateTo(3), Throws.InstanceOf<MigrationNotFoundException>().With.Property("Version").EqualTo(3));
}
[Test]
public void MigrateToDoesNothingIfThereIsNothingToDo()
{
this.LoadMigrator(1);
this.migrator.MigrateTo(1);
Expect(Migration1.UpCalled, False);
Expect(Migration1.DownCalled, False);
Expect(Migration2.UpCalled, False);
Expect(Migration2.DownCalled, False);
this.databaseProvider.Verify(x => x.UpdateVersion(It.IsAny<long>(), It.IsAny<long>(), It.IsAny<string>()), Times.Never());
}
[Test]
public void MigrateToMigratesUpCorrectly()
{
this.LoadMigrator(0);
int sequence = 0;
this.databaseProvider.Setup(x => x.UpdateVersion(0, 1, "Migration1 (Migration 1)")).Callback(() =>
{
Expect(sequence++, EqualTo(0));
Expect(Migration1.UpCalled, True);
Expect(Migration2.UpCalled, False);
}).Verifiable();
this.databaseProvider.Setup(x => x.UpdateVersion(1, 2, "Migration2 (Migration 2)")).Callback(() =>
{
Expect(sequence++, EqualTo(1));
Expect(Migration2.UpCalled, True);
}).Verifiable();
this.migrator.MigrateTo(2);
this.databaseProvider.VerifyAll();
Expect(Migration1.DownCalled, False);
Expect(Migration2.DownCalled, False);
}
[Test]
public void MigrateToMigratesDownCorrectly()
{
this.LoadMigrator(2);
int sequence = 0;
this.databaseProvider.Setup(x => x.UpdateVersion(2, 1, "Migration1 (Migration 1)")).Callback(() =>
{
Expect(sequence++, EqualTo(0));
Expect(Migration2.DownCalled, True);
Expect(Migration1.DownCalled, False);
}).Verifiable();
this.databaseProvider.Setup(x => x.UpdateVersion(1, 0, "Empty Schema")).Callback(() =>
{
Expect(sequence++, EqualTo(1));
Expect(Migration1.DownCalled, True);
}).Verifiable();
this.migrator.MigrateTo(0);
this.databaseProvider.VerifyAll();
Expect(Migration1.UpCalled, False);
Expect(Migration2.UpCalled, False);
}
[Test]
public void MigrateToPropagatesExceptionFromMigration()
{
this.LoadMigrator(0);
var e = new Exception("BOOM");
Migration1.Exception = e;
Expect(() => this.migrator.MigrateTo(2), Throws.Exception.EqualTo(e));
this.databaseProvider.Verify(x => x.UpdateVersion(It.IsAny<long>(), It.IsAny<long>(), It.IsAny<string>()), Times.Never());
Expect(this.migrator.CurrentMigration.Version, EqualTo(0));
Expect(Migration1.DownCalled, False);
}
[Test]
public void MigrateToAssignsConnectionAndLogger()
{
this.LoadMigrator(0);
Migration1.Callback = x =>
{
Expect(x.Connection, EqualTo(this.connection.Object));
Expect(x.Logger, EqualTo(this.logger.Object));
};
this.migrator.MigrateTo(1);
}
private void LoadMigrator(long currentVersion)
{
this.databaseProvider.Object.CurrentVersion = currentVersion;
this.migrator.Load();
}
}
}
| {
"content_hash": "52ce7a07e75ea4a9b7a5b021c43b290a",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 153,
"avg_line_length": 32.016260162601625,
"alnum_prop": 0.5562468257998985,
"repo_name": "canton7/Simple.Migrations",
"id": "f0f83a3d521881b3d672ccf5a97c6cb566dd439d",
"size": "7878",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Simple.Migrations.UnitTests/SimpleMigratorMigrateTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "145673"
},
{
"name": "Ruby",
"bytes": "1091"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>aspect_demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>aspect_demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.12.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
| {
"content_hash": "77c3c6168033c8ab0f2ea0d2cf2b558c",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 104,
"avg_line_length": 28.873015873015873,
"alnum_prop": 0.7234744365035733,
"repo_name": "Roc0924/springDemo",
"id": "22d2797b729295b55aa75fc572e00027dcd37fd1",
"size": "1819",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aspect_demo/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "5005"
}
],
"symlink_target": ""
} |
You can use the [editor on GitHub](https://github.com/devanshbkg/moriswiki/edit/master/README.md) to maintain and preview the content for your website in Markdown files.
Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
### Markdown
Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
```markdown
Syntax highlighted code block
# Header 1
## Header 2
### Header 3
- Bulleted
- List
1. Numbered
2. List
**Bold** and _Italic_ and `Code` text
[Link](url) and 
```
For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/).
### Jekyll Themes
Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/devanshbkg/moriswiki/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
### Support or Contact
Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out.
| {
"content_hash": "d39cf3e92489d61fb35c119741d7db23",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 247,
"avg_line_length": 35.628571428571426,
"alnum_prop": 0.7586206896551724,
"repo_name": "devanshbkg/moriswiki",
"id": "2f947b01a0ff2cebddb149257d87d2ecee81cb4c",
"size": "1277",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "22"
}
],
"symlink_target": ""
} |
import React from 'react';
import PropTypes from 'prop-types';
const XMLNS_SVG = 'http://www.w3.org/2000/svg';
var propTypes = {
/**
* React element(s) passed into the icon
*/
children: PropTypes.oneOfType([
PropTypes.element,
PropTypes.arrayOf(PropTypes.element.isRequired),
]).isRequired,
/**
* Defines the color of the interior
*/
fill: PropTypes.string,
/**
* Height of the root SVG element. Takes precedence over 'size'
*/
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/**
* Applied to the width and height attributes
*/
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
/**
* Added as inline styles to the root SVG element. Shallow merged with
* default style object
*/
style: PropTypes.object,
/**
* Width of the root SVG element. Takes precendence over 'size'
*/
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
var contextTypes = {
sjsIconBase: PropTypes.shape({
fill: PropTypes.string,
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
style: PropTypes.object,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
}),
};
function IconBase(
{ children, fill, height, size, style = {}, width, ...rest },
{
sjsIconBase: {
fill: ctxFill = 'currentColor',
height: ctxHeight,
size: ctxSize = '1.15em',
style: ctxStyle = {},
width: ctxWidth,
...ctxRest
} = {},
}
) {
return (
<svg
version="1.1"
xmlns={XMLNS_SVG}
fill={fill || ctxFill}
height={height || size || ctxHeight || ctxSize}
style={{
verticalAlign: 'text-bottom',
...ctxStyle,
...style,
}}
width={width || size || ctxWidth || ctxSize}
aria-hidden
{...ctxRest}
{...rest}
>
{children}
</svg>
);
}
IconBase.propTypes = propTypes;
IconBase.contextTypes = contextTypes;
export default IconBase;
| {
"content_hash": "0ec9f8982e6ebcac8037cc10eab4e83b",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 72,
"avg_line_length": 24.547619047619047,
"alnum_prop": 0.6275460717749758,
"repo_name": "suitejs/suitejs",
"id": "4ca54b0a36839e3762b2d49bbfa3bf202c7cc91e",
"size": "2062",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/icon-base/src/IconBase/IconBase.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "586081"
}
],
"symlink_target": ""
} |
:Version: |version| (|release|)
:Created: |today|
Welcome to Open Robotics Automation Virtual Environment
=======================================================
.. include:: description.rst
Getting Started
---------------
* :ref:`install`
* :ref:`changelog`, `Roadmap <https://github.com/rdiankov/openrave/issues/milestones>`_
* :ref:`getting_started`
* :ref:`openravepy_beginning`, :ref:`command_line_tools`, :ref:`writing_plugins`, :ref:`environment_variables`, `Octave/MATLAB <http://openrave.programmingvision.com/wiki/index.php/OctaveMATLAB>`_
* :ref:`overview`
* :ref:`architecture`, :ref:`interface_concepts`, :ref:`package-databases`, :ref:`robots_overview`, :ref:`geometric_conventions`
* :ref:`openrave_examples`
* :ref:`robots`
* :ref:`plugin_interfaces`
* :ref:`openrave_database_generators`
Resources
---------
This document is automatically generated for every release and binds together the following versioned resources:
.. only:: htmltag or gettext
* `Core C++ API <../coreapihtml/index.html>`_ - generated by doxygen
.. only:: jsontag or gettext
* `Core C++ API <coreapihtml/index.html>`_ - generated by doxygen
* :ref:`Python API <package-openravepy>` - generated by openravepy in-source comments
* :ref:`plugin_interfaces` - generated by the interface descriptions and their supported commands
* :ref:`openrave_database_generators` - generated by openravepy in-source comments
* :ref:`openrave_examples` - generated by openravepy in-source comments
* :ref:`robots` - generated by running the database generators on the :ref:`robots_repositories`
Other
~~~~~
* `Official Wiki <http://openrave.programmingvision.com/wiki>`_ - latest news, projects using OpenRAVE, and how to link OpenRAVE with other systems. Users can freely add their own project information on it.
* :ref:`developers_guide` - for core OpenRAVE development
Licenses
--------
* The core C++ API is licenced under the `Lesser GPL <http://www.gnu.org/licenses/lgpl.html>`_, which allows the OpenRAVE developers to guarantee a consistent API while enabling commercial use.
* Most of the examples and scripts outside the core are licensed under `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0.html>`_, which is much less restrictive (similar to BSD).
* Documentation is under the `Creative Commons Attribution 3.0 <http://creativecommons.org/licenses/by/3.0/>`_.
* Plugins can be released in any license the plugin authors choose to.
References
----------
Please support OpenRAVE development by referencing it in your works/publications/projects with::
@phdthesis{diankov_thesis,
author = "Rosen Diankov",
title = "Automated Construction of Robotic Manipulation Programs",
school = "Carnegie Mellon University, Robotics Institute",
month = "August",
year = "2010",
number= "CMU-RI-TR-10-29",
url={http://www.programmingvision.com/rosen_diankov_thesis.pdf},
}
`Download PDF here <http://www.programmingvision.com/rosen_diankov_thesis.pdf>`_.
| {
"content_hash": "164f38e638618c7eaef0c60ba4613680",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 206,
"avg_line_length": 35.529411764705884,
"alnum_prop": 0.7172185430463576,
"repo_name": "jdsika/TUM_HOly",
"id": "2fae17d50c97f68bc6dd3996c8aaad8720e6e79b",
"size": "3020",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "openrave/docs/source/index.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "361"
},
{
"name": "C",
"bytes": "111973"
},
{
"name": "C#",
"bytes": "24641"
},
{
"name": "C++",
"bytes": "11966748"
},
{
"name": "CMake",
"bytes": "212392"
},
{
"name": "CSS",
"bytes": "2102"
},
{
"name": "HTML",
"bytes": "16213"
},
{
"name": "Makefile",
"bytes": "41"
},
{
"name": "Matlab",
"bytes": "198171"
},
{
"name": "Modelica",
"bytes": "621"
},
{
"name": "Objective-C",
"bytes": "51576"
},
{
"name": "Python",
"bytes": "10053508"
},
{
"name": "Shell",
"bytes": "11963"
},
{
"name": "XSLT",
"bytes": "471726"
}
],
"symlink_target": ""
} |
var gulp = require("gulp");
var sass = require("gulp-sass");
var minifyHtml = require("gulp-minify-html");
var ngHtml2js = require("gulp-ng-html2js");
var ngAnnotate = require("gulp-ng-annotate");
var iife = require("gulp-iife");
var uglify = require("gulp-uglify");
var concat = require("gulp-concat");
gulp.task("sass", function() {
return gulp.src("src/picker.scss")
.pipe(concat("ion-datetime-picker.min.scss"))
.pipe(sass({outputStyle: "compressed"}))
.pipe(gulp.dest("release"));
});
gulp.task("html", function() {
return gulp.src("src/picker-*.html")
.pipe(minifyHtml({
empty: true,
spare: true,
quotes: true
}))
.pipe(ngHtml2js({
moduleName: "ion-datetime-picker",
prefix: "lib/ion-datetime-picker/src/",
declareModule: false
}))
.pipe(concat("ion-datetime-picker.min.js"))
.pipe(gulp.dest("release"));
});
gulp.task("js", ["html"], function() {
return gulp.src(["src/picker.js", "src/picker-*.js", "release/ion-datetime-picker.min.js"])
.pipe(ngAnnotate())
.pipe(concat("ion-datetime-picker.min.js"))
.pipe(iife())
.pipe(uglify())
.pipe(gulp.dest("release"));
});
gulp.task("build", ["sass", "js"]);
gulp.task("default", ["build"]);
| {
"content_hash": "4fd34451ea71a3e8d2ad66ce512962d9",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 93,
"avg_line_length": 28.295454545454547,
"alnum_prop": 0.623293172690763,
"repo_name": "katemihalikova/ion-datetime-picker",
"id": "b3c46c9b9623115dc3a2e187ccb6de89483f4cdd",
"size": "1245",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "gulpfile.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2440"
},
{
"name": "HTML",
"bytes": "5048"
},
{
"name": "JavaScript",
"bytes": "14740"
}
],
"symlink_target": ""
} |
<?xml version='1.0' encoding="windows-1251"?>
<xml>
<!---------------------------MONOLIT REGULAR with RPG----------------------->
<specific_character id="aes_Monolit_rpg" team_default = "1">
<name>GENERATE_NAME_stalker</name>
<icon x="22" y="10"></icon>
<map_icon x="3" y="0"></map_icon>
<bio>aes_Monolit_rpg_bio</bio>
<team>Monolit_rpg</team>
<class>aes_Monolit_rpg</class>
<community>monolith</community>
<snd_config>characters_voice\human_01\monolith\</snd_config>
<crouch_type>-1</crouch_type>
<rank>520</rank>
<reputation>-632</reputation>
<panic_threshold>0.0</panic_threshold>
<visual>actors\monolit\stalker_mo_mask</visual>
<supplies>
[spawn] \n
wpn_walther \n
ammo_9x19_fmj \n
wpn_rpg7 \n
ammo_og-7b = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_1.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------MONOLIT SPECNAZ---------------------->
<specific_character id="aes_Monolit_specnaz" team_default = "1">
<name>GENERATE_NAME_stalker</name>
<icon x="6" y="2"></icon>
<map_icon x="3" y="0"></map_icon>
<bio>aes_Monolit_specnaz_bio</bio>
<class>aes_Monolit_specnaz</class>
<community>monolith</community>
<rank>760</rank>
<reputation>-783</reputation>
<panic_threshold>0.0</panic_threshold>
<snd_config>characters_voice\human_03\monolith\</snd_config>
<crouch_type>-1</crouch_type>
<visual>actors\monolit\stalker_mo_hood_9</visual>
<supplies>
[spawn] \n
wpn_sig550 = 1 \n
ammo_5.56x45_ap = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_1.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------MONOLIT SPECNAZ RG6---------------------->
<specific_character id="aes_Monolit_specnaz_rg6" team_default = "1">
<name>GENERATE_NAME_stalker</name>
<icon x="4" y="2"></icon>
<map_icon x="3" y="0"></map_icon>
<bio>Áîåâèê ãðóïïèðîâêè "Ìîíîëèò". Õîðîøî ýêèïèðîâàí. Äåòàëüíàÿ èíôîðìàöèÿ îòñóòñòâóåò.</bio>
<class>aes_Monolit_specnaz_rg6</class>
<community>monolith</community>
<rank>700</rank>
<reputation>0</reputation>
<snd_config>characters_voice\human_02\monolith\</snd_config>
<crouch_type>-1</crouch_type>
<visual>actors\monolit\stalker_mo_hood_9</visual>
<supplies>
[spawn] \n
wpn_colt1911 \n
ammo_11.43x23_hydro = 1 \n
</supplies>
#include "gameplay\character_criticals_1.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------MONOLIT SNIPER---------------------->
<specific_character id="aes_Monolit_sniper" team_default = "1">
<name>GENERATE_NAME_stalker</name>
<icon x="22" y="10"></icon>
<map_icon x="3" y="0"></map_icon>
<bio>aes_Monolit_sniper_bio</bio>
<class>aes_Monolit_sniper</class>
<community>monolith</community>
<rank>540</rank>
<reputation>-364</reputation>
<panic_threshold>0.0</panic_threshold>
<snd_config>characters_voice\human_02\monolith\</snd_config>
<crouch_type>-1</crouch_type>
<visual>actors\monolit\stalker_mo_head_1</visual>
<supplies>
[spawn] \n
wpn_svd \n
ammo_7.62x54_ap = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_1.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------MONOLIT SNIPER GAUSS---------------------->
<specific_character id="aes_Monolit_sniper_gauss" team_default = "1">
<name>GENERATE_NAME_stalker</name>
<icon x="22" y="10"></icon>
<map_icon x="3" y="0"></map_icon>
<bio>Ñòàëêåð ãðóïïèðîâêè "Ìîíîëèò". Äåòàëüíàÿ èíôîðìàöèÿ îòñóòñòâóåò.</bio>
<class>aes_Monolit_sniper_gauss</class>
<community>monolith</community>
<rank>890</rank>
<reputation>-789</reputation>
<snd_config>characters_voice\human_01\monolith\</snd_config>
<crouch_type>-1</crouch_type>
<panic_threshold>0.0</panic_threshold>
<visual>actors\monolit\stalker_mo_mask</visual>
<supplies>
[spawn] \n
wpn_gauss \n
ammo_gauss = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_1.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------MONOLIT MASTER----------------------->
<specific_character id="aes_Monolit_master" team_default = "1">
<name>GENERATE_NAME_stalker</name>
<icon x="28" y="8"></icon>
<map_icon x="3" y="0"></map_icon>
<bio>Õðàíèòåëü ãðóïïèðîâêè "Ìîíîëèò". Ëó÷øå äåðæàòüñÿ îò íåãî ïîäàëüøå. Äåòàëüíàÿ èíôîðìàöèÿ îòñóòñòâóåò.</bio>
<class>aes_Monolit_master</class>
<community>monolith</community>
<rank>920</rank>
<reputation>-863</reputation>
<panic_threshold>0.0</panic_threshold>
<snd_config>characters_voice\human_03\monolith\</snd_config>
<crouch_type>-1</crouch_type>
<visual>actors\monolit\stalker_mo_exo</visual>
<supplies>
[spawn] \n
wpn_usp \n
ammo_11.43x23_hydro = 1 \n
wpn_g36 \n
ammo_5.56x45_ss190 = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_1.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------SOLDIERS PROFILES----------------------->
<!---------------------------SOLDIER COMMANDER----------------------->
<specific_character id="aes_Soldier_commander" team_default = "1">
<name>GENERATE_NAME_captain</name>
<icon x="20" y="14"></icon>
<map_icon x="2" y="0"></map_icon>
<bio>aes_Soldier_commander_bio</bio>
<class>aes_Soldier_commander</class>
<community>military</community> <terrain_sect>stalker_military_terrain</terrain_sect>
<rank>860</rank>
<reputation>12</reputation>
<panic_threshold>0.0</panic_threshold>
<snd_config>characters_voice\human_02\military\</snd_config>
<crouch_type>0</crouch_type>
<visual>actors\soldier\soldier_beret_5</visual>
<supplies>
[spawn] \n
wpn_usp \n
ammo_11.43x23_hydro = 1 \n
wpn_val \n
ammo_9x39_sp5 = 1 \n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
#include "gameplay\character_items.xml"
</supplies>
#include "gameplay\character_criticals_5.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------SOLDIER MASTER----------------------->
<specific_character id="aes_Soldier_military" team_default = "1">
<name>GENERATE_NAME_lieutenant</name>
<icon x="20" y="4"></icon>
<map_icon x="2" y="2"></map_icon>
<bio>aes_Soldier_military_bio</bio>
<team>Soldier_military</team>
<class>aes_Soldier_military</class>
<community>military</community> <terrain_sect>stalker_military_terrain</terrain_sect>
<snd_config>characters_voice\human_03\military\</snd_config>
<crouch_type>0</crouch_type>
<rank>900</rank>
<reputation>0</reputation>
<panic_threshold>0.0</panic_threshold>
<visual>actors\militari\stalker_militari_antigas_2</visual>
<supplies>
[spawn] \n
wpn_usp \n
ammo_11.43x23_hydro = 1 \n
wpn_val \n
ammo_9x39_sp5 = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_6.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------SOLDIER SPECNAZ---------------------->
<specific_character id="aes_Soldier_specnaz" team_default = "1">
<name>GENERATE_NAME_sergeant</name>
<icon x="14" y="2"></icon>
<map_icon x="12" y="4"></map_icon>
<bio>aes_Soldier_specnaz_bio</bio>
<team>Soldier_specnaz</team>
<class>aes_Soldier_specnaz</class>
<community>military</community> <terrain_sect>stalker_military_terrain</terrain_sect>
<rank>850</rank>
<reputation>20</reputation>
<panic_threshold>0.0</panic_threshold>
<snd_config>characters_voice\human_03\military\</snd_config>
<crouch_type>0</crouch_type>
<visual>actors\soldier\soldier_antigas</visual>
<supplies>
[spawn] \n
wpn_usp \n
ammo_11.43x23_hydro = 1 \n
wpn_val \n
ammo_9x39_sp5 = 1 \n
#include "gameplay\character_items.xml" \n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_6.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------SOLDIER SPECNAZ AES---------------------->
<specific_character id="aes_Soldier_specnaz_aes" team_default = "1">
<name>aes_Soldier_specnaz_aes_name</name>
<icon x="20" y="4"></icon>
<map_icon x="2" y="2"></map_icon>
<bio>aes_Soldier_specnaz_aes_bio</bio>
<team>Soldier_specnaz</team>
<class>aes_Soldier_specnaz_aes</class>
<community>military</community> <terrain_sect>stalker_military_terrain</terrain_sect>
<rank>890</rank>
<reputation>15</reputation>
<snd_config>characters_voice\human_03\military\</snd_config>
<crouch_type>0</crouch_type>
<panic_threshold>0.0</panic_threshold>
<visual>actors\militari\stalker_militari_antigas_2</visual>
<supplies>
[spawn] \n
wpn_usp \n
ammo_11.43x23_hydro = 1 \n
wpn_val \n
ammo_9x39_sp5 = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_6.xml"
<start_dialog>hello_dialog</start_dialog>
</specific_character>
<!---------------------------SOLDIER SNIPER---------------------->
<specific_character id="aes_Soldier_sniper" team_default = "1">
<name>GENERATE_NAME_private</name>
<icon x="6" y="4"></icon>
<map_icon x="1" y="2"></map_icon>
<bio>aes_Soldier_sniper_bio</bio>
<team>Soldier_sniper</team>
<class>aes_Soldier_sniper</class>
<community>military</community> <terrain_sect>stalker_military_terrain</terrain_sect>
<rank>660</rank>
<reputation>-13</reputation>
<snd_config>characters_voice\human_03\military\</snd_config>
<crouch_type>-1</crouch_type>
<panic_threshold>0.0</panic_threshold>
<visual>actors\militari\stalker_militari_1</visual>
<supplies>
[spawn] \n
wpn_walther \n
ammo_9x19_fmj \n
wpn_svu \n
ammo_7.62x54_ap = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_6.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------SOLDIER SNIPER---------------------->
<specific_character id="aes_x" team_default = "1">
<name>GENERATE_NAME_private</name>
<icon x="6" y="4"></icon>
<map_icon x="1" y="2"></map_icon>
<bio>Ðÿäîâîé ñîëäàò. Äåòàëüíàÿ èíôîðìàöèÿ îòñóòñòâóåò.</bio>
<team>Soldier_sniper</team>
<class>aes_x</class>
<community>military</community> <terrain_sect>stalker_military_terrain</terrain_sect>
<rank>900</rank>
<reputation>0</reputation>
<snd_config>characters_voice\human_03\military\</snd_config>
<crouch_type>0</crouch_type>
<panic_threshold>0.0</panic_threshold>
<visual>actors\killer\stalker_ki_temp2</visual>
<supplies>
[spawn] \n
wpn_walther \n
ammo_9x19_fmj \n
wpn_sig550 \n
ammo_5.56x45_ap = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_6.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
<!---------------------------SOLDIER SNIPER---------------------->
<specific_character id="aes_x_2" team_default = "1">
<name>GENERATE_NAME_private</name>
<icon x="6" y="4"></icon>
<map_icon x="1" y="2"></map_icon>
<bio>Ðÿäîâîé ñîëäàò. Äåòàëüíàÿ èíôîðìàöèÿ îòñóòñòâóåò.</bio>
<team>Soldier_sniper</team>
<class>aes_x_2</class>
<community>stalker</community> <terrain_sect>stalker_terrain</terrain_sect>
<rank>900</rank>
<reputation>0</reputation>
<snd_config>characters_voice\human_03\military\</snd_config>
<crouch_type>0</crouch_type>
<panic_threshold>0.0</panic_threshold>
<visual>actors\killer\stalker_ki_temp</visual>
<supplies>
[spawn] \n
wpn_walther \n
ammo_9x19_fmj \n
wpn_sig550 \n
ammo_5.56x45_ap = 1 \n
#include "gameplay\character_items.xml"\n
#include "gameplay\character_food.xml" \n
#include "gameplay\character_drugs.xml"
</supplies>
#include "gameplay\character_criticals_6.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>esc_stalker_talk_level</actor_dialog>
</specific_character>
</xml> | {
"content_hash": "11650b2b16903f43a89890a0c040405d",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 115,
"avg_line_length": 29.81063829787234,
"alnum_prop": 0.6459924345157376,
"repo_name": "OLR-xray/XRay-NEW",
"id": "cac51e201d546474a9312b71d0dd8eb88589fe5d",
"size": "14011",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gamedata/config/gameplay/character_desc_aes.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "62738"
},
{
"name": "Batchfile",
"bytes": "7939"
},
{
"name": "C",
"bytes": "24706439"
},
{
"name": "C++",
"bytes": "42161717"
},
{
"name": "Groff",
"bytes": "287360"
},
{
"name": "HTML",
"bytes": "67830"
},
{
"name": "Lua",
"bytes": "96997"
},
{
"name": "Makefile",
"bytes": "16534"
},
{
"name": "Objective-C",
"bytes": "175957"
},
{
"name": "Pascal",
"bytes": "1259032"
},
{
"name": "Perl",
"bytes": "9355"
},
{
"name": "PostScript",
"bytes": "115918"
},
{
"name": "Shell",
"bytes": "962"
},
{
"name": "TeX",
"bytes": "2421274"
},
{
"name": "xBase",
"bytes": "99233"
}
],
"symlink_target": ""
} |
<html>
<body>
Reports <b>static</b> variables which are read prior to initialization.
<p>
Note: This inspection uses a very conservative dataflow algorithm, and may report static variables
used uninitialized incorrectly. Variables reported as initialized will always be initialized.
<!-- tooltip end -->
<p>
Use the checkbox below to indicate whether you want uninitialized primitive fields to be reported.
<p>
<small>Powered by InspectionGadgets</small>
</body>
</html>
| {
"content_hash": "3547ecf502f4358de3ae5cc615b0a122",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 98,
"avg_line_length": 36.23076923076923,
"alnum_prop": 0.7834394904458599,
"repo_name": "consulo/consulo-java",
"id": "0fe89050bae483bfba0e04b3064270a274c98d1f",
"size": "471",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java-analysis-impl/src/main/resources/inspectionDescriptions/StaticVariableUninitializedUse.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "317"
},
{
"name": "C",
"bytes": "1632"
},
{
"name": "C#",
"bytes": "390"
},
{
"name": "CMake",
"bytes": "1377"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "Groovy",
"bytes": "265530"
},
{
"name": "HLSL",
"bytes": "57"
},
{
"name": "HTML",
"bytes": "826277"
},
{
"name": "Java",
"bytes": "33731365"
},
{
"name": "Lex",
"bytes": "12468"
},
{
"name": "Raku",
"bytes": "26"
},
{
"name": "Thrift",
"bytes": "990"
}
],
"symlink_target": ""
} |
from django.test.testcases import TestCase
from django_core.forms.widgets import CommaSeparatedListWidget
from django_core.forms.widgets import MultipleDecimalInputWidget
class CommaSeparatedListWidgetTestCase(TestCase):
def test_widget_value_from_datadict(self):
field_name = 'some_field'
data = {field_name: '1,4, 5 , hello'}
widget = CommaSeparatedListWidget()
value = widget.value_from_datadict(data=data, files={},
name=field_name)
self.assertEqual(value, ['1', '4', '5', 'hello'])
def test_widget_value_from_datadict_ints(self):
field_name = 'some_field'
data = {field_name: '1,4,5'}
widget = CommaSeparatedListWidget()
value = widget.value_from_datadict(data=data, files={},
name=field_name)
self.assertEqual(value, ['1', '4', '5'])
class MultipleDecimalInputWidgetTestCase(TestCase):
"""Test case for the multiple decimal input widget."""
def test_widget_value_from_data_dict(self):
field_name = 'some_field'
data = {
'{0}_0'.format(field_name): '3',
'{0}_1'.format(field_name): '2',
'{0}_2'.format(field_name): '1'
}
widget = MultipleDecimalInputWidget(num_inputs=3)
value = widget.value_from_datadict(data=data, files={},
name=field_name)
self.assertEqual(value, ['3', '2', '1'])
def test_widget_decompress(self):
val_1 = '5'
val_2 = '4'
val_3 = '1'
val_4 = '0'
widget = MultipleDecimalInputWidget()
value = '{0} {1} {2} {3}'.format(val_1, val_2, val_3, val_4)
decompressed_value = widget.decompress(value)
self.assertEqual(decompressed_value[0], val_1)
self.assertEqual(decompressed_value[1], val_2)
self.assertEqual(decompressed_value[2], val_3)
self.assertEqual(decompressed_value[3], val_4)
| {
"content_hash": "b7cbe8a82afdd2b5c570d310cb7124c2",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 68,
"avg_line_length": 38.75,
"alnum_prop": 0.5816377171215881,
"repo_name": "InfoAgeTech/django-core",
"id": "0f2b5e85d495834a061cd7a68a9aa366e207830c",
"size": "2015",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_form_widgets.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "452"
},
{
"name": "Python",
"bytes": "180676"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.6.0_27) on Thu Oct 17 21:44:59 EDT 2013 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Class org.apache.solr.schema.BCDStrField (Solr 4.5.1 API)</title>
<meta name="date" content="2013-10-17">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.solr.schema.BCDStrField (Solr 4.5.1 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/solr/schema/BCDStrField.html" title="class in org.apache.solr.schema">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/solr/schema//class-useBCDStrField.html" target="_top">FRAMES</a></li>
<li><a href="BCDStrField.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.solr.schema.BCDStrField" class="title">Uses of Class<br>org.apache.solr.schema.BCDStrField</h2>
</div>
<div class="classUseContainer">No usage of org.apache.solr.schema.BCDStrField</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../org/apache/solr/schema/BCDStrField.html" title="class in org.apache.solr.schema">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/solr/schema//class-useBCDStrField.html" target="_top">FRAMES</a></li>
<li><a href="BCDStrField.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
| {
"content_hash": "55405b21e7384b25c7a9069ee617c9d5",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 131,
"avg_line_length": 36.06870229007634,
"alnum_prop": 0.5921693121693121,
"repo_name": "Hernrup/solr",
"id": "8244481c9168bcee6a2b67cf3aa73cc332caf6a0",
"size": "4725",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/solr-core/org/apache/solr/schema/class-use/BCDStrField.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "4841"
},
{
"name": "C#",
"bytes": "18047"
},
{
"name": "C++",
"bytes": "49866"
},
{
"name": "CSS",
"bytes": "243442"
},
{
"name": "JavaScript",
"bytes": "1382282"
},
{
"name": "Shell",
"bytes": "13608"
},
{
"name": "XSLT",
"bytes": "98495"
}
],
"symlink_target": ""
} |
package org.apache.spark.util
import java.util
import scala.collection.JavaConverters._
import org.apache.spark.rdd.CarbonMergeFilesRDD
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.execution.command.CompactionCallableModel
import org.apache.carbondata.common.logging.LogServiceFactory
import org.apache.carbondata.core.constants.CarbonCommonConstants
import org.apache.carbondata.core.metadata.SegmentFileStore
import org.apache.carbondata.core.metadata.schema.table.CarbonTable
import org.apache.carbondata.core.statusmanager.SegmentStatusManager
import org.apache.carbondata.core.util.ObjectSerializationUtil
import org.apache.carbondata.processing.merger.CarbonDataMergerUtil
object MergeIndexUtil {
val LOGGER = LogServiceFactory.getLogService(this.getClass.getName)
def mergeIndexFilesOnCompaction(compactionCallableModel: CompactionCallableModel): Unit = {
val carbonTable = compactionCallableModel.carbonTable
LOGGER.info(s"Merge index for compaction is called on table ${carbonTable.getTableUniqueName}")
val mergedLoads = compactionCallableModel.compactedSegments
val sparkSession = compactionCallableModel.sqlContext.sparkSession
if (!carbonTable.isStreamingSink) {
val mergedSegmentIds = getMergedSegmentIds(mergedLoads)
val carbonLoadModel = compactionCallableModel.carbonLoadModel
val segmentFileNameMap: java.util.Map[String, String] = new util.HashMap[String, String]()
var partitionInfo: java.util.List[String] = null
var tempFolderPath: String = null
var currPartitionSpec: Option[String] = None
mergedSegmentIds.foreach{ mergedSegmentId =>
segmentFileNameMap.put(mergedSegmentId, String.valueOf(carbonLoadModel.getFactTimeStamp))
}
if (carbonTable.isHivePartitionTable) {
tempFolderPath = carbonLoadModel.getFactTimeStamp.toString + ".tmp"
if (compactionCallableModel.compactedPartitions != null) {
val partitionSpecs = compactionCallableModel.compactedPartitions.getOrElse(List.empty)
currPartitionSpec = Some(ObjectSerializationUtil.convertObjectToString(
new util.ArrayList(partitionSpecs.asJava)))
partitionInfo = partitionSpecs.map(_.getLocation.toString).asJava
}
}
CarbonMergeFilesRDD.mergeIndexFiles(sparkSession,
mergedSegmentIds,
segmentFileNameMap,
carbonTable.getTablePath,
carbonTable,
false,
partitionInfo,
tempFolderPath,
false,
currPartitionSpec)
}
}
private def getMergedSegmentIds(mergedLoads: util.List[String]) = {
mergedLoads.asScala.map { mergedLoad =>
mergedLoad.substring(mergedLoad.indexOf(CarbonCommonConstants.LOAD_FOLDER) +
CarbonCommonConstants.LOAD_FOLDER.length)
}
}
def mergeIndexFilesForCompactedSegments(sparkSession: SparkSession,
carbonTable: CarbonTable,
mergedLoads: util.List[String]): Unit = {
// get only the valid segments of the table
val validSegments = CarbonDataMergerUtil.getValidSegmentList(carbonTable).asScala
val mergedSegmentIds = getMergedSegmentIds(mergedLoads)
// filter out only the valid segments from the list of compacted segments
// Example: say compacted segments list contains 0.1, 3.1, 6.1, 0.2.
// In this list 0.1, 3.1 and 6.1 are compacted to 0.2 in the level 2 compaction.
// So, it is enough to do merge index only for 0.2 as it is the only valid segment in this list
val validMergedSegIds = validSegments
.filter { seg => mergedSegmentIds.contains(seg.getSegmentNo) }.map(_.getSegmentNo)
if (null != validMergedSegIds && validMergedSegIds.nonEmpty) {
CarbonMergeFilesRDD.mergeIndexFiles(sparkSession,
validMergedSegIds,
SegmentStatusManager.mapSegmentToStartTime(carbonTable),
carbonTable.getTablePath,
carbonTable,
false)
// clear Block index Cache
clearBlockIndexCache(carbonTable, validMergedSegIds)
}
}
def clearBlockIndexCache(carbonTable: CarbonTable, segmentIds: Seq[String]): Unit = {
// clear driver Block index cache for each segment
segmentIds.foreach { segmentId =>
SegmentFileStore.clearBlockIndexCache(carbonTable, segmentId)
}
}
}
| {
"content_hash": "dfbde0a9016e40d424e173919662c165",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 99,
"avg_line_length": 41.75728155339806,
"alnum_prop": 0.7488956056730993,
"repo_name": "zzcclp/carbondata",
"id": "e6a2ad31a9904568e385e93e0a1769276d6b6140",
"size": "5101",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "integration/spark/src/main/scala/org/apache/spark/util/MergeIndexUtil.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "16022"
},
{
"name": "Batchfile",
"bytes": "1639"
},
{
"name": "C#",
"bytes": "86"
},
{
"name": "C++",
"bytes": "110888"
},
{
"name": "CMake",
"bytes": "1555"
},
{
"name": "Java",
"bytes": "7859129"
},
{
"name": "Python",
"bytes": "368778"
},
{
"name": "Scala",
"bytes": "12011736"
},
{
"name": "Shell",
"bytes": "7259"
},
{
"name": "Thrift",
"bytes": "23385"
}
],
"symlink_target": ""
} |
package mockit.integration;
import java.util.*;
import mockit.*;
public final class CollaboratorStrictExpectations extends Expectations
{
public CollaboratorStrictExpectations(Collaborator mock)
{
mock.doSomething(); result = new IllegalFormatCodePointException('x');
times = 2;
}
}
| {
"content_hash": "a6163035850f475ea8ec76f1220e11aa",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 20.533333333333335,
"alnum_prop": 0.7435064935064936,
"repo_name": "viniciusfernandes/jmockit1",
"id": "2f1e424513786dfb443a25187ee581db9edd10a6",
"size": "436",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "main/test/mockit/integration/CollaboratorStrictExpectations.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3524"
},
{
"name": "Java",
"bytes": "2066916"
},
{
"name": "JavaScript",
"bytes": "3493"
}
],
"symlink_target": ""
} |
package org.deeplearning4j.nn.layers.custom.testlayers;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.layers.BaseOutputLayer;
/**
* Created by Alex on 28/08/2016.
*/
public class CustomOutputLayerImpl extends BaseOutputLayer<CustomOutputLayer> {
public CustomOutputLayerImpl(NeuralNetConfiguration conf) {
super(conf);
}
}
| {
"content_hash": "6ba2b83b1ff07109413955252ce32672",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 79,
"avg_line_length": 25.733333333333334,
"alnum_prop": 0.7797927461139896,
"repo_name": "xuzhongxing/deeplearning4j",
"id": "b93fdacf2d2e4febbc5d51867cd1fe4fa8b1f9a6",
"size": "1047",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "deeplearning4j-core/src/test/java/org/deeplearning4j/nn/layers/custom/testlayers/CustomOutputLayerImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "931"
},
{
"name": "CSS",
"bytes": "245406"
},
{
"name": "FreeMarker",
"bytes": "18278"
},
{
"name": "HTML",
"bytes": "111375"
},
{
"name": "Java",
"bytes": "6936373"
},
{
"name": "JavaScript",
"bytes": "636238"
},
{
"name": "Ruby",
"bytes": "4558"
},
{
"name": "Scala",
"bytes": "173698"
},
{
"name": "Shell",
"bytes": "10247"
},
{
"name": "TypeScript",
"bytes": "78035"
}
],
"symlink_target": ""
} |
import Component from "@ember/component";
import layout from "../templates/components/sy-close";
export default Component.extend({
layout: layout,
tagName: "button",
classNames: "close",
attributeBindings: ["type", "aria-label"],
type: "button",
"aria-label": "Close"
});
| {
"content_hash": "db2dc2b8cb9cb15a851a3301d03f570f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 54,
"avg_line_length": 20.571428571428573,
"alnum_prop": 0.6840277777777778,
"repo_name": "adfinis-sygroup/ember-sy",
"id": "451275c36790bbdf61043bf84109eba752546e7a",
"size": "288",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "addon/components/sy-close.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "345"
},
{
"name": "HTML",
"bytes": "3770"
},
{
"name": "JavaScript",
"bytes": "15068"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _16ComparingFloats
{
class Program
{
static void Main(string[] args)
{
double numberA = double.Parse(Console.ReadLine());
double numberB = double.Parse(Console.ReadLine());
double eps = 0.000001;
double difference = Math.Abs(numberA - numberB);
bool equal = false;
if (difference < eps)
{
equal = true;
}
Console.WriteLine(equal);
}
}
}
| {
"content_hash": "e56554892875a5e9cb53608623b9db69",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 62,
"avg_line_length": 23.22222222222222,
"alnum_prop": 0.5534290271132376,
"repo_name": "Stradjazz/SoftUni",
"id": "824e74f5c33285fe776ae9b05611418f998ab988",
"size": "629",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Programming fundamentals C#/02. DataTypeExercises/16ComparingFloats/Program.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "197"
},
{
"name": "C#",
"bytes": "1572299"
},
{
"name": "CSS",
"bytes": "1026"
},
{
"name": "HTML",
"bytes": "64349"
},
{
"name": "JavaScript",
"bytes": "452482"
}
],
"symlink_target": ""
} |
package com.ymsino.water.sys.listener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.ymsino.water.service.manager.manager.ManagerReturn;
import com.ymsino.water.service.manager.manager.ManagerSaveParam;
import com.ymsino.water.service.manager.manager.ManagerService;
public class FrameworkContextLoaderListener extends ContextLoaderListener
implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent event) {
WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext());
System.out.println("----------初始化系统超级管理员----------");
ManagerService managerService = (ManagerService) context.getBean("managerService");
ManagerReturn manager = managerService.getByManagerId("administrator");
if(manager == null){
ManagerSaveParam managerSaveParam = new ManagerSaveParam();
managerSaveParam.setName("超级管理员");
managerSaveParam.setManagerId("administrator");
managerSaveParam.setPassword("123456");
managerSaveParam.setChargingUnitId("administrator");
managerSaveParam.setDepartmentId("administrator");
managerService.save(managerSaveParam);
managerService.openStatus("administrator");
}
System.out.println("----------初始化系统超级管理员结束----------");
}
@Override
public void contextDestroyed(ServletContextEvent event) {
}
}
| {
"content_hash": "05eea0b4cc3d0b4ca3098d8e57ee33f5",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 121,
"avg_line_length": 38.48837209302326,
"alnum_prop": 0.7800604229607251,
"repo_name": "xcjava/ymWaterWeb",
"id": "9a957781462fc038fce1e16713715f8b9538f467",
"size": "1709",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/ymsino/water/sys/listener/FrameworkContextLoaderListener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "61370"
},
{
"name": "Java",
"bytes": "1944159"
},
{
"name": "JavaScript",
"bytes": "220727"
},
{
"name": "PHP",
"bytes": "2648"
}
],
"symlink_target": ""
} |
#include "webrtc/modules/video_coding/main/source/receiver.h"
#include <assert.h>
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
#include "webrtc/modules/video_coding/main/source/encoded_frame.h"
#include "webrtc/modules/video_coding/main/source/internal_defines.h"
#include "webrtc/modules/video_coding/main/source/media_opt_util.h"
#include "webrtc/system_wrappers/interface/clock.h"
#include "webrtc/system_wrappers/interface/trace.h"
#include "webrtc/system_wrappers/interface/trace_event.h"
namespace webrtc {
enum { kMaxReceiverDelayMs = 10000 };
VCMReceiver::VCMReceiver(VCMTiming* timing,
Clock* clock,
EventFactory* event_factory,
int32_t vcm_id,
int32_t receiver_id,
bool master)
: crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
vcm_id_(vcm_id),
clock_(clock),
receiver_id_(receiver_id),
master_(master),
jitter_buffer_(clock_, event_factory, vcm_id, receiver_id, master),
timing_(timing),
render_wait_event_(event_factory->CreateEvent()),
state_(kPassive),
max_video_delay_ms_(kMaxVideoDelayMs) {}
VCMReceiver::~VCMReceiver() {
render_wait_event_->Set();
delete crit_sect_;
}
void VCMReceiver::Reset() {
CriticalSectionScoped cs(crit_sect_);
if (!jitter_buffer_.Running()) {
jitter_buffer_.Start();
} else {
jitter_buffer_.Flush();
}
render_wait_event_->Reset();
if (master_) {
state_ = kReceiving;
} else {
state_ = kPassive;
}
}
int32_t VCMReceiver::Initialize() {
CriticalSectionScoped cs(crit_sect_);
Reset();
if (!master_) {
SetNackMode(kNoNack, -1, -1);
}
return VCM_OK;
}
void VCMReceiver::UpdateRtt(uint32_t rtt) {
jitter_buffer_.UpdateRtt(rtt);
}
int32_t VCMReceiver::InsertPacket(const VCMPacket& packet,
uint16_t frame_width,
uint16_t frame_height) {
if (packet.frameType == kVideoFrameKey) {
WEBRTC_TRACE(webrtc::kTraceInfo, webrtc::kTraceVideoCoding,
VCMId(vcm_id_, receiver_id_),
"Inserting key frame packet seqnum=%u, timestamp=%u",
packet.seqNum, packet.timestamp);
}
// Insert the packet into the jitter buffer. The packet can either be empty or
// contain media at this point.
bool retransmitted = false;
const VCMFrameBufferEnum ret = jitter_buffer_.InsertPacket(packet,
&retransmitted);
if (ret == kOldPacket) {
return VCM_OK;
} else if (ret == kFlushIndicator) {
return VCM_FLUSH_INDICATOR;
} else if (ret < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCoding,
VCMId(vcm_id_, receiver_id_),
"Error inserting packet seqnum=%u, timestamp=%u",
packet.seqNum, packet.timestamp);
return VCM_JITTER_BUFFER_ERROR;
}
if (ret == kCompleteSession && !retransmitted) {
// We don't want to include timestamps which have suffered from
// retransmission here, since we compensate with extra retransmission
// delay within the jitter estimate.
timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds());
}
if (master_) {
// Only trace the primary receiver to make it possible to parse and plot
// the trace file.
WEBRTC_TRACE(webrtc::kTraceDebug, webrtc::kTraceVideoCoding,
VCMId(vcm_id_, receiver_id_),
"Packet seqnum=%u timestamp=%u inserted at %u",
packet.seqNum, packet.timestamp,
MaskWord64ToUWord32(clock_->TimeInMilliseconds()));
}
return VCM_OK;
}
VCMEncodedFrame* VCMReceiver::FrameForDecoding(
uint16_t max_wait_time_ms,
int64_t& next_render_time_ms,
bool render_timing,
VCMReceiver* dual_receiver) {
const int64_t start_time_ms = clock_->TimeInMilliseconds();
uint32_t frame_timestamp = 0;
// Exhaust wait time to get a complete frame for decoding.
bool found_frame = jitter_buffer_.NextCompleteTimestamp(
max_wait_time_ms, &frame_timestamp);
if (!found_frame) {
// Get an incomplete frame when enabled.
const bool dual_receiver_enabled_and_passive = (dual_receiver != NULL &&
dual_receiver->State() == kPassive &&
dual_receiver->NackMode() == kNack);
if (dual_receiver_enabled_and_passive &&
!jitter_buffer_.CompleteSequenceWithNextFrame()) {
// Jitter buffer state might get corrupt with this frame.
dual_receiver->CopyJitterBufferStateFromReceiver(*this);
}
found_frame = jitter_buffer_.NextMaybeIncompleteTimestamp(
&frame_timestamp);
}
if (!found_frame) {
return NULL;
}
// We have a frame - Set timing and render timestamp.
timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs());
const int64_t now_ms = clock_->TimeInMilliseconds();
timing_->UpdateCurrentDelay(frame_timestamp);
next_render_time_ms = timing_->RenderTimeMs(frame_timestamp, now_ms);
// Check render timing.
bool timing_error = false;
// Assume that render timing errors are due to changes in the video stream.
if (next_render_time_ms < 0) {
timing_error = true;
} else if (next_render_time_ms < now_ms - max_video_delay_ms_) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
VCMId(vcm_id_, receiver_id_),
"This frame should have been rendered more than %u ms ago."
"Flushing jitter buffer and resetting timing.",
max_video_delay_ms_);
timing_error = true;
} else if (static_cast<int>(timing_->TargetVideoDelay()) >
max_video_delay_ms_) {
WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
VCMId(vcm_id_, receiver_id_),
"More than %u ms target delay. Flushing jitter buffer and"
"resetting timing.", max_video_delay_ms_);
timing_error = true;
}
if (timing_error) {
// Timing error => reset timing and flush the jitter buffer.
jitter_buffer_.Flush();
timing_->Reset();
return NULL;
}
if (!render_timing) {
// Decode frame as close as possible to the render timestamp.
const int32_t available_wait_time = max_wait_time_ms -
static_cast<int32_t>(clock_->TimeInMilliseconds() - start_time_ms);
uint16_t new_max_wait_time = static_cast<uint16_t>(
VCM_MAX(available_wait_time, 0));
uint32_t wait_time_ms = timing_->MaxWaitingTime(
next_render_time_ms, clock_->TimeInMilliseconds());
if (new_max_wait_time < wait_time_ms) {
// We're not allowed to wait until the frame is supposed to be rendered,
// waiting as long as we're allowed to avoid busy looping, and then return
// NULL. Next call to this function might return the frame.
render_wait_event_->Wait(max_wait_time_ms);
return NULL;
}
// Wait until it's time to render.
render_wait_event_->Wait(wait_time_ms);
}
// Extract the frame from the jitter buffer and set the render time.
VCMEncodedFrame* frame = jitter_buffer_.ExtractAndSetDecode(frame_timestamp);
if (frame == NULL) {
return NULL;
}
frame->SetRenderTime(next_render_time_ms);
TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", frame->TimeStamp(),
"SetRenderTS", "render_time", next_render_time_ms);
if (dual_receiver != NULL) {
dual_receiver->UpdateState(*frame);
}
if (!frame->Complete()) {
// Update stats for incomplete frames.
bool retransmitted = false;
const int64_t last_packet_time_ms =
jitter_buffer_.LastPacketTime(frame, &retransmitted);
if (last_packet_time_ms >= 0 && !retransmitted) {
// We don't want to include timestamps which have suffered from
// retransmission here, since we compensate with extra retransmission
// delay within the jitter estimate.
timing_->IncomingTimestamp(frame_timestamp, last_packet_time_ms);
}
}
return frame;
}
void VCMReceiver::ReleaseFrame(VCMEncodedFrame* frame) {
jitter_buffer_.ReleaseFrame(frame);
}
void VCMReceiver::ReceiveStatistics(uint32_t* bitrate,
uint32_t* framerate) {
assert(bitrate);
assert(framerate);
jitter_buffer_.IncomingRateStatistics(framerate, bitrate);
}
void VCMReceiver::ReceivedFrameCount(VCMFrameCount* frame_count) const {
assert(frame_count);
jitter_buffer_.FrameStatistics(&frame_count->numDeltaFrames,
&frame_count->numKeyFrames);
}
uint32_t VCMReceiver::DiscardedPackets() const {
return jitter_buffer_.num_discarded_packets();
}
void VCMReceiver::SetNackMode(VCMNackMode nackMode,
int low_rtt_nack_threshold_ms,
int high_rtt_nack_threshold_ms) {
CriticalSectionScoped cs(crit_sect_);
// Default to always having NACK enabled in hybrid mode.
jitter_buffer_.SetNackMode(nackMode, low_rtt_nack_threshold_ms,
high_rtt_nack_threshold_ms);
if (!master_) {
state_ = kPassive; // The dual decoder defaults to passive.
}
}
void VCMReceiver::SetNackSettings(size_t max_nack_list_size,
int max_packet_age_to_nack,
int max_incomplete_time_ms) {
jitter_buffer_.SetNackSettings(max_nack_list_size,
max_packet_age_to_nack,
max_incomplete_time_ms);
}
VCMNackMode VCMReceiver::NackMode() const {
CriticalSectionScoped cs(crit_sect_);
return jitter_buffer_.nack_mode();
}
VCMNackStatus VCMReceiver::NackList(uint16_t* nack_list,
uint16_t size,
uint16_t* nack_list_length) {
bool request_key_frame = false;
uint16_t* internal_nack_list = jitter_buffer_.GetNackList(
nack_list_length, &request_key_frame);
if (*nack_list_length > size) {
*nack_list_length = 0;
return kNackNeedMoreMemory;
}
if (internal_nack_list != NULL && *nack_list_length > 0) {
memcpy(nack_list, internal_nack_list, *nack_list_length * sizeof(uint16_t));
}
if (request_key_frame) {
return kNackKeyFrameRequest;
}
return kNackOk;
}
// Decide whether we should change decoder state. This should be done if the
// dual decoder has caught up with the decoder decoding with packet losses.
bool VCMReceiver::DualDecoderCaughtUp(VCMEncodedFrame* dual_frame,
VCMReceiver& dual_receiver) const {
if (dual_frame == NULL) {
return false;
}
if (jitter_buffer_.LastDecodedTimestamp() == dual_frame->TimeStamp()) {
dual_receiver.UpdateState(kWaitForPrimaryDecode);
return true;
}
return false;
}
void VCMReceiver::CopyJitterBufferStateFromReceiver(
const VCMReceiver& receiver) {
jitter_buffer_.CopyFrom(receiver.jitter_buffer_);
}
VCMReceiverState VCMReceiver::State() const {
CriticalSectionScoped cs(crit_sect_);
return state_;
}
void VCMReceiver::SetDecodeWithErrors(bool enable){
CriticalSectionScoped cs(crit_sect_);
jitter_buffer_.DecodeWithErrors(enable);
}
bool VCMReceiver::DecodeWithErrors() const {
CriticalSectionScoped cs(crit_sect_);
return jitter_buffer_.decode_with_errors();
}
int VCMReceiver::SetMinReceiverDelay(int desired_delay_ms) {
CriticalSectionScoped cs(crit_sect_);
if (desired_delay_ms < 0 || desired_delay_ms > kMaxReceiverDelayMs) {
return -1;
}
max_video_delay_ms_ = desired_delay_ms + kMaxVideoDelayMs;
// Initializing timing to the desired delay.
timing_->set_min_playout_delay(desired_delay_ms);
return 0;
}
int VCMReceiver::RenderBufferSizeMs() {
uint32_t timestamp_start = 0u;
uint32_t timestamp_end = 0u;
// Render timestamps are computed just prior to decoding. Therefore this is
// only an estimate based on frames' timestamps and current timing state.
jitter_buffer_.RenderBufferSize(×tamp_start, ×tamp_end);
if (timestamp_start == timestamp_end) {
return 0;
}
// Update timing.
const int64_t now_ms = clock_->TimeInMilliseconds();
timing_->SetJitterDelay(jitter_buffer_.EstimatedJitterMs());
// Get render timestamps.
uint32_t render_start = timing_->RenderTimeMs(timestamp_start, now_ms);
uint32_t render_end = timing_->RenderTimeMs(timestamp_end, now_ms);
return render_end - render_start;
}
void VCMReceiver::UpdateState(VCMReceiverState new_state) {
CriticalSectionScoped cs(crit_sect_);
assert(!(state_ == kPassive && new_state == kWaitForPrimaryDecode));
state_ = new_state;
}
void VCMReceiver::UpdateState(const VCMEncodedFrame& frame) {
if (jitter_buffer_.nack_mode() == kNoNack) {
// Dual decoder mode has not been enabled.
return;
}
// Update the dual receiver state.
if (frame.Complete() && frame.FrameType() == kVideoFrameKey) {
UpdateState(kPassive);
}
if (State() == kWaitForPrimaryDecode &&
frame.Complete() && !frame.MissingFrame()) {
UpdateState(kPassive);
}
if (frame.MissingFrame() || !frame.Complete()) {
// State was corrupted, enable dual receiver.
UpdateState(kReceiving);
}
}
} // namespace webrtc
| {
"content_hash": "edfa0ae57d7915602946b2afe8938fc4",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 80,
"avg_line_length": 35.653225806451616,
"alnum_prop": 0.653396667420644,
"repo_name": "goddino/libjingle",
"id": "4cbbebd3127c4bf65434df740a18cf824b12bd0c",
"size": "13675",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "trunk/third_party/webrtc/modules/video_coding/main/source/receiver.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "477670"
},
{
"name": "C++",
"bytes": "9053050"
},
{
"name": "Java",
"bytes": "136369"
},
{
"name": "Objective-C",
"bytes": "245597"
},
{
"name": "Python",
"bytes": "104840"
},
{
"name": "Shell",
"bytes": "4870"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Coding Questions | Warren Liu</title>
<link href="../../../assets/css/rst.css" rel="stylesheet" type="text/css">
<link href="../../../assets/css/poole.css" rel="stylesheet" type="text/css">
<link href="../../../assets/css/lanyon.css" rel="stylesheet" type="text/css">
<link href="../../../assets/css/code.css" rel="stylesheet" type="text/css">
<link href="../../../assets/css/custom.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=PT+Serif:400,400italic,700%7CPT+Sans:400">
<link rel="alternate" type="application/rss+xml" title="RSS" href="../../../rss.xml">
<link rel="canonical" href="https://wudong.graceliu.uk/posts/notes/coding-questions/">
<!--[if lt IE 9]><script src="../../../assets/js/html5.js"></script><![endif]--><meta name="author" content="Warren Liu">
<link rel="prev" href="../solr-notes/" title="Solr Note" type="text/html">
<link rel="next" href="../Bash-notes/" title="Bash Note" type="text/html">
<meta property="og:site_name" content="Warren Liu">
<meta property="og:title" content="Coding Questions">
<meta property="og:url" content="https://wudong.graceliu.uk/posts/notes/coding-questions/">
<meta property="og:description" content="Table of Contents
Some Coding Questions
Some Coding Questions
String rotation:
Use substring() only to determine if a string is a rotation
of the other.
Return k-th to last element (las">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2017-07-14T16:28:48+01:00">
<meta property="article:tag" content="algorithm">
<meta property="article:tag" content="coding">
</head>
<body>
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
<!-- Target for toggling the sidebar `.sidebar-checkbox` is for regular
styles, `#sidebar-checkbox` for behavior. -->
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox"><!-- Toggleable sidebar --><div class="sidebar" id="sidebar">
<div class="sidebar-item">
<p>A reserved <a href="https://getnikola.com" target="_blank">Nikola</a> theme that places the utmost gravity on content with a hidden drawer. Made by <a href="https://twitter.com/mdo" target="_blank">@mdo</a> for Jekyll,
ported to Nikola by <a href="https://twitter.com/ralsina" target="_blank">@ralsina</a>.</p>
</div>
<nav id="menu" role="navigation" class="sidebar-nav"><a class="sidebar-nav-item" href="../../../archive.html">Archive</a>
<a class="sidebar-nav-item" href="../../../categories/">Tags</a>
<a class="sidebar-nav-item" href="../../../rss.xml">RSS feed</a>
</nav>
</div>
<!-- Wrap is the content to shift when toggling the sidebar. We wrap the
content to avoid any CSS collisions with our real content. -->
<div class="wrap">
<div class="masthead">
<div class="container">
<h3 id="brand" class="masthead-title">
<a href="https://wudong.graceliu.uk/" title="Warren Liu" rel="home">Warren Liu</a>
</h3>
</div>
</div>
<div class="container content" id="content">
<article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="post-title p-name entry-title" itemprop="headline name"><a href="." class="u-url">Coding Questions</a></h1>
<div class="metadata">
<p class="byline author vcard"><span class="byline-name fn">Warren Liu</span></p>
<p class="dateline"><a href="." rel="bookmark"><time class="post-date published dt-published" datetime="2017-07-14T16:28:48+01:00" itemprop="datePublished" title="2017-07-14 16:28">2017-07-14 16:28</time></a></p>
</div>
</header><div class="e-content entry-content" itemprop="articleBody text">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">Some Coding Questions</a></li>
</ul>
</div>
</div>
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1">Some Coding Questions</h2>
<div class="outline-text-2" id="text-1">
<ul class="org-ul">
<li>String rotation: <br>
Use <b>substring()</b> only to determine if a string is a rotation
of the other.
</li>
<li>Return k-th to last element (last k element) of a singlely linked list
</li>
<li>Delete middle node in a singely linke list, given only access to
that node.
</li>
<li>Partition a linked list around a value <code>x</code>, so that the node that
has value smaller than <code>x</code> comes before the those larger than <code>x</code>.
</li>
<li>
</li>
</ul>
</div>
</div>
</div>
<aside class="postpromonav"><nav><ul itemprop="keywords" class="tags">
<li><a class="tag p-category" href="../../../categories/algorithm/" rel="tag">algorithm</a></li>
<li><a class="tag p-category" href="../../../categories/coding/" rel="tag">coding</a></li>
</ul>
<ul class="pager hidden-print">
<li class="previous">
<a href="../solr-notes/" rel="prev" title="Solr Note">Previous post</a>
</li>
<li class="next">
<a href="../Bash-notes/" rel="next" title="Bash Note">Next post</a>
</li>
</ul></nav></aside></article><footer id="footer"><p>Contents © 2017 <a href="mailto:[email protected]">Warren Liu</a> - Powered by <a href="https://getnikola.com" rel="nofollow">Nikola</a> </p>
</footer>
</div>
</div>
<label for="sidebar-checkbox" class="sidebar-toggle"></label>
<script src="../../../assets/js/jquery.min.js"></script><script src="../../../assets/js/moment-with-locales.min.js"></script><script src="../../../assets/js/fancydates.js"></script><!-- fancy dates --><script>
moment.locale("en");
fancydates(0, "YYYY-MM-DD HH:mm");
</script><!-- end fancy dates -->
</body>
</html>
| {
"content_hash": "a066434f83a3b225bb8c028e3b6a361a",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 236,
"avg_line_length": 41.83108108108108,
"alnum_prop": 0.6331771926990793,
"repo_name": "wudong/wudong.github.io",
"id": "1a3299b903cee012b586dc70d7fd25fac268e496",
"size": "6192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "posts/notes/coding-questions/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "67532"
},
{
"name": "HTML",
"bytes": "1771375"
},
{
"name": "JavaScript",
"bytes": "38271"
},
{
"name": "XSLT",
"bytes": "3619"
}
],
"symlink_target": ""
} |
<?
namespace Concrete\Controller\SinglePage\Dashboard\System\Files;
use \Concrete\Core\Page\Controller\DashboardPageController;
use Config;
use Loader;
use PermissionKey;
use TaskPermission;
use PermissionAccess;
class Filetypes extends DashboardPageController {
var $helpers = array('form','concrete/ui','validation/token', 'concrete/file');
public function view() {
$helper_file = Loader::helper('concrete/file');
$file_access_file_types = $helper_file->unserializeUploadFileExtensions(
Config::get('concrete.upload.extensions'));
$file_access_file_types = join(', ',$file_access_file_types);
$this->set('file_access_file_types', $file_access_file_types);
}
public function saved() {
$this->set('message', t('Allowed file types saved.'));
$this->view();
}
public function file_access_extensions(){
$helper_file = Loader::helper('concrete/file');
$validation_token = Loader::helper('validation/token');
if (!$validation_token->validate("file_access_extensions")) {
$this->set('error', array($validation_token->getErrorMessage()));
return;
}
$types = preg_split('{,}',$this->post('file-access-file-types'),null,PREG_SPLIT_NO_EMPTY);
$types = $helper_file->serializeUploadFileExtensions($types);
Config::save('concrete.upload.extensions', $types);
$this->redirect('/dashboard/system/files/filetypes','saved');
}
}
| {
"content_hash": "898fddfaf4cdf2d25916afe796d65f5a",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 92,
"avg_line_length": 31.976744186046513,
"alnum_prop": 0.7105454545454546,
"repo_name": "baardev/lbtb",
"id": "26a897d620468f60205d827f8b45722a1db59b31",
"size": "1375",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "concrete/controllers/single_page/dashboard/system/files/filetypes.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "220905"
},
{
"name": "ApacheConf",
"bytes": "335"
},
{
"name": "Batchfile",
"bytes": "41"
},
{
"name": "CSS",
"bytes": "828306"
},
{
"name": "JavaScript",
"bytes": "792139"
},
{
"name": "PHP",
"bytes": "6677077"
},
{
"name": "Shell",
"bytes": "355"
}
],
"symlink_target": ""
} |
class FalseClass
def to_bool() self ; end
end
| {
"content_hash": "c3011d67061922a0acedc758c3fa14bf",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 26,
"avg_line_length": 16,
"alnum_prop": 0.7083333333333334,
"repo_name": "locomotivecms/common",
"id": "4d23ea3a7419118c3c82485b7628a120a8e7bda9",
"size": "48",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/locomotive/common/core_ext/boolean/false.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "12738"
}
],
"symlink_target": ""
} |
"""
The POX packet library for packet parsing and creation.
This is based heavily on NOX's packet library, though it has undergone
some signficant change, particularly with regard to making packet
assembly easier.
Could still use more work.
"""
# None of this is probably that big, and almost all of it gets loaded
# under most circumstances anyway. Let's just load all of it.
import arp as ARP
import dhcp as DHCP
import dns as DNS
import eap as EAP
import eapol as EAPOL
import ethernet as ETHERNET
import ipv4 as IPV4
import ipv6 as IPV6
import icmp as ICMP
import icmpv6 as ICMPV6
import lldp as LLDP
import tcp as TCP
import udp as UDP
import vlan as VLAN
import mpls as MPLS
from arp import *
from dhcp import *
from dns import *
from eap import *
from eapol import *
from ethernet import *
from ipv4 import *
from ipv6 import *
from icmp import *
from icmpv6 import *
from lldp import *
from tcp import *
from udp import *
from vlan import *
from mpls import *
__all__ = [
'arp',
'dhcp',
'dns',
'eap',
'eapol',
'ethernet',
'ipv4',
'ipv6',
'icmp',
'icmpv6',
'lldp',
'tcp',
'tcp_opt',
'udp',
'vlan',
'mpls',
'ARP',
'DHCP',
'DNS',
'EAP',
'EAPOL',
'ETHERNET',
'IPV4',
'IPV6',
'ICMP',
'ICMPV6',
'LLDP',
'TCP',
'UDP',
'VLAN',
'MPLS',
]
| {
"content_hash": "804db61026c17b57eb15c070909f42a4",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 70,
"avg_line_length": 16.743589743589745,
"alnum_prop": 0.6761102603369066,
"repo_name": "kavitshah8/SDNDeveloper",
"id": "4dffc7042402b670997e71fba7dfb0806040a25a",
"size": "1891",
"binary": false,
"copies": "3",
"ref": "refs/heads/SDN_Developer",
"path": "pox/lib/packet/__init__.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "15160"
},
{
"name": "JavaScript",
"bytes": "9048"
},
{
"name": "Python",
"bytes": "1113186"
},
{
"name": "Shell",
"bytes": "447"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<monster name="The Handmaiden" nameDescription="the Handmaiden" race="blood" experience="3850" speed="450" manacost="0">
<health now="14500" max="14500"/>
<look type="230" corpse="6312"/>
<targetchange interval="5000" chance="8"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="70"/>
<flag runonhealth="3100"/>
</flags>
<attacks>
<attack name="melee" interval="2000" min="0" max="-800"/>
<attack name="manadrain" interval="2000" chance="25" range="7" min="-150" max="-800">
<attribute key="areaEffect" value="blueshimmer"/>
</attack>
<attack name="drunk" interval="1000" chance="12" range="1" target="1">
</attack>
</attacks>
<defenses armor="25" defense="35">
<defense name="speed" interval="3000" chance="12" speedchange="380" duration="8000">
<attribute key="areaEffect" value="redshimmer"/>
</defense>
<defense name="invisible" interval="4000" chance="50" duration="6000">
<attribute key="areaEffect" value="redshimmer"/>
</defense>
<defense name="healing" interval="2000" chance="50" min="100" max="250">
<attribute key="areaEffect" value="blueshimmer"/>
</defense>
<defense name="speed" interval="1000" chance="35" speedchange="370" duration="30000">
<attribute key="areaEffect" value="redshimmer"/>
</defense>
</defenses>
<immunities>
<immunity energy="1"/>
<immunity fire="1"/>
<immunity ice="1"/>
<immunity poison="1"/>
<immunity lifedrain="1"/>
<immunity paralyze="1"/>
<immunity outfit="1"/>
<immunity drunk="1"/>
<immunity invisible="1"/>
</immunities>
<loot>
<item id="6539" chance="35000"/><!-- handmaiden's protector -->
</loot>
</monster>
| {
"content_hash": "9b72db6b23f5d06e56e7cbb55762024d",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 120,
"avg_line_length": 34.345454545454544,
"alnum_prop": 0.6553732133403918,
"repo_name": "victorperin/tibia-server",
"id": "a5a8ae393850fad854a89f23ee7f07194aa70a92",
"size": "1889",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "data/monster/bosses/handmaiden.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Lua",
"bytes": "2465786"
}
],
"symlink_target": ""
} |
<?php
/**
* Created by PhpStorm.
* User: pluetzner
* Date: 12.06.2017
* Time: 00:08
*/
namespace Pluetzner\BlockBundle\Model;
/**
* Class EntityBlockTypeModel
* @package Pluetzner\BlockBundle\Model
*/
class EntityBlockTypeModel
{
} | {
"content_hash": "887747444dfa1d157319e14b764c10fc",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 39,
"avg_line_length": 15,
"alnum_prop": 0.7041666666666667,
"repo_name": "karatektus/blockBundle",
"id": "cb5933d41c6a0341f8f2041529c0d7419fe3eaad",
"size": "240",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Model/EntityBlockTypeModel.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1893"
},
{
"name": "HTML",
"bytes": "34078"
},
{
"name": "JavaScript",
"bytes": "23211"
},
{
"name": "PHP",
"bytes": "148080"
}
],
"symlink_target": ""
} |
module DK
class CLI < Thor
desc 'strip', 'Strip old comments from posts.'
long_desc <<-LONGDESC
`strip` will delete other user's previous comments in your Drafts or Queue.
LONGDESC
option :limit, type: :numeric, aliases: :l, desc: Options.op_strings[:limit]
option :blog, type: :string, aliases: :b, desc: Options.op_strings[:blog]
option :source, type: :string, aliases: :S, desc: Options.op_strings[:source]
option :simulate, type: :boolean, aliases: :s, desc: Options.op_strings[:simulate]
option :show_pi, type: :boolean, desc: Options.op_strings[:show_pi], default: true
option :config, type: :string, desc: Options.op_strings[:config]
def strip
configured?
opts = process_options(options)
dk = get_dk_instance(opts)
dk.strip_old_comments(opts)
end
end
end
| {
"content_hash": "7052a8ea020631c572aeb666f15f5f53",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 88,
"avg_line_length": 42.95,
"alnum_prop": 0.6554132712456344,
"repo_name": "meissadia/tumblr_draftking",
"id": "32fcfd7bd8471e9a09072b0c6041b1d932daff4e",
"size": "859",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/draftking/cli/commands/strip.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "77190"
}
],
"symlink_target": ""
} |
import { screen } from '@testing-library/react';
import okapiCurrentUser from 'fixtures/okapiCurrentUser';
import userEvent from '@testing-library/user-event';
import '__mock__/stripesComponents.mock';
import renderWithRouter from 'helpers/renderWithRouter';
import UserServicePoints from './UserServicePoints';
const toggleMock = jest.fn();
const renderUserServicePoints = (props) => renderWithRouter(<UserServicePoints {...props} />);
const props = (preffered, isEmpty) => {
return {
expanded: true,
onToggle: toggleMock,
accordionId: 'UserServicePoints',
preferredServicePoint: preffered ? '578a8413-dec9-4a70-a2ab-10ec865399f6' : '-',
servicePoints: isEmpty ? [] : okapiCurrentUser.servicePoints,
};
};
describe('Render User Service Points component', () => {
it('Check if Component is rendered', () => {
renderUserServicePoints(props(true, false));
expect(screen.getByText('7c5abc9f-f3d7-4856-b8d7-6712462ca007')).toBeInTheDocument();
});
it('Check if Formatter is working', () => {
renderUserServicePoints(props(true, false));
userEvent.click(screen.getByText('Formatter'));
expect(document.querySelector('[id="UserServicePoints"]')).toBeInTheDocument();
});
it('if preffered service point is empty', () => {
renderUserServicePoints(props(false, false));
expect(screen.getByText('ui-users.sp.preferredSPNone')).toBeInTheDocument();
});
it('if services point is empty', () => {
renderUserServicePoints(props(false, true));
expect(screen.getByText('List Component')).toBeInTheDocument();
});
});
| {
"content_hash": "565428be97748fa781c276a854596aa2",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 94,
"avg_line_length": 38.5609756097561,
"alnum_prop": 0.713472485768501,
"repo_name": "folio-org/ui-users",
"id": "ff023fa61e66207afa838a972fe8aa0643f82059",
"size": "1581",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/UserDetailSections/UserServicePoints/UserServicePoints.test.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "11251"
},
{
"name": "JavaScript",
"bytes": "1982478"
},
{
"name": "Shell",
"bytes": "814"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("4. Supermarket Database")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("4. Supermarket Database")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fe64bb62-e697-4eb0-9a65-80d4e18c8f15")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "7f7c1d33b133fec6478464c09ecfcf5e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.916666666666664,
"alnum_prop": 0.7480862908837856,
"repo_name": "origami99/SoftUni",
"id": "a772ff9901acf27617a55a817a490fcbebdafdde",
"size": "1440",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "02. ProgFund/Exercises/08. Dictionaries and Lists - Exercises 2/4. Supermarket Database/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1196627"
},
{
"name": "Python",
"bytes": "3377"
}
],
"symlink_target": ""
} |
package io.youi.drawable
trait Drawable extends Modifiable {
def draw(context: Context, x: Double, y: Double): Unit
}
object Drawable {
object None extends Drawable {
override def draw(context: Context, x: Double, y: Double): Unit = {}
}
} | {
"content_hash": "54dad56580549100a9784285d0eaa472",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 72,
"avg_line_length": 22.818181818181817,
"alnum_prop": 0.701195219123506,
"repo_name": "outr/youi",
"id": "c75ddcdf12c5dbf4073559255a1848055dfba18b",
"size": "251",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ui/js/src/main/scala/io/youi/drawable/Drawable.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "844"
},
{
"name": "HTML",
"bytes": "6666"
},
{
"name": "JavaScript",
"bytes": "106413"
},
{
"name": "Scala",
"bytes": "3490560"
},
{
"name": "Shell",
"bytes": "89"
}
],
"symlink_target": ""
} |
VENDOR_BUY = 1
VENDOR_SELL = 2
VENDOR_BOTH = 3
PLUGIN.name = "Vendors"
PLUGIN.author = "Chessnut"
PLUGIN.desc = "Adds NPC vendors that can sell things."
-- Keys for vendor messages.
VENDOR_WELCOME = 1
VENDOR_LEAVE = 2
VENDOR_NOTRADE = 3
-- Keys for item information.
VENDOR_PRICE = 1
VENDOR_STOCK = 2
VENDOR_MODE = 3
VENDOR_MAXSTOCK = 4
-- Sell and buy the item.
VENDOR_SELLANDBUY = 1
-- Only sell the item to the player.
VENDOR_SELLONLY = 2
-- Only buy the item from the player.
VENDOR_BUYONLY = 3
if (SERVER) then
local PLUGIN = PLUGIN
function PLUGIN:saveVendors()
local data = {}
for k, v in ipairs(ents.FindByClass("nut_vendor")) do
data[#data + 1] = {
name = v:getNetVar("name"),
desc = v:getNetVar("desc"),
pos = v:GetPos(),
angles = v:GetAngles(),
model = v:GetModel(),
bubble = v:getNetVar("noBubble"),
items = v.items,
factions = v.factions,
classes = v.classes,
money = v.money,
scale = v.scale
}
end
self:setData(data)
end
function PLUGIN:LoadData()
for k, v in ipairs(self:getData() or {}) do
local entity = ents.Create("nut_vendor")
entity:SetPos(v.pos)
entity:SetAngles(v.angles)
entity:Spawn()
entity:SetModel(v.model)
entity:setNetVar("noBubble", v.bubble)
entity:setNetVar("name", v.name)
entity:setNetVar("desc", v.desc)
entity.items = v.items or {}
entity.factions = v.factions or {}
entity.classes = v.classes or {}
entity.money = v.money
entity.scale = v.scale or 0.5
end
end
function PLUGIN:CanVendorSellItem(client, vendor, itemID)
local tradeData = vendor.items[itemID]
local char = client:getChar()
if (!tradeData or !char) then
print("Not Valid Item or Client Char.")
return false
end
if (!char:hasMoney(tradeData[1] or 0)) then
print("Insufficient Fund.")
return false
end
return true
end
function PLUGIN:OnCharTradeVendor(client, vendor, x, y, invID, price, isSell)
if (invID) then
local inv = nut.item.inventories[invID]
local item = inv:getItemAt(x, y)
if (price) then
price = nut.currency.get(price)
else
price = L("free", client):upper()
end
if (isSell) then
if (item) then
client:notifyLocalized("businessSell", item.name, price)
end
else
if (item) then
client:notifyLocalized("businessPurchase", item.name, price)
end
end
end
end
netstream.Hook("vendorExit", function(client)
local entity = client.nutVendor
if (IsValid(entity)) then
for k, v in ipairs(entity.receivers) do
if (v == client) then
table.remove(entity.receivers, k)
break
end
end
client.nutVendor = nil
end
end)
netstream.Hook("vendorEdit", function(client, key, data)
if (client:IsAdmin()) then
local entity = client.nutVendor
if (!IsValid(entity)) then
return
end
local feedback = true
if (key == "name") then
entity:setNetVar("name", data)
elseif (key == "desc") then
entity:setNetVar("desc", data)
elseif (key == "bubble") then
entity:setNetVar("noBubble", data)
elseif (key == "mode") then
local uniqueID = data[1]
entity.items[uniqueID] = entity.items[uniqueID] or {}
entity.items[uniqueID][VENDOR_MODE] = data[2]
netstream.Start(entity.receivers, "vendorEdit", key, data)
elseif (key == "price") then
local uniqueID = data[1]
data[2] = tonumber(data[2])
if (data[2]) then
data[2] = math.Round(data[2])
end
entity.items[uniqueID] = entity.items[uniqueID] or {}
entity.items[uniqueID][VENDOR_PRICE] = data[2]
netstream.Start(entity.receivers, "vendorEdit", key, data)
data = uniqueID
elseif (key == "stockDisable") then
entity.items[data] = entity.items[uniqueID] or {}
entity.items[data][VENDOR_MAXSTOCK] = nil
netstream.Start(entity.receivers, "vendorEdit", key, data)
elseif (key == "stockMax") then
local uniqueID = data[1]
data[2] = math.max(math.Round(tonumber(data[2]) or 1), 1)
entity.items[uniqueID] = entity.items[uniqueID] or {}
entity.items[uniqueID][VENDOR_MAXSTOCK] = data[2]
entity.items[uniqueID][VENDOR_STOCK] = math.Clamp(entity.items[uniqueID][VENDOR_STOCK] or data[2], 1, data[2])
data[3] = entity.items[uniqueID][VENDOR_STOCK]
netstream.Start(entity.receivers, "vendorEdit", key, data)
data = uniqueID
elseif (key == "stock") then
local uniqueID = data[1]
entity.items[uniqueID] = entity.items[uniqueID] or {}
if (!entity.items[uniqueID][VENDOR_MAXSTOCK]) then
data[2] = math.max(math.Round(tonumber(data[2]) or 0), 0)
entity.items[uniqueID][VENDOR_MAXSTOCK] = data[2]
end
data[2] = math.Clamp(math.Round(tonumber(data[2]) or 0), 0, entity.items[uniqueID][VENDOR_MAXSTOCK])
entity.items[uniqueID][VENDOR_STOCK] = data[2]
netstream.Start(entity.receivers, "vendorEdit", key, data)
data = uniqueID
elseif (key == "faction") then
local faction = nut.faction.teams[data]
if (faction) then
entity.factions[data] = !entity.factions[data]
if (!entity.factions[data]) then
entity.factions[data] = nil
end
end
local uniqueID = data
data = {uniqueID, entity.factions[uniqueID]}
elseif (key == "class") then
local class
for k, v in ipairs(nut.class.list) do
if (v.uniqueID == data) then
class = v
break
end
end
if (class) then
entity.classes[data] = !entity.classes[data]
if (!entity.classes[data]) then
entity.classes[data] = nil
end
end
local uniqueID = data
data = {uniqueID, entity.classes[uniqueID]}
elseif (key == "model") then
entity:SetModel(data)
entity:setAnim()
elseif (key == "useMoney") then
if (entity.money) then
entity:setMoney()
else
entity:setMoney(0)
end
elseif (key == "money") then
data = math.Round(math.abs(tonumber(data) or 0))
entity:setMoney(data)
feedback = false
elseif (key == "scale") then
data = tonumber(data) or 0.5
entity.scale = data
netstream.Start(entity.receivers, "vendorEdit", key, data)
end
PLUGIN:saveVendors()
if (feedback) then
local receivers = {}
for k, v in ipairs(entity.receivers) do
if (v:IsAdmin()) then
receivers[#receivers + 1] = v
end
end
netstream.Start(receivers, "vendorEditFinish", key, data)
end
end
end)
netstream.Hook("vendorTrade", function(client, uniqueID, isSellingToVendor)
if ((client.nutVendorTry or 0) < CurTime()) then
client.nutVendorTry = CurTime() + 0.33
else
return
end
local found
local entity = client.nutVendor
if (!IsValid(entity) or client:GetPos():Distance(entity:GetPos()) > 192) then
return
end
if (entity.items[uniqueID] and hook.Run("CanPlayerTradeWithVendor", client, entity, uniqueID, isSellingToVendor) != false) then
local price = entity:getPrice(uniqueID, isSellingToVendor)
if (isSellingToVendor) then
local found = false
local name
for k, v in pairs(client:getChar():getInv():getItems()) do
if (v.uniqueID == uniqueID) then
v:remove()
found = true
name = L(v.name, client)
break
end
end
if (!found) then
return
end
if (!entity:hasMoney(price)) then
return client:notifyLocalized("vendorNoMoney")
end
client:getChar():giveMoney(price)
client:notifyLocalized("businessSell", name, nut.currency.get(price))
entity:takeMoney(price)
entity:addStock(uniqueID)
PLUGIN:saveVendors()
else
local stock = entity:getStock(uniqueID)
if (stock and stock < 1) then
return client:notifyLocalized("vendorNoStock")
end
if (!client:getChar():hasMoney(price)) then
return client:notifyLocalized("canNotAfford")
end
local name = L(nut.item.list[uniqueID].name, client)
client:getChar():takeMoney(price)
client:notifyLocalized("businessPurchase", name, price)
entity:giveMoney(price)
if (!client:getChar():getInv():add(uniqueID)) then
nut.item.spawn(uniqueID, client:getItemDropPos())
else
netstream.Start(client, "vendorAdd", uniqueID)
end
entity:takeStock(uniqueID)
PLUGIN:saveVendors()
end
else
client:notifyLocalized("vendorNoTrade")
end
end)
else
VENDOR_TEXT = {}
VENDOR_TEXT[VENDOR_SELLANDBUY] = "vendorBoth"
VENDOR_TEXT[VENDOR_BUYONLY] = "vendorBuy"
VENDOR_TEXT[VENDOR_SELLONLY] = "vendorSell"
netstream.Hook("vendorOpen", function(index, items, money, scale, messages, factions, classes)
local entity = Entity(index)
if (!IsValid(entity)) then
return
end
entity.money = money
entity.items = items
entity.messages = messages
entity.factions = factions
entity.classes = classes
entity.scale = scale
nut.gui.vendor = vgui.Create("nutVendor")
nut.gui.vendor:setup(entity)
if (LocalPlayer():IsAdmin() and messages) then
nut.gui.vendorEditor = vgui.Create("nutVendorEditor")
end
end)
netstream.Hook("vendorEdit", function(key, data)
local panel = nut.gui.vendor
if (!IsValid(panel)) then
return
end
local entity = panel.entity
if (!IsValid(entity)) then
return
end
if (key == "mode") then
entity.items[data[1]] = entity.items[data[1]] or {}
entity.items[data[1]][VENDOR_MODE] = data[2]
if (!data[2]) then
panel:removeItem(data[1])
elseif (data[2] == VENDOR_SELLANDBUY) then
panel:addItem(data[1])
else
panel:addItem(data[1], data[2] == VENDOR_SELLONLY and "selling" or "buying")
panel:removeItem(data[1], data[2] == VENDOR_SELLONLY and "buying" or "selling")
end
elseif (key == "price") then
local uniqueID = data[1]
entity.items[uniqueID] = entity.items[uniqueID] or {}
entity.items[uniqueID][VENDOR_PRICE] = tonumber(data[2])
elseif (key == "stockDisable") then
if (entity.items[data]) then
entity.items[data][VENDOR_MAXSTOCK] = nil
end
elseif (key == "stockMax") then
local uniqueID = data[1]
local value = data[2]
local current = data[3]
entity.items[uniqueID] = entity.items[uniqueID] or {}
entity.items[uniqueID][VENDOR_MAXSTOCK] = value
entity.items[uniqueID][VENDOR_STOCK] = current
elseif (key == "stock") then
local uniqueID = data[1]
local value = data[2]
entity.items[uniqueID] = entity.items[uniqueID] or {}
if (!entity.items[uniqueID][VENDOR_MAXSTOCK]) then
entity.items[uniqueID][VENDOR_MAXSTOCK] = value
end
entity.items[uniqueID][VENDOR_STOCK] = value
elseif (key == "scale") then
entity.scale = data
end
end)
netstream.Hook("vendorEditFinish", function(key, data)
local panel = nut.gui.vendor
local editor = nut.gui.vendorEditor
if (!IsValid(panel) or !IsValid(editor)) then
return
end
local entity = panel.entity
if (!IsValid(entity)) then
return
end
if (key == "name") then
editor.name:SetText(entity:getNetVar("name"))
elseif (key == "desc") then
editor.desc:SetText(entity:getNetVar("desc"))
elseif (key == "bubble") then
editor.bubble.noSend = true
editor.bubble:SetValue(data and 1 or 0)
elseif (key == "mode") then
if (data[2] == nil) then
editor.lines[data[1]]:SetValue(2, L"none")
else
editor.lines[data[1]]:SetValue(2, L(VENDOR_TEXT[data[2]]))
end
elseif (key == "price") then
editor.lines[data]:SetValue(3, entity:getPrice(data))
elseif (key == "stockDisable") then
editor.lines[data]:SetValue(4, "-")
elseif (key == "stockMax" or key == "stock") then
local current, max = entity:getStock(data)
editor.lines[data]:SetValue(4, current.."/"..max)
elseif (key == "faction") then
local uniqueID = data[1]
local state = data[2]
local panel = nut.gui.editorFaction
entity.factions[uniqueID] = state
if (IsValid(panel) and IsValid(panel.factions[uniqueID])) then
panel.factions[uniqueID]:SetChecked(state == true)
end
elseif (key == "class") then
local uniqueID = data[1]
local state = data[2]
local panel = nut.gui.editorFaction
entity.classes[uniqueID] = state
if (IsValid(panel) and IsValid(panel.classes[uniqueID])) then
panel.classes[uniqueID]:SetChecked(state == true)
end
elseif (key == "model") then
editor.model:SetText(entity:GetModel())
elseif (key == "scale") then
editor.sellScale.noSend = true
editor.sellScale:SetValue(data)
end
surface.PlaySound("buttons/button14.wav")
end)
netstream.Hook("vendorMoney", function(value)
local panel = nut.gui.vendor
if (!IsValid(panel)) then
return
end
local entity = panel.entity
if (!IsValid(entity)) then
return
end
entity.money = value
local editor = nut.gui.vendorEditor
if (IsValid(editor)) then
local useMoney = tonumber(value) != nil
editor.money:SetDisabled(!useMoney)
editor.money:SetEnabled(useMoney)
editor.money:SetText(useMoney and value or "∞")
end
end)
netstream.Hook("vendorStock", function(uniqueID, amount)
local panel = nut.gui.vendor
if (!IsValid(panel)) then
return
end
local entity = panel.entity
if (!IsValid(entity)) then
return
end
entity.items[uniqueID] = entity.items[uniqueID] or {}
entity.items[uniqueID][VENDOR_STOCK] = amount
local editor = nut.gui.vendorEditor
if (IsValid(editor)) then
local _, max = entity:getStock(uniqueID)
editor.lines[uniqueID]:SetValue(4, amount.."/"..max)
end
end)
netstream.Hook("vendorAdd", function(uniqueID)
if (IsValid(nut.gui.vendor)) then
nut.gui.vendor:addItem(uniqueID, "buying")
end
end)
end | {
"content_hash": "06afc595c5a39343f42b6f6ee9ec5d76",
"timestamp": "",
"source": "github",
"line_count": 549,
"max_line_length": 129,
"avg_line_length": 24.626593806921676,
"alnum_prop": 0.6632396449704142,
"repo_name": "Cyumus/NutScript",
"id": "b31429270e566078160aadc792f2c8712a879f9e",
"size": "13522",
"binary": false,
"copies": "4",
"ref": "refs/heads/1.1",
"path": "plugins/vendor/sh_plugin.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "637527"
}
],
"symlink_target": ""
} |
module Mongrel2
class Response
StatusMessage = {
100 => 'Continue',
101 => 'Switching Protocols',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
307 => 'Temporary Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Large',
415 => 'Unsupported Media Type',
416 => 'Request Range Not Satisfiable',
417 => 'Expectation Failed',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported'
}
def initialize(resp)
@resp = resp
end
def send_http(req, body, status, headers)
send_resp(req.uuid, req.conn_id, build_http_response(body, status, headers))
end
def close(req)
send_resp(req.uuid, req.conn_id, '')
end
private
def send_resp(uuid, conn_id, data)
@resp.send('%s %d:%s, %s' % [uuid, conn_id.size, conn_id, data])
end
def build_http_response(body, status, headers)
headers['Content-Length'] = body.size.to_s
headers = headers.map{ |k, v| '%s: %s' % [k,v] }.join("\r\n")
"HTTP/1.1 #{status} #{StatusMessage[status.to_i]}\r\n#{headers}\r\n\r\n#{body}"
end
end
end | {
"content_hash": "c1f1629de36df63a93e74fc7840ef3c0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 85,
"avg_line_length": 28.585714285714285,
"alnum_prop": 0.5492253873063468,
"repo_name": "wooga/rack-mongrel2",
"id": "9c75b1cc53cd46aa3eb83f9e3dee7c11b61d921e",
"size": "2001",
"binary": false,
"copies": "1",
"ref": "refs/heads/zmq",
"path": "lib/mongrel2/response.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "16950"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.