repo_name
stringlengths 4
116
| path
stringlengths 3
942
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
---|---|---|---|---|
StephenFluin/code.material.angularjs.org | 0.11.3/js/build-config.js | 234 | DocsApp.constant('BUILDCONFIG', {
"ngVersion": "1.4.6",
"version": "0.11.3",
"repository": "https://github.com/angular/material",
"commit": "3f51bd8633cfc0f1bcfee93d5f0f5650c9a8b01c",
"date": "2015-10-12 10:15:32 -0700"
});
| mit |
goby-lang/goby | vm/http_client.go | 6593 | package vm
import (
"fmt"
"io/ioutil"
"net/http"
"strings"
"github.com/goby-lang/goby/vm/classes"
"github.com/goby-lang/goby/vm/errors"
)
// Instance methods --------------------------------------------------------
func builtinHTTPClientInstanceMethods() []*BuiltinMethodObject {
//TODO: cookie jar and mutable client
goClient := http.DefaultClient
return []*BuiltinMethodObject{
{
// Sends a GET request to the target and returns a `Net::HTTP::Response` object.
Name: "get",
Fn: func(receiver Object, sourceLine int, t *Thread, args []Object, blockFrame *normalCallFrame) Object {
if len(args) != 1 {
return t.vm.InitErrorObject(errors.ArgumentError, sourceLine, errors.WrongNumberOfArgument, 1, len(args))
}
typeErr := t.vm.checkArgTypes(args, sourceLine, classes.StringClass)
if typeErr != nil {
return typeErr
}
resp, err := goClient.Get(args[0].Value().(string))
if err != nil {
return t.vm.InitErrorObject(errors.HTTPError, sourceLine, couldNotCompleteRequest, err)
}
gobyResp, err := responseGoToGoby(t, resp)
if err != nil {
return t.vm.InitErrorObject(errors.InternalError, sourceLine, err.Error())
}
return gobyResp
},
}, {
// Sends a POST request to the target and returns a `Net::HTTP::Response` object.
Name: "post",
Fn: func(receiver Object, sourceLine int, t *Thread, args []Object, blockFrame *normalCallFrame) Object {
if len(args) != 3 {
return t.vm.InitErrorObject(errors.ArgumentError, sourceLine, errors.WrongNumberOfArgument, 3, len(args))
}
typeErr := t.vm.checkArgTypes(args, sourceLine, classes.StringClass, classes.StringClass, classes.StringClass)
if typeErr != nil {
return typeErr
}
bodyR := strings.NewReader(args[2].Value().(string))
resp, err := goClient.Post(args[0].Value().(string), args[1].Value().(string), bodyR)
if err != nil {
return t.vm.InitErrorObject(errors.HTTPError, sourceLine, "Could not complete request, %s", err)
}
gobyResp, err := responseGoToGoby(t, resp)
if err != nil {
return t.vm.InitErrorObject(errors.InternalError, sourceLine, err.Error())
}
return gobyResp
},
}, {
// Sends a HEAD request to the target and returns a `Net::HTTP::Response` object.
Name: "head",
Fn: func(receiver Object, sourceLine int, t *Thread, args []Object, blockFrame *normalCallFrame) Object {
if len(args) != 1 {
return t.vm.InitErrorObject(errors.ArgumentError, sourceLine, errors.WrongNumberOfArgument, 1, len(args))
}
typeErr := t.vm.checkArgTypes(args, sourceLine, classes.StringClass)
if typeErr != nil {
return typeErr
}
resp, err := goClient.Head(args[0].Value().(string))
if err != nil {
return t.vm.InitErrorObject(errors.HTTPError, sourceLine, couldNotCompleteRequest, err)
}
gobyResp, err := responseGoToGoby(t, resp)
if err != nil {
return t.vm.InitErrorObject(errors.InternalError, sourceLine, err.Error())
}
return gobyResp
},
}, {
// Returns a blank `Net::HTTP::Request` object to be sent with the`exec` method
Name: "request",
Fn: func(receiver Object, sourceLine int, t *Thread, args []Object, blockFrame *normalCallFrame) Object {
return httpRequestClass.initializeInstance()
},
}, {
// Sends a passed `Net::HTTP::Request` object and returns a `Net::HTTP::Response` object
Name: "exec",
Fn: func(receiver Object, sourceLine int, t *Thread, args []Object, blockFrame *normalCallFrame) Object {
if len(args) != 1 {
return t.vm.InitErrorObject(errors.ArgumentError, sourceLine, errors.WrongNumberOfArgument, 1, len(args))
}
typeErr := t.vm.checkArgTypes(args, sourceLine, httpRequestClass.Name)
if typeErr != nil {
return typeErr
}
goReq, err := requestGobyToGo(args[0])
if err != nil {
return t.vm.InitErrorObject(errors.ArgumentError, sourceLine, err.Error())
}
goResp, err := goClient.Do(goReq)
if err != nil {
return t.vm.InitErrorObject(errors.HTTPError, sourceLine, couldNotCompleteRequest, err)
}
gobyResp, err := responseGoToGoby(t, goResp)
if err != nil {
return t.vm.InitErrorObject(errors.InternalError, sourceLine, err.Error())
}
return gobyResp
},
},
}
}
// Internal functions ===================================================
// Functions for initialization -----------------------------------------
func initClientClass(vm *VM, hc *RClass) *RClass {
clientClass := vm.initializeClass("Client")
hc.setClassConstant(clientClass)
clientClass.setBuiltinMethods(builtinHTTPClientInstanceMethods(), false)
httpClientClass = clientClass
return clientClass
}
// Other helper functions -----------------------------------------------
func requestGobyToGo(gobyReq Object) (*http.Request, error) {
//:method, :protocol, :body, :content_length, :transfer_encoding, :host, :path, :url, :params
uObj, ok := gobyReq.InstanceVariableGet("@url")
if !ok {
return nil, fmt.Errorf("could not get url")
}
u := uObj.(*StringObject).value
methodObj, ok := gobyReq.InstanceVariableGet("@method")
if !ok {
return nil, fmt.Errorf("could not get method")
}
method := methodObj.(*StringObject).value
var body string
if !(method == "GET" || method == "HEAD") {
bodyObj, ok := gobyReq.InstanceVariableGet("@body")
if !ok {
return nil, fmt.Errorf("could not get body")
}
body = bodyObj.(*StringObject).value
}
return http.NewRequest(method, u, strings.NewReader(body))
}
func responseGoToGoby(t *Thread, goResp *http.Response) (Object, error) {
gobyResp := httpResponseClass.initializeInstance()
//attr_accessor :body, :status, :status_code, :protocol, :transfer_encoding, :http_version, :request_http_version, :request
//attr_reader :headers
body, err := ioutil.ReadAll(goResp.Body)
if err != nil {
return nil, err
}
gobyResp.InstanceVariableSet("@body", t.vm.InitStringObject(string(body)))
gobyResp.InstanceVariableSet("@status_code", t.vm.InitObjectFromGoType(goResp.StatusCode))
gobyResp.InstanceVariableSet("@status", t.vm.InitObjectFromGoType(goResp.Status))
gobyResp.InstanceVariableSet("@protocol", t.vm.InitObjectFromGoType(goResp.Proto))
gobyResp.InstanceVariableSet("@transfer_encoding", t.vm.InitObjectFromGoType(goResp.TransferEncoding))
underHeaders := map[string]Object{}
for k, v := range goResp.Header {
underHeaders[k] = t.vm.InitObjectFromGoType(v)
}
gobyResp.InstanceVariableSet("@headers", t.vm.InitHashObject(underHeaders))
return gobyResp, nil
}
| mit |
bower/components | packages/espresso.js | 85 | {
"name": "espresso.js",
"url": "https://github.com/techlayer/espresso.js.git"
}
| mit |
InsideSalesOfficial/insidesales-components | src/components/icons/EmptyStateIcon.js | 1707 | import React from 'react';
const EmptyStateIcon = props => (
<svg {...props.size || { width: '144px', height: '144px' }} {...props} viewBox="0 0 144 144">
{props.title && <title>{props.title}</title>}
<defs>
<path d="M76,8 L20,8 C15.6,8 12,11.6 12,16 L12,72 C12,76.4 15.6,80 20,80 L36,80 L48,92 L60,80 L76,80 C80.4,80 84,76.4 84,72 L84,16 C84,11.6 80.4,8 76,8 Z M55.52,51.52 L48,68 L40.48,51.52 L24,44 L40.48,36.48 L48,20 L55.52,36.48 L72,44 L55.52,51.52 Z" id="path-1"></path>
</defs>
<g id="Task---Insights" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g id="Insights---Extension-Not-Downloaded" transform="translate(-636.000000, -228.000000)">
<g id="Navigation/Empty-State-Icon" transform="translate(636.000000, 228.000000)">
<circle id="Background" fillOpacity="0.04" fill="#000000" cx="72" cy="72" r="72"></circle>
<g id="Icon/Alert/Error" opacity="0.1" transform="translate(24.000000, 24.000000)">
<polygon id="Spacing" points="0 0 96 0 96 96 0 96"></polygon>
<g id="Icon">
<mask id="mask-2" fill="white">
<use xlinkHref="#path-1"></use>
</mask>
<use id="Shape" fillOpacity="0" fill="#FFFFFF" fillRule="nonzero" xlinkHref="#path-1"></use>
<g id="Color" mask="url(#mask-2)" fill="#000000">
<rect id="Rectangle" x="0" y="0" width="96" height="96"></rect>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
);
export default EmptyStateIcon;
| mit |
Qafoo/changetrack | src/main/Qafoo/ChangeTrack/Analyzer/ResultBuilder/ClassChangesBuilder.php | 1361 | <?php
namespace Qafoo\ChangeTrack\Analyzer\ResultBuilder;
use Qafoo\ChangeTrack\Analyzer\Result\ClassChanges;
class ClassChangesBuilder
{
/**
* @var string
*/
private $className;
/**
* @var \Qafoo\ChangeTrack\Analyzer\ResultBuilder\MethodChangesBuilder[]
*/
private $methodChangesBuilders = array();
/**
* @param string $className
*/
public function __construct($className)
{
$this->className = $className;
}
/**
* @param string $methodName
* @return \Qafoo\ChangeTrack\Analyzer\ResultBuilder\MethodChangesBuilder
*/
public function methodChanges($methodName)
{
if (!isset($this->methodChangesBuilders[$methodName])) {
$this->methodChangesBuilders[$methodName] = new MethodChangesBuilder(
$methodName
);
}
return $this->methodChangesBuilders[$methodName];
}
/**
* @return \Qafoo\ChangeTrack\Analyzer\Result\ClassChanges
*/
public function buildClassChanges()
{
return new ClassChanges(
$this->className,
array_map(
function ($methodChangesBuilder) {
return $methodChangesBuilder->buildMethodChanges();
},
$this->methodChangesBuilders
)
);
}
}
| mit |
odlp/antifreeze | vendor/github.com/cloudfoundry/cli/command/v6/restart_command_test.go | 23815 | package v6_test
import (
"errors"
"time"
"code.cloudfoundry.org/bytefmt"
"code.cloudfoundry.org/cli/actor/actionerror"
"code.cloudfoundry.org/cli/actor/v2action"
"code.cloudfoundry.org/cli/actor/v2v3action"
"code.cloudfoundry.org/cli/actor/v3action"
"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2/constant"
"code.cloudfoundry.org/cli/command/commandfakes"
"code.cloudfoundry.org/cli/command/translatableerror"
. "code.cloudfoundry.org/cli/command/v6"
"code.cloudfoundry.org/cli/command/v6/shared/sharedfakes"
"code.cloudfoundry.org/cli/command/v6/v6fakes"
"code.cloudfoundry.org/cli/types"
"code.cloudfoundry.org/cli/util/configv3"
"code.cloudfoundry.org/cli/util/ui"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gbytes"
)
var _ = Describe("Restart Command", func() {
var (
cmd RestartCommand
testUI *ui.UI
fakeConfig *commandfakes.FakeConfig
fakeSharedActor *commandfakes.FakeSharedActor
fakeApplicationSummaryActor *sharedfakes.FakeApplicationSummaryActor
fakeActor *v6fakes.FakeRestartActor
binaryName string
executeErr error
)
BeforeEach(func() {
testUI = ui.NewTestUI(nil, NewBuffer(), NewBuffer())
fakeConfig = new(commandfakes.FakeConfig)
fakeSharedActor = new(commandfakes.FakeSharedActor)
fakeActor = new(v6fakes.FakeRestartActor)
fakeApplicationSummaryActor = new(sharedfakes.FakeApplicationSummaryActor)
cmd = RestartCommand{
UI: testUI,
Config: fakeConfig,
SharedActor: fakeSharedActor,
Actor: fakeActor,
ApplicationSummaryActor: fakeApplicationSummaryActor,
}
cmd.RequiredArgs.AppName = "some-app"
binaryName = "faceman"
fakeConfig.BinaryNameReturns(binaryName)
var err error
testUI.TimezoneLocation, err = time.LoadLocation("America/Los_Angeles")
Expect(err).NotTo(HaveOccurred())
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
appState <- v2action.ApplicationStateStopping
appState <- v2action.ApplicationStateStaging
appState <- v2action.ApplicationStateStarting
close(messages)
close(logErrs)
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
JustBeforeEach(func() {
executeErr = cmd.Execute(nil)
})
When("checking target fails", func() {
BeforeEach(func() {
fakeSharedActor.CheckTargetReturns(actionerror.NotLoggedInError{BinaryName: binaryName})
})
It("returns an error if the check fails", func() {
Expect(executeErr).To(MatchError(actionerror.NotLoggedInError{BinaryName: "faceman"}))
Expect(fakeSharedActor.CheckTargetCallCount()).To(Equal(1))
checkTargetedOrg, checkTargetedSpace := fakeSharedActor.CheckTargetArgsForCall(0)
Expect(checkTargetedOrg).To(BeTrue())
Expect(checkTargetedSpace).To(BeTrue())
})
})
When("the user is logged in, and org and space are targeted", func() {
BeforeEach(func() {
fakeConfig.HasTargetedOrganizationReturns(true)
fakeConfig.TargetedOrganizationReturns(configv3.Organization{Name: "some-org"})
fakeConfig.HasTargetedSpaceReturns(true)
fakeConfig.TargetedSpaceReturns(configv3.Space{
GUID: "some-space-guid",
Name: "some-space"})
fakeConfig.CurrentUserReturns(
configv3.User{Name: "some-user"},
nil)
})
When("getting the current user returns an error", func() {
var expectedErr error
BeforeEach(func() {
expectedErr = errors.New("getting current user error")
fakeConfig.CurrentUserReturns(
configv3.User{},
expectedErr)
})
It("returns the error", func() {
Expect(executeErr).To(MatchError(expectedErr))
})
})
It("displays flavor text", func() {
Expect(testUI.Out).To(Say("Restarting app some-app in org some-org / space some-space as some-user..."))
})
When("the app exists", func() {
When("the app is started", func() {
BeforeEach(func() {
fakeActor.GetApplicationByNameAndSpaceReturns(
v2action.Application{State: constant.ApplicationStarted},
v2action.Warnings{"warning-1", "warning-2"},
nil,
)
})
It("stops and starts the app", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).Should(Say("Stopping app..."))
Expect(testUI.Out).Should(Say("Staging app and tracing logs..."))
Expect(testUI.Out).Should(Say("Waiting for app to start..."))
Expect(testUI.Err).To(Say("warning-1"))
Expect(testUI.Err).To(Say("warning-2"))
Expect(fakeActor.RestartApplicationCallCount()).To(Equal(1))
})
})
When("the app is not already started", func() {
BeforeEach(func() {
fakeActor.GetApplicationByNameAndSpaceReturns(
v2action.Application{GUID: "app-guid", State: constant.ApplicationStopped},
v2action.Warnings{"warning-1", "warning-2"},
nil,
)
})
It("starts the app", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Err).To(Say("warning-1"))
Expect(testUI.Err).To(Say("warning-2"))
Expect(fakeActor.RestartApplicationCallCount()).To(Equal(1))
app, _ := fakeActor.RestartApplicationArgsForCall(0)
Expect(app.GUID).To(Equal("app-guid"))
})
When("passed an appStarting message", func() {
BeforeEach(func() {
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
messages <- v2action.NewLogMessage("log message 1", 1, time.Unix(0, 0), "STG", "1")
messages <- v2action.NewLogMessage("log message 2", 1, time.Unix(0, 0), "STG", "1")
appState <- v2action.ApplicationStateStopping
appState <- v2action.ApplicationStateStaging
appState <- v2action.ApplicationStateStarting
close(messages)
close(logErrs)
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
It("displays the log", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).To(Say("log message 1"))
Expect(testUI.Out).To(Say("log message 2"))
Expect(testUI.Out).To(Say("Waiting for app to start..."))
})
})
When("passed a log message", func() {
BeforeEach(func() {
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
messages <- v2action.NewLogMessage("log message 1", 1, time.Unix(0, 0), "STG", "1")
messages <- v2action.NewLogMessage("log message 2", 1, time.Unix(0, 0), "STG", "1")
messages <- v2action.NewLogMessage("log message 3", 1, time.Unix(0, 0), "Something else", "1")
close(messages)
close(logErrs)
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
It("displays the log", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).To(Say("log message 1"))
Expect(testUI.Out).To(Say("log message 2"))
Expect(testUI.Out).ToNot(Say("log message 3"))
})
})
When("passed an log err", func() {
Context("NOAA connection times out/closes", func() {
BeforeEach(func() {
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
messages <- v2action.NewLogMessage("log message 1", 1, time.Unix(0, 0), "STG", "1")
messages <- v2action.NewLogMessage("log message 2", 1, time.Unix(0, 0), "STG", "1")
messages <- v2action.NewLogMessage("log message 3", 1, time.Unix(0, 0), "STG", "1")
logErrs <- actionerror.NOAATimeoutError{}
close(messages)
close(logErrs)
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
It("displays a warning and continues until app has started", func() {
Expect(executeErr).To(BeNil())
Expect(testUI.Out).To(Say("message 1"))
Expect(testUI.Out).To(Say("message 2"))
Expect(testUI.Out).To(Say("message 3"))
Expect(testUI.Err).To(Say("timeout connecting to log server, no log will be shown"))
})
})
Context("an unexpected error occurs", func() {
var expectedErr error
BeforeEach(func() {
expectedErr = errors.New("err log message")
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
logErrs <- expectedErr
close(messages)
close(logErrs)
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
It("displays the error and continues to poll", func() {
Expect(executeErr).NotTo(HaveOccurred())
Expect(testUI.Err).To(Say(expectedErr.Error()))
})
})
})
When("passed a warning", func() {
Context("while NOAA is still logging", func() {
BeforeEach(func() {
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
warnings <- "warning 1"
warnings <- "warning 2"
close(messages)
close(logErrs)
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
It("displays the warnings to STDERR", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Err).To(Say("warning 1"))
Expect(testUI.Err).To(Say("warning 2"))
})
})
Context("while NOAA is no longer logging", func() {
BeforeEach(func() {
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
warnings <- "warning 1"
warnings <- "warning 2"
logErrs <- actionerror.NOAATimeoutError{}
close(messages)
close(logErrs)
warnings <- "warning 3"
warnings <- "warning 4"
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
It("displays the warnings to STDERR", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Err).To(Say("warning 1"))
Expect(testUI.Err).To(Say("warning 2"))
Expect(testUI.Err).To(Say("timeout connecting to log server, no log will be shown"))
Expect(testUI.Err).To(Say("warning 3"))
Expect(testUI.Err).To(Say("warning 4"))
})
})
})
When("passed an API err", func() {
var apiErr error
BeforeEach(func() {
fakeActor.RestartApplicationStub = func(app v2action.Application, client v2action.NOAAClient) (<-chan *v2action.LogMessage, <-chan error, <-chan v2action.ApplicationStateChange, <-chan string, <-chan error) {
messages := make(chan *v2action.LogMessage)
logErrs := make(chan error)
appState := make(chan v2action.ApplicationStateChange)
warnings := make(chan string)
errs := make(chan error)
go func() {
errs <- apiErr
close(messages)
close(logErrs)
close(appState)
close(warnings)
close(errs)
}()
return messages, logErrs, appState, warnings, errs
}
})
Context("an unexpected error", func() {
BeforeEach(func() {
apiErr = errors.New("err log message")
})
It("stops logging and returns the error", func() {
Expect(executeErr).To(MatchError(apiErr))
})
})
Context("staging failed", func() {
BeforeEach(func() {
apiErr = actionerror.StagingFailedError{Reason: "Something, but not nothing"}
})
It("stops logging and returns StagingFailedError", func() {
Expect(executeErr).To(MatchError(translatableerror.StagingFailedError{Message: "Something, but not nothing"}))
})
})
Context("staging timed out", func() {
BeforeEach(func() {
apiErr = actionerror.StagingTimeoutError{AppName: "some-app", Timeout: time.Nanosecond}
})
It("stops logging and returns StagingTimeoutError", func() {
Expect(executeErr).To(MatchError(translatableerror.StagingTimeoutError{AppName: "some-app", Timeout: time.Nanosecond}))
})
})
When("the app instance crashes", func() {
BeforeEach(func() {
apiErr = actionerror.ApplicationInstanceCrashedError{Name: "some-app"}
})
It("stops logging and returns UnsuccessfulStartError", func() {
Expect(executeErr).To(MatchError(translatableerror.UnsuccessfulStartError{AppName: "some-app", BinaryName: "faceman"}))
})
})
When("the app instance flaps", func() {
BeforeEach(func() {
apiErr = actionerror.ApplicationInstanceFlappingError{Name: "some-app"}
})
It("stops logging and returns UnsuccessfulStartError", func() {
Expect(executeErr).To(MatchError(translatableerror.UnsuccessfulStartError{AppName: "some-app", BinaryName: "faceman"}))
})
})
Context("starting timeout", func() {
BeforeEach(func() {
apiErr = actionerror.StartupTimeoutError{Name: "some-app"}
})
It("stops logging and returns StartupTimeoutError", func() {
Expect(executeErr).To(MatchError(translatableerror.StartupTimeoutError{AppName: "some-app", BinaryName: "faceman"}))
})
})
})
When("the app finishes starting", func() {
When("the API is at least 3.27.0", func() {
BeforeEach(func() {
fakeApplicationSummaryActor.CloudControllerV3APIVersionReturns("3.50.0")
fakeApplicationSummaryActor.GetApplicationSummaryByNameAndSpaceReturns(
v2v3action.ApplicationSummary{
ApplicationSummary: v3action.ApplicationSummary{
Application: v3action.Application{
Name: "some-app",
},
ProcessSummaries: v3action.ProcessSummaries{
{
Process: v3action.Process{
Type: "aba",
Command: "some-command-1",
MemoryInMB: types.NullUint64{Value: 32, IsSet: true},
DiskInMB: types.NullUint64{Value: 1024, IsSet: true},
},
},
{
Process: v3action.Process{
Type: "console",
Command: "some-command-2",
MemoryInMB: types.NullUint64{Value: 16, IsSet: true},
DiskInMB: types.NullUint64{Value: 512, IsSet: true},
},
},
},
},
},
v2v3action.Warnings{"combo-summary-warning"},
nil)
})
It("displays process information", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).To(Say(`name:\s+%s`, "some-app"))
Expect(testUI.Out).To(Say(`type:\s+aba`))
Expect(testUI.Out).To(Say(`instances:\s+0/0`))
Expect(testUI.Out).To(Say(`memory usage:\s+32M`))
Expect(testUI.Out).To(Say(`start command:\s+some-command-1`))
Expect(testUI.Out).To(Say(`type:\s+console`))
Expect(testUI.Out).To(Say(`instances:\s+0/0`))
Expect(testUI.Out).To(Say(`memory usage:\s+16M`))
Expect(testUI.Out).To(Say(`start command:\s+some-command-2`))
Expect(testUI.Err).To(Say("combo-summary-warning"))
Expect(fakeApplicationSummaryActor.GetApplicationSummaryByNameAndSpaceCallCount()).To(Equal(1))
passedAppName, spaceGUID, withObfuscatedValues := fakeApplicationSummaryActor.GetApplicationSummaryByNameAndSpaceArgsForCall(0)
Expect(passedAppName).To(Equal("some-app"))
Expect(spaceGUID).To(Equal("some-space-guid"))
Expect(withObfuscatedValues).To(BeTrue())
})
})
When("the API is below 3.27.0", func() {
var (
applicationSummary v2action.ApplicationSummary
warnings []string
)
BeforeEach(func() {
fakeApplicationSummaryActor.CloudControllerV3APIVersionReturns("1.0.0")
applicationSummary = v2action.ApplicationSummary{
Application: v2action.Application{
Name: "some-app",
GUID: "some-app-guid",
Instances: types.NullInt{Value: 3, IsSet: true},
Memory: types.NullByteSizeInMb{IsSet: true, Value: 128},
PackageUpdatedAt: time.Unix(0, 0),
DetectedBuildpack: types.FilteredString{IsSet: true, Value: "some-buildpack"},
State: "STARTED",
DetectedStartCommand: types.FilteredString{IsSet: true, Value: "some start command"},
},
IsolationSegment: "some-isolation-segment",
Stack: v2action.Stack{
Name: "potatos",
},
Routes: []v2action.Route{
{
Host: "banana",
Domain: v2action.Domain{
Name: "fruit.com",
},
Path: "/hi",
},
{
Domain: v2action.Domain{
Name: "foobar.com",
},
Port: types.NullInt{IsSet: true, Value: 13},
},
},
}
warnings = []string{"app-summary-warning"}
applicationSummary.RunningInstances = []v2action.ApplicationInstanceWithStats{
{
ID: 0,
State: v2action.ApplicationInstanceState(constant.ApplicationInstanceRunning),
Since: 1403140717.984577,
CPU: 0.73,
Disk: 50 * bytefmt.MEGABYTE,
DiskQuota: 2048 * bytefmt.MEGABYTE,
Memory: 100 * bytefmt.MEGABYTE,
MemoryQuota: 128 * bytefmt.MEGABYTE,
Details: "info from the backend",
},
}
})
When("the isolation segment is not empty", func() {
BeforeEach(func() {
fakeActor.GetApplicationSummaryByNameAndSpaceReturns(applicationSummary, warnings, nil)
})
It("displays the app summary with isolation segments as well as warnings", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).To(Say(`name:\s+some-app`))
Expect(testUI.Out).To(Say(`requested state:\s+started`))
Expect(testUI.Out).To(Say(`instances:\s+1\/3`))
Expect(testUI.Out).To(Say(`isolation segment:\s+some-isolation-segment`))
Expect(testUI.Out).To(Say(`usage:\s+128M x 3 instances`))
Expect(testUI.Out).To(Say(`routes:\s+banana.fruit.com/hi, foobar.com:13`))
Expect(testUI.Out).To(Say(`last uploaded:\s+\w{3} [0-3]\d \w{3} [0-2]\d:[0-5]\d:[0-5]\d \w+ \d{4}`))
Expect(testUI.Out).To(Say(`stack:\s+potatos`))
Expect(testUI.Out).To(Say(`buildpack:\s+some-buildpack`))
Expect(testUI.Out).To(Say(`start command:\s+some start command`))
Expect(testUI.Err).To(Say("app-summary-warning"))
})
It("should display the instance table", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).To(Say(`state\s+since\s+cpu\s+memory\s+disk`))
Expect(testUI.Out).To(Say(`#0\s+running\s+2014-06-19T01:18:37Z\s+73.0%\s+100M of 128M\s+50M of 2G\s+info from the backend`))
})
})
When("the isolation segment is empty", func() {
BeforeEach(func() {
applicationSummary.IsolationSegment = ""
fakeActor.GetApplicationSummaryByNameAndSpaceReturns(applicationSummary, warnings, nil)
})
It("displays the app summary without isolation segment as well as warnings", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).To(Say(`name:\s+some-app`))
Expect(testUI.Out).To(Say(`requested state:\s+started`))
Expect(testUI.Out).To(Say(`instances:\s+1\/3`))
Expect(testUI.Out).NotTo(Say("isolation segment:"))
Expect(testUI.Out).To(Say(`usage:\s+128M x 3 instances`))
Expect(testUI.Out).To(Say(`routes:\s+banana.fruit.com/hi, foobar.com:13`))
Expect(testUI.Out).To(Say(`last uploaded:\s+\w{3} [0-3]\d \w{3} [0-2]\d:[0-5]\d:[0-5]\d \w+ \d{4}`))
Expect(testUI.Out).To(Say(`stack:\s+potatos`))
Expect(testUI.Out).To(Say(`buildpack:\s+some-buildpack`))
Expect(testUI.Out).To(Say(`start command:\s+some start command`))
Expect(testUI.Err).To(Say("app-summary-warning"))
})
It("should display the instance table", func() {
Expect(executeErr).ToNot(HaveOccurred())
Expect(testUI.Out).To(Say(`state\s+since\s+cpu\s+memory\s+disk`))
Expect(testUI.Out).To(Say(`#0\s+running\s+2014-06-19T01:18:37Z\s+73.0%\s+100M of 128M\s+50M of 2G\s+info from the backend`))
})
})
})
})
})
})
When("the app does *not* exists", func() {
BeforeEach(func() {
fakeActor.GetApplicationByNameAndSpaceReturns(
v2action.Application{},
v2action.Warnings{"warning-1", "warning-2"},
actionerror.ApplicationNotFoundError{Name: "some-app"},
)
})
It("returns back an error", func() {
Expect(executeErr).To(MatchError(actionerror.ApplicationNotFoundError{Name: "some-app"}))
Expect(testUI.Err).To(Say("warning-1"))
Expect(testUI.Err).To(Say("warning-2"))
})
})
})
})
| mit |
kowshik/big-o | java/src/binarytrees/TreeDepth.java | 362 | package binarytrees;
/**
* Given a binary tree, find its depth.
*
* Signature of expected method:
*
* public static int maxDepth(TreeNode<?> root) {...}
*/
public class TreeDepth {
public static int maxDepth(TreeNode<?> root) {
if (root == null) {
return 0;
}
return Math.max(maxDepth(root.getLeft()), maxDepth(root.getRight())) + 1;
}
}
| mit |
Joelzm/ocw-manager | app/cache/dev/annotations/OCWm-OCWBundle-Entity-ocws$proyectos_clase.cache.php | 285 | <?php return unserialize('a:1:{i:0;O:27:"Doctrine\\ORM\\Mapping\\Column":10:{s:4:"type";s:4:"text";s:6:"length";N;s:9:"precision";i:0;s:5:"scale";i:0;s:6:"unique";b:0;s:8:"nullable";b:0;s:4:"name";s:15:"proyectos_clase";s:7:"options";a:0:{}s:16:"columnDefinition";N;s:5:"value";N;}}'); | mit |
radzinzki/grunt-ssh-multi-exec | test/multiple targets (restricted parallelism).js | 7099 | 'use strict';
var expect = require('expect.js');
var noop = function() { return function() {}; },
task = require('./../tasks/ssh-multi-exec')(require('grunt'));
var proceed = function(iteration, maxIterations, cb) {
if(++iteration === maxIterations) {
cb();
} else {
return iteration;
}
};
describe('multiple targets (restricted parallelism)', function() {
it('single command, successful', function(done) {
var iteration = 0;
task.call({
async: noop,
target: 'test',
data: {
hosts: ['127.0.0.1:2222', '127.0.0.1:2223'],
maxDegreeOfParallelism: 1,
username: 'test',
password: 'test',
logFn: noop,
commands: [
{
hint: 'hint',
input: 'echo 1',
success: function(data, context, next) {
expect(data).to.equal('1\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
iteration = proceed(iteration, 2, done);
next();
}
}
]
}
});
});
it('multiple commands, successful', function(done) {
var iteration = 0;
task.call({
async: noop,
target: 'test',
data: {
hosts: ['127.0.0.1:2222', '127.0.0.1:2223'],
maxDegreeOfParallelism: 1,
username: 'test',
password: 'test',
logFn: noop,
commands: [
{
hint: 'hint 1',
input: 'echo 1',
success: function(data, context, next) {
expect(data).to.equal('1\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
next();
}
},
{
hint: 'hint 2',
input: 'echo 2',
success: function(data, context, next) {
expect(data).to.equal('2\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
iteration = proceed(iteration, 2, done);
next();
}
}
]
}
});
});
it('multiple commands, first failing', function(done) {
var iteration = 0;
task.call({
async: noop,
target: 'test',
data: {
hosts: ['127.0.0.1:2222', '127.0.0.1:2223'],
maxDegreeOfParallelism: 1,
username: 'test',
password: 'test',
logFn: noop,
commands: [
{
hint: 'hint 1',
input: '_test_',
error: function(err, context, next) {
expect(err).to.equal('bash: _test_: command not found\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
iteration = proceed(iteration, 2, done);
next();
}
},
{
hint: 'hint 2',
input: 'echo 2',
success: function() {
expect().fail('Previous command failed - this should not have been executed!');
}
}
]
}
});
});
it('multiple commands, first failing +force', function(done) {
var iteration = 0;
task.call({
async: noop,
target: 'test',
data: {
hosts: ['127.0.0.1:2222', '127.0.0.1:2223'],
maxDegreeOfParallelism: 1,
username: 'test',
password: 'test',
logFn: noop,
commands: [
{
hint: 'hint 1',
input: '_test_',
force: true,
error: function(err, context, next) {
expect(err).to.equal('bash: _test_: command not found\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
next();
}
},
{
hint: 'hint 2',
input: 'echo 2',
success: function(data, context, next) {
expect(data).to.equal('2\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
iteration = proceed(iteration, 2, done);
next();
}
}
]
}
});
});
it('multiple commands, last failing', function(done) {
var iteration = 0;
task.call({
async: noop,
target: 'test',
data: {
hosts: ['127.0.0.1:2222', '127.0.0.1:2223'],
maxDegreeOfParallelism: 1,
username: 'test',
password: 'test',
logFn: noop,
commands: [
{
hint: 'hint 1',
input: 'echo 1',
success: function(data, context, next) {
expect(data).to.equal('1\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
next();
}
},
{
hint: 'hint 2',
input: '_test_',
error: function(err, context, next) {
expect(err).to.equal('bash: _test_: command not found\n');
expect(context.host).to.equal('127.0.0.1');
expect(context.port).to.match(/222[2,3]/);
iteration = proceed(iteration, 2, done);
next();
}
}
]
}
});
});
});
| mit |
JPAT-ROSEMARY/SCUBA | org.jpat.scuba.external.bcel/bcel-5.2/docs/xref/org/apache/bcel/package-summary.html | 2378 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"></meta>
<title>jakarta-bcel 5.2 Reference Package </title>
<link rel="stylesheet" href="../../../stylesheet.css" type="text/css" title="style"></link>
</head>
<body>
<div class="overview">
<ul>
<li>
<a href="../../../overview-summary.html">Overview</a>
</li>
<li class="selected">Package</li>
</ul>
</div>
<div class="framenoframe">
<ul>
<li>
<a href="../../../index.html" target="_top">FRAMES</a>
</li>
<li>
<a href="package-summary.html" target="_top">NO FRAMES</a>
</li>
</ul>
</div>
<h2>Package org.apache.bcel</h2>
<table class="summary">
<thead>
<tr>
<th>Class Summary</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="Constants.html" target="classFrame">Constants</a>
</td>
</tr>
<tr>
<td>
<a href="ExceptionConstants.html" target="classFrame">ExceptionConstants</a>
</td>
</tr>
<tr>
<td>
<a href="Repository.html" target="classFrame">Repository</a>
</td>
</tr>
</tbody>
</table>
<div class="overview">
<ul>
<li>
<a href="../../../overview-summary.html">Overview</a>
</li>
<li class="selected">Package</li>
</ul>
</div>
<div class="framenoframe">
<ul>
<li>
<a href="../../../index.html" target="_top">FRAMES</a>
</li>
<li>
<a href="package-summary.html" target="_top">NO FRAMES</a>
</li>
</ul>
</div>
<hr></hr>
Copyright © 2002-2006 Apache Software Foundation. All Rights Reserved.
</body>
</html>
| mit |
N00bface/Real-Dolmen-Stage-Opdrachten | stageopdracht/src/main/resources/static/vendors/moment/locale/sq.js | 2726 | /*
* Copyright (c) 2017. MIT-license for Jari Van Melckebeke
* Note that there was a lot of educational work in this project,
* this project was (or is) used for an assignment from Realdolmen in Belgium.
* Please just don't abuse my work
*/
//! moment.js locale configuration
//! locale : Albanian (sq)
//! author : Flakërim Ismani : https://github.com/flakerimi
//! author: Menelion Elensúle: https://github.com/Oire (tests)
//! author : Oerd Cukalla : https://github.com/oerd (fixes)
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
&& typeof require === 'function' ? factory(require('../moment')) :
typeof define === 'function' && define.amd ? define(['moment'], factory) :
factory(global.moment)
}(this, function (moment) { 'use strict';
var sq = moment.defineLocale('sq', {
months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'),
monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'),
weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'),
weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'),
weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'),
weekdaysParseExact : true,
meridiemParse: /PD|MD/,
isPM: function (input) {
return input.charAt(0) === 'M';
},
meridiem : function (hours, minutes, isLower) {
return hours < 12 ? 'PD' : 'MD';
},
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Sot në] LT',
nextDay : '[Nesër në] LT',
nextWeek : 'dddd [në] LT',
lastDay : '[Dje në] LT',
lastWeek : 'dddd [e kaluar në] LT',
sameElse : 'L'
},
relativeTime : {
future : 'në %s',
past : '%s më parë',
s : 'disa sekonda',
m : 'një minutë',
mm : '%d minuta',
h : 'një orë',
hh : '%d orë',
d : 'një ditë',
dd : '%d ditë',
M : 'një muaj',
MM : '%d muaj',
y : 'një vit',
yy : '%d vite'
},
ordinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return sq;
})); | mit |
nojima/vio | third_party/ffmpeg-1.1.3-win64-dev/doc/ffplay.html | 21167 | <!DOCTYPE html>
<html>
<!-- Created on March 3, 2013 by texi2html 1.82 -->
<!--
texi2html was written by:
Lionel Cons <[email protected]> (original author)
Karl Berry <[email protected]>
Olaf Bachmann <[email protected]>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <[email protected]>
-->
<head>
<title>FFmpeg documentation : : </title>
<meta name="description" content=": ">
<meta name="keywords" content="FFmpeg documentation : : ">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="default.css" />
<link rel="icon" href="favicon.png" type="image/png" />
</head>
<body>
<div id="container">
<a name="SEC_Top"></a>
<h1 class="settitle">ffplay Documentation</h1>
<a name="SEC_Contents"></a>
<h1>Table of Contents</h1>
<div class="contents">
<ul class="toc">
<li><a name="toc-Synopsis" href="#Synopsis">1. Synopsis</a></li>
<li><a name="toc-Description" href="#Description">2. Description</a></li>
<li><a name="toc-Options" href="#Options">3. Options</a>
<ul class="toc">
<li><a name="toc-Stream-specifiers-1" href="#Stream-specifiers-1">3.1 Stream specifiers</a></li>
<li><a name="toc-Generic-options" href="#Generic-options">3.2 Generic options</a></li>
<li><a name="toc-AVOptions" href="#AVOptions">3.3 AVOptions</a></li>
<li><a name="toc-Main-options" href="#Main-options">3.4 Main options</a></li>
<li><a name="toc-Advanced-options" href="#Advanced-options">3.5 Advanced options</a></li>
<li><a name="toc-While-playing" href="#While-playing">3.6 While playing</a></li>
</ul></li>
<li><a name="toc-See-Also" href="#See-Also">4. See Also</a></li>
<li><a name="toc-Authors" href="#Authors">5. Authors</a></li>
</ul>
</div>
<a name="Synopsis"></a>
<h1 class="chapter"><a href="ffplay.html#toc-Synopsis">1. Synopsis</a></h1>
<p>ffplay [<var>options</var>] [‘<tt>input_file</tt>’]
</p>
<a name="Description"></a>
<h1 class="chapter"><a href="ffplay.html#toc-Description">2. Description</a></h1>
<p>FFplay is a very simple and portable media player using the FFmpeg
libraries and the SDL library. It is mostly used as a testbed for the
various FFmpeg APIs.
</p>
<a name="Options"></a>
<h1 class="chapter"><a href="ffplay.html#toc-Options">3. Options</a></h1>
<p>All the numerical options, if not specified otherwise, accept in input
a string representing a number, which may contain one of the
SI unit prefixes, for example ’K’, ’M’, ’G’.
If ’i’ is appended after the prefix, binary prefixes are used,
which are based on powers of 1024 instead of powers of 1000.
The ’B’ postfix multiplies the value by 8, and can be
appended after a unit prefix or used alone. This allows using for
example ’KB’, ’MiB’, ’G’ and ’B’ as number postfix.
</p>
<p>Options which do not take arguments are boolean options, and set the
corresponding value to true. They can be set to false by prefixing
with "no" the option name, for example using "-nofoo" in the
command line will set to false the boolean option with name "foo".
</p>
<p><a name="Stream-specifiers"></a>
</p><a name="Stream-specifiers-1"></a>
<h2 class="section"><a href="ffplay.html#toc-Stream-specifiers-1">3.1 Stream specifiers</a></h2>
<p>Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
are used to precisely specify which stream(s) does a given option belong to.
</p>
<p>A stream specifier is a string generally appended to the option name and
separated from it by a colon. E.g. <code>-codec:a:1 ac3</code> option contains
<code>a:1</code> stream specifier, which matches the second audio stream. Therefore it
would select the ac3 codec for the second audio stream.
</p>
<p>A stream specifier can match several streams, the option is then applied to all
of them. E.g. the stream specifier in <code>-b:a 128k</code> matches all audio
streams.
</p>
<p>An empty stream specifier matches all streams, for example <code>-codec copy</code>
or <code>-codec: copy</code> would copy all the streams without reencoding.
</p>
<p>Possible forms of stream specifiers are:
</p><dl compact="compact">
<dt> ‘<samp><var>stream_index</var></samp>’</dt>
<dd><p>Matches the stream with this index. E.g. <code>-threads:1 4</code> would set the
thread count for the second stream to 4.
</p></dd>
<dt> ‘<samp><var>stream_type</var>[:<var>stream_index</var>]</samp>’</dt>
<dd><p><var>stream_type</var> is one of: ’v’ for video, ’a’ for audio, ’s’ for subtitle,
’d’ for data and ’t’ for attachments. If <var>stream_index</var> is given, then
matches stream number <var>stream_index</var> of this type. Otherwise matches all
streams of this type.
</p></dd>
<dt> ‘<samp>p:<var>program_id</var>[:<var>stream_index</var>]</samp>’</dt>
<dd><p>If <var>stream_index</var> is given, then matches stream number <var>stream_index</var> in
program with id <var>program_id</var>. Otherwise matches all streams in this program.
</p></dd>
<dt> ‘<samp>#<var>stream_id</var></samp>’</dt>
<dd><p>Matches the stream by format-specific ID.
</p></dd>
</dl>
<a name="Generic-options"></a>
<h2 class="section"><a href="ffplay.html#toc-Generic-options">3.2 Generic options</a></h2>
<p>These options are shared amongst the av* tools.
</p>
<dl compact="compact">
<dt> ‘<samp>-L</samp>’</dt>
<dd><p>Show license.
</p>
</dd>
<dt> ‘<samp>-h, -?, -help, --help [<var>arg</var>]</samp>’</dt>
<dd><p>Show help. An optional parameter may be specified to print help about a specific
item.
</p>
<p>Possible values of <var>arg</var> are:
</p><dl compact="compact">
<dt> ‘<samp>decoder=<var>decoder_name</var></samp>’</dt>
<dd><p>Print detailed information about the decoder named <var>decoder_name</var>. Use the
‘<samp>-decoders</samp>’ option to get a list of all decoders.
</p>
</dd>
<dt> ‘<samp>encoder=<var>encoder_name</var></samp>’</dt>
<dd><p>Print detailed information about the encoder named <var>encoder_name</var>. Use the
‘<samp>-encoders</samp>’ option to get a list of all encoders.
</p>
</dd>
<dt> ‘<samp>demuxer=<var>demuxer_name</var></samp>’</dt>
<dd><p>Print detailed information about the demuxer named <var>demuxer_name</var>. Use the
‘<samp>-formats</samp>’ option to get a list of all demuxers and muxers.
</p>
</dd>
<dt> ‘<samp>muxer=<var>muxer_name</var></samp>’</dt>
<dd><p>Print detailed information about the muxer named <var>muxer_name</var>. Use the
‘<samp>-formats</samp>’ option to get a list of all muxers and demuxers.
</p>
</dd>
</dl>
</dd>
<dt> ‘<samp>-version</samp>’</dt>
<dd><p>Show version.
</p>
</dd>
<dt> ‘<samp>-formats</samp>’</dt>
<dd><p>Show available formats.
</p>
<p>The fields preceding the format names have the following meanings:
</p><dl compact="compact">
<dt> ‘<samp>D</samp>’</dt>
<dd><p>Decoding available
</p></dd>
<dt> ‘<samp>E</samp>’</dt>
<dd><p>Encoding available
</p></dd>
</dl>
</dd>
<dt> ‘<samp>-codecs</samp>’</dt>
<dd><p>Show all codecs known to libavcodec.
</p>
<p>Note that the term ’codec’ is used throughout this documentation as a shortcut
for what is more correctly called a media bitstream format.
</p>
</dd>
<dt> ‘<samp>-decoders</samp>’</dt>
<dd><p>Show available decoders.
</p>
</dd>
<dt> ‘<samp>-encoders</samp>’</dt>
<dd><p>Show all available encoders.
</p>
</dd>
<dt> ‘<samp>-bsfs</samp>’</dt>
<dd><p>Show available bitstream filters.
</p>
</dd>
<dt> ‘<samp>-protocols</samp>’</dt>
<dd><p>Show available protocols.
</p>
</dd>
<dt> ‘<samp>-filters</samp>’</dt>
<dd><p>Show available libavfilter filters.
</p>
</dd>
<dt> ‘<samp>-pix_fmts</samp>’</dt>
<dd><p>Show available pixel formats.
</p>
</dd>
<dt> ‘<samp>-sample_fmts</samp>’</dt>
<dd><p>Show available sample formats.
</p>
</dd>
<dt> ‘<samp>-layouts</samp>’</dt>
<dd><p>Show channel names and standard channel layouts.
</p>
</dd>
<dt> ‘<samp>-loglevel <var>loglevel</var> | -v <var>loglevel</var></samp>’</dt>
<dd><p>Set the logging level used by the library.
<var>loglevel</var> is a number or a string containing one of the following values:
</p><dl compact="compact">
<dt> ‘<samp>quiet</samp>’</dt>
<dt> ‘<samp>panic</samp>’</dt>
<dt> ‘<samp>fatal</samp>’</dt>
<dt> ‘<samp>error</samp>’</dt>
<dt> ‘<samp>warning</samp>’</dt>
<dt> ‘<samp>info</samp>’</dt>
<dt> ‘<samp>verbose</samp>’</dt>
<dt> ‘<samp>debug</samp>’</dt>
</dl>
<p>By default the program logs to stderr, if coloring is supported by the
terminal, colors are used to mark errors and warnings. Log coloring
can be disabled setting the environment variable
<code>AV_LOG_FORCE_NOCOLOR</code> or <code>NO_COLOR</code>, or can be forced setting
the environment variable <code>AV_LOG_FORCE_COLOR</code>.
The use of the environment variable <code>NO_COLOR</code> is deprecated and
will be dropped in a following FFmpeg version.
</p>
</dd>
<dt> ‘<samp>-report</samp>’</dt>
<dd><p>Dump full command line and console output to a file named
<code><var>program</var>-<var>YYYYMMDD</var>-<var>HHMMSS</var>.log</code> in the current
directory.
This file can be useful for bug reports.
It also implies <code>-loglevel verbose</code>.
</p>
<p>Setting the environment variable <code>FFREPORT</code> to any value has the
same effect. If the value is a ’:’-separated key=value sequence, these
options will affect the report; options values must be escaped if they
contain special characters or the options delimiter ’:’ (see the
“Quoting and escaping” section in the ffmpeg-utils manual). The
following option is recognized:
</p><dl compact="compact">
<dt> ‘<samp>file</samp>’</dt>
<dd><p>set the file name to use for the report; <code>%p</code> is expanded to the name
of the program, <code>%t</code> is expanded to a timestamp, <code>%%</code> is expanded
to a plain <code>%</code>
</p></dd>
</dl>
<p>Errors in parsing the environment variable are not fatal, and will not
appear in the report.
</p>
</dd>
<dt> ‘<samp>-cpuflags flags (<em>global</em>)</samp>’</dt>
<dd><p>Allows setting and clearing cpu flags. This option is intended
for testing. Do not use it unless you know what you’re doing.
</p><table><tr><td> </td><td><pre class="example">ffmpeg -cpuflags -sse+mmx ...
ffmpeg -cpuflags mmx ...
ffmpeg -cpuflags 0 ...
</pre></td></tr></table>
</dd>
</dl>
<a name="AVOptions"></a>
<h2 class="section"><a href="ffplay.html#toc-AVOptions">3.3 AVOptions</a></h2>
<p>These options are provided directly by the libavformat, libavdevice and
libavcodec libraries. To see the list of available AVOptions, use the
‘<samp>-help</samp>’ option. They are separated into two categories:
</p><dl compact="compact">
<dt> ‘<samp>generic</samp>’</dt>
<dd><p>These options can be set for any container, codec or device. Generic options
are listed under AVFormatContext options for containers/devices and under
AVCodecContext options for codecs.
</p></dd>
<dt> ‘<samp>private</samp>’</dt>
<dd><p>These options are specific to the given container, device or codec. Private
options are listed under their corresponding containers/devices/codecs.
</p></dd>
</dl>
<p>For example to write an ID3v2.3 header instead of a default ID3v2.4 to
an MP3 file, use the ‘<samp>id3v2_version</samp>’ private option of the MP3
muxer:
</p><table><tr><td> </td><td><pre class="example">ffmpeg -i input.flac -id3v2_version 3 out.mp3
</pre></td></tr></table>
<p>All codec AVOptions are obviously per-stream, so the chapter on stream
specifiers applies to them
</p>
<p>Note ‘<samp>-nooption</samp>’ syntax cannot be used for boolean AVOptions,
use ‘<samp>-option 0</samp>’/‘<samp>-option 1</samp>’.
</p>
<p>Note2 old undocumented way of specifying per-stream AVOptions by prepending
v/a/s to the options name is now obsolete and will be removed soon.
</p>
<a name="Main-options"></a>
<h2 class="section"><a href="ffplay.html#toc-Main-options">3.4 Main options</a></h2>
<dl compact="compact">
<dt> ‘<samp>-x <var>width</var></samp>’</dt>
<dd><p>Force displayed width.
</p></dd>
<dt> ‘<samp>-y <var>height</var></samp>’</dt>
<dd><p>Force displayed height.
</p></dd>
<dt> ‘<samp>-s <var>size</var></samp>’</dt>
<dd><p>Set frame size (WxH or abbreviation), needed for videos which do
not contain a header with the frame size like raw YUV. This option
has been deprecated in favor of private options, try -video_size.
</p></dd>
<dt> ‘<samp>-an</samp>’</dt>
<dd><p>Disable audio.
</p></dd>
<dt> ‘<samp>-vn</samp>’</dt>
<dd><p>Disable video.
</p></dd>
<dt> ‘<samp>-ss <var>pos</var></samp>’</dt>
<dd><p>Seek to a given position in seconds.
</p></dd>
<dt> ‘<samp>-t <var>duration</var></samp>’</dt>
<dd><p>play <duration> seconds of audio/video
</p></dd>
<dt> ‘<samp>-bytes</samp>’</dt>
<dd><p>Seek by bytes.
</p></dd>
<dt> ‘<samp>-nodisp</samp>’</dt>
<dd><p>Disable graphical display.
</p></dd>
<dt> ‘<samp>-f <var>fmt</var></samp>’</dt>
<dd><p>Force format.
</p></dd>
<dt> ‘<samp>-window_title <var>title</var></samp>’</dt>
<dd><p>Set window title (default is the input filename).
</p></dd>
<dt> ‘<samp>-loop <var>number</var></samp>’</dt>
<dd><p>Loops movie playback <number> times. 0 means forever.
</p></dd>
<dt> ‘<samp>-showmode <var>mode</var></samp>’</dt>
<dd><p>Set the show mode to use.
Available values for <var>mode</var> are:
</p><dl compact="compact">
<dt> ‘<samp>0, video</samp>’</dt>
<dd><p>show video
</p></dd>
<dt> ‘<samp>1, waves</samp>’</dt>
<dd><p>show audio waves
</p></dd>
<dt> ‘<samp>2, rdft</samp>’</dt>
<dd><p>show audio frequency band using RDFT ((Inverse) Real Discrete Fourier Transform)
</p></dd>
</dl>
<p>Default value is "video", if video is not present or cannot be played
"rdft" is automatically selected.
</p>
<p>You can interactively cycle through the available show modes by
pressing the key <w>.
</p>
</dd>
<dt> ‘<samp>-vf <var>filter_graph</var></samp>’</dt>
<dd><p><var>filter_graph</var> is a description of the filter graph to apply to
the input video.
Use the option "-filters" to show all the available filters (including
also sources and sinks).
</p>
</dd>
<dt> ‘<samp>-i <var>input_file</var></samp>’</dt>
<dd><p>Read <var>input_file</var>.
</p></dd>
</dl>
<a name="Advanced-options"></a>
<h2 class="section"><a href="ffplay.html#toc-Advanced-options">3.5 Advanced options</a></h2>
<dl compact="compact">
<dt> ‘<samp>-pix_fmt <var>format</var></samp>’</dt>
<dd><p>Set pixel format.
This option has been deprecated in favor of private options, try -pixel_format.
</p></dd>
<dt> ‘<samp>-stats</samp>’</dt>
<dd><p>Show the stream duration, the codec parameters, the current position in
the stream and the audio/video synchronisation drift.
</p></dd>
<dt> ‘<samp>-bug</samp>’</dt>
<dd><p>Work around bugs.
</p></dd>
<dt> ‘<samp>-fast</samp>’</dt>
<dd><p>Non-spec-compliant optimizations.
</p></dd>
<dt> ‘<samp>-genpts</samp>’</dt>
<dd><p>Generate pts.
</p></dd>
<dt> ‘<samp>-rtp_tcp</samp>’</dt>
<dd><p>Force RTP/TCP protocol usage instead of RTP/UDP. It is only meaningful
if you are streaming with the RTSP protocol.
</p></dd>
<dt> ‘<samp>-sync <var>type</var></samp>’</dt>
<dd><p>Set the master clock to audio (<code>type=audio</code>), video
(<code>type=video</code>) or external (<code>type=ext</code>). Default is audio. The
master clock is used to control audio-video synchronization. Most media
players use audio as master clock, but in some cases (streaming or high
quality broadcast) it is necessary to change that. This option is mainly
used for debugging purposes.
</p></dd>
<dt> ‘<samp>-threads <var>count</var></samp>’</dt>
<dd><p>Set the thread count.
</p></dd>
<dt> ‘<samp>-ast <var>audio_stream_number</var></samp>’</dt>
<dd><p>Select the desired audio stream number, counting from 0. The number
refers to the list of all the input audio streams. If it is greater
than the number of audio streams minus one, then the last one is
selected, if it is negative the audio playback is disabled.
</p></dd>
<dt> ‘<samp>-vst <var>video_stream_number</var></samp>’</dt>
<dd><p>Select the desired video stream number, counting from 0. The number
refers to the list of all the input video streams. If it is greater
than the number of video streams minus one, then the last one is
selected, if it is negative the video playback is disabled.
</p></dd>
<dt> ‘<samp>-sst <var>subtitle_stream_number</var></samp>’</dt>
<dd><p>Select the desired subtitle stream number, counting from 0. The number
refers to the list of all the input subtitle streams. If it is greater
than the number of subtitle streams minus one, then the last one is
selected, if it is negative the subtitle rendering is disabled.
</p></dd>
<dt> ‘<samp>-autoexit</samp>’</dt>
<dd><p>Exit when video is done playing.
</p></dd>
<dt> ‘<samp>-exitonkeydown</samp>’</dt>
<dd><p>Exit if any key is pressed.
</p></dd>
<dt> ‘<samp>-exitonmousedown</samp>’</dt>
<dd><p>Exit if any mouse button is pressed.
</p>
</dd>
<dt> ‘<samp>-codec:<var>media_specifier</var> <var>codec_name</var></samp>’</dt>
<dd><p>Force a specific decoder implementation for the stream identified by
<var>media_specifier</var>, which can assume the values <code>a</code> (audio),
<code>v</code> (video), and <code>s</code> subtitle.
</p>
</dd>
<dt> ‘<samp>-acodec <var>codec_name</var></samp>’</dt>
<dd><p>Force a specific audio decoder.
</p>
</dd>
<dt> ‘<samp>-vcodec <var>codec_name</var></samp>’</dt>
<dd><p>Force a specific video decoder.
</p>
</dd>
<dt> ‘<samp>-scodec <var>codec_name</var></samp>’</dt>
<dd><p>Force a specific subtitle decoder.
</p></dd>
</dl>
<a name="While-playing"></a>
<h2 class="section"><a href="ffplay.html#toc-While-playing">3.6 While playing</a></h2>
<dl compact="compact">
<dt> <q, ESC></dt>
<dd><p>Quit.
</p>
</dd>
<dt> <f></dt>
<dd><p>Toggle full screen.
</p>
</dd>
<dt> <p, SPC></dt>
<dd><p>Pause.
</p>
</dd>
<dt> <a></dt>
<dd><p>Cycle audio channel.
</p>
</dd>
<dt> <v></dt>
<dd><p>Cycle video channel.
</p>
</dd>
<dt> <t></dt>
<dd><p>Cycle subtitle channel.
</p>
</dd>
<dt> <w></dt>
<dd><p>Show audio waves.
</p>
</dd>
<dt> <left/right></dt>
<dd><p>Seek backward/forward 10 seconds.
</p>
</dd>
<dt> <down/up></dt>
<dd><p>Seek backward/forward 1 minute.
</p>
</dd>
<dt> <page down/page up></dt>
<dd><p>Seek backward/forward 10 minutes.
</p>
</dd>
<dt> <mouse click></dt>
<dd><p>Seek to percentage in file corresponding to fraction of width.
</p>
</dd>
</dl>
<a name="See-Also"></a>
<h1 class="chapter"><a href="ffplay.html#toc-See-Also">4. See Also</a></h1>
<p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffprobe.html">ffprobe</a>, <a href="ffserver.html">ffserver</a>,
<a href="ffmpeg-utils.html">ffmpeg-utils</a>,
<a href="ffmpeg-scaler.html">ffmpeg-scaler</a>,
<a href="ffmpeg-resampler.html">ffmpeg-resampler</a>,
<a href="ffmpeg-codecs.html">ffmpeg-codecs</a>,
<a href="ffmpeg-bitstream-filters">ffmpeg-bitstream-filters</a>,
<a href="ffmpeg-formats.html">ffmpeg-formats</a>,
<a href="ffmpeg-devices.html">ffmpeg-devices</a>,
<a href="ffmpeg-protocols.html">ffmpeg-protocols</a>,
<a href="ffmpeg-filters.html">ffmpeg-filters</a>
</p>
<a name="Authors"></a>
<h1 class="chapter"><a href="ffplay.html#toc-Authors">5. Authors</a></h1>
<p>The FFmpeg developers.
</p>
<p>For details about the authorship, see the Git history of the project
(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
<code>git log</code> in the FFmpeg source directory, or browsing the
online repository at <a href="http://source.ffmpeg.org">http://source.ffmpeg.org</a>.
</p>
<p>Maintainers for the specific components are listed in the file
‘<tt>MAINTAINERS</tt>’ in the source code tree.
</p>
<footer class="footer pagination-right">
<span class="label label-info">This document was generated by <em>Kyle Schwarz</em> on <em>March 3, 2013</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.</span></footer></div>
| mit |
zq317157782/Narukami | external/imgui/examples/example_win32_directx10/main.cpp | 9656 | // Dear ImGui: standalone example application for DirectX 10
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
// Read online: https://github.com/ocornut/imgui/tree/master/docs
#include "imgui.h"
#include "imgui_impl_win32.h"
#include "imgui_impl_dx10.h"
#include <d3d10_1.h>
#include <d3d10.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <tchar.h>
// Data
static ID3D10Device* g_pd3dDevice = NULL;
static IDXGISwapChain* g_pSwapChain = NULL;
static ID3D10RenderTargetView* g_mainRenderTargetView = NULL;
// Forward declarations of helper functions
bool CreateDeviceD3D(HWND hWnd);
void CleanupDeviceD3D();
void CreateRenderTarget();
void CleanupRenderTarget();
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
// Main code
int main(int, char**)
{
// Create application window
//ImGui_ImplWin32_EnableDpiAwareness();
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, WndProc, 0L, 0L, GetModuleHandle(NULL), NULL, NULL, NULL, NULL, _T("ImGui Example"), NULL };
::RegisterClassEx(&wc);
HWND hwnd = ::CreateWindow(wc.lpszClassName, _T("Dear ImGui DirectX10 Example"), WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, NULL, NULL, wc.hInstance, NULL);
// Initialize Direct3D
if (!CreateDeviceD3D(hwnd))
{
CleanupDeviceD3D();
::UnregisterClass(wc.lpszClassName, wc.hInstance);
return 1;
}
// Show the window
::ShowWindow(hwnd, SW_SHOWDEFAULT);
::UpdateWindow(hwnd);
// Setup Dear ImGui context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
// Setup Dear ImGui style
ImGui::StyleColorsDark();
//ImGui::StyleColorsClassic();
// Setup Platform/Renderer backends
ImGui_ImplWin32_Init(hwnd);
ImGui_ImplDX10_Init(g_pd3dDevice);
// Load Fonts
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
// - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
// - Read 'docs/FONTS.md' for more instructions and details.
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
//io.Fonts->AddFontDefault();
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
//IM_ASSERT(font != NULL);
// Our state
bool show_demo_window = true;
bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
// Main loop
MSG msg;
ZeroMemory(&msg, sizeof(msg));
while (msg.message != WM_QUIT)
{
// Poll and handle messages (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
if (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
continue;
}
// Start the Dear ImGui frame
ImGui_ImplDX10_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if (show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
{
static float f = 0.0f;
static int counter = 0;
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
ImGui::Checkbox("Another Window", &show_another_window);
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if (show_another_window)
{
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
show_another_window = false;
ImGui::End();
}
// Rendering
ImGui::Render();
g_pd3dDevice->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color);
ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
g_pSwapChain->Present(1, 0); // Present with vsync
//g_pSwapChain->Present(0, 0); // Present without vsync
}
ImGui_ImplDX10_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
CleanupDeviceD3D();
::DestroyWindow(hwnd);
::UnregisterClass(wc.lpszClassName, wc.hInstance);
return 0;
}
// Helper functions
bool CreateDeviceD3D(HWND hWnd)
{
// Setup swap chain
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory(&sd, sizeof(sd));
sd.BufferCount = 2;
sd.BufferDesc.Width = 0;
sd.BufferDesc.Height = 0;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = hWnd;
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;
sd.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
UINT createDeviceFlags = 0;
//createDeviceFlags |= D3D10_CREATE_DEVICE_DEBUG;
if (D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, createDeviceFlags, D3D10_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice) != S_OK)
return false;
CreateRenderTarget();
return true;
}
void CleanupDeviceD3D()
{
CleanupRenderTarget();
if (g_pSwapChain) { g_pSwapChain->Release(); g_pSwapChain = NULL; }
if (g_pd3dDevice) { g_pd3dDevice->Release(); g_pd3dDevice = NULL; }
}
void CreateRenderTarget()
{
ID3D10Texture2D* pBackBuffer;
g_pSwapChain->GetBuffer(0, IID_PPV_ARGS(&pBackBuffer));
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_mainRenderTargetView);
pBackBuffer->Release();
}
void CleanupRenderTarget()
{
if (g_mainRenderTargetView) { g_mainRenderTargetView->Release(); g_mainRenderTargetView = NULL; }
}
// Forward declare message handler from imgui_impl_win32.cpp
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
// Win32 message handler
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam))
return true;
switch (msg)
{
case WM_SIZE:
if (g_pd3dDevice != NULL && wParam != SIZE_MINIMIZED)
{
CleanupRenderTarget();
g_pSwapChain->ResizeBuffers(0, (UINT)LOWORD(lParam), (UINT)HIWORD(lParam), DXGI_FORMAT_UNKNOWN, 0);
CreateRenderTarget();
}
return 0;
case WM_SYSCOMMAND:
if ((wParam & 0xfff0) == SC_KEYMENU) // Disable ALT application menu
return 0;
break;
case WM_DESTROY:
::PostQuitMessage(0);
return 0;
}
return ::DefWindowProc(hWnd, msg, wParam, lParam);
}
| mit |
obi-a/ragios | lib/ragios/notifications/notify_worker.rb | 1083 | module Ragios
module Notifications
class NotifyWorker
include Celluloid
def perform(event, monitor, test_result, notifier)
event_details = {
monitor_id: monitor[:_id],
state: event,
time: Time.now.utc,
type: "event",
event_type: "monitor.notification",
monitor: monitor,
test_result: test_result,
notifier: notifier_name(notifier)
}
notifier.send(event, test_result) if notifier.respond_to?(event)
occurred = {notified: event, via: notifier_name(notifier)}
pusher.async.log_event!(
event_details.merge(event: occurred)
)
rescue Exception => exception
occurred = {"notifier error" => exception.message}
pusher.async.log_event!(
event_details.merge(event: occurred)
)
raise exception
end
private
def pusher
Ragios::Events::Pusher.new
end
def notifier_name(notifier)
notifier.class.name.split('::').last
end
end
end
end
| mit |
ungdev/integration-UTT | database/migrations/2016_07_09_171819_add_a_relation_between_student_and_team.php | 1034 | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddARelationBetweenStudentAndTeam extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('students', function (Blueprint $table) {
$table->integer('team_id')->default(null)->nullable()->after('ce');
$table->boolean('team_accepted')->default(false)->after('team_id');
});
Schema::table('teams', function (Blueprint $table) {
$table->integer('respo_id')->after('img_url');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('students', function (Blueprint $table) {
$table->dropColumn('team_id');
$table->dropColumn('team_accepted');
});
Schema::table('teams', function (Blueprint $table) {
$table->dropColumn('respo_id');
});
}
}
| mit |
ochrons/diode | diode-core/js/src/main/scala/diode/Implicits.scala | 116 | package diode
import diode.util.RunAfterJS
object Implicits {
implicit object runAfterImpl extends RunAfterJS
}
| mit |
oenning/highcharts-mvc | src/Highcharts.Mvc/highcharts-mvc.min.js | 994 | // (c) 2012 Guilherme Oenning
var hCharts=[];function setIntervalAndExecute(func,time){func();return(setInterval(func,time));}
Highcharts.Chart.prototype.clearSeries=function(){while(this.series.length>0)
this.series[0].remove(true);};function loadChartAjax(options){var chart=hCharts[options.chartId];var url=options.url;var animation=options.animation;var interval=options.interval;var fn=function(){if("GET"===options.method){$.getJSON(url,function(data){parseAjaxResult(chart,data,animation)});}else{$.post(url,null,function(data){parseAjaxResult(chart,data,animation)},"json");}}
if(typeof(interval)!='undefined')
setIntervalAndExecute(fn,interval);else
fn();}
function parseAjaxResult(chart,data,animation){$.each(data,function(key,value){if(chart.series.length>key){var serie=chart.series[key];for(var i=0;i<serie.data.length;i++){serie.data[i].update(value.Values[i],false,false);}}
else{chart.addSeries({name:value.Name,data:value.Values},false,false);}});chart.redraw(animation);} | mit |
zidik/Robocup-Simulator | style/screen.css | 5042 | /* Layout */
HTML,
BODY {
padding: 0;
margin: 0;
height: 100%;
background: url(../images/body-bg.jpg) no-repeat center center;
}
#contents {
position: absolute;
width: 820px;
height: 557px;
left: 50%;
top: 50%;
margin-left: -410px;
margin-top: -310px;
overflow: visible;
}
#canvas {
width: 800px;
height: 537px;
border: 10px solid rgba(50, 100, 200, 0.5);
border-radius: 10px;
}
/* Toolbar */
#toolbar {
position: absolute;
left: 10px;
top: 560px;
padding: 0;
margin: 0;
list-style: none;
}
#toolbar > LI {
float: left;
padding: 0;
margin: 0;
}
#toolbar > LI > BUTTON {
padding: 6px 12px;
}
/* Dialog
.dialog {
position: absolute;
width: 300px;
left: 50%;
top: 50%;
padding: 5px;
margin-left: -155px;
margin-top: -130px;
background-color: rgba(0, 0, 0, 0.5);
}
.dialog .dialog-inner {
background-color: #FFF;
padding: 20px 40px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}*/
/* Joystick */
.joystick {
position: absolute;
top: 0;
width: 100px;
height: 100px;
border-radius: 20px;
background-color: rgba(0, 0, 0, 0.25);
}
.joystick.yellow {
left: -140px;
border: 5px solid rgba(255, 255, 0, 0.5);
}
.joystick.blue {
right: -140px;
border: 5px solid rgba(0, 0, 255, 0.5);
}
.joystick > A {
display: block;
position: absolute;
width: 40px;
height: 40px;
left: 50%;
top: 50%;
margin-left: -20px;
margin-top: -20px;
border-radius: 20px;
}
.joystick.yellow > A {
background-color: rgba(255, 255, 0, 0.5);
}
.joystick.blue > A {
background-color: rgba(0, 0, 255, 0.5);
}
/* Modal */
#modal {
position: absolute;
width: 400px;
height: 300px;
left: 50%;
top: 50%;
margin: -150px 0 0 -200px;
background-color: #FFF;
border-radius: 10px;
box-shadow: 0 0 80px #666;
display: none;
}
#modal > H1 {
display: block;
margin: 0;
padding: 0;
height: 60px;
line-height: 60px;
font-family: serif;
font-size: 40px;
color: #333;
text-shadow: 2px 2px 2px #CCC;
text-align: center;
background-color: #F8F8F8;
border-bottom: 1px solid #CCC;
border-radius: 10px 10px 0 0;
}
#yellow-wrap,
#blue-wrap {
position: absolute;
top: 80px;
width: 100px;
text-align: center;
padding: 10px;
color: #FFF;
border-radius: 3px;
}
#yellow-wrap {
left: 70px;
background-color: #DD0;
}
#blue-wrap {
right: 70px;
background-color: #00D;
}
#yellow-wrap SPAN,
#blue-wrap SPAN {
font-size: 80px;
}
#yellow-wrap SELECT,
#blue-wrap SELECT {
font-size: 20px;
text-align: center;
width: 100px;
padding: 4px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
border: none;
/*background-color: rgba(255, 255, 255, 0.25) !important;*/
}
.modal-btn {
position: absolute;
left: 70px;
right: 70px;
top: 240px;
text-align: center;
line-height: 30px;
}
/* Start match */
.start-match {
height: 210px !important;
}
.start-match .modal-btn {
top: 150px;
}
/* Game over */
#match-duration {
position: absolute;
left: 70px;
top: 200px;
font-size: 22px;
}
/* Debugging */
#debug-wrap {
position: absolute;
left: 20px;
top: 20px;
list-style: none;
margin: 0;
padding: 0;
}
#debug-wrap > LI {
float: left;
clear: both;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 3px;
padding: 5px 10px;
margin: 0 0 10px;
color: #FFF;
}
#commands {
position: absolute;
top: 20px;
right: 20px;
margin: 0;
padding: 4px;
max-height: 90%;
list-style: none;
background-color: rgba(0, 0, 0, 0.25);
border-radius: 5px;
overflow: hidden;
}
#commands > LI {
width: 200px;
padding: 5px 10px;
margin: 1px 0 0;
background-color: rgba(0, 0, 0, 0.5);
color: #FFF;
}
#commands > LI:first-child {
margin-top: 0;
border-radius: 3px 3px 0 0;
background-color: rgba(0, 255, 0, 0.5);
}
#commands > LI:last-child {
border-radius: 0 0 3px 3px;
}
#gamepad {
position: absolute;
left: 0;
top: -30px;
width: 800px;
text-align: center;
font-size: 20px;
color: #FFF;
}
/* Fullscreen */
#toggle-fullscreen-btn {
position: absolute;
right: 20px;
top: 20px;
width: 32px;
height: 32px;
background: url(../images/fullscreen-btn.png) no-repeat left top;
text-indent: -10000px;
overflow: hidden;
}
.fullscreen #contents {
left: 0;
top: 0;
margin-left: 0;
margin-top: 0;
width: 100%;
height: 100%;
}
.fullscreen #canvas {
width: 100%;
height: 100%;
border: none;
}
.fullscreen #toolbar,
.fullscreen #toggle-fullscreen-btn,
.fullscreen #debug-wrap {
display: none;
}
/* Temp error table */
#error-results {
position: absolute;
left: 20px;
bottom: 20px;
}
#error-results TH, #error-results TD {
background-color: #FFF;
} | mit |
NickAger/elm-slider | ServerSlider/HTTPServer/Packages/COpenSSL-0.14.0/Sources/a_d2i_fp.c | 9419 | /* crypto/asn1/a_d2i_fp.c */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <stdio.h>
#include <limits.h>
#include "cryptlib.h"
#include "buffer.h"
#include "asn1_mac.h"
static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb);
#ifndef NO_OLD_ASN1
# ifndef OPENSSL_NO_FP_API
void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x)
{
BIO *b;
void *ret;
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_D2I_FP, ERR_R_BUF_LIB);
return (NULL);
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_d2i_bio(xnew, d2i, b, x);
BIO_free(b);
return (ret);
}
# endif
void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x)
{
BUF_MEM *b = NULL;
const unsigned char *p;
void *ret = NULL;
int len;
len = asn1_d2i_read_bio(in, &b);
if (len < 0)
goto err;
p = (unsigned char *)b->data;
ret = d2i(x, &p, len);
err:
if (b != NULL)
BUF_MEM_free(b);
return (ret);
}
#endif
void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x)
{
BUF_MEM *b = NULL;
const unsigned char *p;
void *ret = NULL;
int len;
len = asn1_d2i_read_bio(in, &b);
if (len < 0)
goto err;
p = (const unsigned char *)b->data;
ret = ASN1_item_d2i(x, &p, len, it);
err:
if (b != NULL)
BUF_MEM_free(b);
return (ret);
}
#ifndef OPENSSL_NO_FP_API
void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x)
{
BIO *b;
char *ret;
if ((b = BIO_new(BIO_s_file())) == NULL) {
ASN1err(ASN1_F_ASN1_ITEM_D2I_FP, ERR_R_BUF_LIB);
return (NULL);
}
BIO_set_fp(b, in, BIO_NOCLOSE);
ret = ASN1_item_d2i_bio(it, b, x);
BIO_free(b);
return (ret);
}
#endif
#define HEADER_SIZE 8
#define ASN1_CHUNK_INITIAL_SIZE (16 * 1024)
static int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb)
{
BUF_MEM *b;
unsigned char *p;
int i;
ASN1_const_CTX c;
size_t want = HEADER_SIZE;
int eos = 0;
size_t off = 0;
size_t len = 0;
b = BUF_MEM_new();
if (b == NULL) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ERR_R_MALLOC_FAILURE);
return -1;
}
ERR_clear_error();
for (;;) {
if (want >= (len - off)) {
want -= (len - off);
if (len + want < len || !BUF_MEM_grow_clean(b, len + want)) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ERR_R_MALLOC_FAILURE);
goto err;
}
i = BIO_read(in, &(b->data[len]), want);
if ((i < 0) && ((len - off) == 0)) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_NOT_ENOUGH_DATA);
goto err;
}
if (i > 0) {
if (len + i < len) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_TOO_LONG);
goto err;
}
len += i;
}
}
/* else data already loaded */
p = (unsigned char *)&(b->data[off]);
c.p = p;
c.inf = ASN1_get_object(&(c.p), &(c.slen), &(c.tag), &(c.xclass),
len - off);
if (c.inf & 0x80) {
unsigned long e;
e = ERR_GET_REASON(ERR_peek_error());
if (e != ASN1_R_TOO_LONG)
goto err;
else
ERR_clear_error(); /* clear error */
}
i = c.p - p; /* header length */
off += i; /* end of data */
if (c.inf & 1) {
/* no data body so go round again */
eos++;
if (eos < 0) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_HEADER_TOO_LONG);
goto err;
}
want = HEADER_SIZE;
} else if (eos && (c.slen == 0) && (c.tag == V_ASN1_EOC)) {
/* eos value, so go back and read another header */
eos--;
if (eos <= 0)
break;
else
want = HEADER_SIZE;
} else {
/* suck in c.slen bytes of data */
want = c.slen;
if (want > (len - off)) {
size_t chunk_max = ASN1_CHUNK_INITIAL_SIZE;
want -= (len - off);
if (want > INT_MAX /* BIO_read takes an int length */ ||
len + want < len) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_TOO_LONG);
goto err;
}
while (want > 0) {
/*
* Read content in chunks of increasing size
* so we can return an error for EOF without
* having to allocate the entire content length
* in one go.
*/
size_t chunk = want > chunk_max ? chunk_max : want;
if (!BUF_MEM_grow_clean(b, len + chunk)) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ERR_R_MALLOC_FAILURE);
goto err;
}
want -= chunk;
while (chunk > 0) {
i = BIO_read(in, &(b->data[len]), chunk);
if (i <= 0) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO,
ASN1_R_NOT_ENOUGH_DATA);
goto err;
}
/*
* This can't overflow because |len+want| didn't
* overflow.
*/
len += i;
chunk -= i;
}
if (chunk_max < INT_MAX/2)
chunk_max *= 2;
}
}
if (off + c.slen < off) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_TOO_LONG);
goto err;
}
off += c.slen;
if (eos <= 0) {
break;
} else
want = HEADER_SIZE;
}
}
if (off > INT_MAX) {
ASN1err(ASN1_F_ASN1_D2I_READ_BIO, ASN1_R_TOO_LONG);
goto err;
}
*pb = b;
return off;
err:
if (b != NULL)
BUF_MEM_free(b);
return -1;
}
| mit |
Mahaswami/netzke-core | test/core_test_app/spec/js_class_config_scope.rb | 1145 | require 'spec_helper'
class SomeComponent < Netzke::Base
end
module MyCompanyComponents
class SomeComponent < Netzke::Base
end
end
class InheritedComponent < SomeComponent
end
module Netzke
module Basepack
class GridPanel < Netzke::Base
end
end
end
describe Netzke::Core::ClientClass do
it "should build scope based on component scope" do
SomeComponent.js_config.scope.should == "Netzke.classes"
MyCompanyComponents::SomeComponent.js_config.scope.should == "Netzke.classes.MyCompanyComponents"
end
it "should properly detect whether we are extending a Netzke component" do
SomeComponent.js_config.extending_extjs_component?.should be_true
InheritedComponent.js_config.extending_extjs_component?.should be_false
end
it "should build full client class name based on class name" do
SomeComponent.js_config.class_name.should == "Netzke.classes.SomeComponent"
MyCompanyComponents::SomeComponent.js_config.class_name.should == "Netzke.classes.MyCompanyComponents.SomeComponent"
Netzke::Basepack::GridPanel.js_config.class_name.should == "Netzke.classes.Netzke.Basepack.GridPanel"
end
end
| mit |
ccamensuli/stage_full | src/stage-ui/plugins/grid/test/fixtures/html/bdd200.html | 33371 | <table>
<thead>
<tr>
<th>Id</th>
<th>qsdqsdqsdsqdsqd</th>
<th>Email</th>
<th>Date</th>
<th>Price</th>
<th>Change</th>
<th>Available</th>
</tr>
</thead>
<tbody>
<tr>
<td>N7C 0P4</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>12-05-11</td>
<td>14949</td>
<td>5</td>
<td>1</td>
</tr>
<tr>
<td>B4X 0G4</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>10-22-11</td>
<td>62581</td>
<td>5.51</td>
<td>1</td>
</tr>
<tr>
<td>Q6S 6J7</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>01-25-11</td>
<td>84505</td>
<td>6.02</td>
<td>1</td>
</tr>
<tr>
<td>P2H 1U9</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>04-28-12</td>
<td>34895</td>
<td>6.53</td>
<td>0</td>
</tr>
<tr>
<td>E3M 9A0</td>
<td>Borland</td>
<td>[email protected]</td>
<td>03-11-12</td>
<td>11026</td>
<td>7.04</td>
<td>0</td>
</tr>
<tr>
<td>H7U 5U9</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>06-17-11</td>
<td>51085</td>
<td>7.55</td>
<td>1</td>
</tr>
<tr>
<td>S0T 7C0</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>03-23-11</td>
<td>33505</td>
<td>8.06</td>
<td>0</td>
</tr>
<tr>
<td>D0R 6U3</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>01-25-11</td>
<td>54166</td>
<td>8.57</td>
<td>1</td>
</tr>
<tr>
<td>Y4I 1U4</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>11-13-11</td>
<td>11354</td>
<td>9.08</td>
<td>1</td>
</tr>
<tr>
<td>D8M 6U4</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>12-12-10</td>
<td>78223</td>
<td>9.59</td>
<td>1</td>
</tr>
<tr>
<td>V3L 8C5</td>
<td>Chami</td>
<td>[email protected]</td>
<td>09-11-11</td>
<td>29175</td>
<td>10.1</td>
<td>1</td>
</tr>
<tr>
<td>A2Q 7V4</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>08-04-10</td>
<td>62309</td>
<td>10.61</td>
<td>0</td>
</tr>
<tr>
<td>K6X 6I9</td>
<td>Chami</td>
<td>[email protected]</td>
<td>06-07-10</td>
<td>87211</td>
<td>11.12</td>
<td>1</td>
</tr>
<tr>
<td>H7U 8C1</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>05-01-11</td>
<td>42231</td>
<td>11.63</td>
<td>0</td>
</tr>
<tr>
<td>N7H 3L5</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>01-25-11</td>
<td>81710</td>
<td>12.14</td>
<td>1</td>
</tr>
<tr>
<td>A1X 3F4</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>01-31-11</td>
<td>70819</td>
<td>12.65</td>
<td>1</td>
</tr>
<tr>
<td>T2P 5Z6</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>03-04-12</td>
<td>56662</td>
<td>13.16</td>
<td>0</td>
</tr>
<tr>
<td>V2T 5V4</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>10-18-10</td>
<td>57552</td>
<td>13.67</td>
<td>0</td>
</tr>
<tr>
<td>V2S 3N5</td>
<td>Google</td>
<td>[email protected]</td>
<td>04-27-11</td>
<td>82616</td>
<td>14.18</td>
<td>1</td>
</tr>
<tr>
<td>P2B 1N9</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>04-16-11</td>
<td>30020</td>
<td>14.69</td>
<td>0</td>
</tr>
<tr>
<td>V3U 6Y3</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>08-02-10</td>
<td>82226</td>
<td>15.2</td>
<td>0</td>
</tr>
<tr>
<td>P0H 8O1</td>
<td>Google</td>
<td>[email protected]</td>
<td>10-20-11</td>
<td>59909</td>
<td>15.71</td>
<td>0</td>
</tr>
<tr>
<td>T0W 5L4</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>12-26-11</td>
<td>40033</td>
<td>16.22</td>
<td>1</td>
</tr>
<tr>
<td>Y9Q 4K3</td>
<td>Finale</td>
<td>[email protected]</td>
<td>08-07-11</td>
<td>38089</td>
<td>16.73</td>
<td>1</td>
</tr>
<tr>
<td>P9O 9O5</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>02-12-11</td>
<td>47031</td>
<td>17.24</td>
<td>1</td>
</tr>
<tr>
<td>V7W 1Q4</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>01-26-12</td>
<td>24426</td>
<td>17.75</td>
<td>0</td>
</tr>
<tr>
<td>I4X 7F7</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>04-27-12</td>
<td>56355</td>
<td>18.26</td>
<td>1</td>
</tr>
<tr>
<td>M2G 6M5</td>
<td>Borland</td>
<td>[email protected]</td>
<td>11-18-10</td>
<td>95127</td>
<td>18.77</td>
<td>1</td>
</tr>
<tr>
<td>W0U 3O2</td>
<td>Chami</td>
<td>[email protected]</td>
<td>09-28-11</td>
<td>31208</td>
<td>19.28</td>
<td>1</td>
</tr>
<tr>
<td>H6U 2D6</td>
<td>Google</td>
<td>[email protected]</td>
<td>06-15-10</td>
<td>56292</td>
<td>19.79</td>
<td>1</td>
</tr>
<tr>
<td>P1D 8Z4</td>
<td>Google</td>
<td>[email protected]</td>
<td>10-25-10</td>
<td>76069</td>
<td>20.3</td>
<td>1</td>
</tr>
<tr>
<td>A2R 5G2</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>07-17-11</td>
<td>41631</td>
<td>20.81</td>
<td>1</td>
</tr>
<tr>
<td>V3M 5W4</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>01-16-12</td>
<td>33095</td>
<td>21.32</td>
<td>1</td>
</tr>
<tr>
<td>I6C 6F9</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>01-25-11</td>
<td>53162</td>
<td>21.83</td>
<td>0</td>
</tr>
<tr>
<td>F9Z 4W2</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>03-07-12</td>
<td>20378</td>
<td>22.34</td>
<td>1</td>
</tr>
<tr>
<td>J7P 8Y8</td>
<td>Borland</td>
<td>[email protected]</td>
<td>11-11-11</td>
<td>17397</td>
<td>22.85</td>
<td>1</td>
</tr>
<tr>
<td>F3E 3X5</td>
<td>Borland</td>
<td>[email protected]</td>
<td>06-17-11</td>
<td>41302</td>
<td>23.36</td>
<td>0</td>
</tr>
<tr>
<td>W4O 9A7</td>
<td>Borland</td>
<td>[email protected]</td>
<td>04-21-12</td>
<td>74976</td>
<td>23.87</td>
<td>1</td>
</tr>
<tr>
<td>F2B 5S8</td>
<td>Finale</td>
<td>[email protected]</td>
<td>09-15-11</td>
<td>10039</td>
<td>24.38</td>
<td>1</td>
</tr>
<tr>
<td>T8H 4W4</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>09-02-11</td>
<td>28985</td>
<td>24.89</td>
<td>0</td>
</tr>
<tr>
<td>I2C 3U8</td>
<td>Chami</td>
<td>[email protected]</td>
<td>10-01-10</td>
<td>29460</td>
<td>25.4</td>
<td>1</td>
</tr>
<tr>
<td>P3H 8O6</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>12-27-10</td>
<td>61902</td>
<td>25.91</td>
<td>0</td>
</tr>
<tr>
<td>O7J 7J9</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>08-25-11</td>
<td>47455</td>
<td>26.42</td>
<td>1</td>
</tr>
<tr>
<td>A4D 5Q6</td>
<td>Chami</td>
<td>[email protected]</td>
<td>10-11-10</td>
<td>75853</td>
<td>26.93</td>
<td>0</td>
</tr>
<tr>
<td>R4M 0F4</td>
<td>Finale</td>
<td>[email protected]</td>
<td>06-23-11</td>
<td>16808</td>
<td>27.44</td>
<td>1</td>
</tr>
<tr>
<td>F1P 9L2</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>02-12-11</td>
<td>43115</td>
<td>27.95</td>
<td>1</td>
</tr>
<tr>
<td>C8U 1N9</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>01-02-12</td>
<td>57206</td>
<td>28.46</td>
<td>1</td>
</tr>
<tr>
<td>N0A 8V1</td>
<td>Borland</td>
<td>[email protected]</td>
<td>02-25-12</td>
<td>19579</td>
<td>28.97</td>
<td>0</td>
</tr>
<tr>
<td>I2S 8U2</td>
<td>Google</td>
<td>[email protected]</td>
<td>02-07-12</td>
<td>12538</td>
<td>29.48</td>
<td>1</td>
</tr>
<tr>
<td>B6L 1E7</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>12-06-10</td>
<td>36043</td>
<td>29.99</td>
<td>1</td>
</tr>
<tr>
<td>J6J 3H4</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>05-06-11</td>
<td>29311</td>
<td>30.5</td>
<td>0</td>
</tr>
<tr>
<td>I6F 6F5</td>
<td>Borland</td>
<td>[email protected]</td>
<td>04-13-11</td>
<td>28478</td>
<td>31.01</td>
<td>0</td>
</tr>
<tr>
<td>A6L 2V7</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>06-23-10</td>
<td>82651</td>
<td>31.52</td>
<td>1</td>
</tr>
<tr>
<td>L8Q 6Z6</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>01-12-12</td>
<td>22735</td>
<td>32.03</td>
<td>0</td>
</tr>
<tr>
<td>J4H 1I7</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>09-05-10</td>
<td>92444</td>
<td>32.54</td>
<td>1</td>
</tr>
<tr>
<td>R8Y 8B3</td>
<td>Google</td>
<td>[email protected]</td>
<td>05-30-10</td>
<td>10260</td>
<td>33.05</td>
<td>0</td>
</tr>
<tr>
<td>M4V 3Z4</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>07-11-11</td>
<td>55628</td>
<td>33.56</td>
<td>1</td>
</tr>
<tr>
<td>V7T 8C1</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>02-21-11</td>
<td>76214</td>
<td>34.07</td>
<td>1</td>
</tr>
<tr>
<td>Z7I 4N1</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>01-06-11</td>
<td>36503</td>
<td>34.58</td>
<td>0</td>
</tr>
<tr>
<td>J7R 1F6</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>10-08-11</td>
<td>87243</td>
<td>35.09</td>
<td>0</td>
</tr>
<tr>
<td>Y5Z 2P3</td>
<td>Finale</td>
<td>[email protected]</td>
<td>05-09-12</td>
<td>41863</td>
<td>35.6</td>
<td>0</td>
</tr>
<tr>
<td>L4J 2W2</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>04-16-11</td>
<td>66299</td>
<td>36.11</td>
<td>0</td>
</tr>
<tr>
<td>Q0Z 0F4</td>
<td>Finale</td>
<td>[email protected]</td>
<td>11-17-10</td>
<td>88398</td>
<td>36.62</td>
<td>0</td>
</tr>
<tr>
<td>M9B 1K7</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>01-29-11</td>
<td>43653</td>
<td>37.13</td>
<td>0</td>
</tr>
<tr>
<td>M0F 3L6</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>05-09-11</td>
<td>55426</td>
<td>37.64</td>
<td>1</td>
</tr>
<tr>
<td>Y1B 3F5</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>02-25-11</td>
<td>25974</td>
<td>38.15</td>
<td>0</td>
</tr>
<tr>
<td>Z6A 4I9</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>12-05-10</td>
<td>19979</td>
<td>38.66</td>
<td>0</td>
</tr>
<tr>
<td>D2O 3I5</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>04-19-12</td>
<td>65592</td>
<td>39.17</td>
<td>1</td>
</tr>
<tr>
<td>N7I 6V4</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>06-27-10</td>
<td>38348</td>
<td>39.68</td>
<td>0</td>
</tr>
<tr>
<td>J7Q 9M1</td>
<td>Chami</td>
<td>[email protected]</td>
<td>02-25-12</td>
<td>81825</td>
<td>40.19</td>
<td>1</td>
</tr>
<tr>
<td>E8N 4A8</td>
<td>Google</td>
<td>[email protected]</td>
<td>11-02-10</td>
<td>50858</td>
<td>40.7</td>
<td>1</td>
</tr>
<tr>
<td>L8B 2Q2</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>12-24-10</td>
<td>27420</td>
<td>41.21</td>
<td>0</td>
</tr>
<tr>
<td>T5G 1B7</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>03-01-12</td>
<td>51003</td>
<td>41.72</td>
<td>0</td>
</tr>
<tr>
<td>P8C 8H8</td>
<td>Finale</td>
<td>[email protected]</td>
<td>12-26-11</td>
<td>48401</td>
<td>42.23</td>
<td>1</td>
</tr>
<tr>
<td>H3Y 7K5</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>10-27-10</td>
<td>54526</td>
<td>42.74</td>
<td>1</td>
</tr>
<tr>
<td>A6X 4F2</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>06-06-11</td>
<td>32170</td>
<td>43.25</td>
<td>1</td>
</tr>
<tr>
<td>U3D 2Z1</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>07-01-11</td>
<td>94469</td>
<td>43.76</td>
<td>1</td>
</tr>
<tr>
<td>I4M 5I2</td>
<td>Google</td>
<td>[email protected]</td>
<td>07-12-10</td>
<td>80903</td>
<td>44.27</td>
<td>0</td>
</tr>
<tr>
<td>J9R 3U9</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>07-30-11</td>
<td>60677</td>
<td>44.78</td>
<td>0</td>
</tr>
<tr>
<td>V6P 5V9</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>05-23-10</td>
<td>62954</td>
<td>45.29</td>
<td>0</td>
</tr>
<tr>
<td>M7P 0Z3</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>09-08-10</td>
<td>13480</td>
<td>45.8</td>
<td>0</td>
</tr>
<tr>
<td>W2D 4R6</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>03-29-11</td>
<td>11397</td>
<td>46.31</td>
<td>1</td>
</tr>
<tr>
<td>U6D 8Y9</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>04-14-11</td>
<td>61948</td>
<td>46.82</td>
<td>1</td>
</tr>
<tr>
<td>V9G 8R0</td>
<td>Borland</td>
<td>[email protected]</td>
<td>02-08-12</td>
<td>77296</td>
<td>47.33</td>
<td>1</td>
</tr>
<tr>
<td>O0O 1O3</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>05-28-11</td>
<td>94761</td>
<td>47.84</td>
<td>0</td>
</tr>
<tr>
<td>Q9Z 3T5</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>04-23-11</td>
<td>85429</td>
<td>48.35</td>
<td>0</td>
</tr>
<tr>
<td>B2L 0H0</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>02-24-11</td>
<td>81622</td>
<td>48.86</td>
<td>1</td>
</tr>
<tr>
<td>A0H 8B3</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>02-12-11</td>
<td>45150</td>
<td>49.37</td>
<td>1</td>
</tr>
<tr>
<td>P7I 3J3</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>09-01-11</td>
<td>15723</td>
<td>49.88</td>
<td>1</td>
</tr>
<tr>
<td>M3G 8Y8</td>
<td>Borland</td>
<td>[email protected]</td>
<td>01-05-12</td>
<td>75589</td>
<td>50.39</td>
<td>1</td>
</tr>
<tr>
<td>Q6K 7M8</td>
<td>Borland</td>
<td>[email protected]</td>
<td>07-19-11</td>
<td>45154</td>
<td>50.9</td>
<td>1</td>
</tr>
<tr>
<td>Y4V 6G4</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>04-11-12</td>
<td>30861</td>
<td>51.41</td>
<td>0</td>
</tr>
<tr>
<td>P0I 9Q2</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>07-11-11</td>
<td>24424</td>
<td>51.92</td>
<td>0</td>
</tr>
<tr>
<td>O5F 8U8</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>05-01-12</td>
<td>70850</td>
<td>52.43</td>
<td>1</td>
</tr>
<tr>
<td>L6Q 5X2</td>
<td>Adobe</td>
<td>posuere.cubilia.Curae;@rhoncusProin.edu</td>
<td>07-11-11</td>
<td>42569</td>
<td>52.94</td>
<td>0</td>
</tr>
<tr>
<td>I0Y 9Q3</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>06-17-11</td>
<td>37793</td>
<td>53.45</td>
<td>0</td>
</tr>
<tr>
<td>U5Q 1A9</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>05-09-11</td>
<td>51663</td>
<td>53.96</td>
<td>1</td>
</tr>
<tr>
<td>G7C 5F8</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>04-25-12</td>
<td>41000</td>
<td>54.47</td>
<td>1</td>
</tr>
<tr>
<td>K6S 8M9</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>11-24-10</td>
<td>11296</td>
<td>54.98</td>
<td>1</td>
</tr>
<tr>
<td>C3K 4E8</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>03-27-12</td>
<td>77651</td>
<td>55.49</td>
<td>0</td>
</tr>
<tr>
<td>Y6H 9F3</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>01-26-11</td>
<td>66997</td>
<td>56</td>
<td>1</td>
</tr>
<tr>
<td>P4A 3S9</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>09-20-10</td>
<td>55115</td>
<td>56.51</td>
<td>1</td>
</tr>
<tr>
<td>Q8J 2M9</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>10-24-10</td>
<td>79918</td>
<td>57.02</td>
<td>1</td>
</tr>
<tr>
<td>V1T 3X3</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>06-25-11</td>
<td>33721</td>
<td>57.53</td>
<td>1</td>
</tr>
<tr>
<td>H7V 0P6</td>
<td>Borland</td>
<td>[email protected]</td>
<td>06-20-11</td>
<td>26284</td>
<td>58.04</td>
<td>0</td>
</tr>
<tr>
<td>S6G 9N5</td>
<td>Google</td>
<td>[email protected]</td>
<td>09-08-11</td>
<td>16884</td>
<td>58.55</td>
<td>1</td>
</tr>
<tr>
<td>E0O 3C2</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>11-11-10</td>
<td>88180</td>
<td>59.06</td>
<td>0</td>
</tr>
<tr>
<td>P8Q 6N8</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>08-31-10</td>
<td>81527</td>
<td>59.57</td>
<td>1</td>
</tr>
<tr>
<td>D2R 9S2</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>05-21-11</td>
<td>36636</td>
<td>60.08</td>
<td>1</td>
</tr>
<tr>
<td>R4C 4Y2</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>12-08-10</td>
<td>70456</td>
<td>60.59</td>
<td>1</td>
</tr>
<tr>
<td>N2W 8C5</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>09-06-10</td>
<td>57030</td>
<td>61.1</td>
<td>1</td>
</tr>
<tr>
<td>N8A 1S5</td>
<td>Finale</td>
<td>[email protected]</td>
<td>10-18-10</td>
<td>56976</td>
<td>61.61</td>
<td>0</td>
</tr>
<tr>
<td>D4H 6F7</td>
<td>Borland</td>
<td>[email protected]</td>
<td>04-20-11</td>
<td>65370</td>
<td>62.12</td>
<td>1</td>
</tr>
<tr>
<td>X2H 4Q4</td>
<td>Google</td>
<td>[email protected]</td>
<td>01-10-11</td>
<td>37879</td>
<td>62.63</td>
<td>0</td>
</tr>
<tr>
<td>J1V 9A7</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>09-18-11</td>
<td>36549</td>
<td>63.14</td>
<td>0</td>
</tr>
<tr>
<td>Y9X 2G2</td>
<td>Finale</td>
<td>[email protected]</td>
<td>01-21-12</td>
<td>77324</td>
<td>63.65</td>
<td>1</td>
</tr>
<tr>
<td>C5S 3X6</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>09-20-10</td>
<td>85008</td>
<td>64.16</td>
<td>1</td>
</tr>
<tr>
<td>T7Q 5L7</td>
<td>Google</td>
<td>[email protected]</td>
<td>11-23-11</td>
<td>12448</td>
<td>64.67</td>
<td>0</td>
</tr>
<tr>
<td>C2M 9D2</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>10-11-11</td>
<td>78187</td>
<td>65.18</td>
<td>1</td>
</tr>
<tr>
<td>I1I 3K4</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>01-23-11</td>
<td>68812</td>
<td>65.69</td>
<td>0</td>
</tr>
<tr>
<td>H2K 0B7</td>
<td>Borland</td>
<td>[email protected]</td>
<td>03-02-11</td>
<td>32111</td>
<td>66.2</td>
<td>0</td>
</tr>
<tr>
<td>F9W 8Z1</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>09-09-11</td>
<td>26765</td>
<td>66.71</td>
<td>0</td>
</tr>
<tr>
<td>H0W 5O0</td>
<td>Chami</td>
<td>[email protected]</td>
<td>08-11-11</td>
<td>75761</td>
<td>67.22</td>
<td>1</td>
</tr>
<tr>
<td>L0X 6K2</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>01-11-12</td>
<td>44537</td>
<td>67.73</td>
<td>1</td>
</tr>
<tr>
<td>M9G 2N7</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>09-23-11</td>
<td>41338</td>
<td>68.24</td>
<td>1</td>
</tr>
<tr>
<td>O7D 9H6</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>11-28-10</td>
<td>92220</td>
<td>68.75</td>
<td>0</td>
</tr>
<tr>
<td>H0P 6B1</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>06-21-10</td>
<td>60342</td>
<td>69.26</td>
<td>0</td>
</tr>
<tr>
<td>Y5Y 8V2</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>02-22-12</td>
<td>33538</td>
<td>69.77</td>
<td>1</td>
</tr>
<tr>
<td>A6E 5D0</td>
<td>Borland</td>
<td>[email protected]</td>
<td>09-09-11</td>
<td>12737</td>
<td>70.28</td>
<td>0</td>
</tr>
<tr>
<td>N1L 7V4</td>
<td>Google</td>
<td>[email protected]</td>
<td>12-13-10</td>
<td>41533</td>
<td>70.79</td>
<td>1</td>
</tr>
<tr>
<td>E8Y 1X4</td>
<td>Finale</td>
<td>[email protected]</td>
<td>11-27-10</td>
<td>94950</td>
<td>71.3</td>
<td>0</td>
</tr>
<tr>
<td>L7B 7U2</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>12-21-11</td>
<td>67506</td>
<td>71.81</td>
<td>1</td>
</tr>
<tr>
<td>S2K 6G8</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>01-23-11</td>
<td>42489</td>
<td>72.32</td>
<td>1</td>
</tr>
<tr>
<td>V0G 4Y9</td>
<td>Google</td>
<td>[email protected]</td>
<td>01-14-12</td>
<td>80254</td>
<td>72.83</td>
<td>0</td>
</tr>
<tr>
<td>R2S 0Z5</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>05-07-11</td>
<td>46233</td>
<td>73.34</td>
<td>1</td>
</tr>
<tr>
<td>K2P 1S2</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>06-29-10</td>
<td>78347</td>
<td>73.85</td>
<td>0</td>
</tr>
<tr>
<td>D1L 5V8</td>
<td>Chami</td>
<td>[email protected]</td>
<td>02-19-12</td>
<td>52339</td>
<td>74.36</td>
<td>0</td>
</tr>
<tr>
<td>U3W 5R9</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>03-05-12</td>
<td>34803</td>
<td>74.87</td>
<td>0</td>
</tr>
<tr>
<td>O0N 0F3</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>07-19-10</td>
<td>85325</td>
<td>75.38</td>
<td>1</td>
</tr>
<tr>
<td>U7X 0B4</td>
<td>Borland</td>
<td>[email protected]</td>
<td>04-27-12</td>
<td>59907</td>
<td>75.89</td>
<td>0</td>
</tr>
<tr>
<td>W7O 7M3</td>
<td>Chami</td>
<td>[email protected]</td>
<td>09-09-10</td>
<td>46884</td>
<td>76.4</td>
<td>0</td>
</tr>
<tr>
<td>W7S 4V5</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>04-02-11</td>
<td>44864</td>
<td>76.91</td>
<td>1</td>
</tr>
<tr>
<td>B5O 4Y4</td>
<td>Chami</td>
<td>bibendum.ullamcorper@Curae;Donectincidunt.ca</td>
<td>03-21-11</td>
<td>41405</td>
<td>77.42</td>
<td>1</td>
</tr>
<tr>
<td>C1Z 4U0</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>03-26-12</td>
<td>23643</td>
<td>77.93</td>
<td>1</td>
</tr>
<tr>
<td>M8M 8W5</td>
<td>Chami</td>
<td>[email protected]</td>
<td>10-31-10</td>
<td>38364</td>
<td>78.44</td>
<td>0</td>
</tr>
<tr>
<td>Q4Y 7D4</td>
<td>Finale</td>
<td>[email protected]</td>
<td>02-18-12</td>
<td>44007</td>
<td>78.95</td>
<td>1</td>
</tr>
<tr>
<td>D3M 4S0</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>03-15-11</td>
<td>63914</td>
<td>79.46</td>
<td>0</td>
</tr>
<tr>
<td>V5L 2C5</td>
<td>Google</td>
<td>[email protected]</td>
<td>08-22-11</td>
<td>51278</td>
<td>79.97</td>
<td>0</td>
</tr>
<tr>
<td>K9P 0G4</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>07-21-10</td>
<td>82666</td>
<td>80.48</td>
<td>1</td>
</tr>
<tr>
<td>A4V 4V2</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>07-19-10</td>
<td>30649</td>
<td>80.99</td>
<td>0</td>
</tr>
<tr>
<td>X7N 7L5</td>
<td>Chami</td>
<td>[email protected]</td>
<td>07-18-11</td>
<td>88929</td>
<td>81.5</td>
<td>1</td>
</tr>
<tr>
<td>E7E 4E0</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>01-09-11</td>
<td>20916</td>
<td>82.01</td>
<td>0</td>
</tr>
<tr>
<td>C2D 9C3</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>10-29-11</td>
<td>17973</td>
<td>82.52</td>
<td>0</td>
</tr>
<tr>
<td>W1V 9H9</td>
<td>Chami</td>
<td>[email protected]</td>
<td>10-17-10</td>
<td>43488</td>
<td>83.03</td>
<td>1</td>
</tr>
<tr>
<td>C9Y 1G7</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>07-22-10</td>
<td>54139</td>
<td>83.54</td>
<td>1</td>
</tr>
<tr>
<td>A6J 3Q4</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>01-02-11</td>
<td>92452</td>
<td>84.05</td>
<td>1</td>
</tr>
<tr>
<td>L8S 9P7</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>08-29-10</td>
<td>83503</td>
<td>84.56</td>
<td>0</td>
</tr>
<tr>
<td>T0U 6Y2</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>05-23-10</td>
<td>77439</td>
<td>85.07</td>
<td>0</td>
</tr>
<tr>
<td>R2X 4H6</td>
<td>Chami</td>
<td>[email protected]</td>
<td>09-06-11</td>
<td>34273</td>
<td>85.58</td>
<td>1</td>
</tr>
<tr>
<td>L0G 1E9</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>04-22-12</td>
<td>30124</td>
<td>86.09</td>
<td>1</td>
</tr>
<tr>
<td>I2J 6G8</td>
<td>Google</td>
<td>[email protected]</td>
<td>02-12-12</td>
<td>48395</td>
<td>86.6</td>
<td>1</td>
</tr>
<tr>
<td>A5Z 2J3</td>
<td>Chami</td>
<td>[email protected]</td>
<td>06-21-11</td>
<td>64117</td>
<td>87.11</td>
<td>1</td>
</tr>
<tr>
<td>C3W 5D8</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>05-25-10</td>
<td>80128</td>
<td>87.62</td>
<td>1</td>
</tr>
<tr>
<td>K2H 9C4</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>11-09-11</td>
<td>73428</td>
<td>88.13</td>
<td>0</td>
</tr>
<tr>
<td>A4D 8D5</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>02-11-11</td>
<td>74508</td>
<td>88.64</td>
<td>0</td>
</tr>
<tr>
<td>Q4R 3P7</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>08-24-11</td>
<td>12222</td>
<td>89.15</td>
<td>1</td>
</tr>
<tr>
<td>S7D 4W7</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>10-11-10</td>
<td>95449</td>
<td>89.66</td>
<td>0</td>
</tr>
<tr>
<td>G8E 2R8</td>
<td>Borland</td>
<td>[email protected]</td>
<td>11-03-11</td>
<td>93815</td>
<td>90.17</td>
<td>1</td>
</tr>
<tr>
<td>R0J 6F6</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>12-02-11</td>
<td>26529</td>
<td>90.68</td>
<td>1</td>
</tr>
<tr>
<td>B7K 9S0</td>
<td>Lavasoft</td>
<td>[email protected]</td>
<td>11-17-10</td>
<td>60875</td>
<td>91.19</td>
<td>0</td>
</tr>
<tr>
<td>T8R 9O7</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>01-26-12</td>
<td>47708</td>
<td>91.7</td>
<td>0</td>
</tr>
<tr>
<td>Z9B 5I8</td>
<td>Chami</td>
<td>[email protected]</td>
<td>05-21-11</td>
<td>59681</td>
<td>92.21</td>
<td>0</td>
</tr>
<tr>
<td>F8X 6Y8</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>09-21-10</td>
<td>28307</td>
<td>92.72</td>
<td>0</td>
</tr>
<tr>
<td>S8P 2X8</td>
<td>Chami</td>
<td>[email protected]</td>
<td>08-04-11</td>
<td>31922</td>
<td>93.23</td>
<td>0</td>
</tr>
<tr>
<td>P3O 7V3</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>05-17-11</td>
<td>18018</td>
<td>93.74</td>
<td>1</td>
</tr>
<tr>
<td>U7K 0Z9</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>02-07-11</td>
<td>84013</td>
<td>94.25</td>
<td>1</td>
</tr>
<tr>
<td>V3H 9G0</td>
<td>Google</td>
<td>[email protected]</td>
<td>02-09-11</td>
<td>78625</td>
<td>94.76</td>
<td>1</td>
</tr>
<tr>
<td>S8C 5T9</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>08-08-10</td>
<td>62982</td>
<td>95.27</td>
<td>1</td>
</tr>
<tr>
<td>M7K 2G1</td>
<td>Yahoo</td>
<td>[email protected]</td>
<td>12-22-10</td>
<td>49963</td>
<td>95.78</td>
<td>0</td>
</tr>
<tr>
<td>P2U 1B2</td>
<td>Google</td>
<td>[email protected]</td>
<td>10-30-11</td>
<td>97605</td>
<td>96.29</td>
<td>1</td>
</tr>
<tr>
<td>D7T 5T3</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>09-22-11</td>
<td>56618</td>
<td>96.8</td>
<td>0</td>
</tr>
<tr>
<td>I5H 3L4</td>
<td>Macromedia</td>
<td>[email protected]</td>
<td>05-08-12</td>
<td>28360</td>
<td>97.31</td>
<td>1</td>
</tr>
<tr>
<td>C3L 6K7</td>
<td>Lycos</td>
<td>[email protected]</td>
<td>06-19-11</td>
<td>47419</td>
<td>97.82</td>
<td>1</td>
</tr>
<tr>
<td>Y9S 1M8</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>02-06-11</td>
<td>60267</td>
<td>98.33</td>
<td>1</td>
</tr>
<tr>
<td>S2H 1V1</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>01-22-11</td>
<td>91296</td>
<td>98.84</td>
<td>0</td>
</tr>
<tr>
<td>R0A 2N7</td>
<td>Sibelius</td>
<td>[email protected]</td>
<td>07-01-11</td>
<td>72738</td>
<td>99.35</td>
<td>1</td>
</tr>
<tr>
<td>J9R 2J3</td>
<td>Finale</td>
<td>[email protected]</td>
<td>12-22-11</td>
<td>84531</td>
<td>99.86</td>
<td>1</td>
</tr>
<tr>
<td>R7X 3R2</td>
<td>Altavista</td>
<td>[email protected]</td>
<td>03-15-12</td>
<td>50867</td>
<td>100.37</td>
<td>0</td>
</tr>
<tr>
<td>W7T 7J4</td>
<td>Chami</td>
<td>[email protected]</td>
<td>01-21-11</td>
<td>71074</td>
<td>100.88</td>
<td>0</td>
</tr>
<tr>
<td>M6H 9Z1</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>09-27-10</td>
<td>16423</td>
<td>101.39</td>
<td>1</td>
</tr>
<tr>
<td>A7G 6F7</td>
<td>Apple Systems</td>
<td>[email protected]</td>
<td>11-10-10</td>
<td>98779</td>
<td>101.9</td>
<td>0</td>
</tr>
<tr>
<td>F7F 2P2</td>
<td>Microsoft</td>
<td>[email protected]</td>
<td>02-06-12</td>
<td>45486</td>
<td>102.41</td>
<td>1</td>
</tr>
<tr>
<td>D0G 1F4</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>02-26-12</td>
<td>21306</td>
<td>102.92</td>
<td>1</td>
</tr>
<tr>
<td>R1T 0W8</td>
<td>Cakewalk</td>
<td>[email protected]</td>
<td>03-24-11</td>
<td>29367</td>
<td>103.43</td>
<td>0</td>
</tr>
<tr>
<td>Q1A 7Z7</td>
<td>Google</td>
<td>[email protected]</td>
<td>09-26-10</td>
<td>30421</td>
<td>103.94</td>
<td>1</td>
</tr>
<tr>
<td>L5G 6S8</td>
<td>Google</td>
<td>[email protected]</td>
<td>08-10-11</td>
<td>75550</td>
<td>104.45</td>
<td>0</td>
</tr>
<tr>
<td>M8U 7L2</td>
<td>Chami</td>
<td>[email protected]</td>
<td>10-13-11</td>
<td>12749</td>
<td>104.96</td>
<td>0</td>
</tr>
<tr>
<td>I6N 0V9</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>02-11-12</td>
<td>54798</td>
<td>105.47</td>
<td>1</td>
</tr>
<tr>
<td>Q5D 6B4</td>
<td>Finale</td>
<td>[email protected]</td>
<td>02-12-12</td>
<td>39420</td>
<td>105.98</td>
<td>0</td>
</tr>
<tr>
<td>U8J 2S0</td>
<td>Adobe</td>
<td>[email protected]</td>
<td>02-20-12</td>
<td>35623</td>
<td>106.49</td>
<td>0</td>
</tr>
</tbody>
</table>
| mit |
tdeo/rubocop | spec/rubocop/cop/style/even_odd_spec.rb | 3756 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Style::EvenOdd do
subject(:cop) { described_class.new }
it 'converts x % 2 == 0 to #even?' do
expect_offense(<<~RUBY)
x % 2 == 0
^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
x.even?
RUBY
end
it 'converts x % 2 != 0 to #odd?' do
expect_offense(<<~RUBY)
x % 2 != 0
^^^^^^^^^^ Replace with `Integer#odd?`.
RUBY
expect_correction(<<~RUBY)
x.odd?
RUBY
end
it 'converts (x % 2) == 0 to #even?' do
expect_offense(<<~RUBY)
(x % 2) == 0
^^^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
x.even?
RUBY
end
it 'converts (x % 2) != 0 to #odd?' do
expect_offense(<<~RUBY)
(x % 2) != 0
^^^^^^^^^^^^ Replace with `Integer#odd?`.
RUBY
expect_correction(<<~RUBY)
x.odd?
RUBY
end
it 'converts x % 2 == 1 to #odd?' do
expect_offense(<<~RUBY)
x % 2 == 1
^^^^^^^^^^ Replace with `Integer#odd?`.
RUBY
expect_correction(<<~RUBY)
x.odd?
RUBY
end
it 'converts x % 2 != 1 to #even?' do
expect_offense(<<~RUBY)
x % 2 != 1
^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
x.even?
RUBY
end
it 'converts (x % 2) == 1 to #odd?' do
expect_offense(<<~RUBY)
(x % 2) == 1
^^^^^^^^^^^^ Replace with `Integer#odd?`.
RUBY
expect_correction(<<~RUBY)
x.odd?
RUBY
end
it 'converts (y % 2) != 1 to #even?' do
expect_offense(<<~RUBY)
(y % 2) != 1
^^^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
y.even?
RUBY
end
it 'converts (x.y % 2) != 1 to #even?' do
expect_offense(<<~RUBY)
(x.y % 2) != 1
^^^^^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
x.y.even?
RUBY
end
it 'converts (x(y) % 2) != 1 to #even?' do
expect_offense(<<~RUBY)
(x(y) % 2) != 1
^^^^^^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
x(y).even?
RUBY
end
it 'accepts x % 2 == 2' do
expect_no_offenses('x % 2 == 2')
end
it 'accepts x % 3 == 0' do
expect_no_offenses('x % 3 == 0')
end
it 'accepts x % 3 != 0' do
expect_no_offenses('x % 3 != 0')
end
it 'converts (x._(y) % 2) != 1 to even?' do
expect_offense(<<~RUBY)
(x._(y) % 2) != 1
^^^^^^^^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
x._(y).even?
RUBY
end
it 'converts (x._(y)) % 2 != 1 to even?' do
expect_offense(<<~RUBY)
(x._(y)) % 2 != 1
^^^^^^^^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
(x._(y)).even?
RUBY
end
it 'converts x._(y) % 2 != 1 to even?' do
expect_offense(<<~RUBY)
x._(y) % 2 != 1
^^^^^^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
x._(y).even?
RUBY
end
it 'converts 1 % 2 != 1 to even?' do
expect_offense(<<~RUBY)
1 % 2 != 1
^^^^^^^^^^ Replace with `Integer#even?`.
RUBY
expect_correction(<<~RUBY)
1.even?
RUBY
end
it 'converts complex examples' do
expect_offense(<<~RUBY)
if (y % 2) != 1
^^^^^^^^^^^^ Replace with `Integer#even?`.
method == :== ? :even : :odd
elsif x % 2 == 1
^^^^^^^^^^ Replace with `Integer#odd?`.
method == :== ? :odd : :even
end
RUBY
expect_correction(<<~RUBY)
if y.even?
method == :== ? :even : :odd
elsif x.odd?
method == :== ? :odd : :even
end
RUBY
end
end
| mit |
DMDcoin/Diamond | doc/release-notes/dash/release-notes-0.12.0.md | 3051 | 0.12.0 Release notes
====================
Dash Core version 0.12.0 is now available from:
https://dashpay.io/downloads
Please report bugs using the issue tracker at github:
https://github.com/dashpay/dash/issues
How to Upgrade
--------------
If you are running an older version, shut it down. Wait until it has completely
shut down (which might take a few minutes for older versions), then run the
installer (on Windows) or just copy over /Applications/Dash-Qt (on Mac) or
dashd/dash-qt (on Linux).
**This new version uses transaction indexing by default, you will need to reindex
the blockchain. To do so, start the client with --reindex.**
Downgrade warning
------------------
Because release 0.12.0 and later makes use of headers-first synchronization and
parallel block download (see further), the block files and databases are not
backwards-compatible with pre-0.12 versions of Dash Core or other software:
* Blocks will be stored on disk out of order (in the order they are
received, really), which makes it incompatible with some tools or
other programs. Reindexing using earlier versions will also not work
anymore as a result of this.
* The block index database will now hold headers for which no block is
stored on disk, which earlier versions won't support.
If you want to be able to downgrade smoothly, make a backup of your entire data
directory. Without this your node will need start syncing (or importing from
bootstrap.dat) anew afterwards. It is possible that the data from a completely
synchronised 0.10 node may be usable in older versions as-is, but this is not
supported and may break as soon as the older version attempts to reindex.
This does not affect wallet forward or backward compatibility.
0.12.0 changelog
----------------
Switched to Bitcoin Core version 0.10 - https://bitcoin.org/en/release/v0.10.0
- Implemented decentralized budget system
- Removed reference node
- Implemented new decentralized masternode payment consensus system
- Improved speed of DS
- New masternode payment/winners/budgets syncing strategy
- Platform independent masternode ranking system
- Masternode broadcasts, pings and winners now use the inventory system
- Transaction indexing is enabled by default for all clients
- Better implementation of IX block reprocessing to find and remove an invalid block
- IX nearly 100% successful with new implementation
- Lots of UI improvements and fixes including DS progress, wallet repair buttons, UI settings/filters persistence etc
Credits
--------
Thanks to who contributed to this release, at least:
eduffield
UdjinM6
Crowning
moli
flare
thelazier
adios
poiuty
scratchy
moocowmoo
the-baker
BrainShutdown
Lukas_Jackson
Sub-Ether
italx
yidakee
TanteStefana
coingun
tungfa
MangledBlue
AjM
Lariondos
elbereth
minersday
qwizzie
TaoOfSatoshi
dark-sailor
AlexMomo
snogcel
bertlebbert
As well as everyone that helped translating on [Transifex](https://www.transifex.com/diamond-project/diamond-project-translations).
| mit |
zeit/next.js | packages/next/trace/shared.ts | 164 | export type SpanId = number
export const traceGlobals: Map<any, any> = new Map()
export const setGlobal = (key: any, val: any) => {
traceGlobals.set(key, val)
}
| mit |
BackupTheBerlios/zena | test/unit/page_test.rb | 1066 | require 'test_helper'
class PageTest < Zena::Unit::TestCase
context 'Creating a page' do
setup do
login(:tiger)
end
should 'work with just a title' do
assert_difference('Node.count', 1) do
secure(Page) { Page.create(:parent_id=>nodes_id(:projects), :title=>'lazy node')}
end
end
should 'allow same title' do
wiki_title = nodes(:wiki).title
assert_difference('Node.count', 1) do
page = secure(Page) { Page.create(:parent_id=>nodes_id(:projects), :title => wiki_title)}
assert_equal page.title, wiki_title
end
end
end # Creating a page
def test_custom_base_path
login(:tiger)
node = secure!(Node) { nodes(:wiki) }
bird = secure!(Node) { nodes(:bird_jpg)}
assert_equal '', node.basepath
assert_equal '', bird.basepath
assert_equal node[:id], bird[:parent_id]
assert node.update_attributes(:custom_base => true)
assert_equal '18/29', node.basepath
bird = secure!(Node) { nodes(:bird_jpg)}
assert_equal '18/29', bird.basepath
end
end
| mit |
mockingbirdnest/Principia | physics/discrete_trajectory_iterator_body.hpp | 9469 | #pragma once
#include "physics/discrete_trajectory_iterator.hpp"
#include "astronomy/epoch.hpp"
#include "geometry/named_quantities.hpp"
namespace principia {
namespace physics {
namespace internal_discrete_trajectory_iterator {
using geometry::InfiniteFuture;
using geometry::Instant;
template<typename Frame>
FORCE_INLINE(inline) DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator++() {
CHECK(!is_at_end(point_));
auto& point = iterator(point_);
Instant const previous_time = point->time;
do {
++point;
if (point == segment_->timeline_end()) {
do {
++segment_;
} while (!segment_.is_end() && segment_->timeline_empty());
if (segment_.is_end()) {
point_.reset();
break;
} else {
point = segment_->timeline_begin();
}
}
} while (point->time == previous_time);
return *this;
}
template<typename Frame>
FORCE_INLINE(inline) DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator--() {
bool const point_is_at_end = is_at_end(point_);
if (point_is_at_end) {
// Move the iterator to the end of the last segment.
segment_ = std::prev(segment_.segments().end());
point_ = segment_->timeline_end();
// Now proceed with the decrement.
}
auto& point = iterator(point_);
Instant const previous_time = point_is_at_end ? InfiniteFuture : point->time;
do {
if (point == segment_->timeline_begin()) {
CHECK(!segment_.is_begin());
--segment_;
point = segment_->timeline_end();
}
--point;
} while (point->time == previous_time);
return *this;
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame>
DiscreteTrajectoryIterator<Frame>::operator++(int) { // NOLINT
auto const initial = *this;
++*this;
return initial;
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame>
DiscreteTrajectoryIterator<Frame>::operator--(int) { // NOLINT
auto const initial = *this;
--*this;
return initial;
}
template<typename Frame>
typename DiscreteTrajectoryIterator<Frame>::reference
DiscreteTrajectoryIterator<Frame>::operator*() const {
CHECK(!is_at_end(point_));
return *iterator(point_);
}
template<typename Frame>
typename DiscreteTrajectoryIterator<Frame>::pointer
DiscreteTrajectoryIterator<Frame>::operator->() const {
CHECK(!is_at_end(point_));
return &*iterator(point_);
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator+=(difference_type const n) {
if (n < 0) {
return *this -= (-n);
} else {
// This loop attempts to skip entire segments. To do this, it relies on
// how operator++ moves through the trajectory. If this was to change this
// function might become less efficient, but it would not become incorrect
// (it would fall back to vanilla increments).
difference_type m = n;
while (m > 0) {
CHECK(!is_at_end(point_));
auto& point = iterator(point_);
// We know that operator++ never leaves |point_| at |timeline_begin()|.
// Therefore, to detect that we are in a new segment, we must check for
// the second point of the segment.
if (segment_->timeline_size() > 2 &&
segment_->timeline_size() <= m + 2 &&
point == std::next(segment_->timeline_begin())) {
point = std::prev(segment_->timeline_end());
m -= segment_->timeline_size() - 2;
} else {
++*this;
--m;
}
}
return *this;
}
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator-=(difference_type const n) {
if (n < 0) {
return *this += (-n);
} else {
difference_type m = n;
if (m > 0 && is_at_end(point_)) {
--*this;
--m;
}
// This loop attempts to skip entire segments. To do this, it relies on
// how operator-- moves through the trajectory. If this was to change this
// function might become less efficient, but it would not become incorrect
// (it would fall back to vanilla decrements).
while (m > 0) {
auto& point = iterator(point_);
// We know that operator-- never leaves |point_| at
// |std::prev(timeline_end())|. Therefore, to detect that we are in a new
// segment, we must check for the second-to-last point of the segment.
if (segment_->timeline_size() > 2 &&
segment_->timeline_size() <= m + 2 &&
point == std::prev(std::prev(segment_->timeline_end()))) {
point = segment_->timeline_begin();
m -= segment_->timeline_size() - 2;
} else {
--*this;
--m;
}
}
return *this;
}
}
template<typename Frame>
typename DiscreteTrajectoryIterator<Frame>::reference
DiscreteTrajectoryIterator<Frame>::operator[](difference_type const n) const {
return *(*this + n);
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame> DiscreteTrajectoryIterator<Frame>::operator-(
typename DiscreteTrajectoryIterator<Frame>::difference_type const n) const {
auto mutable_it = *this;
return mutable_it -= n;
}
template<typename Frame>
typename DiscreteTrajectoryIterator<Frame>::difference_type
DiscreteTrajectoryIterator<Frame>::operator-(
DiscreteTrajectoryIterator<Frame> const right) const {
auto const left = *this;
auto it = right;
Instant const left_time =
is_at_end(left.point_) ? InfiniteFuture : left->time;
// This code is similar to operator+=.
difference_type m = 0;
while (it != left) {
CHECK(!is_at_end(it.point_));
auto& point = iterator(it.point_);
auto const& segment = it.segment_;
if (segment->timeline_size() > 2 &&
std::prev(segment->timeline_end())->time <= left_time &&
point == std::next(segment->timeline_begin())) {
point = std::prev(segment->timeline_end());
m += segment->timeline_size() - 2;
} else {
++it;
++m;
}
}
return m;
}
template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator==(
DiscreteTrajectoryIterator const other) const {
if (is_at_end(point_)) {
return segment_ == other.segment_ && is_at_end(other.point_);
} else if (is_at_end(other.point_)) {
return false;
} else {
return iterator(point_)->time == iterator(other.point_)->time;
}
}
template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator!=(
DiscreteTrajectoryIterator const other) const {
return !operator==(other);
}
template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator<(
DiscreteTrajectoryIterator const other) const {
if (is_at_end(point_)) {
return false;
} else if (is_at_end(other.point_)) {
return true;
} else {
return iterator(point_)->time < iterator(other.point_)->time;
}
}
template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator>(
DiscreteTrajectoryIterator const other) const {
if (is_at_end(other.point_)) {
return false;
} else if (is_at_end(point_)) {
return true;
} else {
return iterator(point_)->time > iterator(other.point_)->time;
}
}
template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator<=(
DiscreteTrajectoryIterator const other) const {
return !operator>(other);
}
template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator>=(
DiscreteTrajectoryIterator const other) const {
return !operator<(other);
}
template <typename Frame>
DiscreteTrajectoryIterator<Frame>
DiscreteTrajectoryIterator<Frame>::EndOfLastSegment(
DiscreteTrajectorySegmentIterator<Frame> const segment) {
DCHECK(segment.is_end());
return DiscreteTrajectoryIterator<Frame>(segment, std::nullopt);
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame>::DiscreteTrajectoryIterator(
DiscreteTrajectorySegmentIterator<Frame> const segment,
OptionalTimelineConstIterator const point)
: segment_(segment),
point_(point) {
bool incremented_segment = false;
while (!segment_.is_end() && segment_->timeline_empty()) {
++segment_;
incremented_segment = true;
}
if (segment_.is_end()) {
point_.reset();
} else if (incremented_segment) {
point_ = segment_->timeline_begin();
}
}
template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::is_at_end(
OptionalTimelineConstIterator const point) {
return !point.has_value();
}
template<typename Frame>
typename DiscreteTrajectoryIterator<Frame>::Timeline::const_iterator&
DiscreteTrajectoryIterator<Frame>::iterator(
OptionalTimelineConstIterator& point) {
DCHECK(point.has_value());
return point.value();
}
template<typename Frame>
typename DiscreteTrajectoryIterator<Frame>::Timeline::const_iterator const&
DiscreteTrajectoryIterator<Frame>::iterator(
OptionalTimelineConstIterator const& point) {
DCHECK(point.has_value());
return point.value();
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame> operator+(
DiscreteTrajectoryIterator<Frame> const it,
typename DiscreteTrajectoryIterator<Frame>::difference_type const n) {
auto mutable_it = it;
return mutable_it += n;
}
template<typename Frame>
DiscreteTrajectoryIterator<Frame> operator+(
typename DiscreteTrajectoryIterator<Frame>::difference_type const n,
DiscreteTrajectoryIterator<Frame> const it) {
auto mutable_it = it;
return mutable_it += n;
}
} // namespace internal_discrete_trajectory_iterator
} // namespace physics
} // namespace principia
| mit |
markglibres/cad.web | src/Configuration/Tenant.cs | 1119 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CAD.Core;
namespace CAD.Web
{
public class Tenant : ITenant
{
public string Name { get; set; }
private Lazy<List<TenantPlugin>> _plugins = new Lazy<List<TenantPlugin>>(() => new List<TenantPlugin>());
public List<TenantPlugin> Plugins
{
get
{
return this._plugins.Value;
}
}
public TenantPlugin GetPlugin(string name)
{
return this.Plugins.Where(p => p.Name == name).FirstOrDefault();
}
public void AddPlugin(TenantPlugin tenant)
{
var plugin = this.GetPlugin(tenant.Name);
if(plugin != null)
{
this._plugins.Value.Remove(plugin);
}
this._plugins.Value.Add(tenant);
}
public void SortPriority()
{
this._plugins.Value.Sort((p1,p2) => p1.Priority.CompareTo(p2.Priority));
}
}
}
| mit |
caffeina-core/core | classes/Redirect.php | 1140 | <?php
/**
* Redirect
*
* HTTP redirection commands.
*
* @package core
* @author [email protected]
* @copyright Caffeina srl - 2015 - http://caffeina.it
*/
class Redirect {
use Module;
public static function to($url, $status=302){
if ($link = Filter::with('core.redirect',$url)) {
Response::clean();
Response::status($status);
Response::header('Location', $link);
Response::send();
exit;
}
}
public static function back(){
if ($link = Filter::with('core.redirect', (empty($_SERVER['HTTP_REFERER']) ? Request::get('redirect_uri',false) : $_SERVER['HTTP_REFERER']) )){
Response::clean();
Response::header('Location', $link);
Response::send();
exit;
}
}
public static function viaJavaScript($url, $parent=false){
if ($link = Filter::with('core.redirect', $url)){
Response::type('text/html');
Response::add('<script>'.($parent?'parent.':'').'location.href="'.addslashes($link).'"</script>');
Response::send();
exit;
}
}
}
| mit |
philnash/twilio-ruby | lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb | 17122 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
module Twilio
module REST
class Conversations < Domain
class V1 < Version
class ServiceContext < InstanceContext
class ConfigurationContext < InstanceContext
class NotificationList < ListResource
##
# Initialize the NotificationList
# @param [Version] version Version that contains the resource
# @param [String] chat_service_sid The unique string that we created to identify
# the Service configuration resource.
# @return [NotificationList] NotificationList
def initialize(version, chat_service_sid: nil)
super(version)
# Path Solution
@solution = {chat_service_sid: chat_service_sid}
end
##
# Provide a user friendly representation
def to_s
'#<Twilio.Conversations.V1.NotificationList>'
end
end
class NotificationPage < Page
##
# Initialize the NotificationPage
# @param [Version] version Version that contains the resource
# @param [Response] response Response from the API
# @param [Hash] solution Path solution for the resource
# @return [NotificationPage] NotificationPage
def initialize(version, response, solution)
super(version, response)
# Path Solution
@solution = solution
end
##
# Build an instance of NotificationInstance
# @param [Hash] payload Payload response from the API
# @return [NotificationInstance] NotificationInstance
def get_instance(payload)
NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
end
##
# Provide a user friendly representation
def to_s
'<Twilio.Conversations.V1.NotificationPage>'
end
end
class NotificationContext < InstanceContext
##
# Initialize the NotificationContext
# @param [Version] version Version that contains the resource
# @param [String] chat_service_sid The SID of the {Conversation
# Service}[https://www.twilio.com/docs/conversations/api/service-resource] the
# Configuration applies to.
# @return [NotificationContext] NotificationContext
def initialize(version, chat_service_sid)
super(version)
# Path Solution
@solution = {chat_service_sid: chat_service_sid, }
@uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Notifications"
end
##
# Update the NotificationInstance
# @param [Boolean] log_enabled Weather the notification logging is enabled.
# @param [Boolean] new_message_enabled Whether to send a notification when a new
# message is added to a conversation. The default is `false`.
# @param [String] new_message_template The template to use to create the
# notification text displayed when a new message is added to a conversation and
# `new_message.enabled` is `true`.
# @param [String] new_message_sound The name of the sound to play when a new
# message is added to a conversation and `new_message.enabled` is `true`.
# @param [Boolean] new_message_badge_count_enabled Whether the new message badge
# is enabled. The default is `false`.
# @param [Boolean] added_to_conversation_enabled Whether to send a notification
# when a participant is added to a conversation. The default is `false`.
# @param [String] added_to_conversation_template The template to use to create the
# notification text displayed when a participant is added to a conversation and
# `added_to_conversation.enabled` is `true`.
# @param [String] added_to_conversation_sound The name of the sound to play when a
# participant is added to a conversation and `added_to_conversation.enabled` is
# `true`.
# @param [Boolean] removed_from_conversation_enabled Whether to send a
# notification to a user when they are removed from a conversation. The default is
# `false`.
# @param [String] removed_from_conversation_template The template to use to create
# the notification text displayed to a user when they are removed from a
# conversation and `removed_from_conversation.enabled` is `true`.
# @param [String] removed_from_conversation_sound The name of the sound to play to
# a user when they are removed from a conversation and
# `removed_from_conversation.enabled` is `true`.
# @param [Boolean] new_message_with_media_enabled Whether to send a notification
# when a new message with media/file attachments is added to a conversation. The
# default is `false`.
# @param [String] new_message_with_media_template The template to use to create
# the notification text displayed when a new message with media/file attachments
# is added to a conversation and `new_message.attachments.enabled` is `true`.
# @return [NotificationInstance] Updated NotificationInstance
def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset)
data = Twilio::Values.of({
'LogEnabled' => log_enabled,
'NewMessage.Enabled' => new_message_enabled,
'NewMessage.Template' => new_message_template,
'NewMessage.Sound' => new_message_sound,
'NewMessage.BadgeCountEnabled' => new_message_badge_count_enabled,
'AddedToConversation.Enabled' => added_to_conversation_enabled,
'AddedToConversation.Template' => added_to_conversation_template,
'AddedToConversation.Sound' => added_to_conversation_sound,
'RemovedFromConversation.Enabled' => removed_from_conversation_enabled,
'RemovedFromConversation.Template' => removed_from_conversation_template,
'RemovedFromConversation.Sound' => removed_from_conversation_sound,
'NewMessage.WithMedia.Enabled' => new_message_with_media_enabled,
'NewMessage.WithMedia.Template' => new_message_with_media_template,
})
payload = @version.update('POST', @uri, data: data)
NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
end
##
# Fetch the NotificationInstance
# @return [NotificationInstance] Fetched NotificationInstance
def fetch
payload = @version.fetch('GET', @uri)
NotificationInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
end
##
# Provide a user friendly representation
def to_s
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Conversations.V1.NotificationContext #{context}>"
end
##
# Provide a detailed, user friendly representation
def inspect
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
"#<Twilio.Conversations.V1.NotificationContext #{context}>"
end
end
class NotificationInstance < InstanceResource
##
# Initialize the NotificationInstance
# @param [Version] version Version that contains the resource
# @param [Hash] payload payload that contains response from Twilio
# @param [String] chat_service_sid The unique string that we created to identify
# the Service configuration resource.
# @return [NotificationInstance] NotificationInstance
def initialize(version, payload, chat_service_sid: nil)
super(version)
# Marshaled Properties
@properties = {
'account_sid' => payload['account_sid'],
'chat_service_sid' => payload['chat_service_sid'],
'new_message' => payload['new_message'],
'added_to_conversation' => payload['added_to_conversation'],
'removed_from_conversation' => payload['removed_from_conversation'],
'log_enabled' => payload['log_enabled'],
'url' => payload['url'],
}
# Context
@instance_context = nil
@params = {'chat_service_sid' => chat_service_sid, }
end
##
# Generate an instance context for the instance, the context is capable of
# performing various actions. All instance actions are proxied to the context
# @return [NotificationContext] NotificationContext for this NotificationInstance
def context
unless @instance_context
@instance_context = NotificationContext.new(@version, @params['chat_service_sid'], )
end
@instance_context
end
##
# @return [String] The unique ID of the Account responsible for this configuration.
def account_sid
@properties['account_sid']
end
##
# @return [String] The SID of the Conversation Service that the Configuration applies to.
def chat_service_sid
@properties['chat_service_sid']
end
##
# @return [Hash] The Push Notification configuration for New Messages.
def new_message
@properties['new_message']
end
##
# @return [Hash] The Push Notification configuration for being added to a Conversation.
def added_to_conversation
@properties['added_to_conversation']
end
##
# @return [Hash] The Push Notification configuration for being removed from a Conversation.
def removed_from_conversation
@properties['removed_from_conversation']
end
##
# @return [Boolean] Weather the notification logging is enabled.
def log_enabled
@properties['log_enabled']
end
##
# @return [String] An absolute URL for this configuration.
def url
@properties['url']
end
##
# Update the NotificationInstance
# @param [Boolean] log_enabled Weather the notification logging is enabled.
# @param [Boolean] new_message_enabled Whether to send a notification when a new
# message is added to a conversation. The default is `false`.
# @param [String] new_message_template The template to use to create the
# notification text displayed when a new message is added to a conversation and
# `new_message.enabled` is `true`.
# @param [String] new_message_sound The name of the sound to play when a new
# message is added to a conversation and `new_message.enabled` is `true`.
# @param [Boolean] new_message_badge_count_enabled Whether the new message badge
# is enabled. The default is `false`.
# @param [Boolean] added_to_conversation_enabled Whether to send a notification
# when a participant is added to a conversation. The default is `false`.
# @param [String] added_to_conversation_template The template to use to create the
# notification text displayed when a participant is added to a conversation and
# `added_to_conversation.enabled` is `true`.
# @param [String] added_to_conversation_sound The name of the sound to play when a
# participant is added to a conversation and `added_to_conversation.enabled` is
# `true`.
# @param [Boolean] removed_from_conversation_enabled Whether to send a
# notification to a user when they are removed from a conversation. The default is
# `false`.
# @param [String] removed_from_conversation_template The template to use to create
# the notification text displayed to a user when they are removed from a
# conversation and `removed_from_conversation.enabled` is `true`.
# @param [String] removed_from_conversation_sound The name of the sound to play to
# a user when they are removed from a conversation and
# `removed_from_conversation.enabled` is `true`.
# @param [Boolean] new_message_with_media_enabled Whether to send a notification
# when a new message with media/file attachments is added to a conversation. The
# default is `false`.
# @param [String] new_message_with_media_template The template to use to create
# the notification text displayed when a new message with media/file attachments
# is added to a conversation and `new_message.attachments.enabled` is `true`.
# @return [NotificationInstance] Updated NotificationInstance
def update(log_enabled: :unset, new_message_enabled: :unset, new_message_template: :unset, new_message_sound: :unset, new_message_badge_count_enabled: :unset, added_to_conversation_enabled: :unset, added_to_conversation_template: :unset, added_to_conversation_sound: :unset, removed_from_conversation_enabled: :unset, removed_from_conversation_template: :unset, removed_from_conversation_sound: :unset, new_message_with_media_enabled: :unset, new_message_with_media_template: :unset)
context.update(
log_enabled: log_enabled,
new_message_enabled: new_message_enabled,
new_message_template: new_message_template,
new_message_sound: new_message_sound,
new_message_badge_count_enabled: new_message_badge_count_enabled,
added_to_conversation_enabled: added_to_conversation_enabled,
added_to_conversation_template: added_to_conversation_template,
added_to_conversation_sound: added_to_conversation_sound,
removed_from_conversation_enabled: removed_from_conversation_enabled,
removed_from_conversation_template: removed_from_conversation_template,
removed_from_conversation_sound: removed_from_conversation_sound,
new_message_with_media_enabled: new_message_with_media_enabled,
new_message_with_media_template: new_message_with_media_template,
)
end
##
# Fetch the NotificationInstance
# @return [NotificationInstance] Fetched NotificationInstance
def fetch
context.fetch
end
##
# Provide a user friendly representation
def to_s
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Conversations.V1.NotificationInstance #{values}>"
end
##
# Provide a detailed, user friendly representation
def inspect
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
"<Twilio.Conversations.V1.NotificationInstance #{values}>"
end
end
end
end
end
end
end
end | mit |
beni55/bop | test/run.sh | 331 | fails=0
n=0
sdate=$(date +"%s")
for t in test/*-test.js; do
echo -e "\n[ Bop" $t "]\n"
node $t || let fails++
let n++
done
edate=$(date +"%s")
etime=$[ $edate-$sdate ]
echo -e "\n" $n "test files executed ("$etime"s):"
echo -e " tests passed:" $[ $n - $fails ] 'files.'
echo -e " tests failed:" $fails 'files.\n'
exit $fails
| mit |
iflamed/deployer | app/Presenters/CommandPresenter.php | 2738 | <?php
namespace REBELinBLUE\Deployer\Presenters;
use Illuminate\Support\Facades\Lang;
use REBELinBLUE\Deployer\Command;
use Robbo\Presenter\Presenter;
/**
* The view presenter for a command class.
*/
class CommandPresenter extends Presenter
{
/**
* Gets the readable list of before clone commands.
*
* @return string
* @see self::commandNames()
*/
public function presentBeforeClone()
{
return $this->commandNames(Command::BEFORE_CLONE);
}
/**
* Gets the readable list of after clone commands.
*
* @return string
* @see self::commandNames()
*/
public function presentAfterClone()
{
return $this->commandNames(Command::AFTER_CLONE);
}
/**
* Gets the readable list of before install commands.
*
* @return string
* @see self::commandNames()
*/
public function presentBeforeInstall()
{
return $this->commandNames(Command::BEFORE_INSTALL);
}
/**
* Gets the readable list of after install commands.
*
* @return string
* @see self::commandNames()
*/
public function presentAfterInstall()
{
return $this->commandNames(Command::AFTER_INSTALL);
}
/**
* Gets the readable list of before activate commands.
*
* @return string
* @see self::commandNames()
*/
public function presentBeforeActivate()
{
return $this->commandNames(Command::BEFORE_ACTIVATE);
}
/**
* Gets the readable list of after activate commands.
*
* @return string
* @see self::commandNames()
*/
public function presentAfterActivate()
{
return $this->commandNames(Command::AFTER_ACTIVATE);
}
/**
* Gets the readable list of before purge commands.
*
* @return string
* @see self::commandNames()
*/
public function presentBeforePurge()
{
return $this->commandNames(Command::BEFORE_PURGE);
}
/**
* Gets the readable list of after purge commands.
*
* @return string
* @see self::commandNames()
*/
public function presentAfterPurge()
{
return $this->commandNames(Command::AFTER_PURGE);
}
/**
* Gets the readable list of commands.
*
* @param int $stage
* @return string
*/
private function commandNames($stage)
{
$commands = [];
foreach ($this->object->commands as $command) {
if ($command->step === $stage) {
$commands[] = $command->name;
}
}
if (count($commands)) {
return implode(', ', $commands);
}
return Lang::get('app.none');
}
}
| mit |
EliteScientist/webpack | lib/runtime/CompatRuntimePlugin.js | 1622 | /*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
"use strict";
const RuntimeGlobals = require("../RuntimeGlobals");
const RuntimeModule = require("../RuntimeModule");
/** @typedef {import("../MainTemplate")} MainTemplate */
class CompatRuntimePlugin extends RuntimeModule {
constructor() {
super("compat", 10);
}
/**
* @returns {string} runtime code
*/
generate() {
const { chunk, compilation } = this;
const {
chunkGraph,
runtimeTemplate,
mainTemplate,
moduleTemplates,
dependencyTemplates
} = compilation;
const bootstrap = mainTemplate.hooks.bootstrap.call(
"",
chunk,
compilation.hash || "XXXX",
moduleTemplates.javascript,
dependencyTemplates
);
const localVars = mainTemplate.hooks.localVars.call(
"",
chunk,
compilation.hash || "XXXX"
);
const requireExtensions = mainTemplate.hooks.requireExtensions.call(
"",
chunk,
compilation.hash || "XXXX"
);
const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
let requireEnsure = "";
if (runtimeRequirements.has(RuntimeGlobals.ensureChunk)) {
const requireEnsureHandler = mainTemplate.hooks.requireEnsure.call(
"",
chunk,
compilation.hash || "XXXX",
"chunkId"
);
if (requireEnsureHandler) {
requireEnsure = `${
RuntimeGlobals.ensureChunkHandlers
}.compat = ${runtimeTemplate.basicFunction(
"chunkId, promises",
requireEnsureHandler
)};`;
}
}
return [bootstrap, localVars, requireEnsure, requireExtensions]
.filter(Boolean)
.join("\n");
}
}
module.exports = CompatRuntimePlugin;
| mit |
poojaadani/carlvlewis-theme | _posts/2009-07-15-tuition-ammunition.html | 6245 | ---
layout: post
title: Tuition ammunition
date: 2009-07-15 21:10:10.000000000 +05:30
categories:
- Deadline
- Print
- The Telegraph (Macon, Ga.)
tags:
- GI bill
- military
- universities
status: publish
type: post
published: true
meta:
_edit_last: '1'
quote-author: Unknown
image: ''
quote-url: http://
quote-copy: Unknown
audio: http://
link-url: http://
seo_follow: 'false'
seo_noindex: 'false'
tmac_last_id: '229660853690068993'
pvc_views: '430'
_jetpack_related_posts_cache: a:1:{s:32:"8f6677c9d6b0f903e98ad32ec61f8deb";a:2:{s:7:"expires";i:1429059961;s:7:"payload";a:3:{i:0;a:1:{s:2:"id";i:145;}i:1;a:1:{s:2:"id";i:252;}i:2;a:1:{s:2:"id";i:158;}}}}
author:
login: cvlewis
email: [email protected]
display_name: Carl V. Lewis
first_name: Carl V.
last_name: Lewis
excerpt: !ruby/object:Hpricot::Doc
options: {}
---
<p><a href="http://69.89.31.238/~carlvlew/wp-content/uploads/2009/07/MA.GIBILL.jpg"><img class="size-large wp-image-74 alignright" title="MA.GIBILL" src="/assets/MA.GIBILL.jpg" alt="MA.GIBILL" width="131" height="269" /></a></p>
<p>[box]</p>
<p><a href="http://www.macon.com/139/story/778194.html">Tuition Ammunition</a></p>
<p>New G.I. bill offers midstate veterans a full ride to Mercer, Wesleyan</p>
<p>By Carl Lewis</p>
<p>[email protected]</p>
<p>Wednesday, Jul. 15, 2009</p>
<p>[/box]</p>
<p>From a young age, Elyse Jones wanted to be a dermatologist.</p>
<p>But when she was called to active duty with the Air Force in 2002, Jones, who was 19 at the time, almost gave up her plans to go to college.</p>
<p>“I put everything on hold, and I wasn’t sure of what would happen or if I’d be able to go to school in the future at all,” she said.</p>
<p><!--more-->Now, the 26-year-old may finally be getting the chance. Beginning next month, her classes at Wesleyan College should be covered under new benefits she earned from her military duty.</p>
<p>Jones is one of the many midstate service members who plans to reap the benefits of the new Post-9/11 GI Bill that takes effect in August.</p>
<p>Under the bill, a limited number of qualified Iraq and Afghanistan war-era veterans will be able to attend private colleges such as Mercer University and Wesleyan College for free or minimal tuition. And they will get expanded benefits at public institutions, too.</p>
<p>Dan Hines, a third-year Mercer law student, hopes to be one of the five students who will receive an additional $4,000 in financial assistance in the fall, half of which will come from federal coffers.</p>
<p>“I’m really excited about the prospect of this program,” said Hines, who served 13 months in Iraq and is president of the Mercer Law Military Veterans Association.</p>
<p>In the past, the federal government has helped pay for veterans’ tuition and fees at private colleges, but only up to an amount that matched the tuition at the most expensive public college in the state.</p>
<p>Yet at pricier private institutions such as Wesleyan and Mercer University, tuition exceeds that cap, which in the past has often forced service members either to make up the difference themselves or choose a public school instead.</p>
<p>However, under the Yellow Ribbon campaign — a component of the new bill — the government and participating private colleges will jointly cover the remaining difference to pay the entire tuition cost. At Mercer and Wesleyan in Macon, that means qualified veterans will receive a full scholarship.</p>
<p>According to information from the U.S. Department of Veterans Affairs, Mercer will contribute $11,625 per student, per year for 17 undergraduate students, while Wesleyan will contribute $8,750 for 10 students. Veterans Affairs will then match those amounts.</p>
<p>Mercer also has committed to covering the difference for at least 28 veterans to attend its graduate schools and regional academic centers and will contribute $2,000 in assistance to five veterans attending its law school.</p>
<p>A number of other veterans already have expressed interest in taking advantage of the program to attend Mercer, said Rick Goddard, who’s heading up the program at the school.</p>
<p>“These are veterans who may not necessarily have been able to afford Mercer without this assistance,” Goddard said. “And Mercer’s glad to have them. They bring a world of experience to the university, and the university feels an obligation to serve them.”</p>
<p>At least six veterans plan to attend Wesleyan in the fall using Yellow Ribbon money, Susan Welsh, a spokeswoman for the college, said.</p>
<p>At public colleges, veterans can expect to see enhanced benefits, too, though not as dramatic of improvements as their peers in private institutions are seeing.</p>
<p>In keeping with past GI bills, all qualified service members at state schools would still receive free tuition, but they now can transfer their benefits to family members more easily and may, in some cases, receive higher living stipends, said Tammie Burke, who handles VA programs at Georgia College & State University.</p>
<p>But while the bill does provide some new advantages to students at state colleges, it’s not expected to be a major change.</p>
<p>“At GCSU, it’s going to improve the way in which student veterans receive benefits, but it’s not really going to affect the amount of benefits they receive,” Burke said.</p>
<p>Officials at Macon State College and Fort Valley State University echoed Burke’s sentiments, saying that while the bill is a great improvement, it should not cause any major influx in veteran enrollment.</p>
<p>The new bill does have stipulations. To qualify for full assistance, veterans must have served at least 36 months for wars in Iraq and Afghanistan, Waugh said. Other service — such as Homeland Security missions or participation in the Active Guard and Reserve Program — may not qualify for benefits under the bill.</p>
<p>As for Jones, she’s getting the chance to attend a school she might not have been able to afford otherwise.</p>
<p>“I love the small, private setting of Wesleyan,” she said. “It gives me opportunities I might not have gotten at a big state school.”</p>
<p>To contact writer Carl Lewis, call 744-4347.</p>
| mit |
saadullahsaeed/chai.io | vendor/bundle/ruby/1.9.1/gems/sequel-3.41.0/lib/sequel/plugins/composition.rb | 7178 | module Sequel
module Plugins
# The composition plugin allows you to easily define a virtual
# attribute where the backing data is composed of other columns.
#
# There are two ways to use the plugin. One way is with the
# :mapping option. A simple example of this is when you have a
# database table with separate columns for year, month, and day,
# but where you want to deal with Date objects in your ruby code.
# This can be handled with:
#
# Album.plugin :composition
# Album.composition :date, :mapping=>[:year, :month, :day]
#
# With the :mapping option, you can provide a :class option
# that gives the class to use, but if that is not provided, it
# is inferred from the name of the composition (e.g. :date -> Date).
# When the <tt>date</tt> method is called, it will return a
# Date object by calling:
#
# Date.new(year, month, day)
#
# When saving the object, if the date composition has been used
# (by calling either the getter or setter method), it will
# populate the related columns of the object before saving:
#
# self.year = date.year
# self.month = date.month
# self.day = date.day
#
# The :mapping option is just a shortcut that works in particular
# cases. To handle any case, you can define a custom :composer
# and :decomposer procs. The :composer proc will be instance_evaled
# the first time the getter is called, and the :decomposer proc
# will be instance_evaled before saving. The above example could
# also be implemented as:
#
# Album.composition :date,
# :composer=>proc{Date.new(year, month, day) if year || month || day},
# :decomposer=>(proc do
# if d = compositions[:date]
# self.year = d.year
# self.month = d.month
# self.day = d.day
# else
# self.year = nil
# self.month = nil
# self.day = nil
# end
# end)
#
# Note that when using the composition object, you should not
# modify the underlying columns if you are also instantiating
# the composition, as otherwise the composition object values
# will override any underlying columns when the object is saved.
module Composition
# Define the necessary class instance variables.
def self.apply(model)
model.instance_eval{@compositions = {}}
end
module ClassMethods
# A hash with composition name keys and composition reflection
# hash values.
attr_reader :compositions
# A module included in the class holding the composition
# getter and setter methods.
attr_reader :composition_module
# Define a composition for this model, with name being the name of the composition.
# You must provide either a :mapping option or both the :composer and :decomposer options.
#
# Options:
# * :class - if using the :mapping option, the class to use, as a Class, String or Symbol.
# * :composer - A proc that is instance evaled when the composition getter method is called
# to create the composition.
# * :decomposer - A proc that is instance evaled before saving the model object,
# if the composition object exists, which sets the columns in the model object
# based on the value of the composition object.
# * :mapping - An array where each element is either a symbol or an array of two symbols.
# A symbol is treated like an array of two symbols where both symbols are the same.
# The first symbol represents the getter method in the model, and the second symbol
# represents the getter method in the composition object. Example:
# # Uses columns year, month, and day in the current model
# # Uses year, month, and day methods in the composition object
# :mapping=>[:year, :month, :day]
# # Uses columns year, month, and day in the current model
# # Uses y, m, and d methods in the composition object where
# # for example y in the composition object represents year
# # in the model object.
# :mapping=>[[:year, :y], [:month, :m], [:day, :d]]
def composition(name, opts={})
opts = opts.dup
compositions[name] = opts
if mapping = opts[:mapping]
keys = mapping.map{|k| k.is_a?(Array) ? k.first : k}
if !opts[:composer]
late_binding_class_option(opts, name)
klass = opts[:class]
class_proc = proc{klass || constantize(opts[:class_name])}
opts[:composer] = proc do
if values = keys.map{|k| send(k)} and values.any?{|v| !v.nil?}
class_proc.call.new(*values)
else
nil
end
end
end
if !opts[:decomposer]
setter_meths = keys.map{|k| :"#{k}="}
cov_methods = mapping.map{|k| k.is_a?(Array) ? k.last : k}
setters = setter_meths.zip(cov_methods)
opts[:decomposer] = proc do
if (o = compositions[name]).nil?
setter_meths.each{|sm| send(sm, nil)}
else
setters.each{|sm, cm| send(sm, o.send(cm))}
end
end
end
end
raise(Error, "Must provide :composer and :decomposer options, or :mapping option") unless opts[:composer] && opts[:decomposer]
define_composition_accessor(name, opts)
end
# Copy the necessary class instance variables to the subclass.
def inherited(subclass)
super
c = compositions.dup
subclass.instance_eval{@compositions = c}
end
# Define getter and setter methods for the composition object.
def define_composition_accessor(name, opts={})
include(@composition_module ||= Module.new) unless composition_module
composer = opts[:composer]
composition_module.class_eval do
define_method(name) do
compositions.include?(name) ? compositions[name] : (compositions[name] = instance_eval(&composer))
end
define_method("#{name}=") do |v|
modified!
compositions[name] = v
end
end
end
end
module InstanceMethods
# Clear the cached compositions when refreshing.
def _refresh(ds)
super
compositions.clear
end
# For each composition, set the columns in the model class based
# on the composition object.
def before_save
@compositions.keys.each{|n| instance_eval(&model.compositions[n][:decomposer])} if @compositions
super
end
# Cache of composition objects for this class.
def compositions
@compositions ||= {}
end
end
end
end
end
| mit |
dm-dashboard/dashboard | node_modules/npm/html/doc/api/npm-view.html | 6469 | <!doctype html>
<html>
<title>npm-view</title>
<meta http-equiv="content-type" value="text/html;utf-8">
<link rel="stylesheet" type="text/css" href="../../static/style.css">
<link rel="canonical" href="https://www.npmjs.org/doc/api/npm-view.html">
<script async=true src="../../static/toc.js"></script>
<body>
<div id="wrapper">
<h1><a href="../api/npm-view.html">npm-view</a></h1> <p>View registry info</p>
<h2 id="synopsis">SYNOPSIS</h2>
<pre><code>npm.commands.view(args, [silent,] callback)
</code></pre><h2 id="description">DESCRIPTION</h2>
<p>This command shows data about a package and prints it to the stream
referenced by the <code>outfd</code> config, which defaults to stdout.</p>
<p>The "args" parameter is an ordered list that closely resembles the command-line
usage. The elements should be ordered such that the first element is
the package and version (package@version). The version is optional. After that,
the rest of the parameters are fields with optional subfields ("field.subfield")
which can be used to get only the information desired from the registry.</p>
<p>The callback will be passed all of the data returned by the query.</p>
<p>For example, to get the package registry entry for the <code>connect</code> package,
you can do this:</p>
<pre><code>npm.commands.view(["connect"], callback)
</code></pre><p>If no version is specified, "latest" is assumed.</p>
<p>Field names can be specified after the package descriptor.
For example, to show the dependencies of the <code>ronn</code> package at version
0.3.5, you could do the following:</p>
<pre><code>npm.commands.view(["[email protected]", "dependencies"], callback)
</code></pre><p>You can view child field by separating them with a period.
To view the git repository URL for the latest version of npm, you could
do this:</p>
<pre><code>npm.commands.view(["npm", "repository.url"], callback)
</code></pre><p>For fields that are arrays, requesting a non-numeric field will return
all of the values from the objects in the list. For example, to get all
the contributor names for the "express" project, you can do this:</p>
<pre><code>npm.commands.view(["express", "contributors.email"], callback)
</code></pre><p>You may also use numeric indices in square braces to specifically select
an item in an array field. To just get the email address of the first
contributor in the list, you can do this:</p>
<pre><code>npm.commands.view(["express", "contributors[0].email"], callback)
</code></pre><p>Multiple fields may be specified, and will be printed one after another.
For exampls, to get all the contributor names and email addresses, you
can do this:</p>
<pre><code>npm.commands.view(["express", "contributors.name", "contributors.email"], callback)
</code></pre><p>"Person" fields are shown as a string if they would be shown as an
object. So, for example, this will show the list of npm contributors in
the shortened string format. (See <code>npm help json</code> for more on this.)</p>
<pre><code>npm.commands.view(["npm", "contributors"], callback)
</code></pre><p>If a version range is provided, then data will be printed for every
matching version of the package. This will show which version of jsdom
was required by each matching version of yui3:</p>
<pre><code>npm.commands.view(["yui3@>0.5.4", "dependencies.jsdom"], callback)
</code></pre><h2 id="output">OUTPUT</h2>
<p>If only a single string field for a single version is output, then it
will not be colorized or quoted, so as to enable piping the output to
another command.</p>
<p>If the version range matches multiple versions, than each printed value
will be prefixed with the version it applies to.</p>
<p>If multiple fields are requested, than each of them are prefixed with
the field name.</p>
<p>Console output can be disabled by setting the 'silent' parameter to true.</p>
<h2 id="return-value">RETURN VALUE</h2>
<p>The data returned will be an object in this formation:</p>
<pre><code>{ <version>:
{ <field>: <value>
, ... }
, ... }
</code></pre><p>corresponding to the list of fields selected.</p>
</div>
<table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
<tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
<tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td colspan=6 style="width:60px;height:10px;background:#fff"> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td></tr>
<tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2> </td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td></tr>
<tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
<tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
<p id="footer">npm-view — [email protected]</p>
| mit |
LivePersonInc/dev-hub | content_ga2/data-operational-realtime-sla-histogram.html | 172240 | <!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="keywords" content=" ">
<title>SLA Histogram | LivePerson Technical Documentation</title>
<link rel="stylesheet" href="css/syntax.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome-4.7.0/css/font-awesome.min.css">
<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">-->
<link rel="stylesheet" href="css/modern-business.css">
<link rel="stylesheet" href="css/lavish-bootstrap.css">
<link rel="stylesheet" href="css/customstyles.css">
<link rel="stylesheet" href="css/theme-blue.css">
<!-- <script src="assets/js/jsoneditor.js"></script> -->
<script src="assets/js/jquery-3.1.0.min.js"></script>
<!-- <link rel='stylesheet' id='theme_stylesheet' href='//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css'> -->
<!-- <link rel='stylesheet' id='theme_stylesheet' href='//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css'>
-->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> -->
<script src="assets/js/jquery.cookie-1.4.1.min.js"></script>
<script src="js/jquery.navgoco.min.js"></script>
<script src="assets/js/bootstrap-3.3.4.min.js"></script>
<script src="assets/js/anchor-2.0.0.min.js"></script>
<script src="js/toc.js"></script>
<script src="js/customscripts.js"></script>
<link rel="shortcut icon" href="images/favicon.ico">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="" href="http://0.0.0.0:4005feed.xml">
<script>
$(document).ready(function() {
// Initialize navgoco with default options
$("#mysidebar").navgoco({
caretHtml: '',
accordion: true,
openClass: 'active', // open
save: false, // leave false or nav highlighting doesn't work right
cookie: {
name: 'navgoco',
expires: false,
path: '/'
},
slide: {
duration: 400,
easing: 'swing'
}
});
$("#collapseAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', false);
});
$("#expandAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', true);
});
});
</script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container topnavlinks">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="fa fa-home fa-lg navbar-brand" href="index.html"> <span class="projectTitle"> LivePerson Technical Documentation</span></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<!-- entries without drop-downs appear here -->
<!-- entries with drop-downs appear here -->
<!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
<li><a class="email" title="Submit feedback" href="https://github.com/LivePersonInc/dev-hub/issues" ><i class="fa fa-github"></i> Issues</a><li>
<!--comment out this block if you want to hide search-->
<li>
<!--start search-->
<div id="search-demo-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
</div>
<script src="js/jekyll-search.js" type="text/javascript"></script>
<script type="text/javascript">
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
dataSource: 'search.json',
searchResultTemplate: '<li><a href="{url}" title="SLA Histogram">{title}</a></li>',
noResultsText: 'No results found.',
limit: 10,
fuzzy: true,
})
</script>
<!--end search-->
</li>
</ul>
</div>
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<div class="container">
<div class="col-lg-12"> </div>
<!-- Content Row -->
<div class="row">
<!-- Sidebar Column -->
<div class="col-md-3">
<ul id="mysidebar" class="nav">
<li class="sidebarTitle"> </li>
<li>
<a href="#">Common Guidelines</a>
<ul>
<li class="subfolders">
<a href="#">Introduction</a>
<ul>
<li class="thirdlevel"><a href="index.html">Home</a></li>
<li class="thirdlevel"><a href="getting-started.html">Getting Started with LiveEngage APIs</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Guides</a>
<ul>
<li class="thirdlevel"><a href="guides-customizedchat.html">Customized Chat Windows</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">Account Configuration</a>
<ul>
<li class="subfolders">
<a href="#">Predefined Content API</a>
<ul>
<li class="thirdlevel"><a href="account-configuration-predefined-content-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-get-items.html">Get Predefined Content Items</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-get-by-id.html">Get Predefined Content by ID</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-query-delta.html">Predefined Content Query Delta</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-create-content.html">Create Predefined Content</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-update-content.html">Update Predefined Content</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-update-content-items.html">Update Predefined Content Items</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-delete-content.html">Delete Predefined Content</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-delete-content-items.html">Delete Predefined Content Items</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-get-default-items.html">Get Default Predefined Content Items</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-get-default-items-by-id.html">Get Default Predefined Content by ID</a></li>
<li class="thirdlevel"><a href="account-configuration-predefined-content-appendix.html">Appendix</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Automatic Messages API</a>
<ul>
<li class="thirdlevel"><a href="account-configuration-automatic-messages-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="account-configuration-automatic-messages-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="account-configuration-automatic-messages-get-automatic-messages.html">Get Automatic Messages</a></li>
<li class="thirdlevel"><a href="account-configuration-automatic-messages-get-automatic-message-by-id.html">Get Automatic Message by ID</a></li>
<li class="thirdlevel"><a href="account-configuration-automatic-messages-update-an-automatic-message.html">Update an Automatic Message</a></li>
<li class="thirdlevel"><a href="account-configuration-automatic-messages-appendix.html">Appendix</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">Administration</a>
<ul>
<li class="subfolders">
<a href="#">Users API</a>
<ul>
<li class="thirdlevel"><a href="administration-users-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="administration-users-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="administration-get-all-users.html">Get all users</a></li>
<li class="thirdlevel"><a href="administration-get-user-by-id.html">Get user by ID</a></li>
<li class="thirdlevel"><a href="administration-create-users.html">Create users</a></li>
<li class="thirdlevel"><a href="administration-update-users.html">Update users</a></li>
<li class="thirdlevel"><a href="administration-update-user.html">Update user</a></li>
<li class="thirdlevel"><a href="administration-delete-users.html">Delete users</a></li>
<li class="thirdlevel"><a href="administration-delete-user.html">Delete user</a></li>
<li class="thirdlevel"><a href="administration-change-users-password.html">Change user's password</a></li>
<li class="thirdlevel"><a href="administration-reset-users-password.html">Reset user's password</a></li>
<li class="thirdlevel"><a href="administration-user-query-delta.html">User query delta</a></li>
<li class="thirdlevel"><a href="administration-users-appendix.html">Appendix</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Skills API</a>
<ul>
<li class="thirdlevel"><a href="administration-skills-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="administration-skills-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="administration-get-all-skills.html">Get all skills</a></li>
<li class="thirdlevel"><a href="administration-get-skill-by-id.html">Get skill by ID</a></li>
<li class="thirdlevel"><a href="administration-create-skills.html">Create skills</a></li>
<li class="thirdlevel"><a href="administration.update-skills.html">Update skills</a></li>
<li class="thirdlevel"><a href="administration-update-skill.html">Update skill</a></li>
<li class="thirdlevel"><a href="administration-delete-skills.html">Delete skills</a></li>
<li class="thirdlevel"><a href="administration-delete-skill.html">Delete skill</a></li>
<li class="thirdlevel"><a href="administration-skills-query-delta.html">Skills Query Delta</a></li>
<li class="thirdlevel"><a href="administration-skills-appendix.html">Appendix</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Agent Groups API</a>
<ul>
<li class="thirdlevel"><a href="administration-agent-groups-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="administration-agent-groups-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="administration-get-all-agent-groups.html">Get all agent groups</a></li>
<li class="thirdlevel"><a href="administration-get-agent-groups-by-id.html">Get agent group by ID</a></li>
<li class="thirdlevel"><a href="administration-create-agent-groups.html">Create agent groups</a></li>
<li class="thirdlevel"><a href="administration-update-agent-groups.html">Update agent groups</a></li>
<li class="thirdlevel"><a href="administration-update-agent-group.html">Update agent group</a></li>
<li class="thirdlevel"><a href="administration-delete-agent-groups.html">Delete agent groups</a></li>
<li class="thirdlevel"><a href="administration-delete-agent-group.html">Delete agent group</a></li>
<li class="thirdlevel"><a href="administration-get-subgroups-and-members.html">Get subgroups and members of an agent group</a></li>
<li class="thirdlevel"><a href="administration-agent-groups-query-delta.html">Agent Groups Query Delta</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">Consumer Experience</a>
<ul>
<li class="subfolders">
<a href="#">JavaScript Chat SDK</a>
<ul>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getting-started.html">Getting Started</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-chat-states.html">Chat States</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-surveys.html">Surveys</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-creating-an-instance.html">Creating an Instance</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getestimatedwaittime.html">getEstimatedWaitTime</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getprechatsurvey.html">getPreChatSurvey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getengagement.html">getEngagement</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-requestchat.html">requestChat</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-addline.html">addLine</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-setvisitortyping.html">setVisitorTyping</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-setvisitorname.html">setVisitorName</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-endchat.html">endChat</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-requesttranscript.html">requestTranscript</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getexitsurvey.html">getExitSurvey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-submitexitsurvey.html">submitExitSurvey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getofflinesurvey.html">getOfflineSurvey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-submitofflinesurvey.html">submitOfflineSurvey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getstate.html">getState</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getagentloginname.html">getAgentLoginName</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getvisitorname.html">getVisitorName</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getagentid.html">getAgentId</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getrtsessionid.html">getRtSessionId</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getsessionkey.html">getSessionKey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-getagenttyping.html">getAgentTyping</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-events.html">Events</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onload.html">onLoad</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-oninit.html">onInit</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onestimatedwaittime.html">onEstimatedWaitTime</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onengagement.html">onEngagement</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onprechatsurvey.html">onPreChatSurvey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onstart.html">onStart</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onstop.html">onStop</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onrequestchat.html">onRequestChat</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-ontranscript.html">onTranscript</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-online.html">onLine</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onstate.html">onState</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-oninfo.html">onInfo</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onagenttyping.html">onAgentTyping</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onexitsurvey.html">onExitSurvey</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-onaccounttoaccounttransfer.html">onAccountToAccountTransfer</a></li>
<li class="thirdlevel"><a href="rt-interactions-example.html">Engagement Attributes Body Example</a></li>
<li class="thirdlevel"><a href="consumer-experience-javascript-chat-demo.html">Demo App</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Server Chat API</a>
<ul>
<li class="thirdlevel"><a href="consumer-experience-server-chat-getting-started.html">Getting Started</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-availability.html">Retrieve Availability</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-available-slots.html">Retrieve Available Slots</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-estimated-wait-time.html">Retrieve Estimated Wait Time</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-offline-survey.html">Retrieve an Offline Survey</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-start-chat.html">Start a Chat</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-chat-resources.html">Retrieve Chat Resources, Events and Information</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-chat-events.html">Retrieve Chat Events</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-add-lines.html">Add Lines / End Chat</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-chat-information.html">Retrieve Chat Information</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-visitor-name.html">Retrieve the Visitor's Name</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-set-visitor-name.html">Set the Visitor's Name</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-agent-typing-status.html">Retrieve the Agent's Typing Status</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-visitor-typing-status.html">Retrieve the Visitor's Typing Status</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-set-visitor-typing-status.html">Set the Visitor's Typing Status</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-retrieve-exit-survey-structure.html">Retrieve Exit Survey Structure</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-submit-survey-data.html">Submit Survey Data</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-send-transcript.html">Send a Transcript</a></li>
<li class="thirdlevel"><a href="consumer-experience-server-chat-sample.html">Sample Postman Collection</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Push Service API</a>
<ul>
<li class="thirdlevel"><a href="push-service-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="push-service-tls-html">TLS Authentication</a></li>
<li class="thirdlevel"><a href="push-service-codes-html">HTTP Response Codes</a></li>
<li class="thirdlevel"><a href="push-service-configuration-html">Configuration of Push Proxy</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">In-App Messaging SDK iOS (2.0)</a>
<ul>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-quick-start.html">Quick Start</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-advanced-configurations.html">Advanced Configurations</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-initialize.html">initialize</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-showconversation.html">showConversation</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-removeconversation.html">removeConversation</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-reconnect.html">reconnect</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-togglechatactions.html">toggleChatActions</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-checkactiveconversation.html">checkActiveConversation</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-markasurgent.html">markAsUrgent</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-isurgent.html">isUrgent</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-dismissurgent.html">dismissUrgent</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-resolveconversation.html">resolveConversation</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-clearhistory.html">clearHistory</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-logout.html">logout</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-destruct.html">destruct</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-handlepush.html">handlePush</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-registerpushnotifications.html">registerPushNotifications</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-setuserprofile.html">setUserProfile</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-getassignedagent.html">getAssignedAgent</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-subscribelogevents.html">subscribeLogEvents</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-getsdkversion.html">getSDKVersion</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-printalllocalizedkeys.html">printAllLocalizedKeys</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-printsupportedlanguages.html">printSupportedLanguages</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-getallsupportedlanguages.html">getAllSupportedLanguages</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-interfacedefinitions.html">Interface and Class Definitions</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-callbacks-index.html">Callbacks index</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-configuring-the-sdk.html">Configuring the SDK</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-attributes.html">Attributes</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-deprecated-attributes.html">Deprecated Attributes</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-stringlocalization.html">String localization in SDK</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-localizationkeys.html">Localization Keys</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-timestamps.html">Timestamps Formatting</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-createcertificate.html">OS Certificate Creation</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-advanced-csat.html">CSAT UI Content</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-photosharing.html">Photo Sharing (Beta)</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-pushnotifications.html">Configuring Push Notifications</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-opensource.html">Open Source List</a></li>
<li class="thirdlevel"><a href="consumer-experience-ios-sdk-security.html">Security</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">In-App Messaging SDK Android (2.0)</a>
<ul>
<li class="thirdlevel"><a href="android-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="android-prerequisites.html">Prerequisites</a></li>
<li class="thirdlevel"><a href="android-download-and-unzip.html">Step 1: Download and Unzip the SDK</a></li>
<li class="thirdlevel"><a href="android-configure-project-settings.html">Step 2: Configure project settings to connect LiveEngage SDK</a></li>
<li class="thirdlevel"><a href="android-code-integration.html">Step 3: Code integration for basic deployment</a></li>
<li class="thirdlevel"><a href="android-initialization.html">SDK Initialization and Lifecycle</a></li>
<li class="thirdlevel"><a href="android-authentication.html">Authentication</a></li>
<li class="thirdlevel"><a href="android-conversations-lifecycle.html">Conversations Lifecycle</a></li>
<li class="thirdlevel"><a href="android-callbacks-interface.html">LivePerson Callbacks Interface</a></li>
<li class="thirdlevel"><a href="android-notifications.html">Notifications</a></li>
<li class="thirdlevel"><a href="android-user-data.html">User Data</a></li>
<li class="thirdlevel"><a href="android-logs.html">Logs and Info</a></li>
<li class="thirdlevel"><a href="android-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="android-initializedeprecated.html">initialize (Deprecated)</a></li>
<li class="thirdlevel"><a href="android-initializeproperties.html">initialize (with SDK properties object)</a></li>
<li class="thirdlevel"><a href="android-showconversation.html">showConversation</a></li>
<li class="thirdlevel"><a href="android-showconversationauth.html">showConversation (with authentication support)</a></li>
<li class="thirdlevel"><a href="android-hideconversation.html">hideConversation</a></li>
<li class="thirdlevel"><a href="android-getconversationfrag.html">getConversationFragment</a></li>
<li class="thirdlevel"><a href="android-getconversationfragauth.html">getConversationFragment with authentication support</a></li>
<li class="thirdlevel"><a href="android-reconnect.html">reconnect</a></li>
<li class="thirdlevel"><a href="android-setuserprofile.html">setUserProfile</a></li>
<li class="thirdlevel"><a href="android-setuserprofiledeprecated.html">setUserProfile (Deprecated)</a></li>
<li class="thirdlevel"><a href="android-registerlppusher.html">registerLPPusher</a></li>
<li class="thirdlevel"><a href="android-unregisterlppusher.html">unregisterLPPusher</a></li>
<li class="thirdlevel"><a href="android-handlepush.html">handlePush</a></li>
<li class="thirdlevel"><a href="android-getsdkversion.html">getSDKVersion</a></li>
<li class="thirdlevel"><a href="android-setcallback.html">setCallback</a></li>
<li class="thirdlevel"><a href="android-removecallback.html">removeCallBack</a></li>
<li class="thirdlevel"><a href="android-checkactiveconversation.html">checkActiveConversation</a></li>
<li class="thirdlevel"><a href="android-checkagentid.html">checkAgentID</a></li>
<li class="thirdlevel"><a href="android-markurgent.html">markConversationAsUrgent</a></li>
<li class="thirdlevel"><a href="android-marknormal.html">markConversationAsNormal</a></li>
<li class="thirdlevel"><a href="android-checkurgent.html">checkConversationIsMarkedAsUrgent</a></li>
<li class="thirdlevel"><a href="android-resolveconversation.html">resolveConversation</a></li>
<li class="thirdlevel"><a href="android-shutdown.html">shutDown</a></li>
<li class="thirdlevel"><a href="android-shutdowndeprecated.html">shutDown (Deprecated)</a></li>
<li class="thirdlevel"><a href="android-clearhistory.html">clearHistory</a></li>
<li class="thirdlevel"><a href="android-logout.html">logOut</a></li>
<li class="thirdlevel"><a href="android-callbacks-index.html">Callbacks Index</a></li>
<li class="thirdlevel"><a href="android-configuring-sdk.html">Configuring the SDK</a></li>
<li class="thirdlevel"><a href="android-attributes.html">Attributes</a></li>
<li class="thirdlevel"><a href="android-configuring-edittext.html">Configuring the message’s EditText</a></li>
<li class="thirdlevel"><a href="android-proguard.html">Proguard Configuration</a></li>
<li class="thirdlevel"><a href="android-modifying-string.html">Modifying Strings</a></li>
<li class="thirdlevel"><a href="android-modifying-resources.html">Modifying Resources</a></li>
<li class="thirdlevel"><a href="android-plural-string.html">Plural String Resource Example</a></li>
<li class="thirdlevel"><a href="android-timestamps.html">Timestamps Formatting</a></li>
<li class="thirdlevel"><a href="android-off-hours.html">Date and Time</a></li>
<li class="thirdlevel"><a href="android-bubble.html">Bubble Timestamp</a></li>
<li class="thirdlevel"><a href="android-separator.html">Separator Timestamp</a></li>
<li class="thirdlevel"><a href="android-resolve.html">Resolve Message</a></li>
<li class="thirdlevel"><a href="android-csat.html">CSAT Behavior</a></li>
<li class="thirdlevel"><a href="android-photo-sharing.html">Photo Sharing - Beta</a></li>
<li class="thirdlevel"><a href="android-push-notifications.html">Enable Push Notifications</a></li>
<li class="thirdlevel"><a href="android-appendix.html">Appendix</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">Real-time Interactions</a>
<ul>
<li class="subfolders">
<a href="#">Visit Information API</a>
<ul>
<li class="thirdlevel"><a href="rt-interactions-visit-information-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="rt-interactions-visit-information-visit-information.html">Visit Information</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">App Engagement API</a>
<ul>
<li class="thirdlevel"><a href="rt-interactions-app-engagement-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="rt-interactions-app-engagement-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="rt-interactions-create-session.html">Create Session</a></li>
<li class="thirdlevel"><a href="rt-interactions-update-session.html">Update Session</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Engagement Attributes</a>
<ul>
<li class="thirdlevel"><a href="rt-interactions-engagement-attributes-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="rt-interactions-engagement-attributes-engagement-attributes.html">Engagement Attributes</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">IVR Engagement API</a>
<ul>
<li class="thirdlevel"><a href="rt-interactions-ivr-engagement-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="rt-interactions-ivr-engagement-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="rt-interactions-ivr-engagement-external engagement.html">External Engagement</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Validate Engagement</a>
<ul>
<li class="thirdlevel"><a href="rt-interactions-validate-engagement-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="rt-interactions-validate-engagement-validate-engagement.html">Validate Engagement API</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Engagement Trigger API</a>
<ul>
<li class="thirdlevel"><a href="trigger-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="trigger-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="trigger-click.html">Click</a></li>
<li class="thirdlevel"><a href="trigger-getinfo.html">getEngagementInfo</a></li>
<li class="thirdlevel"><a href="trigger-getstate.html">getEngagementState</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Engagement Window Widget SDK</a>
<ul>
<li class="thirdlevel"><a href="rt-interactions-window-sdk-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="rt-interactions-window-sdk-getting-started.html">Getting Started</a></li>
<li class="thirdlevel"><a href="rt-interactions-window-sdk-limitations.html">Limitations</a></li>
<li class="thirdlevel"><a href="rt-interactions-window-sdk-configuration.html">Configuration</a></li>
<li class="thirdlevel"><a href="rt-interactions-window-sdk-how-to-use.html">How to use the SDK</a></li>
<li class="thirdlevel"><a href="rt-interactions-window-sdk-code-examples.html">Code Examples</a></li>
<li class="thirdlevel"><a href="rt-interactions-window-sdk-event-structure.html">Event Structure</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">Agent</a>
<ul>
<li class="subfolders">
<a href="#">Agent Workspace Widget SDK</a>
<ul>
<li class="thirdlevel"><a href="agent-workspace-sdk-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="agent-workspace-sdk-getting-started.html">Getting Started</a></li>
<li class="thirdlevel"><a href="agent-workspace-sdk-limitations.html">Limitations</a></li>
<li class="thirdlevel"><a href="agent-workspace-sdk-how-to-use.html">How to use the SDK</a></li>
<li class="thirdlevel"><a href="agent-workspace-sdk-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="agent-workspace-sdk-public-model.html">Public Model Structure</a></li>
<li class="thirdlevel"><a href="agent-workspace-sdk-public-properties.html">Public Properties</a></li>
<li class="thirdlevel"><a href="agent-workspace-sdk-code-examples.html">Code Examples</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">LivePerson Domain API</a>
<ul>
<li class="thirdlevel"><a href="agent-domain-domain-api.html">Domain API</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Login Service API</a>
<ul>
<li class="thirdlevel"><a href="login-getting-started.html">Getting Started</a></li>
<li class="thirdlevel"><a href="agent-login-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="agent-login.html">Login</a></li>
<li class="thirdlevel"><a href="agent-refresh.html">Refresh</a></li>
<li class="thirdlevel"><a href="agent-refresh.html">Logout</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Chat Agent API</a>
<ul>
<li class="thirdlevel"><a href="chat-agent-getting-started.html">Getting Started</a></li>
<li class="thirdlevel"><a href="agent-chat-agent-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="agent-start-agent-session.html">Start Agent Session</a></li>
<li class="thirdlevel"><a href="agent-retrieve-current-availability.html">Retrieve Current Availability</a></li>
<li class="thirdlevel"><a href="agent-set-agent-availability.html">Set Agent Availability</a></li>
<li class="thirdlevel"><a href="agent-retrieve-available-agents.html">Retrieve Available Agents</a></li>
<li class="thirdlevel"><a href="agent-retrieve-available-slots.html">Retrieve Available Slots</a></li>
<li class="thirdlevel"><a href="agent-retrieve-agent-information.html">Retrieve Agent Information</a></li>
<li class="thirdlevel"><a href="agent-determine-incoming.html">Determine Incoming Chat Requests</a></li>
<li class="thirdlevel"><a href="agent-accept-chat.html">Accept a Chat</a></li>
<li class="thirdlevel"><a href="agent-retrieve-chat-sessions.html">Retrieve Chat Sessions</a></li>
<li class="thirdlevel"><a href="agent-retrieve-chat-resources.html">Retrieve Chat Resources, Events and Information</a></li>
<li class="thirdlevel"><a href="agent-retrieve-data.html">Retrieve Data for Multiple Chats</a></li>
<li class="thirdlevel"><a href="agent-retrieve-chat-events.html">Retrieve Chat Events</a></li>
<li class="thirdlevel"><a href="agent-add-lines.html">Add Lines</a></li>
<li class="thirdlevel"><a href="agent-end-chat.html">End Chat</a></li>
<li class="thirdlevel"><a href="agent-retrieve-chat-info.html">Retrieve Chat Information</a></li>
<li class="thirdlevel"><a href="">Retrieve Visitor’s Name</a></li>
<li class="thirdlevel"><a href="agent-retrieve-agent-typing.html">Retrieve Agent's Typing Status</a></li>
<li class="thirdlevel"><a href="agent-set-agent-typing.html">Set Agent’s Typing Status</a></li>
<li class="thirdlevel"><a href="agent-retrieve-visitor-typing.html">Retrieve Visitor's Typing Status</a></li>
<li class="thirdlevel"><a href="agent-chat-agent-retrieve-skills.html">Retrieve Available Skills</a></li>
<li class="thirdlevel"><a href="agent-transfer-chat.html">Transfer a Chat</a></li>
<li class="thirdlevel"><a href="agent-retrieve-survey-structure.html">Retrieve Agent Survey Structure</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Messaging Agent SDK</a>
<ul>
<li class="thirdlevel"><a href="messaging-agent-sdk-overview.html">Overview</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">Data</a>
<ul>
<li class="subfolders">
<a href="#">Data Access API (Beta)</a>
<ul>
<li class="thirdlevel"><a href="data-data-access-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="data-data-access-architecture.html">Architecture</a></li>
<li class="thirdlevel"><a href="data-data-access-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="data-data-access-base-resource.html">Base Resource</a></li>
<li class="thirdlevel"><a href="data-data-access-agent-activity.html">Agent Activity</a></li>
<li class="thirdlevel"><a href="data-data-access-web-session.html">Web Session</a></li>
<li class="thirdlevel"><a href="data-data-access-engagement.html">Engagement</a></li>
<li class="thirdlevel"><a href="data-data-access-survey.html">Survey</a></li>
<li class="thirdlevel"><a href="data-data-access-schema.html">Schema</a></li>
<li class="thirdlevel"><a href="data-data-access-appendix.html">Appendix</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Messaging Operations API</a>
<ul>
<li class="thirdlevel"><a href="data-messaging-operations-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="data-messaging-operations-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="data-messaging-operations-messaging-conversation.html">Messaging Conversation</a></li>
<li class="thirdlevel"><a href="data-messaging-operations-messaging-csat-distribution.html">Messaging CSAT Distribution</a></li>
<li class="thirdlevel"><a href="data-messaging-operations-appendix.html">Appendix</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Messaging Interactions API (Beta)</a>
<ul>
<li class="thirdlevel"><a href="data-messaging-interactions-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="data-messaging-interactions-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="data-messaging-interactions-conversations.html">Conversations</a></li>
<li class="thirdlevel"><a href="data-messaging-interactions-get-conversation-by-conversation-id.html">Get conversation by conversation ID</a></li>
<li class="thirdlevel"><a href="data-messaging-interactions-get-conversations-by-consumer-id.html">Get Conversations by Consumer ID</a></li>
<li class="thirdlevel"><a href="data-messaging-interactions-sample-code.html">Sample Code</a></li>
<li class="thirdlevel"><a href="data-messaging-interactions-appendix.html">Appendix</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Engagement History API</a>
<ul>
<li class="thirdlevel"><a href="data-data-access-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="data-engagement-history-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="data-engagement-history-retrieve-engagement-list-by-criteria.html">Retrieve Engagement List by Criteria</a></li>
<li class="thirdlevel"><a href="data-engagement-history-sample-code.html">Sample Code</a></li>
<li class="thirdlevel"><a href="data-engagement-history-appendix.html">Appendix</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Operational Real-time API</a>
<ul>
<li class="thirdlevel"><a href="data-operational-realtime-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="data-operational-realtime-methods.html">Methods</a></li>
<li class="thirdlevel"><a href="data-operational-realtime-queue-health.html">Queue Health</a></li>
<li class="thirdlevel"><a href="data-operational-realtime-engagement-activity.html">Engagement Activity</a></li>
<li class="thirdlevel"><a href="data-operational-realtime-agent-activity.html">Agent Activity</a></li>
<li class="thirdlevel"><a href="data-operational-realtime-current-queue-state.html">Current Queue State</a></li>
<li class="active thirdlevel"><a href="data-operational-realtime-sla-histogram.html">SLA Histogram</a></li>
<li class="thirdlevel"><a href="data-operational-realtime-sample-code.html">Sample Code</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">LiveEngage Tag</a>
<ul>
<li class="subfolders">
<a href="#">LE Tag Events</a>
<ul>
<li class="thirdlevel"><a href="lp-tag-tag-events-overview.html">Overview</a></li>
<li class="thirdlevel"><a href="lp-tag-tag-events-how.html">How to use these Events</a></li>
<li class="thirdlevel"><a href="lp-tag-tag-events-events.html">Events</a></li>
<li class="thirdlevel"><a href="lp-tag-visitor-flow.html">Visitor Flow Events</a></li>
<li class="thirdlevel"><a href="lp-tag-engagement.html">Engagement Events</a></li>
<li class="thirdlevel"><a href="lp-tag-engagement-window.html">Engagement Window Events</a></li>
</ul>
</li>
</ul>
<li>
<a href="#">Messaging Window API</a>
<ul>
<li class="subfolders">
<a href="#">Introduction</a>
<ul>
<li class="thirdlevel"><a href="consumer-interation-index.html">Home</a></li>
<li class="thirdlevel"><a href="consumer-int-protocol-overview.html">Protocol Overview</a></li>
<li class="thirdlevel"><a href="consumer-int-getting-started.html">Getting Started</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Tutorials</a>
<ul>
<li class="thirdlevel"><a href="consumer-int-get-msg.html">Get Messages</a></li>
<li class="thirdlevel"><a href="consumer-int-conversation-md.html">Conversation Metadata</a></li>
<li class="thirdlevel"><a href="consumer-int-readaccept-events.html">Read/Accept events</a></li>
<li class="thirdlevel"><a href="consumer-int-authentication.html">Authentication</a></li>
<li class="thirdlevel"><a href="consumer-int-agent-profile.html">Agent Profile</a></li>
<li class="thirdlevel"><a href="consumer-int-post-survey.html">Post Conversation Survey</a></li>
<li class="thirdlevel"><a href="consumer-int-client-props.html">Client Properties</a></li>
<li class="thirdlevel"><a href="consumer-int-no-headers.html">Avoid Webqasocket Headers</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Samples</a>
<ul>
<li class="thirdlevel"><a href="consumer-int-js-sample.html">JavaScript Messenger</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">API Reference</a>
<ul>
<li class="thirdlevel"><a href="consumer-int-api-reference.html">Overview</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-reqs.html">Request Builder</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-resps.html">Response Builder</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-notifications.html">Notification Builder</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-req-conv.html">New Conversation</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-close-conv.html">Close Conversation</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-conv-ttr.html">Urgent Conversation</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-csat-conv.html">Update CSAT</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-sub-conv.html">Subscribe Conversations Metadata</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-unsub-conv.html">Unsubscribe Conversations Metadata</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-text-cont.html">Publish Content</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-sub-events.html">Subscribe Conversation Content</a></li>
<li class="thirdlevel"><a href="consumer-int-msg-init-con.html">Browser Init Connection</a></li>
</ul>
</li>
</ul>
<!-- if you aren't using the accordion, uncomment this block:
<p class="external">
<a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
</p>
-->
</li>
</ul>
</div>
<!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
<script>$("li.active").parents('li').toggleClass("active");</script>
<!-- Content Column -->
<div class="col-md-9">
<div class="post-header">
<h1 class="post-title-main">SLA Histogram</h1>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-96175782-1', 'auto');
ga('send', 'pageview');
</script>
<div class="post-content">
<p>Retrieves the distribution of visitors’ wait time in the queue, before an agent replies to their chat. The wait time in the histogram is accurate (no more than +/- 5 seconds). Histogram bucket sizes are specified in multiples of 5 seconds.</p>
<p><em>Note: SLA is calculated using bucket-based aggregation techniques, in which events are collected into 5 minute buckets. For this reason, events may be included that took place outside of the requested time frame.</em></p>
<p><em>Example: If the current time is 13:29 and the required time frame is 7 minutes, the API will use 2 buckets: 13:25 and 13:30. The time of the collected data is actually not 13:22-13:29, but 13:20-13:29.</em></p>
<h2 id="request">Request</h2>
<table>
<thead>
<tr>
<th style="text-align: left">Method</th>
<th style="text-align: left">URL</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">GET</td>
<td style="text-align: left"><code class="highlighter-rouge">https://<domain>/operations/api/account/{accountID}/sla?timeframe=<timeframe in minutes>&skillIds=<skillIDs>&groupIds=<groupIds>&histogram=<histogram bucket list>&v=<version></code></td>
</tr>
</tbody>
</table>
<p>URL Parameters</p>
<table>
<thead>
<tr>
<th style="text-align: left">Name</th>
<th style="text-align: left">Description</th>
<th style="text-align: left">Type / Value</th>
<th style="text-align: left">Required</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">timeframe</td>
<td style="text-align: left">The time range (in minutes) in which the data can be filtered. Where end time = current time, and start time = end time - timeframe. The maximum timeframe value is 1440 minutes (24 hours).</td>
<td style="text-align: left">numeric</td>
<td style="text-align: left">required</td>
</tr>
<tr>
<td style="text-align: left">v</td>
<td style="text-align: left">Version of API, for example, v=1.</td>
<td style="text-align: left">numeric</td>
<td style="text-align: left">required</td>
</tr>
<tr>
<td style="text-align: left">skillIds</td>
<td style="text-align: left">When provided, SLA will be calculated only for interactions involving agents of the specified skills. You can provide one or more skill IDs. <br /> Example: skillIds=4,15,3. <br /> To retrieve all skills active for the time period, use skillIds=all. If no skillIds is provided, ‘all’ is assumed.</td>
<td style="text-align: left">numeric, comma separated, or ‘all’</td>
<td style="text-align: left">optional</td>
</tr>
<tr>
<td style="text-align: left">groupIds</td>
<td style="text-align: left">When provided, SLA will be calculated only for interactions involving agents of the specified groups. You can provide one or more agent group IDs. <br /> Example: groupIds=4,15,3. <br /> To retrieve all agent groups active for the time period, use groupIds=all. If no groupIds is provided, ‘all’ is assumed.</td>
<td style="text-align: left">numeric, comma separated, or ‘all’</td>
<td style="text-align: left">optional</td>
</tr>
<tr>
<td style="text-align: left">histogram</td>
<td style="text-align: left">Histogram bucket ranges (in seconds). Values in the list must be multiples of 5 seconds. Each value is taken as the lower limit of a bucket. The value ‘0’ is always assumed to be part of the histogram. The highest value in the histogram will bucket all waiting times that are higher. <br /> Example: histogram=0,50,100,200,400,1000 <br /> If no histogram is provided, the default histogram is assumed: 0,15,30,45,60,90,120</td>
<td style="text-align: left">numeric, comma separated</td>
<td style="text-align: left">optional</td>
</tr>
</tbody>
</table>
<h2 id="response">Response</h2>
<p><strong>JSON Example</strong></p>
<div class="highlighter-rouge"><pre class="highlight"><code>Request by histogram=0,5,10,20,30. Assuming 2 chats waited for 2 seconds, 2 chats waited for 7 seconds and 1 chat waited for 27 seconds.
{
"slaDataRange": {
"0": {
"accumulated": 0.4,
"percentageFromTotal": 0.4,
"chats": 2
},
"5": {
"accumulated": 0.8,
"percentageFromTotal": 0.4,
"chats": 2
},
"10": {
"accumulated": 0.8,
"percentageFromTotal": 0,
"chats": 0
},
"20": {
"accumulated": 1,
"percentageFromTotal": 0.2,
"chats": 1
},
"30": {
"accumulated": 1,
"percentageFromTotal": 0,
"chats": 0
}
}
}
</code></pre>
</div>
<p><strong>Elements in the Response</strong></p>
<table>
<thead>
<tr>
<th style="text-align: left">Name</th>
<th style="text-align: left">Description</th>
<th style="text-align: left">Type / Value</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">slaDataRange</td>
<td style="text-align: left">Root element of the response. Contains a list of sub elements with numeric names, one for each histogram bucket. The names of the sub elements represent the start of the bucket (in seconds).</td>
<td style="text-align: left">element</td>
</tr>
<tr>
<td style="text-align: left">accumulated</td>
<td style="text-align: left">The percentage of chats that fall in this bucket or in earlier buckets (buckets for shorter queue wait periods).</td>
<td style="text-align: left">long</td>
</tr>
<tr>
<td style="text-align: left">percentageFromTotal</td>
<td style="text-align: left">The percentage of chats that fall in this bucket.</td>
<td style="text-align: left">long</td>
</tr>
<tr>
<td style="text-align: left">chats</td>
<td style="text-align: left">The number of chats with wait time that falls in this bucket.</td>
<td style="text-align: left">long</td>
</tr>
</tbody>
</table>
<div class="tags">
</div>
</div>
<hr class="shaded"/>
<footer>
<div class="row">
<div class="col-lg-12 footer">
©2017 LivePerson. All rights reserved.<br />This documentation is subject to change without notice.<br />
Site last generated: Mar 26, 2017 <br />
<p><img src="img/company_logo.png" alt="Company logo"/></p>
</div>
</div>
</footer>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
</body>
</html> | mit |
g0otgahp/number-energy | theme/tinymce/tinymce/themes/modern/theme.js | 44251 | (function () {
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
// Used when there is no 'main' module.
// The name is probably (hopefully) unique so minification removes for releases.
var register_3795 = function (id) {
var module = dem(id);
var fragments = id.split('.');
var target = Function('return this;')();
for (var i = 0; i < fragments.length - 1; ++i) {
if (target[fragments[i]] === undefined)
target[fragments[i]] = {};
target = target[fragments[i]];
}
target[fragments[fragments.length - 1]] = module;
};
var instantiate = function (id) {
var actual = defs[id];
var dependencies = actual.deps;
var definition = actual.defn;
var len = dependencies.length;
var instances = new Array(len);
for (var i = 0; i < len; ++i)
instances[i] = dem(dependencies[i]);
var defResult = definition.apply(null, instances);
if (defResult === undefined)
throw 'module [' + id + '] returned undefined';
actual.instance = defResult;
};
var def = function (id, dependencies, definition) {
if (typeof id !== 'string')
throw 'module id must be a string';
else if (dependencies === undefined)
throw 'no dependencies for ' + id;
else if (definition === undefined)
throw 'no definition function for ' + id;
defs[id] = {
deps: dependencies,
defn: definition,
instance: undefined
};
};
var dem = function (id) {
var actual = defs[id];
if (actual === undefined)
throw 'module [' + id + '] was undefined';
else if (actual.instance === undefined)
instantiate(id);
return actual.instance;
};
var req = function (ids, callback) {
var len = ids.length;
var instances = new Array(len);
for (var i = 0; i < len; ++i)
instances.push(dem(ids[i]));
callback.apply(null, callback);
};
var ephox = {};
ephox.bolt = {
module: {
api: {
define: def,
require: req,
demand: dem
}
}
};
var define = def;
var require = req;
var demand = dem;
// this helps with minificiation when using a lot of global references
var defineGlobal = function (id, ref) {
define(id, [], function () { return ref; });
};
/*jsc
["tinymce.themes.modern.Theme","global!window","tinymce.core.AddOnManager","tinymce.core.EditorManager","tinymce.core.Env","tinymce.core.ui.Api","tinymce.themes.modern.modes.Iframe","tinymce.themes.modern.modes.Inline","tinymce.themes.modern.ui.ProgressState","tinymce.themes.modern.ui.Resize","global!tinymce.util.Tools.resolve","tinymce.core.dom.DOMUtils","tinymce.core.ui.Factory","tinymce.core.util.Tools","tinymce.themes.modern.ui.A11y","tinymce.themes.modern.ui.Branding","tinymce.themes.modern.ui.ContextToolbars","tinymce.themes.modern.ui.Menubar","tinymce.themes.modern.ui.Sidebar","tinymce.themes.modern.ui.SkinLoaded","tinymce.themes.modern.ui.Toolbar","tinymce.core.ui.FloatPanel","tinymce.core.ui.Throbber","tinymce.core.util.Delay","tinymce.core.geom.Rect"]
jsc*/
defineGlobal("global!window", window);
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.AddOnManager',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.AddOnManager');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.EditorManager',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.EditorManager');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.Env',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.Env');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.ui.Api',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.ui.Api');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.dom.DOMUtils',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.dom.DOMUtils');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.ui.Factory',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.ui.Factory');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.util.Tools',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.util.Tools');
}
);
/**
* A11y.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.A11y',
[
],
function () {
var focus = function (panel, type) {
return function () {
var item = panel.find(type)[0];
if (item) {
item.focus(true);
}
};
};
var addKeys = function (editor, panel) {
editor.shortcuts.add('Alt+F9', '', focus(panel, 'menubar'));
editor.shortcuts.add('Alt+F10,F10', '', focus(panel, 'toolbar'));
editor.shortcuts.add('Alt+F11', '', focus(panel, 'elementpath'));
panel.on('cancel', function () {
editor.focus();
});
};
return {
addKeys: addKeys
};
}
);
/**
* Branding.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.Branding',
[
'tinymce.core.dom.DOMUtils'
],
function (DOMUtils) {
var DOM = DOMUtils.DOM;
var reposition = function (editor, poweredByElm) {
return function () {
var iframeWidth = editor.getContentAreaContainer().querySelector('iframe').offsetWidth;
var scrollbarWidth = Math.max(iframeWidth - editor.getDoc().documentElement.offsetWidth, 0);
var statusbarElm = editor.getContainer().querySelector('.mce-statusbar');
var statusbarHeight = statusbarElm ? statusbarElm.offsetHeight : 1;
DOM.setStyles(poweredByElm, {
right: scrollbarWidth + 'px',
bottom: statusbarHeight + 'px'
});
};
};
var hide = function (poweredByElm) {
return function () {
DOM.hide(poweredByElm);
};
};
var setupEventListeners = function (editor) {
editor.on('SkinLoaded', function () {
var poweredByElm = DOM.create('div', { 'class': 'mce-branding-powered-by' });
editor.getContainer().appendChild(poweredByElm);
DOM.bind(poweredByElm, 'click', hide(poweredByElm));
editor.on('NodeChange ResizeEditor', reposition(editor, poweredByElm));
});
};
var setup = function (editor) {
if (editor.settings.branding !== false) {
setupEventListeners(editor);
}
};
return {
setup: setup
};
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.util.Delay',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.util.Delay');
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.geom.Rect',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.geom.Rect');
}
);
/**
* Toolbar.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.Toolbar',
[
'tinymce.core.util.Tools',
'tinymce.core.ui.Factory'
],
function (Tools, Factory) {
var defaultToolbar = "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | " +
"bullist numlist outdent indent | link image";
var createToolbar = function (editor, items, size) {
var toolbarItems = [], buttonGroup;
if (!items) {
return;
}
Tools.each(items.split(/[ ,]/), function (item) {
var itemName;
var bindSelectorChanged = function () {
var selection = editor.selection;
if (item.settings.stateSelector) {
selection.selectorChanged(item.settings.stateSelector, function (state) {
item.active(state);
}, true);
}
if (item.settings.disabledStateSelector) {
selection.selectorChanged(item.settings.disabledStateSelector, function (state) {
item.disabled(state);
});
}
};
if (item == "|") {
buttonGroup = null;
} else {
if (!buttonGroup) {
buttonGroup = { type: 'buttongroup', items: [] };
toolbarItems.push(buttonGroup);
}
if (editor.buttons[item]) {
// TODO: Move control creation to some UI class
itemName = item;
item = editor.buttons[itemName];
if (typeof item == "function") {
item = item();
}
item.type = item.type || 'button';
item.size = size;
item = Factory.create(item);
buttonGroup.items.push(item);
if (editor.initialized) {
bindSelectorChanged();
} else {
editor.on('init', bindSelectorChanged);
}
}
}
});
return {
type: 'toolbar',
layout: 'flow',
items: toolbarItems
};
};
/**
* Creates the toolbars from config and returns a toolbar array.
*
* @param {String} size Optional toolbar item size.
* @return {Array} Array with toolbars.
*/
var createToolbars = function (editor, size) {
var toolbars = [], settings = editor.settings;
var addToolbar = function (items) {
if (items) {
toolbars.push(createToolbar(editor, items, size));
return true;
}
};
// Convert toolbar array to multiple options
if (Tools.isArray(settings.toolbar)) {
// Empty toolbar array is the same as a disabled toolbar
if (settings.toolbar.length === 0) {
return;
}
Tools.each(settings.toolbar, function (toolbar, i) {
settings["toolbar" + (i + 1)] = toolbar;
});
delete settings.toolbar;
}
// Generate toolbar<n>
for (var i = 1; i < 10; i++) {
if (!addToolbar(settings["toolbar" + i])) {
break;
}
}
// Generate toolbar or default toolbar unless it's disabled
if (!toolbars.length && settings.toolbar !== false) {
addToolbar(settings.toolbar || defaultToolbar);
}
if (toolbars.length) {
return {
type: 'panel',
layout: 'stack',
classes: "toolbar-grp",
ariaRoot: true,
ariaRemember: true,
items: toolbars
};
}
};
return {
createToolbar: createToolbar,
createToolbars: createToolbars
};
}
);
/**
* ContextToolbars.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.ContextToolbars',
[
'tinymce.core.dom.DOMUtils',
'tinymce.core.util.Tools',
'tinymce.core.util.Delay',
'tinymce.core.ui.Factory',
'tinymce.core.geom.Rect',
'tinymce.themes.modern.ui.Toolbar'
],
function (DOMUtils, Tools, Delay, Factory, Rect, Toolbar) {
var DOM = DOMUtils.DOM;
var toClientRect = function (geomRect) {
return {
left: geomRect.x,
top: geomRect.y,
width: geomRect.w,
height: geomRect.h,
right: geomRect.x + geomRect.w,
bottom: geomRect.y + geomRect.h
};
};
var hideAllFloatingPanels = function (editor) {
Tools.each(editor.contextToolbars, function (toolbar) {
if (toolbar.panel) {
toolbar.panel.hide();
}
});
};
var movePanelTo = function (panel, pos) {
panel.moveTo(pos.left, pos.top);
};
var togglePositionClass = function (panel, relPos, predicate) {
relPos = relPos ? relPos.substr(0, 2) : '';
Tools.each({
t: 'down',
b: 'up'
}, function (cls, pos) {
panel.classes.toggle('arrow-' + cls, predicate(pos, relPos.substr(0, 1)));
});
Tools.each({
l: 'left',
r: 'right'
}, function (cls, pos) {
panel.classes.toggle('arrow-' + cls, predicate(pos, relPos.substr(1, 1)));
});
};
var userConstrain = function (handler, x, y, elementRect, contentAreaRect, panelRect) {
panelRect = toClientRect({ x: x, y: y, w: panelRect.w, h: panelRect.h });
if (handler) {
panelRect = handler({
elementRect: toClientRect(elementRect),
contentAreaRect: toClientRect(contentAreaRect),
panelRect: panelRect
});
}
return panelRect;
};
var addContextualToolbars = function (editor) {
var scrollContainer, settings = editor.settings;
var getContextToolbars = function () {
return editor.contextToolbars || [];
};
var getElementRect = function (elm) {
var pos, targetRect, root;
pos = DOM.getPos(editor.getContentAreaContainer());
targetRect = editor.dom.getRect(elm);
root = editor.dom.getRoot();
// Adjust targetPos for scrolling in the editor
if (root.nodeName === 'BODY') {
targetRect.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft;
targetRect.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop;
}
targetRect.x += pos.x;
targetRect.y += pos.y;
return targetRect;
};
var reposition = function (match, shouldShow) {
var relPos, panelRect, elementRect, contentAreaRect, panel, relRect, testPositions, smallElementWidthThreshold;
var handler = settings.inline_toolbar_position_handler;
if (editor.removed) {
return;
}
if (!match || !match.toolbar.panel) {
hideAllFloatingPanels(editor);
return;
}
testPositions = [
'bc-tc', 'tc-bc',
'tl-bl', 'bl-tl',
'tr-br', 'br-tr'
];
panel = match.toolbar.panel;
// Only show the panel on some events not for example nodeChange since that fires when context menu is opened
if (shouldShow) {
panel.show();
}
elementRect = getElementRect(match.element);
panelRect = DOM.getRect(panel.getEl());
contentAreaRect = DOM.getRect(editor.getContentAreaContainer() || editor.getBody());
smallElementWidthThreshold = 25;
if (DOM.getStyle(match.element, 'display', true) !== 'inline') {
// We need to use these instead of the rect values since the style
// size properites might not be the same as the real size for a table
elementRect.w = match.element.clientWidth;
elementRect.h = match.element.clientHeight;
}
if (!editor.inline) {
contentAreaRect.w = editor.getDoc().documentElement.offsetWidth;
}
// Inflate the elementRect so it doesn't get placed above resize handles
if (editor.selection.controlSelection.isResizable(match.element) && elementRect.w < smallElementWidthThreshold) {
elementRect = Rect.inflate(elementRect, 0, 8);
}
relPos = Rect.findBestRelativePosition(panelRect, elementRect, contentAreaRect, testPositions);
elementRect = Rect.clamp(elementRect, contentAreaRect);
if (relPos) {
relRect = Rect.relativePosition(panelRect, elementRect, relPos);
movePanelTo(panel, userConstrain(handler, relRect.x, relRect.y, elementRect, contentAreaRect, panelRect));
} else {
// Allow overflow below the editor to avoid placing toolbars ontop of tables
contentAreaRect.h += panelRect.h;
elementRect = Rect.intersect(contentAreaRect, elementRect);
if (elementRect) {
relPos = Rect.findBestRelativePosition(panelRect, elementRect, contentAreaRect, [
'bc-tc', 'bl-tl', 'br-tr'
]);
if (relPos) {
relRect = Rect.relativePosition(panelRect, elementRect, relPos);
movePanelTo(panel, userConstrain(handler, relRect.x, relRect.y, elementRect, contentAreaRect, panelRect));
} else {
movePanelTo(panel, userConstrain(handler, elementRect.x, elementRect.y, elementRect, contentAreaRect, panelRect));
}
} else {
panel.hide();
}
}
togglePositionClass(panel, relPos, function (pos1, pos2) {
return pos1 === pos2;
});
//drawRect(contentAreaRect, 'blue');
//drawRect(elementRect, 'red');
//drawRect(panelRect, 'green');
};
var repositionHandler = function (show) {
return function () {
var execute = function () {
if (editor.selection) {
reposition(findFrontMostMatch(editor.selection.getNode()), show);
}
};
Delay.requestAnimationFrame(execute);
};
};
var bindScrollEvent = function () {
if (!scrollContainer) {
scrollContainer = editor.selection.getScrollContainer() || editor.getWin();
DOM.bind(scrollContainer, 'scroll', repositionHandler(true));
editor.on('remove', function () {
DOM.unbind(scrollContainer, 'scroll');
});
}
};
var showContextToolbar = function (match) {
var panel;
if (match.toolbar.panel) {
match.toolbar.panel.show();
reposition(match);
return;
}
bindScrollEvent();
panel = Factory.create({
type: 'floatpanel',
role: 'dialog',
classes: 'tinymce tinymce-inline arrow',
ariaLabel: 'Inline toolbar',
layout: 'flex',
direction: 'column',
align: 'stretch',
autohide: false,
autofix: true,
fixed: true,
border: 1,
items: Toolbar.createToolbar(editor, match.toolbar.items),
oncancel: function () {
editor.focus();
}
});
match.toolbar.panel = panel;
panel.renderTo(document.body).reflow();
reposition(match);
};
var hideAllContextToolbars = function () {
Tools.each(getContextToolbars(), function (toolbar) {
if (toolbar.panel) {
toolbar.panel.hide();
}
});
};
var findFrontMostMatch = function (targetElm) {
var i, y, parentsAndSelf, toolbars = getContextToolbars();
parentsAndSelf = editor.$(targetElm).parents().add(targetElm);
for (i = parentsAndSelf.length - 1; i >= 0; i--) {
for (y = toolbars.length - 1; y >= 0; y--) {
if (toolbars[y].predicate(parentsAndSelf[i])) {
return {
toolbar: toolbars[y],
element: parentsAndSelf[i]
};
}
}
}
return null;
};
editor.on('click keyup setContent ObjectResized', function (e) {
// Only act on partial inserts
if (e.type === 'setcontent' && !e.selection) {
return;
}
// Needs to be delayed to avoid Chrome img focus out bug
Delay.setEditorTimeout(editor, function () {
var match;
match = findFrontMostMatch(editor.selection.getNode());
if (match) {
hideAllContextToolbars();
showContextToolbar(match);
} else {
hideAllContextToolbars();
}
});
});
editor.on('blur hide contextmenu', hideAllContextToolbars);
editor.on('ObjectResizeStart', function () {
var match = findFrontMostMatch(editor.selection.getNode());
if (match && match.toolbar.panel) {
match.toolbar.panel.hide();
}
});
editor.on('ResizeEditor ResizeWindow', repositionHandler(true));
editor.on('nodeChange', repositionHandler(false));
editor.on('remove', function () {
Tools.each(getContextToolbars(), function (toolbar) {
if (toolbar.panel) {
toolbar.panel.remove();
}
});
editor.contextToolbars = {};
});
editor.shortcuts.add('ctrl+shift+e > ctrl+shift+p', '', function () {
var match = findFrontMostMatch(editor.selection.getNode());
if (match && match.toolbar.panel) {
match.toolbar.panel.items()[0].focus();
}
});
};
return {
addContextualToolbars: addContextualToolbars
};
}
);
/**
* Menubar.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.Menubar',
[
'tinymce.core.util.Tools'
],
function (Tools) {
var defaultMenus = {
file: { title: 'File', items: 'newdocument' },
edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall' },
insert: { title: 'Insert', items: '|' },
view: { title: 'View', items: 'visualaid |' },
format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat' },
table: { title: 'Table' },
tools: { title: 'Tools' }
};
var createMenuItem = function (menuItems, name) {
var menuItem;
if (name == '|') {
return { text: '|' };
}
menuItem = menuItems[name];
return menuItem;
};
var createMenu = function (editorMenuItems, settings, context) {
var menuButton, menu, menuItems, isUserDefined, removedMenuItems;
removedMenuItems = Tools.makeMap((settings.removed_menuitems || '').split(/[ ,]/));
// User defined menu
if (settings.menu) {
menu = settings.menu[context];
isUserDefined = true;
} else {
menu = defaultMenus[context];
}
if (menu) {
menuButton = { text: menu.title };
menuItems = [];
// Default/user defined items
Tools.each((menu.items || '').split(/[ ,]/), function (item) {
var menuItem = createMenuItem(editorMenuItems, item);
if (menuItem && !removedMenuItems[item]) {
menuItems.push(createMenuItem(editorMenuItems, item));
}
});
// Added though context
if (!isUserDefined) {
Tools.each(editorMenuItems, function (menuItem) {
if (menuItem.context == context) {
if (menuItem.separator == 'before') {
menuItems.push({ text: '|' });
}
if (menuItem.prependToContext) {
menuItems.unshift(menuItem);
} else {
menuItems.push(menuItem);
}
if (menuItem.separator == 'after') {
menuItems.push({ text: '|' });
}
}
});
}
for (var i = 0; i < menuItems.length; i++) {
if (menuItems[i].text == '|') {
if (i === 0 || i == menuItems.length - 1) {
menuItems.splice(i, 1);
}
}
}
menuButton.menu = menuItems;
if (!menuButton.menu.length) {
return null;
}
}
return menuButton;
};
var createMenuButtons = function (editor) {
var name, menuButtons = [], settings = editor.settings;
var defaultMenuBar = [];
if (settings.menu) {
for (name in settings.menu) {
defaultMenuBar.push(name);
}
} else {
for (name in defaultMenus) {
defaultMenuBar.push(name);
}
}
var enabledMenuNames = typeof settings.menubar == "string" ? settings.menubar.split(/[ ,]/) : defaultMenuBar;
for (var i = 0; i < enabledMenuNames.length; i++) {
var menu = enabledMenuNames[i];
menu = createMenu(editor.menuItems, editor.settings, menu);
if (menu) {
menuButtons.push(menu);
}
}
return menuButtons;
};
return {
createMenuButtons: createMenuButtons
};
}
);
/**
* Resize.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.Resize',
[
'tinymce.core.dom.DOMUtils'
],
function (DOMUtils) {
var DOM = DOMUtils.DOM;
var getSize = function (elm) {
return {
width: elm.clientWidth,
height: elm.clientHeight
};
};
var resizeTo = function (editor, width, height) {
var containerElm, iframeElm, containerSize, iframeSize, settings = editor.settings;
containerElm = editor.getContainer();
iframeElm = editor.getContentAreaContainer().firstChild;
containerSize = getSize(containerElm);
iframeSize = getSize(iframeElm);
if (width !== null) {
width = Math.max(settings.min_width || 100, width);
width = Math.min(settings.max_width || 0xFFFF, width);
DOM.setStyle(containerElm, 'width', width + (containerSize.width - iframeSize.width));
DOM.setStyle(iframeElm, 'width', width);
}
height = Math.max(settings.min_height || 100, height);
height = Math.min(settings.max_height || 0xFFFF, height);
DOM.setStyle(iframeElm, 'height', height);
editor.fire('ResizeEditor');
};
var resizeBy = function (editor, dw, dh) {
var elm = editor.getContentAreaContainer();
resizeTo(editor, elm.clientWidth + dw, elm.clientHeight + dh);
};
return {
resizeTo: resizeTo,
resizeBy: resizeBy
};
}
);
/**
* Sidebar.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.Sidebar',
[
'tinymce.core.util.Tools',
'tinymce.core.ui.Factory',
'tinymce.core.Env'
],
function (Tools, Factory, Env) {
var api = function (elm) {
return {
element: function () {
return elm;
}
};
};
var trigger = function (sidebar, panel, callbackName) {
var callback = sidebar.settings[callbackName];
if (callback) {
callback(api(panel.getEl('body')));
}
};
var hidePanels = function (name, container, sidebars) {
Tools.each(sidebars, function (sidebar) {
var panel = container.items().filter('#' + sidebar.name)[0];
if (panel && panel.visible() && sidebar.name !== name) {
trigger(sidebar, panel, 'onhide');
panel.visible(false);
}
});
};
var deactivateButtons = function (toolbar) {
toolbar.items().each(function (ctrl) {
ctrl.active(false);
});
};
var findSidebar = function (sidebars, name) {
return Tools.grep(sidebars, function (sidebar) {
return sidebar.name === name;
})[0];
};
var showPanel = function (editor, name, sidebars) {
return function (e) {
var btnCtrl = e.control;
var container = btnCtrl.parents().filter('panel')[0];
var panel = container.find('#' + name)[0];
var sidebar = findSidebar(sidebars, name);
hidePanels(name, container, sidebars);
deactivateButtons(btnCtrl.parent());
if (panel && panel.visible()) {
trigger(sidebar, panel, 'onhide');
panel.hide();
btnCtrl.active(false);
} else {
if (panel) {
panel.show();
trigger(sidebar, panel, 'onshow');
} else {
panel = Factory.create({
type: 'container',
name: name,
layout: 'stack',
classes: 'sidebar-panel',
html: ''
});
container.prepend(panel);
trigger(sidebar, panel, 'onrender');
trigger(sidebar, panel, 'onshow');
}
btnCtrl.active(true);
}
editor.fire('ResizeEditor');
};
};
var isModernBrowser = function () {
return !Env.ie || Env.ie >= 11;
};
var hasSidebar = function (editor) {
return isModernBrowser() && editor.sidebars ? editor.sidebars.length > 0 : false;
};
var createSidebar = function (editor) {
var buttons = Tools.map(editor.sidebars, function (sidebar) {
var settings = sidebar.settings;
return {
type: 'button',
icon: settings.icon,
image: settings.image,
tooltip: settings.tooltip,
onclick: showPanel(editor, sidebar.name, editor.sidebars)
};
});
return {
type: 'panel',
name: 'sidebar',
layout: 'stack',
classes: 'sidebar',
items: [
{
type: 'toolbar',
layout: 'stack',
classes: 'sidebar-toolbar',
items: buttons
}
]
};
};
return {
hasSidebar: hasSidebar,
createSidebar: createSidebar
};
}
);
/**
* SkinLoaded.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.SkinLoaded', [
],
function () {
var fireSkinLoaded = function (editor) {
var done = function () {
editor._skinLoaded = true;
editor.fire('SkinLoaded');
};
return function () {
if (editor.initialized) {
done();
} else {
editor.on('init', done);
}
};
};
return {
fireSkinLoaded: fireSkinLoaded
};
}
);
/**
* Iframe.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.modes.Iframe',
[
'tinymce.core.dom.DOMUtils',
'tinymce.core.ui.Factory',
'tinymce.core.util.Tools',
'tinymce.themes.modern.ui.A11y',
'tinymce.themes.modern.ui.Branding',
'tinymce.themes.modern.ui.ContextToolbars',
'tinymce.themes.modern.ui.Menubar',
'tinymce.themes.modern.ui.Resize',
'tinymce.themes.modern.ui.Sidebar',
'tinymce.themes.modern.ui.SkinLoaded',
'tinymce.themes.modern.ui.Toolbar'
],
function (DOMUtils, Factory, Tools, A11y, Branding, ContextToolbars, Menubar, Resize, Sidebar, SkinLoaded, Toolbar) {
var DOM = DOMUtils.DOM;
var switchMode = function (panel) {
return function (e) {
panel.find('*').disabled(e.mode === 'readonly');
};
};
var editArea = function (border) {
return {
type: 'panel',
name: 'iframe',
layout: 'stack',
classes: 'edit-area',
border: border,
html: ''
};
};
var editAreaContainer = function (editor) {
return {
type: 'panel',
layout: 'stack',
classes: 'edit-aria-container',
border: '1 0 0 0',
items: [
editArea('0'),
Sidebar.createSidebar(editor)
]
};
};
var render = function (editor, theme, args) {
var panel, resizeHandleCtrl, startSize, settings = editor.settings;
if (args.skinUiCss) {
DOM.styleSheetLoader.load(args.skinUiCss, SkinLoaded.fireSkinLoaded(editor));
}
panel = theme.panel = Factory.create({
type: 'panel',
role: 'application',
classes: 'tinymce',
style: 'visibility: hidden',
layout: 'stack',
border: 1,
items: [
settings.menubar === false ? null : { type: 'menubar', border: '0 0 1 0', items: Menubar.createMenuButtons(editor) },
Toolbar.createToolbars(editor, settings.toolbar_items_size),
Sidebar.hasSidebar(editor) ? editAreaContainer(editor) : editArea('1 0 0 0')
]
});
if (settings.resize !== false) {
resizeHandleCtrl = {
type: 'resizehandle',
direction: settings.resize,
onResizeStart: function () {
var elm = editor.getContentAreaContainer().firstChild;
startSize = {
width: elm.clientWidth,
height: elm.clientHeight
};
},
onResize: function (e) {
if (settings.resize === 'both') {
Resize.resizeTo(editor, startSize.width + e.deltaX, startSize.height + e.deltaY);
} else {
Resize.resizeTo(editor, null, startSize.height + e.deltaY);
}
}
};
}
// Add statusbar if needed
if (settings.statusbar !== false) {
panel.add({
type: 'panel', name: 'statusbar', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', ariaRoot: true, items: [
{ type: 'elementpath', editor: editor },
resizeHandleCtrl
]
});
}
editor.fire('BeforeRenderUI');
editor.on('SwitchMode', switchMode(panel));
panel.renderBefore(args.targetNode).reflow();
if (settings.readonly) {
editor.setMode('readonly');
}
if (args.width) {
DOM.setStyle(panel.getEl(), 'width', args.width);
}
// Remove the panel when the editor is removed
editor.on('remove', function () {
panel.remove();
panel = null;
});
// Add accesibility shortcuts
A11y.addKeys(editor, panel);
ContextToolbars.addContextualToolbars(editor);
Branding.setup(editor);
return {
iframeContainer: panel.find('#iframe')[0].getEl(),
editorContainer: panel.getEl()
};
};
return {
render: render
};
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.ui.FloatPanel',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.ui.FloatPanel');
}
);
/**
* Inline.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.modes.Inline',
[
'tinymce.core.util.Tools',
'tinymce.core.ui.Factory',
'tinymce.core.dom.DOMUtils',
'tinymce.core.ui.FloatPanel',
'tinymce.themes.modern.ui.Toolbar',
'tinymce.themes.modern.ui.Menubar',
'tinymce.themes.modern.ui.ContextToolbars',
'tinymce.themes.modern.ui.A11y',
'tinymce.themes.modern.ui.SkinLoaded'
],
function (Tools, Factory, DOMUtils, FloatPanel, Toolbar, Menubar, ContextToolbars, A11y, SkinLoaded) {
var render = function (editor, theme, args) {
var panel, inlineToolbarContainer, settings = editor.settings;
var DOM = DOMUtils.DOM;
if (settings.fixed_toolbar_container) {
inlineToolbarContainer = DOM.select(settings.fixed_toolbar_container)[0];
}
var reposition = function () {
if (panel && panel.moveRel && panel.visible() && !panel._fixed) {
// TODO: This is kind of ugly and doesn't handle multiple scrollable elements
var scrollContainer = editor.selection.getScrollContainer(), body = editor.getBody();
var deltaX = 0, deltaY = 0;
if (scrollContainer) {
var bodyPos = DOM.getPos(body), scrollContainerPos = DOM.getPos(scrollContainer);
deltaX = Math.max(0, scrollContainerPos.x - bodyPos.x);
deltaY = Math.max(0, scrollContainerPos.y - bodyPos.y);
}
panel.fixed(false).moveRel(body, editor.rtl ? ['tr-br', 'br-tr'] : ['tl-bl', 'bl-tl', 'tr-br']).moveBy(deltaX, deltaY);
}
};
var show = function () {
if (panel) {
panel.show();
reposition();
DOM.addClass(editor.getBody(), 'mce-edit-focus');
}
};
var hide = function () {
if (panel) {
// We require two events as the inline float panel based toolbar does not have autohide=true
panel.hide();
// All other autohidden float panels will be closed below.
FloatPanel.hideAll();
DOM.removeClass(editor.getBody(), 'mce-edit-focus');
}
};
var render = function () {
if (panel) {
if (!panel.visible()) {
show();
}
return;
}
// Render a plain panel inside the inlineToolbarContainer if it's defined
panel = theme.panel = Factory.create({
type: inlineToolbarContainer ? 'panel' : 'floatpanel',
role: 'application',
classes: 'tinymce tinymce-inline',
layout: 'flex',
direction: 'column',
align: 'stretch',
autohide: false,
autofix: true,
fixed: !!inlineToolbarContainer,
border: 1,
items: [
settings.menubar === false ? null : { type: 'menubar', border: '0 0 1 0', items: Menubar.createMenuButtons(editor) },
Toolbar.createToolbars(editor, settings.toolbar_items_size)
]
});
// Add statusbar
/*if (settings.statusbar !== false) {
panel.add({type: 'panel', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', items: [
{type: 'elementpath'}
]});
}*/
editor.fire('BeforeRenderUI');
panel.renderTo(inlineToolbarContainer || document.body).reflow();
A11y.addKeys(editor, panel);
show();
ContextToolbars.addContextualToolbars(editor);
editor.on('nodeChange', reposition);
editor.on('activate', show);
editor.on('deactivate', hide);
editor.nodeChanged();
};
settings.content_editable = true;
editor.on('focus', function () {
// Render only when the CSS file has been loaded
if (args.skinUiCss) {
DOM.styleSheetLoader.load(args.skinUiCss, render, render);
} else {
render();
}
});
editor.on('blur hide', hide);
// Remove the panel when the editor is removed
editor.on('remove', function () {
if (panel) {
panel.remove();
panel = null;
}
});
// Preload skin css
if (args.skinUiCss) {
DOM.styleSheetLoader.load(args.skinUiCss, SkinLoaded.fireSkinLoaded(editor));
}
return {};
};
return {
render: render
};
}
);
/**
* ResolveGlobal.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.core.ui.Throbber',
[
'global!tinymce.util.Tools.resolve'
],
function (resolve) {
return resolve('tinymce.ui.Throbber');
}
);
/**
* ProgressState.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.ui.ProgressState',
[
'tinymce.core.ui.Throbber'
],
function (Throbber) {
var setup = function (editor, theme) {
var throbber;
editor.on('ProgressState', function (e) {
throbber = throbber || new Throbber(theme.panel.getEl('body'));
if (e.state) {
throbber.show(e.time);
} else {
throbber.hide();
}
});
};
return {
setup: setup
};
}
);
/**
* Theme.js
*
* Released under LGPL License.
* Copyright (c) 1999-2016 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.themes.modern.Theme',
[
'global!window',
'tinymce.core.AddOnManager',
'tinymce.core.EditorManager',
'tinymce.core.Env',
'tinymce.core.ui.Api',
'tinymce.themes.modern.modes.Iframe',
'tinymce.themes.modern.modes.Inline',
'tinymce.themes.modern.ui.ProgressState',
'tinymce.themes.modern.ui.Resize'
],
function (window, AddOnManager, EditorManager, Env, Api, Iframe, Inline, ProgressState, Resize) {
var ThemeManager = AddOnManager.ThemeManager;
Api.appendTo(window.tinymce ? window.tinymce : {});
var renderUI = function (editor, theme, args) {
var settings = editor.settings;
var skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
if (skin) {
var skinUrl = settings.skin_url;
if (skinUrl) {
skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
} else {
skinUrl = EditorManager.baseURL + '/skins/' + skin;
}
args.skinUiCss = skinUrl + '/skin.min.css';
// Load content.min.css or content.inline.min.css
editor.contentCSS.push(skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css');
}
ProgressState.setup(editor, theme);
if (settings.inline) {
return Inline.render(editor, theme, args);
}
return Iframe.render(editor, theme, args);
};
ThemeManager.add('modern', function (editor) {
return {
renderUI: function (args) {
return renderUI(editor, this, args);
},
resizeTo: function (w, h) {
return Resize.resizeTo(editor, w, h);
},
resizeBy: function (dw, dh) {
return Resize.resizeBy(editor, dw, dh);
}
};
});
return function () {
};
}
);
dem('tinymce.themes.modern.Theme')();
})();
| mit |
tianon/debian-golang-pty | debian/helpers/create-upstream-tag.sh | 1391 | #!/bin/bash
set -e
upstreamCommit="$1"
dayVersion="${2:-1}"
if [ -z "$upstreamCommit" ]; then
echo >&2 "usage: $0 commit [day-version]"
echo >&2 " ie: $0 8d849acb"
echo >&2 " ie: $0 upstream # to tag the latest local upstream commit"
echo >&2 " ie: $0 upstream 2 # to tag a second commit in the same day"
echo >&2
echo >&2 'DO NOT USE BRANCH NAMES OR TAG NAMES FROM UPSTREAM!'
echo >&2 'ONLY COMMIT HASHES OR "upstream" WILL WORK PROPERLY!'
echo >&2
echo >&2 'Also, you _must_ update your upstream remote and branch first, because that'
echo >&2 'is where these commits come from ultimately.'
echo >&2 '(See also the "update-upstream-branch.sh" helper.)'
exit 1
fi
dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
"$dir/setup-upstream-remote.sh"
git fetch -qp --all || true
commit="$(git log -1 --date='short' --pretty='%h' "$upstreamCommit" --)"
unix="$(git log -1 --format='%at' "$commit" --)"
gitTime="$(TZ=UTC date --date="@$unix" +'%Y%m%d')"
version="0.0~git${gitTime}.${dayVersion}.${commit}"
echo
echo "commit $commit becomes version $version"
echo
tag="upstream/${version//'~'/_}"
( set -x; git tag -f "$tag" "$commit" )
echo
echo "local tag '$tag' created"
echo
echo 'use the following to push it:'
echo
echo " git push -f origin $tag:$tag"
echo
echo 'if this upstream version has not been merged into master yet, use:'
echo
echo " git merge $tag"
echo
| mit |
mitdbg/asciiclass | labs/lab7/code/src/test/SimpleShortestPathsVertex.java | 2846 | package test;
/*
* 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.
*/
import org.apache.giraph.Algorithm;
import org.apache.giraph.conf.LongConfOption;
import org.apache.giraph.edge.Edge;
import org.apache.giraph.graph.Vertex;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.FloatWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.log4j.Logger;
/**
* Demonstrates the basic Pregel shortest paths implementation.
*/
@Algorithm(
name = "Shortest paths",
description = "Finds all shortest paths from a selected vertex"
)
public class SimpleShortestPathsVertex extends
Vertex<LongWritable, DoubleWritable,
FloatWritable, DoubleWritable> {
/** The shortest paths id */
public static final LongConfOption SOURCE_ID =
new LongConfOption("SimpleShortestPathsVertex.sourceId", 1);
/** Class logger */
private static final Logger LOG =
Logger.getLogger(SimpleShortestPathsVertex.class);
/**
* Is this vertex the source id?
*
* @return True if the source id
*/
private boolean isSource() {
return getId().get() == SOURCE_ID.get(getConf());
}
@Override
public void compute(Iterable<DoubleWritable> messages) {
if (getSuperstep() == 0) {
setValue(new DoubleWritable(Double.MAX_VALUE));
}
double minDist = isSource() ? 0d : Double.MAX_VALUE;
for (DoubleWritable message : messages) {
minDist = Math.min(minDist, message.get());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Vertex " + getId() + " got minDist = " + minDist +
" vertex value = " + getValue());
}
if (minDist < getValue().get()) {
setValue(new DoubleWritable(minDist));
for (Edge<LongWritable, FloatWritable> edge : getEdges()) {
double distance = minDist + edge.getValue().get();
if (LOG.isDebugEnabled()) {
LOG.debug("Vertex " + getId() + " sent to " +
edge.getTargetVertexId() + " = " + distance);
}
sendMessage(edge.getTargetVertexId(), new DoubleWritable(distance));
}
}
voteToHalt();
}
}
| mit |
coolicer/shopshop | models/Product.js | 807 | module.exports = function(sequelize, DataTypes) {
var Product = sequelize.define('Product', {
ProductId: {
type: DataTypes.BIGINT,
primaryKey:true,
allowNull: false,
autoIncrement: true
},
ProductTypeId:{
type:DataTypes.BIGINT,
allowNull: false,
references : 'ProductType',
referencesKey:'ProductTypeId',
comment: "references对应的是表名"
} ,
productName:{
type:DataTypes.STRING,
allowNull: false
},
productDesc:{
type:DataTypes.STRING
},
mount:{
type:DataTypes.BIGINT
},
price:{
type:DataTypes.DECIMAL(10,2)
},
isSale:{
type:DataTypes.BOOLEAN
},
isVailed:{
type:DataTypes.BOOLEAN
}
});
return Product;
}; | mit |
0x0ade/GifToGomez | Properties/AssemblyInfo.cs | 981 | using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("GifToGomez")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("maik")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| mit |
nvisionative/Dnn.Platform | DNN Platform/DotNetNuke.Web/Api/Auth/BasicAuthMessageHandler.cs | 4146 | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Web.Api.Auth
{
using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Security.Principal;
using System.Text;
using System.Threading;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;
using DotNetNuke.Security.Membership;
using DotNetNuke.Web.ConfigSection;
public class BasicAuthMessageHandler : AuthMessageHandlerBase
{
private readonly Encoding _encoding = Encoding.GetEncoding("iso-8859-1");
public BasicAuthMessageHandler(bool includeByDefault, bool forceSsl)
: base(includeByDefault, forceSsl)
{
}
public override string AuthScheme => "Basic";
public override HttpResponseMessage OnInboundRequest(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (this.NeedsAuthentication(request))
{
var portalSettings = PortalController.Instance.GetCurrentPortalSettings();
if (portalSettings != null)
{
this.TryToAuthenticate(request, portalSettings.PortalId);
}
}
return base.OnInboundRequest(request, cancellationToken);
}
public override HttpResponseMessage OnOutboundResponse(HttpResponseMessage response, CancellationToken cancellationToken)
{
if (response.StatusCode == HttpStatusCode.Unauthorized && this.SupportsBasicAuth(response.RequestMessage))
{
response.Headers.WwwAuthenticate.Add(new AuthenticationHeaderValue(this.AuthScheme, "realm=\"DNNAPI\""));
}
return base.OnOutboundResponse(response, cancellationToken);
}
private bool SupportsBasicAuth(HttpRequestMessage request)
{
return !IsXmlHttpRequest(request);
}
private void TryToAuthenticate(HttpRequestMessage request, int portalId)
{
UserCredentials credentials = this.GetCredentials(request);
if (credentials == null)
{
return;
}
var status = UserLoginStatus.LOGIN_FAILURE;
string ipAddress = request.GetIPAddress();
UserInfo user = UserController.ValidateUser(portalId, credentials.UserName, credentials.Password, "DNN", string.Empty,
"a portal", ipAddress ?? string.Empty, ref status);
if (user != null)
{
SetCurrentPrincipal(new GenericPrincipal(new GenericIdentity(credentials.UserName, this.AuthScheme), null), request);
}
}
private UserCredentials GetCredentials(HttpRequestMessage request)
{
if (request?.Headers.Authorization == null)
{
return null;
}
if (request?.Headers.Authorization.Scheme.ToLower() != this.AuthScheme.ToLower())
{
return null;
}
string authorization = request?.Headers.Authorization.Parameter;
if (string.IsNullOrEmpty(authorization))
{
return null;
}
string decoded = this._encoding.GetString(Convert.FromBase64String(authorization));
string[] parts = decoded.Split(new[] { ':' }, 2);
if (parts.Length < 2)
{
return null;
}
return new UserCredentials(parts[0], parts[1]);
}
internal class UserCredentials
{
public UserCredentials(string userName, string password)
{
this.UserName = userName;
this.Password = password;
}
public string Password { get; set; }
public string UserName { get; set; }
}
}
}
| mit |
pharring/ApplicationInsights-dotnet | WEB/Src/WindowsServer/WindowsServer.Tests/Mock/HeartbeatProviderMock.cs | 2100 | namespace Microsoft.ApplicationInsights.WindowsServer.Mock
{
using System;
using System.Collections.Generic;
using Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing;
internal class HeartbeatProviderMock : IHeartbeatPropertyManager
{
public bool Enabled = true;
public TimeSpan Interval = TimeSpan.FromMinutes(15);
public List<string> ExcludedProps = new List<string>();
public List<string> ExcludedPropProviders = new List<string>();
public Dictionary<string, string> HbeatProps = new Dictionary<string, string>();
public Dictionary<string, bool> HbeatHealth = new Dictionary<string, bool>();
public bool IsHeartbeatEnabled { get => this.Enabled; set => this.Enabled = value; }
public TimeSpan HeartbeatInterval { get => this.Interval; set => this.Interval = value; }
public IList<string> ExcludedHeartbeatProperties => this.ExcludedProps;
public IList<string> ExcludedHeartbeatPropertyProviders => this.ExcludedPropProviders;
public bool AddHeartbeatProperty(string propertyName, string propertyValue, bool isHealthy)
{
if (!this.HbeatProps.ContainsKey(propertyName))
{
this.HbeatProps.Add(propertyName, propertyValue);
this.HbeatHealth.Add(propertyName, isHealthy);
return true;
}
return false;
}
public bool SetHeartbeatProperty(string propertyName, string propertyValue = null, bool? isHealthy = null)
{
if (!string.IsNullOrEmpty(propertyName) && this.HbeatProps.ContainsKey(propertyName))
{
if (!string.IsNullOrEmpty(propertyValue))
{
this.HbeatProps[propertyName] = propertyValue;
}
if (isHealthy.HasValue)
{
this.HbeatHealth[propertyName] = isHealthy.GetValueOrDefault(false);
}
return true;
}
return false;
}
}
}
| mit |
johnpankowicz/govmeeting | Utilities/PsScripts/tmp/Move-Docs.ps1 | 599 | # Temporary script to move some files.
$WORKSPACE_ROOT = "C:\GOVMEETING\_SOURCECODE"
$docs = $WORKSPACE_ROOT + "\src\WebUI\WebApp\clientapp\src\assets\docs"
Set-Location $docs
# foreach ($lang in "AR","BN", "DE", "ES", "FI", "FR", "HI", "IT", "PT", "SW", "ZH") {
# New-Item -Path $docs -Name $lang -ItemType "directory"
# }
Get-Childitem $docs -File | ForEach-Object {
$name = $_.Name
$parts = ($name).Split(".")
$lan = $parts[1]
if ($lan -ne "en") {
$newname = $parts[0] + ".md"
$dir = $lan.ToUpper()
Move-Item $name ($dir + "/" + $newname)
}
} | mit |
Bogdanp/modviz | tests/test_cli.py | 1467 | import bootstrap # noqa
import pytest
from modviz.cli import parse_arguments, validate_path, validate_fold_paths
def test_argument_parsing():
with pytest.raises(SystemExit):
parse_arguments([])
namespace = parse_arguments(["foo"])
assert namespace.path == "foo"
assert namespace.target is None
assert namespace.fold_paths is None
assert namespace.exclude_paths is None
namespace = parse_arguments(["foo", "-o", "test.html"])
assert namespace.path == "foo"
assert namespace.target is "test.html"
assert namespace.fold_paths is None
assert namespace.exclude_paths is None
namespace = parse_arguments(["foo", "-o", "test.html", "-e", "foo", "bar"])
assert namespace.path == "foo"
assert namespace.target is "test.html"
assert namespace.fold_paths is None
assert namespace.exclude_paths == ["foo", "bar"]
namespace = parse_arguments(["foo", "-o", "test.html", "-f", "foo", "bar"])
assert namespace.path == "foo"
assert namespace.target is "test.html"
assert namespace.fold_paths == ["foo", "bar"]
assert namespace.exclude_paths is None
def test_validate_path():
assert validate_path("/")
assert not validate_path("/imprettysureidontexist")
def test_validate_fold_paths():
root = "/"
assert validate_fold_paths(root, [])
assert validate_fold_paths(root, ["/a", "/b"])
with pytest.raises(ValueError):
validate_fold_paths(root, ["foo"])
| mit |
924ge/xpoint21 | www/wordpress/wordpress/wp-content/plugins/simple-membership/classes/class.swpm-utils-member.php | 3017 | <?php
/**
* SwpmMemberUtils
* All the utility functions related to member records should be added to this class
*/
class SwpmMemberUtils {
public static function is_member_logged_in() {
$auth = SwpmAuth::get_instance();
if ($auth->is_logged_in()) {
return true;
} else {
return false;
}
}
public static function get_logged_in_members_id() {
$auth = SwpmAuth::get_instance();
if (!$auth->is_logged_in()) {
return SwpmUtils::_("User is not logged in.");
}
return $auth->get('member_id');
}
public static function get_logged_in_members_username() {
$auth = SwpmAuth::get_instance();
if (!$auth->is_logged_in()) {
return SwpmUtils::_("User is not logged in.");
}
return $auth->get('user_name');
}
public static function get_logged_in_members_level() {
$auth = SwpmAuth::get_instance();
if (!$auth->is_logged_in()) {
return SwpmUtils::_("User is not logged in.");
}
return $auth->get('membership_level');
}
public static function get_logged_in_members_level_name() {
$auth = SwpmAuth::get_instance();
if ($auth->is_logged_in()) {
return $auth->get('alias');
}
return SwpmUtils::_("User is not logged in.");
}
public static function get_member_field_by_id($id, $field, $default = '') {
global $wpdb;
$query = "SELECT * FROM " . $wpdb->prefix . "swpm_members_tbl WHERE member_id = %d";
$userData = $wpdb->get_row($wpdb->prepare($query, $id));
if (isset($userData->$field)) {
return $userData->$field;
}
return apply_filters('swpm_get_member_field_by_id', $default, $id, $field);
}
public static function get_user_by_id($swpm_id) {
//Retrieves the SWPM user record for the given member ID
global $wpdb;
$query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}swpm_members_tbl WHERE member_id = %d", $swpm_id);
$result = $wpdb->get_row($query);
return $result;
}
public static function get_user_by_user_name($swpm_user_name) {
//Retrieves the SWPM user record for the given member username
global $wpdb;
$query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}swpm_members_tbl WHERE user_name = %s", $swpm_user_name);
$result = $wpdb->get_row($query);
return $result;
}
public static function get_user_by_email($swpm_email) {
//Retrieves the SWPM user record for the given member email address
global $wpdb;
$query = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}swpm_members_tbl WHERE email = %s", $swpm_email);
$result = $wpdb->get_row($query);
return $result;
}
public static function is_valid_user_name($user_name){
return preg_match("/^[a-zA-Z0-9!@#$%&+\/=?^_`{|}~\.-]+$/", $user_name)== 1;
}
}
| mit |
RichardHowells/Dnn.Platform | DNN Platform/DotNetNuke.Web.Deprecated/UI/WebControls/DnnListViewItem.cs | 1498 | #region Copyright
//
// DotNetNuke® - https://www.dnnsoftware.com
// Copyright (c) 2002-2018
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
#region Usings
using Telerik.Web.UI;
#endregion
namespace DotNetNuke.Web.UI.WebControls
{
public class DnnListViewItem : RadListViewItem
{
public DnnListViewItem(RadListViewItemType itemType, RadListView ownerView) : base(itemType, ownerView)
{
}
}
} | mit |
bburnichon/PHPExiftool | lib/PHPExiftool/Driver/Tag/KDCIFD/SerialNumber.php | 838 | <?php
/*
* This file is part of the PHPExifTool package.
*
* (c) Alchemy <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\KDCIFD;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class SerialNumber extends AbstractTag
{
protected $Id = 64000;
protected $Name = 'SerialNumber';
protected $FullName = 'Kodak::KDC_IFD';
protected $GroupName = 'KDC_IFD';
protected $g0 = 'MakerNotes';
protected $g1 = 'KDC_IFD';
protected $g2 = 'Image';
protected $Type = 'string';
protected $Writable = true;
protected $Description = 'Serial Number';
protected $flag_Permanent = true;
}
| mit |
bburnichon/PHPExiftool | lib/PHPExiftool/Driver/Tag/Qualcomm/R2TL84Tbl27.php | 850 | <?php
/*
* This file is part of the PHPExifTool package.
*
* (c) Alchemy <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\Qualcomm;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class R2TL84Tbl27 extends AbstractTag
{
protected $Id = 'r2_tl84_tbl[27]';
protected $Name = 'R2TL84Tbl27';
protected $FullName = 'Qualcomm::Main';
protected $GroupName = 'Qualcomm';
protected $g0 = 'MakerNotes';
protected $g1 = 'Qualcomm';
protected $g2 = 'Camera';
protected $Type = '?';
protected $Writable = false;
protected $Description = 'R2 TL84 Tbl 27';
protected $flag_Permanent = true;
}
| mit |
luanlv/lila | app/views/clas/teacherDashboard.scala | 10660 | package views.html.clas
import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.clas.{ Clas, ClasInvite, ClasProgress, Student }
import lila.common.String.html.richText
import lila.rating.PerfType
import lila.user.User
object teacherDashboard {
private[clas] def layout(
c: Clas,
students: List[Student.WithUser],
active: String
)(modifiers: Modifier*)(implicit ctx: Context) =
bits.layout(c.name, Left(c withStudents students.map(_.student)))(
cls := s"clas-show dashboard dashboard-teacher dashboard-teacher-$active",
div(cls := "clas-show__top")(
h1(dataIcon := "", cls := "text")(c.name),
st.nav(cls := "dashboard-nav")(
a(cls := active.active("overview"), href := routes.Clas.show(c.id.value))("Overview"),
a(cls := active.active("wall"), href := routes.Clas.wall(c.id.value))("News"),
a(
cls := active.active("progress"),
href := routes.Clas.progress(c.id.value, PerfType.Blitz.key, 7)
)(trans.clas.progress()),
a(cls := active.active("edit"), href := routes.Clas.edit(c.id.value))(trans.edit()),
a(cls := active.active("students"), href := routes.Clas.students(c.id.value))(
"Students"
)
)
),
standardFlash(),
c.archived map { archived =>
div(cls := "clas-show__archived archived")(
bits.showArchived(archived),
postForm(action := routes.Clas.archive(c.id.value, v = false))(
form3.submit(trans.clas.reopen(), icon = none)(cls := "confirm button-empty")
)
)
},
modifiers
)
def overview(
c: Clas,
students: List[Student.WithUser]
)(implicit ctx: Context) =
layout(c, students, "overview")(
div(cls := "clas-show__overview")(
c.desc.trim.nonEmpty option div(cls := "clas-show__desc")(richText(c.desc)),
div(cls := "clas-show__overview__manage")(
clas.teachers(c),
a(
href := routes.Clas.studentForm(c.id.value),
cls := "button button-clas text",
dataIcon := ""
)(trans.clas.addStudent())
)
),
if (students.isEmpty)
p(cls := "box__pad students__empty")(trans.clas.noStudents())
else
studentList(c, students)
)
def students(
c: Clas,
all: List[Student.WithUser],
invites: List[ClasInvite]
)(implicit ctx: Context) =
layout(c, all.filter(_.student.isActive), "students") {
val archived = all.filter(_.student.isArchived)
val inviteBox =
if (invites.isEmpty)
div(cls := "box__pad invites__empty")(h2(trans.clas.nbPendingInvitations(0)))
else
div(cls := "box__pad invites")(
h2(trans.clas.nbPendingInvitations.pluralSame(invites.size)),
table(cls := "slist")(
tbody(
invites.map { i =>
tr(
td(userIdLink(i.userId.some)),
td(i.realName),
td(
if (i.accepted has false) "Declined" else "Pending"
),
td(momentFromNow(i.created.at)),
td(
postForm(action := routes.Clas.invitationRevoke(i._id.value))(
submitButton(cls := "button button-red button-empty")("Revoke")
)
)
)
}
)
)
)
val archivedBox =
if (archived.isEmpty)
div(cls := "box__pad students__empty")(h2(trans.clas.noRemovedStudents()))
else
div(cls := "box__pad")(
h2(trans.clas.removedStudents()),
studentList(c, archived)
)
frag(inviteBox, archivedBox)
}
def unreasonable(c: Clas, students: List[Student.WithUser], active: String)(implicit ctx: Context) =
layout(c, students, active)(
div(cls := "box__pad students__empty")(
p(
"This feature is only available for classes of ",
lila.clas.Clas.maxStudents,
" or fewer students."
),
p(
"This class has ",
students.size,
" students. You could maybe create more classes to split the students."
)
)
)
def progress(
c: Clas,
students: List[Student.WithUser],
progress: ClasProgress
)(implicit ctx: Context) =
layout(c, students, "progress")(
progressHeader(c, progress.some),
div(cls := "students")(
table(cls := "slist slist-pad sortable")(
thead(
tr(
th(dataSortDefault)(
trans.clas.variantXOverLastY(progress.perfType.trans, trans.nbDays.txt(progress.days)),
dataSortNumberTh(trans.rating()),
dataSortNumberTh(trans.clas.progress()),
dataSortNumberTh(if (progress.isPuzzle) trans.puzzles() else trans.games()),
if (progress.isPuzzle) dataSortNumberTh(trans.clas.winrate())
else dataSortNumberTh(trans.clas.timePlaying())
)
),
tbody(
students.sortBy(_.user.username).map { case s @ Student.WithUser(_, user) =>
val prog = progress(user)
tr(
studentTd(c, s),
td(dataSort := user.perfs(progress.perfType).intRating, cls := "rating")(
user.perfs(progress.perfType).showRatingProvisional
),
td(dataSort := prog.ratingProgress)(
ratingProgress(prog.ratingProgress) | trans.clas.na.txt()
),
td(prog.nb),
if (progress.isPuzzle) td(dataSort := prog.winRate)(prog.winRate, "%")
else td(dataSort := prog.millis)(showPeriod(prog.period))
)
}
)
)
)
)
)
def learn(
c: Clas,
students: List[Student.WithUser],
basicCompletion: Map[User.ID, Int],
practiceCompletion: Map[User.ID, Int],
coordScores: Map[User.ID, chess.Color.Map[Int]]
)(implicit ctx: Context) =
layout(c, students, "progress")(
progressHeader(c, none),
div(cls := "students")(
table(cls := "slist slist-pad sortable")(
thead(
tr(
th(dataSortDefault)(
trans.clas.nbStudents.pluralSame(students.size),
dataSortNumberTh(trans.chessBasics()),
dataSortNumberTh(trans.practice()),
dataSortNumberTh(trans.coordinates.coordinates())
)
),
tbody(
students.sortBy(_.user.username).map { case s @ Student.WithUser(_, user) =>
val coord = coordScores.getOrElse(user.id, chess.Color.Map(0, 0))
tr(
studentTd(c, s),
td(dataSort := basicCompletion.getOrElse(user.id, 0))(
basicCompletion.getOrElse(user.id, 0).toString,
"%"
),
td(dataSort := practiceCompletion.getOrElse(user.id, 0))(
practiceCompletion.getOrElse(user.id, 0).toString,
"%"
),
td(dataSort := coord.white, cls := "coords")(
i(cls := "color-icon is white")(coord.white),
i(cls := "color-icon is black")(coord.black)
)
)
}
)
)
)
)
)
private def progressHeader(c: Clas, progress: Option[ClasProgress])(implicit ctx: Context) =
div(cls := "progress")(
div(cls := "progress-perf")(
label(trans.variant()),
div(cls := "progress-choices")(
List(
PerfType.Bullet,
PerfType.Blitz,
PerfType.Rapid,
PerfType.Classical,
PerfType.Correspondence,
PerfType.Puzzle
).map { pt =>
a(
cls := progress.map(_.perfType.key.active(pt.key)),
href := routes.Clas.progress(c.id.value, pt.key, progress.fold(7)(_.days))
)(pt.trans)
},
a(cls := progress.isEmpty.option("active"), href := routes.Clas.learn(c.id.value))(
trans.learnMenu()
)
)
),
progress.map { p =>
div(cls := "progress-days")(
label(trans.clas.overDays()),
div(cls := "progress-choices")(
List(1, 2, 3, 7, 10, 14, 21, 30, 60, 90).map { days =>
a(
cls := p.days.toString.active(days.toString),
href := routes.Clas.progress(c.id.value, p.perfType.key, days)
)(days)
}
)
)
}
)
private def studentList(c: Clas, students: List[Student.WithUser])(implicit ctx: Context) =
div(cls := "students")(
table(cls := "slist slist-pad sortable")(
thead(
tr(
th(dataSortDefault)(trans.clas.nbStudents(students.size)),
dataSortNumberTh(trans.rating()),
dataSortNumberTh(trans.games()),
dataSortNumberTh(trans.puzzles()),
dataSortNumberTh(trans.clas.lastActiveDate()),
th(iconTag("")(title := trans.clas.managed.txt()))
)
),
tbody(
students.sortBy(_.user.username).map { case s @ Student.WithUser(student, user) =>
tr(
studentTd(c, s),
td(dataSort := user.perfs.bestRating, cls := "rating")(user.best3Perfs.map {
showPerfRating(user, _)
}),
td(user.count.game.localize),
td(user.perfs.puzzle.nb),
td(dataSort := user.seenAt.map(_.getMillis.toString))(user.seenAt.map(momentFromNowOnce)),
td(
dataSort := (if (student.managed) 1 else 0),
student.managed option iconTag("")(title := trans.clas.managed.txt())
)
)
}
)
)
)
private def studentTd(c: Clas, s: Student.WithUser)(implicit ctx: Context) =
td(
a(href := routes.Clas.studentShow(c.id.value, s.user.username))(
userSpan(
s.user,
name = span(
s.user.username,
em(s.student.realName)
).some,
withTitle = false
)
)
)
}
| mit |
railt/railt | packages/SDL/src/CompilerInterface.php | 989 | <?php
/**
* This file is part of Railt package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Railt\SDL;
use GraphQL\Contracts\TypeSystem\SchemaInterface;
use Phplrt\Contracts\Source\ReadableInterface;
/**
* Interface CompilerInterface
*/
interface CompilerInterface
{
/**
* Loads GraphQL source into the compiler.
*
* @param ReadableInterface|string|resource|mixed $source
* @param array $variables
* @return CompilerInterface|$this
*/
public function preload($source, array $variables = []): self;
/**
* Compiles the sources and all previously loaded types
* into the final document.
*
* @param ReadableInterface|string|resource|mixed $source
* @param array $variables
* @return SchemaInterface
*/
public function compile($source, array $variables = []): SchemaInterface;
}
| mit |
anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_commoner_tatooine_rodian_male_04.py | 466 | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_commoner_tatooine_rodian_male_04.iff"
result.attribute_template_id = 9
result.stfName("npc_name","rodian_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | mit |
Bingle-labake/coollive.com.cn | public/data/static/assets/upload_img/css/diyUpload.css | 3409 | @charset "utf-8";
/* CSS Document*/
.parentFileBox {
width:auto;
height:auto;
overflow:hidden;
position:relative;
}
.parentFileBox>.fileBoxUl {
position:relative;
width:100%;
height:auto;
overflow:hidden;
padding-bottom:5px;
}
.parentFileBox>.fileBoxUl>li {
float:left;
border:1px solid #09F;
border-radius:5px;
width:170px;
height:150px;
margin-top:5px;
margin-left:5px;
overflow:hidden;
position:relative;
background-color:#099;
}
.parentFileBox>.fileBoxUl>li>.viewThumb {
position:absolute;
top:0;
left:0;
width:170px;
height:150px;
overflow:hidden;
}
.parentFileBox>.fileBoxUl>li>.viewThumb>img {
width:100%;
height:100%;
}
.parentFileBox>.fileBoxUl>li>.diyCancel,.parentFileBox>.fileBoxUl>li>.diySuccess {
position:absolute;
width:32px;
height:32px;
top:2px;
right:2px;
cursor:pointer;
display:none;
}
.parentFileBox>.fileBoxUl>li>.diyCancel {
background:url(../images/x_alt.png) no-repeat;
}
.parentFileBox>.fileBoxUl>li>.diySuccess {
background:url(../images/check_alt.png) no-repeat;
cursor:default;
}
.parentFileBox>.fileBoxUl>li>.diyFileName {
position:absolute;
bottom:0px;
left:0px;
width:100%;
height:20px;
line-height:20px;
text-align:center;
color:#fff;
font-size:12px;
display:none;
background:url(../images/bgblack.png);
}
.parentFileBox>.fileBoxUl>li>.diyBar {
top:0;
left:0;
position: absolute;
width: 170px;
height: 150px;
line-height:150px;
background:url(../images/bgblack.png);
display:none;
}
.parentFileBox>.fileBoxUl>li>.diyBar>.diyProgressText {
font-size:14px;
text-align:center;
color:#FFF;
position:relative;
z-index:99;
}
.parentFileBox>.fileBoxUl>li>.diyBar>.diyProgress {
position:absolute;
left:0;
top:42%;
height:24px;
width:100%;
background-color:#09F;
filter:alpha(opacity=70);
-moz-opacity:0.7;
opacity:0.7;
z-index:97;
}
.parentFileBox>.diyButton {
width:100%;
margin-top:5px;
margin-bottom:5px;
height:20px;
line-height:20px;
text-align:center;
}
.parentFileBox>.diyButton>a {
padding:5px 10px 5px 10px;
background-color:#EB5F21;
color:#FFF;
font-size:12px;
text-decoration:none;
border-radius:3px;
}
.parentFileBox>.diyButton>a:hover {
background-color:#ed6d34;
color:#FFF;
}
.parentFileBox>.fileBoxUl>li:hover {
-moz-box-shadow: 3px 3px 4px #FF0;
-webkit-box-shadow: 3px 3px 4px #FF0;
box-shadow: 3px 3px 4px #FF0;
}
.parentFileBox>.fileBoxUl>.diyUploadHover:hover .diyCancel {
display:block;
}
.parentFileBox>.fileBoxUl>li:hover .diyFileName {
display:block;
}
.avi_diy_bg,.txt_diy_bg,.doc_diy_bg,.zip_diy_bg,.csv_diy_bg,.xls_diy_bg,.mp3_diy_bg,.pdf_diy_bg,.rar_diy_bg {
background-position:center;
background-repeat:no-repeat;
}
.avi_diy_bg {
background-image:url(../images/filebg/avi.png);
}
.txt_diy_bg {
background-image:url(../images/filebg/txt.png);
}
.doc_diy_bg {
background-image:url(../images/filebg/doc.png);
}
.zip_diy_bg {
background-image:url(../images/filebg/zip.png);
}
.csv_diy_bg {
background-image:url(../images/filebg/csv.png);
}
.xls_diy_bg {
background-image:url(../images/filebg/xls.png);
}
.mp3_diy_bg {
background-image:url(../images/filebg/mp3.png);
}
.pdf_diy_bg {
background-image:url(../images/filebg/pdf.png);
}
.rar_diy_bg {
background-image:url(../images/filebg/rar.png);
}
| mit |
oliviertassinari/material-ui | packages/mui-icons-material/lib/BatteryStdSharp.js | 497 | "use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon"));
var _jsxRuntime = require("react/jsx-runtime");
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
d: "M17 4h-3V2h-4v2H7v18h10V4z"
}), 'BatteryStdSharp');
exports.default = _default; | mit |
monstaHD/integral | web/bundles/integralcore/css/style.css | 3607 | body {
background-image: url("../images/hexellence.png");
font-family: Helvetica, Arial;
color: black;
width: 100%;
}
.container {
width: 1024px;
}
/* Menu bar */
.menu-item {
font-family: 'Harabara', Arial;
font-size: 28px;
text-align: center;
margin: 12px 0 12px 0;
}
.active-menu-item {
color: #FF0133;
}
.menu-item:hover {
cursor: pointer;
}
/* Slider */
.slider {
position: relative;
}
#gradient-line {
background: transparent;
background: -moz-linear-gradient(left, transparent 0%, #555555 50%, transparent 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,transparent), color-stop(50%,#555555), color-stop(100%,transparent));
background: -webkit-linear-gradient(left, transparent 0%,#555555 50%,transparent 100%);
background: -o-linear-gradient(left, transparent 0%,#555555 50%,transparent 100%);
background: -ms-linear-gradient(left, transparent 0%,#555555 50%,transparent 100%);
background: linear-gradient(to right, transparent 0%,#555555 50%,transparent 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='transparent', endColorstr='transparent',GradientType=0 );
height: 1px;
width: 100%;
}
.slide {
display: none;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}
.active-slide {
display: block;
}
/* Computate slide */
.dropdown-item {
font-weight: bold;
text-align: right;
}
.dropdown-items {
list-style: none;
font-size: 21px;
text-indent: -40px;
position: relative;
top: 177px;
padding-right: 20px;
display: none;
}
.dropdown-items:hover {
cursor: pointer;
}
.active-dropdown-item {
font-size: 21px;
color: #FF0133;
text-indent: -10px;
position: relative;
top: 180px;
padding-right: 5px;
}
.active-dropdown-item a {
text-decoration: none;
color: #FF0133;
}
.active-dropdown-item:hover {
cursor: pointer;
}
input {
font-family: Verdana;
font-size: 17.5px;
text-align: center;
border: 2px solid #FF0133;
border-radius: 7px;
outline-style: none;
width: 160px;
}
input::selection {
color: white;
background: #555555;
}
#upper-domain {
position: relative;
top: 70px;
}
#lower-domain {
position: relative;
top: 280px;
left: -164px;
}
#function-input {
font-size: 19px;
width: 340px;
position: relative;
top: 148px;
left: 94px;
}
#integral-sign {
position: absolute;
top: 105px;
left: 64px;
}
#integral-sign:hover {
cursor: pointer;
}
#comp-button {
font-size: 33px;
font-weight: bold;
font-family: Helvetica, Arial;
background: transparent;
border: 2px solid;
height: 51px;
width: 51px;
position: relative;
top: 170px;
left: -12px;
}
#infotable {
border: 2px dashed #555555;
border-radius: 9px;
position: relative;
top: 124px;
left: -24px;
height: 140px;
width: 310px;
}
#infotable li {
list-style: none;
text-align: center;
text-indent: -40px;
margin: 14px 0;
}
#computationMessage {
font-size: 19px;
font-style: italic;
}
#computationValue {
font-size: 21px;
}
#computationEps {
font-size: 17px;
}
/* Syntax slide */
code {
background: inherit;
font-weight: bold;
color: #555555;
}
.syntax-first p {
font-size: 23px;
text-indent: 30px;
margin-top: -10px;
}
#syntax h2 {
font-size: 22px;
font-weight: bold;
text-indent: 32px;
}
#syntax ul {
list-style: none;
text-indent: -10px;
font-size: 15px;
}
#syntax ul code {
font-size: 17px;
}
/* Other lists */
#credits ul li{
font-size: 19px;
margin: 30px;
}
#help ul {
margin: 36px;
}
#help ul li {
font-size: 19px;
margin: 5px;
}
#credits a {
color: #555555;
}
#credits code, #help code {
font-size: 18px;
} | mit |
Dackng/eh-unmsm-client | node_modules/bootstrap-loader/lib/bootstrap.config.js | 5934 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createConfig;
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _fs = require('fs');
var _fs2 = _interopRequireDefault(_fs);
var _jsYaml = require('js-yaml');
var _jsYaml2 = _interopRequireDefault(_jsYaml);
var _stripJsonComments = require('strip-json-comments');
var _stripJsonComments2 = _interopRequireDefault(_stripJsonComments);
var _fileExists = require('./utils/fileExists');
var _fileExists2 = _interopRequireDefault(_fileExists);
var _selectModules = require('./utils/selectModules');
var _selectModules2 = _interopRequireDefault(_selectModules);
var _selectUserModules = require('./utils/selectUserModules');
var _selectUserModules2 = _interopRequireDefault(_selectUserModules);
var _getEnvProp = require('./utils/getEnvProp');
var _getEnvProp2 = _interopRequireDefault(_getEnvProp);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* ======= Fetching config */
var DEFAULT_VERSION = 3;
var SUPPORTED_VERSIONS = [3, 4];
var CONFIG_FILE = '.bootstraprc';
function resolveDefaultConfigPath(bootstrapVersion) {
return _path2.default.resolve(__dirname, '../' + CONFIG_FILE + '-' + bootstrapVersion + '-default');
}
function parseConfigFile(configFilePath) {
var configContent = (0, _stripJsonComments2.default)(_fs2.default.readFileSync(configFilePath, 'utf8'));
try {
return _jsYaml2.default.safeLoad(configContent);
} catch (YAMLException) {
throw new Error('Config file cannot be parsed: ' + configFilePath + '\'');
}
}
function readDefaultConfig() {
var configFilePath = resolveDefaultConfigPath(DEFAULT_VERSION);
var defaultConfig = parseConfigFile(configFilePath);
return {
defaultConfig: defaultConfig,
configFilePath: configFilePath
};
}
// default location .bootstraprc
function defaultUserConfigPath() {
return _path2.default.resolve(__dirname, '../../../' + CONFIG_FILE);
}
function readUserConfig(customConfigFilePath) {
var userConfig = parseConfigFile(customConfigFilePath);
var bootstrapVersion = userConfig.bootstrapVersion;
if (!bootstrapVersion) {
throw new Error('\nBootstrap version not found in your \'.bootstraprc\'.\nMake sure it\'s set to 3 or 4. Like this:\n bootstrapVersion: 4\n ');
}
if (SUPPORTED_VERSIONS.indexOf(parseInt(bootstrapVersion, 10)) === -1) {
throw new Error('\nUnsupported Bootstrap version in your \'.bootstraprc\'.\nMake sure it\'s set to 3 or 4. Like this:\n bootstrapVersion: 4\n ');
}
var defaultConfigFilePath = resolveDefaultConfigPath(bootstrapVersion);
var defaultConfig = parseConfigFile(defaultConfigFilePath);
return {
userConfig: userConfig,
defaultConfig: defaultConfig
};
}
/* ======= Exports */
function createConfig(_ref) {
var extractStyles = _ref.extractStyles,
customConfigFilePath = _ref.customConfigFilePath;
// .bootstraprc-{3,4}-default, per the DEFAULT_VERSION
// otherwise read user provided config file
var userConfigFilePath = null;
if (customConfigFilePath) {
userConfigFilePath = _path2.default.resolve(__dirname, customConfigFilePath);
} else {
var defaultLocationUserConfigPath = defaultUserConfigPath();
if ((0, _fileExists2.default)(defaultLocationUserConfigPath)) {
userConfigFilePath = defaultLocationUserConfigPath;
}
}
if (!userConfigFilePath) {
var _readDefaultConfig = readDefaultConfig(),
_defaultConfig = _readDefaultConfig.defaultConfig,
_configFilePath = _readDefaultConfig.configFilePath;
return {
bootstrapVersion: parseInt(_defaultConfig.bootstrapVersion, 10),
loglevel: _defaultConfig.loglevel,
useFlexbox: _defaultConfig.useFlexbox,
preBootstrapCustomizations: _defaultConfig.preBootstrapCustomizations,
bootstrapCustomizations: _defaultConfig.bootstrapCustomizations,
appStyles: _defaultConfig.appStyles,
useCustomIconFontPath: _defaultConfig.useCustomIconFontPath,
extractStyles: extractStyles || (0, _getEnvProp2.default)('extractStyles', _defaultConfig),
styleLoaders: (0, _getEnvProp2.default)('styleLoaders', _defaultConfig),
styles: (0, _selectModules2.default)(_defaultConfig.styles),
scripts: (0, _selectModules2.default)(_defaultConfig.scripts),
configFilePath: _configFilePath
};
}
var configFilePath = userConfigFilePath;
var _readUserConfig = readUserConfig(configFilePath),
userConfig = _readUserConfig.userConfig,
defaultConfig = _readUserConfig.defaultConfig;
var configDir = _path2.default.dirname(configFilePath);
var preBootstrapCustomizations = userConfig.preBootstrapCustomizations && _path2.default.resolve(configDir, userConfig.preBootstrapCustomizations);
var bootstrapCustomizations = userConfig.bootstrapCustomizations && _path2.default.resolve(configDir, userConfig.bootstrapCustomizations);
var appStyles = userConfig.appStyles && _path2.default.resolve(configDir, userConfig.appStyles);
return {
bootstrapVersion: parseInt(userConfig.bootstrapVersion, 10),
loglevel: userConfig.loglevel,
preBootstrapCustomizations: preBootstrapCustomizations,
bootstrapCustomizations: bootstrapCustomizations,
appStyles: appStyles,
disableSassSourceMap: userConfig.disableSassSourceMap,
disableResolveUrlLoader: userConfig.disableResolveUrlLoader,
useFlexbox: userConfig.useFlexbox,
useCustomIconFontPath: userConfig.useCustomIconFontPath,
extractStyles: extractStyles || (0, _getEnvProp2.default)('extractStyles', userConfig),
styleLoaders: (0, _getEnvProp2.default)('styleLoaders', userConfig),
styles: (0, _selectUserModules2.default)(userConfig.styles, defaultConfig.styles),
scripts: (0, _selectUserModules2.default)(userConfig.scripts, defaultConfig.scripts),
configFilePath: configFilePath
};
} | mit |
fernandoval/FVAL-PHP-Framework | springy/system_errors_create_table.sql | 430 | CREATE TABLE `%table_name%` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`error_code` CHAR(8) NOT NULL,
`description` TEXT NOT NULL,
`details` LONGTEXT NOT NULL,
`occurrences` INT(10) UNSIGNED NOT NULL DEFAULT '1',
`last_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE INDEX `error_code` (`error_code`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
;
| mit |
j-froehlich/magento2_wk | vendor/magento/module-catalog/Model/Product/Gallery/Entry.php | 4135 | <?php
/**
*
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Catalog\Model\Product\Gallery;
use Magento\Framework\Model\AbstractExtensibleModel;
use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface;
use Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryExtensionInterface;
/**
* @codeCoverageIgnore
*/
class Entry extends AbstractExtensibleModel implements ProductAttributeMediaGalleryEntryInterface
{
/**
* Retrieve gallery entry ID
*
* @return int
*/
public function getId()
{
return $this->getData(self::ID);
}
/**
* Get media type
*
* @return string
*/
public function getMediaType()
{
return $this->getData(self::MEDIA_TYPE);
}
/**
* Retrieve gallery entry alternative text
*
* @return string
*/
public function getLabel()
{
return $this->getData(self::LABEL);
}
/**
* Retrieve gallery entry position (sort order)
*
* @return int
*/
public function getPosition()
{
return $this->getData(self::POSITION);
}
/**
* Check if gallery entry is hidden from product page
*
* @return bool
*/
public function isDisabled()
{
return $this->getData(self::DISABLED);
}
/**
* Retrieve gallery entry image types (thumbnail, image, small_image etc)
*
* @return string[]
*/
public function getTypes()
{
return $this->getData(self::TYPES);
}
/**
* Get file path
*
* @return string
*/
public function getFile()
{
return $this->getData(self::FILE);
}
/**
* @return \Magento\Framework\Api\Data\ImageContentInterface|null
*/
public function getContent()
{
return $this->getData(self::CONTENT);
}
/**
* Set media type
*
* @param string $mediaType
* @return $this
*/
public function setMediaType($mediaType)
{
return $this->setData(self::MEDIA_TYPE, $mediaType);
}
/**
* Set gallery entry alternative text
*
* @param string $label
* @return $this
*/
public function setLabel($label)
{
return $this->setData(self::LABEL, $label);
}
/**
* Set gallery entry position (sort order)
*
* @param int $position
* @return $this
*/
public function setPosition($position)
{
return $this->setData(self::POSITION, $position);
}
/**
* Set whether gallery entry is hidden from product page
*
* @param bool $disabled
* @return $this
*/
public function setDisabled($disabled)
{
return $this->setData(self::DISABLED, $disabled);
}
/**
* Set gallery entry image types (thumbnail, image, small_image etc)
*
* @param string[] $types
* @return $this
*/
public function setTypes(array $types = null)
{
return $this->setData(self::TYPES, $types);
}
/**
* Set file path
*
* @param string $file
* @return $this
*/
public function setFile($file)
{
return $this->setData(self::FILE, $file);
}
/**
* Set media gallery content
*
* @param $content \Magento\Framework\Api\Data\ImageContentInterface
* @return $this
*/
public function setContent($content)
{
return $this->setData(self::CONTENT, $content);
}
/**
* {@inheritdoc}
*
* @return ProductAttributeMediaGalleryEntryExtensionInterface|null
*/
public function getExtensionAttributes()
{
return $this->_getExtensionAttributes();
}
/**
* {@inheritdoc}
*
* @param ProductAttributeMediaGalleryEntryExtensionInterface $extensionAttributes
* @return $this
*/
public function setExtensionAttributes(ProductAttributeMediaGalleryEntryExtensionInterface $extensionAttributes)
{
return $this->_setExtensionAttributes($extensionAttributes);
}
}
| mit |
nick-thompson/dsp | README.md | 2265 | # dsp
> A collection of digital signal processing concepts explored in Python.
Without the full backstory, this repository is probably very convoluted. The work here follows from an exploration
of sound design in Web Audio, which I wrote about
[on my blog](http://nickwritesablog.com/sound-design-in-web-audio-neurofunk-bass-part-1/). If you're interested,
I suggest you start there and read through the short series.
In particular, the concepts covered here revolve around an examination of the phasing, flanging characteristics of
the old school Drum n' Bass reese bass, and the application of those characteristics in modern sound design.
That bit is explained in the blog series mentioned above. I continued down this path in search of a way to render
these characteristics in real time, learning and exploring as much of the digital signal processing world as I
could to answer such a question. That led me first into wavetable synthesis, and more recently into the more simple
digital filters.
Many of the modules written here are well documented, and can be invoked directly (e.g. `python -m filters.allpass`)
to visualize characteristics of the module and help explain its purpose.
## License
Copyright (c) 2015 Nick Thompson
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
| mit |
hanumesh/video-web | node_modules/webrtcsupport/README.md | 1936 | # webrtcsupport
## What is this?
A tiny browser module for detecting support for WebRTC and also for extracting the necessary constructors such as `PeerConnection`, `SessionDescription`, and `IceCandidate`.
Suitable for use with browserify/CommonJS on the client.
If you're not using browserify or you want AMD support use `webrtcsupport.bundle.js`.
This tiny module is used by [SimpleWebRTC](http://simplewebrtc.com), but obviously can be used by itself.
## Installing
```
npm install webrtcsupport
```
## How to use it
Simply require it and it returns a simple object with support flags and useful support info and normalized constructors for various WebRTC related items.
```js
var webrtcSupport = require('webrtcsupport');
// it returns an object with the following:
{
support: // boolean whether basic WebRTC support exists
browserVersion: // integer, browser version
supportRTCPeerConnection: // boolean whether basic support for RTCPeerConnection exists
supportVp8: // boolean guess whether VP8 is supported by the browser
supportGetUserMedia: // boolean whether getUserMedia is supported by the browser
supportDataChannel: // boolean whether WebRTC data channels are supported
supportWebAudio: // boolean whether WebAudio API is supported
supportMediaStream: // boolean whether MediaStream is supported
supportScreenSharing: // boolean guess of whether screensharing is supported,
prefix: // returns browser prefix (either moz or webkit for now)
AudioContext: // the audio context constructor from the web audio API
PeerConnection: // constructor for creating a peer connection
SessionDescription: // constructor for RTCSessionDescriptions
IceCandidate: // constructor for ice candidate
getUserMedia: // getUserMedia function
}
```
## License
MIT
## Created By
If you like this, follow: [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on twitter.
| mit |
johnathan99j/history-project | _people/omid_faramarzi.md | 94 | ---
title: Omid Faramarzi
headshot: QQsM7HS
gender: male
submitted: false
graduated: 2016
---
| mit |
madridonrails/StrategyMOR | vendor/rails/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb | 3330 | # Retain for backward compatibility. Methods are now included in Class.
module ClassInheritableAttributes # :nodoc:
end
# Allows attributes to be shared within an inheritance hierarchy, but where each descendant gets a copy of
# their parents' attributes, instead of just a pointer to the same. This means that the child can add elements
# to, for example, an array without those additions being shared with either their parent, siblings, or
# children, which is unlike the regular class-level attributes that are shared across the entire hierarchy.
class Class # :nodoc:
def class_inheritable_reader(*syms)
syms.each do |sym|
class_eval <<-EOS
def self.#{sym}
read_inheritable_attribute(:#{sym})
end
def #{sym}
self.class.#{sym}
end
EOS
end
end
def class_inheritable_writer(*syms)
syms.each do |sym|
class_eval <<-EOS
def self.#{sym}=(obj)
write_inheritable_attribute(:#{sym}, obj)
end
def #{sym}=(obj)
self.class.#{sym} = obj
end
EOS
end
end
def class_inheritable_array_writer(*syms)
syms.each do |sym|
class_eval <<-EOS
def self.#{sym}=(obj)
write_inheritable_array(:#{sym}, obj)
end
def #{sym}=(obj)
self.class.#{sym} = obj
end
EOS
end
end
def class_inheritable_hash_writer(*syms)
syms.each do |sym|
class_eval <<-EOS
def self.#{sym}=(obj)
write_inheritable_hash(:#{sym}, obj)
end
def #{sym}=(obj)
self.class.#{sym} = obj
end
EOS
end
end
def class_inheritable_accessor(*syms)
class_inheritable_reader(*syms)
class_inheritable_writer(*syms)
end
def class_inheritable_array(*syms)
class_inheritable_reader(*syms)
class_inheritable_array_writer(*syms)
end
def class_inheritable_hash(*syms)
class_inheritable_reader(*syms)
class_inheritable_hash_writer(*syms)
end
def inheritable_attributes
@inheritable_attributes ||= {}
end
def write_inheritable_attribute(key, value)
inheritable_attributes[key] = value
end
def write_inheritable_array(key, elements)
write_inheritable_attribute(key, []) if read_inheritable_attribute(key).nil?
write_inheritable_attribute(key, read_inheritable_attribute(key) + elements)
end
def write_inheritable_hash(key, hash)
write_inheritable_attribute(key, {}) if read_inheritable_attribute(key).nil?
write_inheritable_attribute(key, read_inheritable_attribute(key).merge(hash))
end
def read_inheritable_attribute(key)
inheritable_attributes[key]
end
def reset_inheritable_attributes
inheritable_attributes.clear
end
private
def inherited_with_inheritable_attributes(child)
inherited_without_inheritable_attributes(child) if respond_to?(:inherited_without_inheritable_attributes)
new_inheritable_attributes = inheritable_attributes.inject({}) do |memo, (key, value)|
memo.update(key => (value.dup rescue value))
end
child.instance_variable_set('@inheritable_attributes', new_inheritable_attributes)
end
alias inherited_without_inheritable_attributes inherited
alias inherited inherited_with_inheritable_attributes
end
| mit |
fstonezst/LightGBM | include/LightGBM/metric.h | 3500 | #ifndef LIGHTGBM_METRIC_H_
#define LIGHTGBM_METRIC_H_
#include <LightGBM/meta.h>
#include <LightGBM/config.h>
#include <LightGBM/dataset.h>
#include <LightGBM/objective_function.h>
#include <vector>
namespace LightGBM {
/*!
* \brief The interface of metric.
* Metric is used to calculate metric result
*/
class Metric {
public:
/*! \brief virtual destructor */
virtual ~Metric() {}
/*!
* \brief Initialize
* \param test_name Specific name for this metric, will output on log
* \param metadata Label data
* \param num_data Number of data
*/
virtual void Init(const Metadata& metadata, data_size_t num_data) = 0;
virtual const std::vector<std::string>& GetName() const = 0;
virtual double factor_to_bigger_better() const = 0;
/*!
* \brief Calcaluting and printing metric result
* \param score Current prediction score
*/
virtual std::vector<double> Eval(const double* score, const ObjectiveFunction* objective) const = 0;
Metric() = default;
/*! \brief Disable copy */
Metric& operator=(const Metric&) = delete;
/*! \brief Disable copy */
Metric(const Metric&) = delete;
/*!
* \brief Create object of metrics
* \param type Specific type of metric
* \param config Config for metric
*/
LIGHTGBM_EXPORT static Metric* CreateMetric(const std::string& type, const MetricConfig& config);
};
/*!
* \brief Static class, used to calculate DCG score
*/
class DCGCalculator {
public:
/*!
* \brief Initial logic
* \param label_gain Gain for labels, default is 2^i - 1
*/
static void Init(std::vector<double> label_gain);
/*!
* \brief Calculate the DCG score at position k
* \param k The position to evaluate
* \param label Pointer of label
* \param score Pointer of score
* \param num_data Number of data
* \return The DCG score
*/
static double CalDCGAtK(data_size_t k, const float* label,
const double* score, data_size_t num_data);
/*!
* \brief Calculate the DCG score at multi position
* \param ks The positions to evaluate
* \param label Pointer of label
* \param score Pointer of score
* \param num_data Number of data
* \param out Output result
*/
static void CalDCG(const std::vector<data_size_t>& ks,
const float* label, const double* score,
data_size_t num_data, std::vector<double>* out);
/*!
* \brief Calculate the Max DCG score at position k
* \param k The position want to eval at
* \param label Pointer of label
* \param num_data Number of data
* \return The max DCG score
*/
static double CalMaxDCGAtK(data_size_t k,
const float* label, data_size_t num_data);
/*!
* \brief Calculate the Max DCG score at multi position
* \param ks The positions want to eval at
* \param label Pointer of label
* \param num_data Number of data
* \param out Output result
*/
static void CalMaxDCG(const std::vector<data_size_t>& ks,
const float* label, data_size_t num_data, std::vector<double>* out);
/*!
* \brief Get discount score of position k
* \param k The position
* \return The discount of this position
*/
inline static double GetDiscount(data_size_t k) { return discount_[k]; }
private:
/*! \brief store gains for different label */
static std::vector<double> label_gain_;
/*! \brief store discount score for different position */
static std::vector<double> discount_;
/*! \brief max position for eval */
static const data_size_t kMaxPosition;
};
} // namespace LightGBM
#endif // LightGBM_METRIC_H_
| mit |
farcaller/cocotron | CoreGraphics/KGPDFFunction_Type3.h | 1534 | /* Copyright (c) 2007 Christopher J. W. Lloyd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import "KGFunction+PDF.h"
#import "KGPDFObject.h"
@class NSArray;
@interface KGPDFFunction_Type3 : KGFunction {
unsigned _functionCount;
KGFunction **_functions;
unsigned _boundsCount;
KGPDFReal *_bounds;
unsigned _encodeCount;
KGPDFReal *_encode;
}
-initWithDomain:(KGPDFArray *)domain range:(KGPDFArray *)range functions:(NSArray *)functions bounds:(KGPDFArray *)bounds encode:(KGPDFArray *)encode;
@end
| mit |
mightydonbriggs/xarisma | src/XarismaBundle/Form/ImportType.php | 1220 | <?php
namespace XarismaBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ImportType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('importTime')
->add('filename')
->add('md5')
->add('status')
->add('recs')
->add('errors')
->add('customerNew')
->add('customerUpdate')
->add('orderNew')
->add('orderUpdate')
->add('datecreated')
->add('dateupdated')
->add('deleted')
;
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'XarismaBundle\Entity\Import'
));
}
/**
* @return string
*/
public function getName()
{
return 'xarismabundle_import';
}
}
| mit |
selvasingh/azure-sdk-for-java | sdk/servicebus/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/servicebus/v2017_04_01/implementation/MigrationConfigPropertiesImpl.java | 4198 | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.servicebus.v2017_04_01.implementation;
import com.microsoft.azure.management.servicebus.v2017_04_01.MigrationConfigProperties;
import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl;
import rx.Observable;
class MigrationConfigPropertiesImpl extends CreatableUpdatableImpl<MigrationConfigProperties, MigrationConfigPropertiesInner, MigrationConfigPropertiesImpl> implements MigrationConfigProperties, MigrationConfigProperties.Definition, MigrationConfigProperties.Update {
private final ServiceBusManager manager;
private String resourceGroupName;
private String namespaceName;
MigrationConfigPropertiesImpl(String name, ServiceBusManager manager) {
super(name, new MigrationConfigPropertiesInner());
this.manager = manager;
// Set resource name
this.namespaceName = name;
//
}
MigrationConfigPropertiesImpl(MigrationConfigPropertiesInner inner, ServiceBusManager manager) {
super(inner.name(), inner);
this.manager = manager;
// Set resource name
this.namespaceName = inner.name();
// set resource ancestor and positional variables
this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups");
this.namespaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "namespaces");
//
}
@Override
public ServiceBusManager manager() {
return this.manager;
}
@Override
public Observable<MigrationConfigProperties> createResourceAsync() {
MigrationConfigsInner client = this.manager().inner().migrationConfigs();
return client.createAndStartMigrationAsync(this.resourceGroupName, this.namespaceName, this.inner())
.map(innerToFluentMap(this));
}
@Override
public Observable<MigrationConfigProperties> updateResourceAsync() {
MigrationConfigsInner client = this.manager().inner().migrationConfigs();
return client.createAndStartMigrationAsync(this.resourceGroupName, this.namespaceName, this.inner())
.map(innerToFluentMap(this));
}
@Override
protected Observable<MigrationConfigPropertiesInner> getInnerAsync() {
MigrationConfigsInner client = this.manager().inner().migrationConfigs();
return client.getAsync(this.resourceGroupName, this.namespaceName);
}
@Override
public boolean isInCreateMode() {
return this.inner().id() == null;
}
@Override
public String id() {
return this.inner().id();
}
@Override
public String migrationState() {
return this.inner().migrationState();
}
@Override
public String name() {
return this.inner().name();
}
@Override
public Long pendingReplicationOperationsCount() {
return this.inner().pendingReplicationOperationsCount();
}
@Override
public String postMigrationName() {
return this.inner().postMigrationName();
}
@Override
public String provisioningState() {
return this.inner().provisioningState();
}
@Override
public String targetNamespace() {
return this.inner().targetNamespace();
}
@Override
public String type() {
return this.inner().type();
}
@Override
public MigrationConfigPropertiesImpl withExistingNamespace(String resourceGroupName, String namespaceName) {
this.resourceGroupName = resourceGroupName;
this.namespaceName = namespaceName;
return this;
}
@Override
public MigrationConfigPropertiesImpl withPostMigrationName(String postMigrationName) {
this.inner().withPostMigrationName(postMigrationName);
return this;
}
@Override
public MigrationConfigPropertiesImpl withTargetNamespace(String targetNamespace) {
this.inner().withTargetNamespace(targetNamespace);
return this;
}
}
| mit |
selvasingh/azure-sdk-for-java | sdk/machinelearningservices/mgmt-v2019_05_01/src/main/java/com/microsoft/azure/management/machinelearningservices/v2019_05_01/implementation/PageImpl1.java | 1776 | /**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.machinelearningservices.v2019_05_01.implementation;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.azure.Page;
import java.util.List;
/**
* An instance of this class defines a page of Azure resources and a link to
* get the next page of resources, if any.
*
* @param <T> type of Azure resource
*/
public class PageImpl1<T> implements Page<T> {
/**
* The link to the next page.
*/
@JsonProperty("nextLink")
private String nextPageLink;
/**
* The list of items.
*/
@JsonProperty("value")
private List<T> items;
/**
* Gets the link to the next page.
*
* @return the link to the next page.
*/
@Override
public String nextPageLink() {
return this.nextPageLink;
}
/**
* Gets the list of items.
*
* @return the list of items in {@link List}.
*/
@Override
public List<T> items() {
return items;
}
/**
* Sets the link to the next page.
*
* @param nextPageLink the link to the next page.
* @return this Page object itself.
*/
public PageImpl1<T> setNextPageLink(String nextPageLink) {
this.nextPageLink = nextPageLink;
return this;
}
/**
* Sets the list of items.
*
* @param items the list of items in {@link List}.
* @return this Page object itself.
*/
public PageImpl1<T> setItems(List<T> items) {
this.items = items;
return this;
}
}
| mit |
acacha/adminlte-laravel | src/Console/Routes/GeneratesCode.php | 440 | <?php
namespace Acacha\AdminLTETemplateLaravel\Console\Routes;
/**
* Interface GeneratesCode.
*
* @package Acacha\AdminLTETemplateLaravel\Console\Routes
*/
interface GeneratesCode
{
/**
* Generates route code
*
* @return mixed
*/
public function code();
/**
* Set replacements.
*
* @param $replacements
* @return mixed
*/
public function setReplacements($replacements);
}
| mit |
FredrikWendt/stark | src/main/scala/se/marcuslonnberg/stark/auth/AuthActor.scala | 13393 | package se.marcuslonnberg.stark.auth
import java.security.SecureRandom
import akka.actor.{Actor, ActorLogging, ActorRef, Props}
import akka.pattern.pipe
import com.github.nscala_time.time.Imports._
import com.typesafe.config.ConfigFactory
import net.ceedubs.ficus.Ficus._
import se.marcuslonnberg.stark.auth.AuthActor._
import se.marcuslonnberg.stark.auth.providers.{AuthProvider, AuthProviderRequestActor, GoogleAuthProvider}
import se.marcuslonnberg.stark.auth.storage.RedisAuthStore
import se.marcuslonnberg.stark.site.SitesActor.{GetSiteByUri, GetSiteResponse}
import se.marcuslonnberg.stark.utils.Implicits._
import se.marcuslonnberg.stark.utils._
import spray.http.StatusCodes.{Redirection, TemporaryRedirect, Unauthorized}
import spray.http.{DateTime => SprayDateTime, _}
import scala.concurrent.duration.{Duration, FiniteDuration}
import scala.util.matching.Regex
object AuthActor {
case class AuthInfo(user: UserInfo, expires: Option[DateTime])
sealed trait NotAuthenticated
case object NotAuthenticatedHeader extends NotAuthenticated
case object NotAuthenticatedSession extends NotAuthenticated
sealed trait Authenticated
case object AuthenticatedHeader extends Authenticated
case class AuthenticatedSession(userInfo: UserInfo, cookie: Option[HttpCookie] = None) extends Authenticated
case class UserInfo(name: Option[String],
email: Option[String],
locale: Option[String])
case class AuthResponse(response: HttpResponse)
case class AuthCallback(requestUri: Uri, userInfo: UserInfo)
def props(sitesActor: ActorRef) = Props(classOf[AuthActor], sitesActor)
}
class AuthActor(sitesActor: ActorRef) extends Actor with ActorLogging with CookieAuth with HeaderAuth with SecureRandomIdGenerator with PathRequests with RedisAuthStore {
import context.dispatcher
implicit lazy val system = context.system
val config = ConfigFactory.load().getConfig("auth")
val authCookieName: String = config.as[String]("cookie-name")
val authHeaderName: String = config.as[String]("header-name")
val callbackUri: Uri = Uri(config.as[String]("callback-uri"))
val checkUriBase: Uri = Uri(config.as[String]("check-uri"))
val setCookiePath: Uri.Path = Uri.Path(config.as[String]("set-cookie-path"))
val cookieParameter: String = config.as[String]("cookie-parameter")
val sourceUriParameter: String = config.as[String]("source-uri-parameter")
val allowedEmailsRegexOption: Option[Regex] = config.as[Option[String]]("allowed-emails-regex").map(_.r)
val sessionExpiration: Duration = config.as[Option[FiniteDuration]]("session-expiration").getOrElse(Duration.Inf)
val authProvider: AuthProvider = {
config.as[String]("provider") match {
case "google" => GoogleAuthProvider
case provider => sys.error(s"Can't resolve provider '$provider'")
}
}
val useWildcardCookieDomain: Boolean = config.as[Boolean]("wildcard-cookie-domain")
def cookieDomain(uri: Uri): Option[String] = {
if (useWildcardCookieDomain) Some(wildcardCookieDomain(uri))
else None
}
def checkUri(source: Uri) = checkUriBase.withQuery(sourceUriParameter -> source.toString())
def receive = authRequest orElse regularRequest
def regularRequest: Receive = {
case request: HttpRequest =>
getAuthHeader(request) match {
case Some(header) =>
log.debug("Found auth header: {}", header)
containsHeader(header).map {
case true => AuthenticatedHeader
case false => NotAuthenticatedHeader
} pipeTo self
context.become(checkAuthenticated(request))
case None =>
getAuthCookie(request) match {
case Success(cookie) =>
log.debug("Found auth cookie: {}", cookie)
getSession(cookie.content).map {
case Some(authInfo) => AuthenticatedSession(authInfo.user)
case None => NotAuthenticatedSession
} pipeTo self
context.become(checkAuthenticated(request))
case Failure(_) =>
log.debug("No cookie or header in request, making check request")
val redirect = redirectionResponse(TemporaryRedirect, checkUri(request.uri))
context.parent ! AuthResponse(redirect)
}
}
}
def authRequest: Receive = {
case request: HttpRequest if isCallbackRequest(request) =>
log.debug("Callback request: {}", request.uri)
val requestActor = context.actorOf(AuthProviderRequestActor.props(authProvider, sender()), "provider")
requestActor ! AuthProvider.AuthResponse(request, callbackUri)
context.become(authProviderResponse(request))
case request: HttpRequest if isSetCookieRequest(request) =>
log.debug("Set cookie request: {}", request.uri)
getSetCookieInfo(request) match {
case Success(SetCookieInfo(cookie, uri)) =>
val redirect = redirectionResponse(TemporaryRedirect, uri) + setAuthCookieHeader(cookie, None, cookieDomain(uri))
context.parent ! AuthResponse(redirect)
case Failure(message) =>
val response = unauthorizedResponse(message)
context.parent ! AuthResponse(response)
}
case request: HttpRequest if isCheckRequest(request) =>
log.debug("Check request: {}", request.uri)
getCheckRequestInfo(request) match {
case Success(CheckRequestInfo(Some(cookie), uri)) =>
getSession(cookie.content) pipeTo self
context.become(checkCookie(request, uri, cookie))
case Success(CheckRequestInfo(None, uri)) =>
log.debug("Missing auth cookie, redirecting to auth provider")
val redirect = authProvider.redirectBrowser(request, callbackUri, uri)
context.parent ! AuthResponse(redirect)
case Failure(message) =>
val response = unauthorizedResponse(message)
context.parent ! AuthResponse(response)
}
}
def checkAuthenticated(request: HttpRequest): Receive = {
case authenticated: Authenticated =>
log.debug("Authenticated: {}", authenticated)
context.parent ! authenticated
context.become(receive)
case NotAuthenticatedSession =>
log.debug("Not authenticated by session")
val redirect = redirectionResponse(TemporaryRedirect, checkUri(request.uri))
context.parent ! AuthResponse(redirect)
context.become(receive)
case NotAuthenticatedHeader =>
log.debug("Not authenticated by header")
val response = HttpResponse(Unauthorized, "Permission denied!")
context.parent ! AuthResponse(response)
context.become(receive)
}
def checkCookie(request: HttpRequest, sourceUri: Uri, cookie: HttpCookie): Receive = {
case Some(authInfo: AuthInfo) =>
log.debug("Found valid cookie: {}", authInfo)
// Before we make the 'set cookie' request we must check that the source URI is an URL that have a site
// configuration, otherwise it would be possible to steal the cookie.
sitesActor ! GetSiteByUri(sourceUri)
context.become(checkUri(sourceUri, cookie))
case None =>
log.debug("Checked for cookie, none found. Sending user to auth provider")
val redirect = authProvider.redirectBrowser(request, callbackUri, sourceUri)
context.parent ! AuthResponse(redirect)
context.become(receive)
}
def checkUri(sourceUri: Uri, cookie: HttpCookie): Receive = {
case GetSiteResponse(Some(site)) =>
log.debug("Source uri have a site, {}, {}", sourceUri, site)
val redirectionUri = sourceUri.withPath(setCookiePath)
.withQuery(sourceUriParameter -> sourceUri.toString(), cookieParameter -> cookie.content)
val redirect = redirectionResponse(TemporaryRedirect, redirectionUri)
context.parent ! AuthResponse(redirect)
context.become(receive)
case GetSiteResponse(None) =>
log.debug("Source URI ({}) is not a site, request terminated.", sourceUri)
val response = HttpResponse(Unauthorized, s"Permission denied! There is no site for $sourceUri")
context.parent ! AuthResponse(response)
context.become(receive)
}
case class SaveSessionResult(saved: Boolean)
def authProviderResponse(request: HttpRequest): Receive = {
case AuthCallback(sourceUri, userInfo) =>
if (isAuthorized(userInfo)) {
val id = generateId
log.info("Auth provider callback, generating id '{}' for: {}", id, userInfo)
val expiration = sessionExpiration match {
case Duration.Inf => None
case _ => Some(DateTime.now + sessionExpiration.toMillis)
}
saveSession(id, AuthInfo(userInfo, expiration)).map(SaveSessionResult) pipeTo self
context.become(saveSession(request, sourceUri, id, expiration))
} else {
log.info("User is not authorized: {}", userInfo)
val response = unauthorizedResponse("Permission denied!")
context.parent ! AuthResponse(response)
context.become(receive)
}
}
def isAuthorized(userInfo: UserInfo) = {
(allowedEmailsRegexOption, userInfo.email) match {
case (Some(allowedEmailsRegex), Some(email)) => allowedEmailsRegex.findFirstIn(email).isDefined
case (Some(_), _) => false
case (None, _) => true
}
}
def saveSession(request: HttpRequest, sourceUri: Uri, id: String, expiration: Option[DateTime]): Receive = {
case SaveSessionResult(true) =>
val redirect = redirectionResponse(TemporaryRedirect, sourceUri) + setAuthCookieHeader(id, expiration, cookieDomain(sourceUri))
context.parent ! AuthResponse(redirect)
context.become(receive)
case SaveSessionResult(false) =>
log.error("Could not save session")
val response = HttpResponse(StatusCodes.InternalServerError, "Could create session")
context.parent ! AuthResponse(response)
context.become(receive)
}
def redirectionResponse(statusCode: Redirection, uri: Uri): HttpResponse = {
HttpResponse(statusCode, headers = List(HttpHeaders.Location(uri)))
}
def unauthorizedResponse(message: String): HttpResponse = {
HttpResponse(Unauthorized, message)
}
override def unhandled(message: Any) = {
log.warning("Unhandled message: {}", message)
}
}
trait PathRequests {
this: CookieAuth =>
def callbackUri: Uri
def checkUriBase: Uri
def cookieParameter: String
def sourceUriParameter: String
def setCookiePath: Uri.Path
case class SetCookieInfo(cookieValue: String, source: Uri)
case class CheckRequestInfo(cookie: Option[HttpCookie], source: Uri)
def getSetCookieInfo(request: HttpRequest): Validation[SetCookieInfo, String] = {
for {
sourceUri <- getParameter(sourceUriParameter)(request)
cookie <- getParameter(cookieParameter)(request)
} yield SetCookieInfo(cookie, Uri(sourceUri))
}
def getCheckRequestInfo(request: HttpRequest): Validation[CheckRequestInfo, String] = {
for {
sourceUri <- getParameter(sourceUriParameter)(request)
} yield {
val cookie = getAuthCookie(request)
CheckRequestInfo(cookie.toOption, Uri(sourceUri))
}
}
def isUri(baseUri: Uri)(uri: Uri): Boolean = uri.authority == baseUri.authority && uri.path == baseUri.path
def isCallbackRequest(request: HttpRequest): Boolean = isUri(callbackUri)(request.uri)
def isCheckRequest(request: HttpRequest): Boolean = isUri(checkUriBase)(request.uri)
def isSetCookieRequest(request: HttpRequest) = {
val uri = request.uri
uri.path == setCookiePath &&
uri.query.get(sourceUriParameter).isDefined &&
uri.query.get(cookieParameter).isDefined
}
}
trait SecureRandomIdGenerator {
private val random = new SecureRandom()
def generateId = BigInt(130, random).toString(32)
}
trait CookieAuth extends Utils {
def authCookieName: String
def wildcardCookieDomain(uri: Uri): String = {
"." + uri.authority.host.address.split("\\.").takeRight(2).mkString(".")
}
def getAuthCookie(request: HttpRequest) = getCookie(authCookieName)(request)
def setAuthCookieHeader(content: String, expiration: Option[DateTime] = None, domain: Option[String] = None) = {
val expirationInSprayDate = expiration.map(d => SprayDateTime(d.getMillis))
val expirationInSeconds = expiration.map(date => (date.getMillis - DateTime.now.getMillis) / 1000)
val cookie = HttpCookie(authCookieName, content,
expires = expirationInSprayDate,
maxAge = expirationInSeconds,
path = Some("/"),
httpOnly = true,
domain = domain)
HttpHeaders.`Set-Cookie`(cookie)
}
}
trait HeaderAuth {
def authHeaderName: String
def getAuthHeader(request: HttpRequest) = request.headers.collectFirst {
case header@HttpHeader(_, credentials) if header.is(authHeaderName.toLowerCase) => credentials
}
}
trait Utils {
def getCookie(cookieName: String)(request: HttpRequest): Validation[HttpCookie, String] = {
request.cookies.find(_.name == cookieName) match {
case Some(cookie) =>
Success(cookie)
case None =>
Failure(s"Missing $cookieName cookie.")
}
}
def getParameter(parameterName: String)(request: HttpRequest): Validation[String, String] = {
request.uri.query.get(parameterName) match {
case Some(value) =>
Success(value)
case None =>
Failure(s"Missing $parameterName parameter.")
}
}
}
| mit |
szapata/Migol | app/cache/prod/annotations/Migol-UserBundle-Entity-User.cache.php | 282 | <?php return unserialize('a:2:{i:0;O:27:"Doctrine\\ORM\\Mapping\\Entity":3:{s:15:"repositoryClass";N;s:8:"readOnly";b:0;s:5:"value";N;}i:1;O:26:"Doctrine\\ORM\\Mapping\\Table":5:{s:4:"name";s:8:"fos_user";s:6:"schema";N;s:7:"indexes";N;s:17:"uniqueConstraints";N;s:5:"value";N;}}'); | mit |
Qihoo360/beanstalkd-win | sd-daemon.c | 11741 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
Copyright 2010 Lennart Poettering
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
***/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifdef WIN32
# include "dat_w32.h"
#else
# include <sys/socket.h>
# include <sys/un.h>
# include <sys/fcntl.h>
# include <netinet/in.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include "sd-daemon.h"
int sd_listen_fds(int unset_environment) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 0;
#else
int r, fd;
const char *e;
char *p = NULL;
unsigned long l;
if (!(e = getenv("LISTEN_PID"))) {
r = 0;
goto finish;
}
errno = 0;
l = strtoul(e, &p, 10);
if (errno != 0) {
r = -errno;
goto finish;
}
if (!p || *p || l <= 0) {
r = -EINVAL;
goto finish;
}
/* Is this for us? */
if (getpid() != (pid_t) l) {
r = 0;
goto finish;
}
if (!(e = getenv("LISTEN_FDS"))) {
r = 0;
goto finish;
}
errno = 0;
l = strtoul(e, &p, 10);
if (errno != 0) {
r = -errno;
goto finish;
}
if (!p || *p) {
r = -EINVAL;
goto finish;
}
for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
int flags;
if ((flags = fcntl(fd, F_GETFD)) < 0) {
r = -errno;
goto finish;
}
if (flags & FD_CLOEXEC)
continue;
if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
r = -errno;
goto finish;
}
}
r = (int) l;
finish:
if (unset_environment) {
unsetenv("LISTEN_PID");
unsetenv("LISTEN_FDS");
}
return r;
#endif
}
int sd_is_fifo(int fd, const char *path) {
struct stat st_fd;
if (fd < 0)
return -EINVAL;
memset(&st_fd, 0, sizeof(st_fd));
if (fstat(fd, &st_fd) < 0)
return -errno;
if (!S_ISFIFO(st_fd.st_mode))
return 0;
if (path) {
struct stat st_path;
memset(&st_path, 0, sizeof(st_path));
if (stat(path, &st_path) < 0) {
if (errno == ENOENT || errno == ENOTDIR)
return 0;
return -errno;
}
return
st_path.st_dev == st_fd.st_dev &&
st_path.st_ino == st_fd.st_ino;
}
return 1;
}
static int sd_is_socket_internal(int fd, int type, int listening) {
struct stat st_fd;
if (fd < 0 || type < 0)
return -EINVAL;
if (fstat(fd, &st_fd) < 0)
return -errno;
if (!S_ISSOCK(st_fd.st_mode))
return 0;
if (type != 0) {
int other_type = 0;
socklen_t l = sizeof(other_type);
if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
return -errno;
if (l != sizeof(other_type))
return -EINVAL;
if (other_type != type)
return 0;
}
if (listening >= 0) {
int accepting = 0;
socklen_t l = sizeof(accepting);
if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
return -errno;
if (l != sizeof(accepting))
return -EINVAL;
if (!accepting != !listening)
return 0;
}
return 1;
}
#if !defined WIN32
union sockaddr_union {
struct sockaddr sa;
struct sockaddr_in in4;
struct sockaddr_in6 in6;
struct sockaddr_un un;
struct sockaddr_storage storage;
};
#endif
int sd_is_socket(int fd, int family, int type, int listening) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 1;
#else
int r;
if (family < 0)
return -EINVAL;
if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
return r;
if (family > 0) {
union sockaddr_union sockaddr;
socklen_t l;
memset(&sockaddr, 0, sizeof(sockaddr));
l = sizeof(sockaddr);
if (getsockname(fd, &sockaddr.sa, &l) < 0)
return -errno;
if (l < sizeof(sa_family_t))
return -EINVAL;
return sockaddr.sa.sa_family == family;
}
return 1;
#endif
}
int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 1;
#else
union sockaddr_union sockaddr;
socklen_t l;
int r;
if (family != 0 && family != AF_INET && family != AF_INET6)
return -EINVAL;
if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
return r;
memset(&sockaddr, 0, sizeof(sockaddr));
l = sizeof(sockaddr);
if (getsockname(fd, &sockaddr.sa, &l) < 0)
return -errno;
if (l < sizeof(sa_family_t))
return -EINVAL;
if (sockaddr.sa.sa_family != AF_INET &&
sockaddr.sa.sa_family != AF_INET6)
return 0;
if (family > 0)
if (sockaddr.sa.sa_family != family)
return 0;
if (port > 0) {
if (sockaddr.sa.sa_family == AF_INET) {
if (l < sizeof(struct sockaddr_in))
return -EINVAL;
return htons(port) == sockaddr.in4.sin_port;
} else {
if (l < sizeof(struct sockaddr_in6))
return -EINVAL;
return htons(port) == sockaddr.in6.sin6_port;
}
}
return 1;
#endif
}
int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 0;
#else
union sockaddr_union sockaddr;
socklen_t l;
int r;
if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
return r;
memset(&sockaddr, 0, sizeof(sockaddr));
l = sizeof(sockaddr);
if (getsockname(fd, &sockaddr.sa, &l) < 0)
return -errno;
if (l < sizeof(sa_family_t))
return -EINVAL;
if (sockaddr.sa.sa_family != AF_UNIX)
return 0;
if (path) {
if (length <= 0)
length = strlen(path);
if (length <= 0)
/* Unnamed socket */
return l == sizeof(sa_family_t);
if (path[0])
/* Normal path socket */
return
(l >= sizeof(sa_family_t) + length + 1) &&
memcmp(path, sockaddr.un.sun_path, length+1) == 0;
else
/* Abstract namespace socket */
return
(l == sizeof(sa_family_t) + length) &&
memcmp(path, sockaddr.un.sun_path, length) == 0;
}
return 1;
#endif
}
int sd_notify(int unset_environment, const char *state) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC)
return 0;
#else
int fd = -1, r;
struct msghdr msghdr;
struct iovec iovec;
union sockaddr_union sockaddr;
const char *e;
if (!state) {
r = -EINVAL;
goto finish;
}
if (!(e = getenv("NOTIFY_SOCKET")))
return 0;
/* Must be an abstract socket, or an absolute path */
if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
r = -EINVAL;
goto finish;
}
if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) {
r = -errno;
goto finish;
}
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.sa.sa_family = AF_UNIX;
strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
if (sockaddr.un.sun_path[0] == '@')
sockaddr.un.sun_path[0] = 0;
memset(&iovec, 0, sizeof(iovec));
iovec.iov_base = (char*) state;
iovec.iov_len = strlen(state);
memset(&msghdr, 0, sizeof(msghdr));
msghdr.msg_name = &sockaddr;
msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e);
if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
msghdr.msg_namelen = sizeof(struct sockaddr_un);
msghdr.msg_iov = &iovec;
msghdr.msg_iovlen = 1;
if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
r = -errno;
goto finish;
}
r = 1;
finish:
if (unset_environment)
unsetenv("NOTIFY_SOCKET");
if (fd >= 0)
close(fd);
return r;
#endif
}
int sd_notifyf(int unset_environment, const char *format, ...) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 0;
#else
va_list ap;
char *p = NULL;
int r;
va_start(ap, format);
r = vasprintf(&p, format, ap);
va_end(ap);
if (r < 0 || !p)
return -ENOMEM;
r = sd_notify(unset_environment, p);
free(p);
return r;
#endif
}
int sd_booted(void) {
#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
return 0;
#else
struct stat a, b;
/* We simply test whether the systemd cgroup hierarchy is
* mounted */
if (lstat("/sys/fs/cgroup", &a) < 0)
return 0;
if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
return 0;
return a.st_dev != b.st_dev;
#endif
}
| mit |
amironov73/ManagedIrbis | Source/Classic/Libs/AM.Win32/AM/Win32/Gdi32/DISPLAY_DEVICE.cs | 5145 | // This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/* DISPLAY_DEVICE.cs --
Ars Magna project, http://arsmagna.ru */
#region Using directives
using System;
using System.Runtime.InteropServices;
using JetBrains.Annotations;
#endregion
// ReSharper disable InconsistentNaming
namespace AM.Win32
{
/// <summary>
/// Receives information about the display device specified
/// by the iDevNum parameter of the EnumDisplayDevices function.
/// </summary>
/// <remarks>
/// The four string members are set based on the parameters passed
/// to EnumDisplayDevices. If the lpDevice param is NULL, then DISPLAY_DEVICE is filled in with information about the display adapter(s). If it is a valid device name, then it is filled in with information about the monitor(s) for that device.
/// </remarks>
// Не фурычит, падла!
[PublicAPI]
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = SIZE,
CharSet = CharSet.Unicode)]
public struct DISPLAY_DEVICEW
{
/// <summary>
/// Size of structure in bytes.
/// </summary>
public const int SIZE = 840;
/// <summary>
/// Size, in bytes, of the DISPLAY_DEVICE structure.
/// This must be initialized prior to calling EnumDisplayDevices.
/// </summary>
//[FieldOffset ( 0 )]
public int cb;
/// <summary>
/// An array of characters identifying the device name.
/// This is either the adapter device or the monitor device.
/// </summary>
//[FieldOffset ( 4 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string DeviceName;
/// <summary>
/// An array of characters containing the device context string.
/// This is either a description of the display adapter or of the
/// display monitor.
/// </summary>
//[FieldOffset ( 68 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceString;
/// <summary>
///
/// </summary>
//[FieldOffset ( 324 )]
public DeviceStateFlags StateFlags;
/// <summary>
/// Windows 98/Me: A string that uniquely identifies the hardware
/// adapter or the monitor. This is the Plug and Play identifier.
/// </summary>
//[FieldOffset ( 328 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceID;
/// <summary>
/// Reserved.
/// </summary>
//[FieldOffset ( 584 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceKey;
}
/// <summary>
/// Receives information about the display device specified
/// by the iDevNum parameter of the EnumDisplayDevices function.
/// </summary>
/// <remarks>
/// The four string members are set based on the parameters passed
/// to EnumDisplayDevices. If the lpDevice param is NULL, then DISPLAY_DEVICE is filled in with information about the display adapter(s). If it is a valid device name, then it is filled in with information about the monitor(s) for that device.
/// </remarks>
[Serializable]
[StructLayout(LayoutKind.Sequential, Size = SIZE)]
public struct DISPLAY_DEVICEA
{
/// <summary>
/// Size of structure in bytes.
/// </summary>
public const int SIZE = 424;
/// <summary>
/// Size, in bytes, of the DISPLAY_DEVICE structure.
/// This must be initialized prior to calling EnumDisplayDevices.
/// </summary>
//[FieldOffset ( 0 )]
public int cb;
/// <summary>
/// An array of characters identifying the device name.
/// This is either the adapter device or the monitor device.
/// </summary>
//[FieldOffset ( 4 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string DeviceName;
/// <summary>
/// An array of characters containing the device context string.
/// This is either a description of the display adapter or of the
/// display monitor.
/// </summary>
//[FieldOffset ( 68 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceString;
/// <summary>
///
/// </summary>
//[FieldOffset ( 324 )]
public DeviceStateFlags StateFlags;
/// <summary>
/// Windows 98/Me: A string that uniquely identifies the hardware
/// adapter or the monitor. This is the Plug and Play identifier.
/// </summary>
//[FieldOffset ( 328 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceID;
/// <summary>
/// Reserved.
/// </summary>
//[FieldOffset ( 584 )]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceKey;
}
}
| mit |
aslushnikov/ftree | src/print.css | 1629 | html, body {
padding: 0;
margin: 0;
background-color: #fdf9ef;
font-family: arial;
color: #333;
position: relative;
}
body {
display: flex;
flex-direction: column;
}
header {
flex-grow: 0;
pointer-events: auto;
background-color: rgba(253, 249, 239, 0.75);
padding-top: 1em;
text-align: center;
font-family: Iowan Old Style;
}
header .title {
font-weight: 600;
font-size: 5.5em;
color: #183EA0;
}
header .subtitle {
font-size: 2em;
margin-top: 25px;
margin-bottom: 50px;
}
header .tutorial {
font-size: 0.8em;
}
header .top-right {
text-align: right;
}
@media print {
.config-selector {
display: none;
}
}
.viewport {
flex-grow: 0;
}
canvas {
display: block;
}
footer {
position: absolute;
left: 0;
bottom: 0;
margin: 3em;
margin-bottom: -100px;
}
.stories {
display: flex;
pointer-events: auto;
font-size: 20px;
flex-direction: column;
width: 550px;
}
.stories .story {
margin-top: 1em;
}
.map-legend {
display: flex;
flex-direction: column;
flex-shrink: 0;
margin: 3em;
pointer-events: auto;
font-size: 25px;
position: absolute;
right: 0;
bottom: 0;
margin-bottom: -100px;
}
.map-legend .legend-line {
display: flex;
flex-direction: row;
align-items: center;
}
.map-legend .legend-text {
margin: 5px 5px 5px 7px;
}
/* Bigger fonts for print version */
.person .name {
font-size: 23px;
transform: translate(0, 3px);
}
.person .dates {
font-size: 14px;
transform: translate(0, 2px);
}
| mit |
teohhanhui/symfony | src/Symfony/Component/Config/Loader/FileLoader.php | 5542 | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Config\Loader;
use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException;
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
use Symfony\Component\Config\Exception\LoaderLoadException;
use Symfony\Component\Config\FileLocatorInterface;
use Symfony\Component\Config\Resource\FileExistenceResource;
use Symfony\Component\Config\Resource\GlobResource;
/**
* FileLoader is the abstract class used by all built-in loaders that are file based.
*
* @author Fabien Potencier <[email protected]>
*/
abstract class FileLoader extends Loader
{
protected static $loading = [];
protected $locator;
private $currentDir;
public function __construct(FileLocatorInterface $locator)
{
$this->locator = $locator;
}
/**
* Sets the current directory.
*/
public function setCurrentDir(string $dir)
{
$this->currentDir = $dir;
}
/**
* Returns the file locator used by this loader.
*
* @return FileLocatorInterface
*/
public function getLocator()
{
return $this->locator;
}
/**
* Imports a resource.
*
* @param mixed $resource A Resource
* @param string|null $type The resource type or null if unknown
* @param bool $ignoreErrors Whether to ignore import errors or not
* @param string|null $sourceResource The original resource importing the new resource
*
* @return mixed
*
* @throws LoaderLoadException
* @throws FileLoaderImportCircularReferenceException
* @throws FileLocatorFileNotFoundException
*/
public function import($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null)
{
if (\is_string($resource) && \strlen($resource) !== $i = strcspn($resource, '*?{[')) {
$ret = [];
$isSubpath = 0 !== $i && false !== strpos(substr($resource, 0, $i), '/');
foreach ($this->glob($resource, false, $_, $ignoreErrors || !$isSubpath) as $path => $info) {
if (null !== $res = $this->doImport($path, $type, $ignoreErrors, $sourceResource)) {
$ret[] = $res;
}
$isSubpath = true;
}
if ($isSubpath) {
return isset($ret[1]) ? $ret : (isset($ret[0]) ? $ret[0] : null);
}
}
return $this->doImport($resource, $type, $ignoreErrors, $sourceResource);
}
/**
* @internal
*/
protected function glob(string $pattern, bool $recursive, &$resource = null, bool $ignoreErrors = false, bool $forExclusion = false, array $excluded = [])
{
if (\strlen($pattern) === $i = strcspn($pattern, '*?{[')) {
$prefix = $pattern;
$pattern = '';
} elseif (0 === $i || false === strpos(substr($pattern, 0, $i), '/')) {
$prefix = '.';
$pattern = '/'.$pattern;
} else {
$prefix = \dirname(substr($pattern, 0, 1 + $i));
$pattern = substr($pattern, \strlen($prefix));
}
try {
$prefix = $this->locator->locate($prefix, $this->currentDir, true);
} catch (FileLocatorFileNotFoundException $e) {
if (!$ignoreErrors) {
throw $e;
}
$resource = [];
foreach ($e->getPaths() as $path) {
$resource[] = new FileExistenceResource($path);
}
return;
}
$resource = new GlobResource($prefix, $pattern, $recursive, $forExclusion, $excluded);
yield from $resource;
}
private function doImport($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null)
{
try {
$loader = $this->resolve($resource, $type);
if ($loader instanceof self && null !== $this->currentDir) {
$resource = $loader->getLocator()->locate($resource, $this->currentDir, false);
}
$resources = \is_array($resource) ? $resource : [$resource];
for ($i = 0; $i < $resourcesCount = \count($resources); ++$i) {
if (isset(self::$loading[$resources[$i]])) {
if ($i == $resourcesCount - 1) {
throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading));
}
} else {
$resource = $resources[$i];
break;
}
}
self::$loading[$resource] = true;
try {
$ret = $loader->load($resource, $type);
} finally {
unset(self::$loading[$resource]);
}
return $ret;
} catch (FileLoaderImportCircularReferenceException $e) {
throw $e;
} catch (\Exception $e) {
if (!$ignoreErrors) {
// prevent embedded imports from nesting multiple exceptions
if ($e instanceof LoaderLoadException) {
throw $e;
}
throw new LoaderLoadException($resource, $sourceResource, null, $e, $type);
}
}
}
}
| mit |
src-run/serferals | README.md | 7699 |
# [src-run] serferals
[Welcome](https://src.run/go/readme_welcome)! The `src-run/serferals` package provides a CLI application for looking-up
and organizing media files, with support for movies and TV episodes.
The following list shows the name of the input files to the left of the output paths this script would move them to on
the right.
```txt
Stranger Things S01E01.mkv -> tv/Stranger Things (2016)/Season 01/Stranger Things (2016) [S01E01] Chapter One: The Vanishing Of Will Byers.mkv
stranger_things_s01e02.mkv -> tv/Stranger Things (2016)/Season 01/Stranger Things (2016) [S01E02] Chapter Two: The Weirdo on Maple Street.mkv
3:10-To-Yuma-720p-2007.mkv -> movie/3:10 to Yuma (2007)/3:10 to Yuma (2007) [5176].mkv
```
This behavior is especially useful for media servers such as [Plex](https://www.plex.tv/downloads/) that require their
library files follow specific naming conventions. It is also useful for those with OCD-tendencies who require their
archive of media to be properly and consistently named.
### Customization
The output file path formats can be easily customized by overwriting the default templates in the `parameters.yml`
configuration file. The default template for TV episodes is the following.
```twig
tv/{{ name|raw }}{% if year is defined %} ({{ year }}){% endif %}/Season {{ season }}/{{ name|raw }}{% if year is defined %} ({{ year }}){% endif %} [S{{ season }}E{{ start }}{% if end is defined %}-{{ end }}{% endif %}]{% if title is defined %} {{ title|raw }}{% endif %}.{{ ext }}
```
You may recognize the template syntax as [Twig](http://twig.sensiolabs.org/), a widely used template engine in many
web frameworks (such as [Symfony](http://symfony.com/), [Drupal](https://www.drupal.org/), and others). While its use
in this project may be a bit of a "sledge hammer approach", it also means that customizing the output file paths is easy
and straightforward to anyone who's worked with any modern web template language. To further exemplify the simplicity
of this approach, take a look at the same template as above, but re-formatted with newlines for clarity and displaying
the output of each statement in the right-hand side comments, given the following input file
`Stranger Things (2016) [S01E01] Chapter One: The Vanishing Of Will Byers.mkv`.
```twig
tv/ # tv/
{{ name|raw }} # Stranger Things
{% if year is defined %} # <true>
({{ year }}) # (2016)
{% endif %}
/Season {{ season }}/ # Season 01/
{{ name|raw }} # Stranger Things
{% if year is defined %} # <true>
({{ year }}) # (2016)
{% endif %}
[ # [
S{{ season }} # S01
E{{ start }} # E01
{% if end is defined %} # <false>
-{{ end }}
{% endif %}
] # ]
{% if title is defined %} # <true>
{{ title|raw }} # Chapter One: The Vanishing Of Will Byers
{% endif %}
.{{ ext }} # .mkv
```
## JTT
This package represents a single project within a [large collection](https://src.run/go/explore) of open-source code
released under the *SR* namespace, comprised of framework-agnostic libraries, and a number of Symfony bundles. These
projects are authored and maintained by [Rob Frawley 2nd](https://src.run/rmf) and
[collaborators](https://src.run/serferals/github_collaborators).
## Quick Start
### Basic Usage Video
[](https://src.run/go/serferals-video-usage)
### Installation
Before beginning, ensure you have created an account and requested a free API key from
[The Movie DB](https://www.themoviedb.org/) website. Once you have an API key, take note of it and enter it when
prompted by the `make` script.
> **Note**: For the installation to complete successfully, **PHAR archive writing must not be disabled**. To find the
> location of your configuration file, run `php -i | grep "Loaded Configuration File"`. Edit your `php.ini` file,
> ensuring the variable `phar.readonly` is uncommented and assigned the value `Off`.
```bash
git clone https://github.com/robfrawley/serferals.git && cd serferals
./make
```
If installation completes without error, the final line of output will be the version string of the serferals command.
```txt
src-run/serferals version 2.2.3 by Rob Frawley 2nd <[email protected]> (69975c3)
```
### Troubleshooting
If you experience issues with the installer script, debug mode can be enabled by defining a bash variable when calling
`make`.
```bash
SERFERALS_DEBUG=true ./make
```
Additionally, you can enable "clean installation" mode, which ensures all dependencies and helper PHARs (Composer, Box)
are forcefully re-fetched.
```bash
SERFERALS_CLEAN=true ./make
```
Moreover, you can enable "pristine installation" mode, which forces removal and re-creation of configuration files as
well as enables everything from "clean installation" mode.
```bash
SERFERALS_PRISTINE=true ./make
```
Lastly, all the above mentioned environment variables can be passed in any combination.
```bash
SERFERALS_DEBUG=true SERFERALS_PRISTINE=true ./make
```
> **Note:** All troubleshooting variables are only checked to see if they are defined or undefined; they are not checked
for a specific value. **Their value is irrelevant.** Calling `SERFERALS_DEBUG=false ./make` will enable "debug mode"
because the variable is defined.
#### Installation Video
[](https://src.run/go/serferals-video-install)
## Reference
My prefered CLI usage includes the `-vvv` and `-s` options, enabling verbose output and the "smart overwrite" feature.
```bash
serferals -vvv -s -o /output/path /input/path/foo [...] /input/path/bar
```
The only required option is the output path (`-o|--output-path`). At least one input path must be provided as an argument,
though you can specify multiple input
paths if required.
```bash
serferals --output-path=/output/path /input/path [...]
```
## Contributing
### Discussion
For general inquiries or to discuss a broad topic or idea, find "robfrawley" on Freenode. He is always happy to
discuss language-level ideas, possible new directions for a project, emerging technologies, as well as the weather.
### Issues
To report issues or request a new feature, use the [project issue tracker](https://src.run/serferals/github_issues).
Include as much information as possible in any bug reports. Feel free to "ping" the topic if you don't get a response
within a few days (sometimes Github notification e-mails fall through the cracks).
### Code
You created additional functionality while utilizing this package? Wonderful: send it back upstream! *Don't hesitate to
submit a pull request!* Your [imagination](https://src.run/go/readme_imagination) and the requirements outlined within
our [CONTRIBUTING.md](https://src.run/serferals/contributing) file are the only limitations.
## License
This project is licensed under the [MIT License](https://src.run/go/mit), an [FSF](https://src.run/go/fsf)- and
[OSI](https://src.run/go/osi)-approved, [GPL](https://src.run/go/gpl)-compatible, permissive free software license.
Review the [LICENSE](https://src.run/serferals/license) file distributed with this source code for additional
information.
## API Usage
[](https://src.run/serferals/packagist)
Serferals episode and movie lookup powered by
[The Movie Database](https://www.themoviedb.org/)
[API](http://docs.themoviedb.apiary.io/).
| mit |
gabrielbull/php-sitesearch | src/Common/CredentialsInterface.php | 458 | <?php
/**
* Created by IntelliJ IDEA.
* User: emcnaughton
* Date: 5/4/17
* Time: 10:35 AM
*/
namespace Omnimail\Common;
/**
* Interface CredentialsInterface
*
* @package Omnimail
*/
interface CredentialsInterface
{
/**
* Set credentials.
*
* @param array $credentials
*/
public function setCredentials($credentials);
/**
* @param $parameter
* @return mixed
*/
public function get($parameter);
}
| mit |
stephaneAG/PengPod700 | QtEsrc/qt-everywhere-opensource-src-4.8.5/doc/html/qglwidget-qt3.html | 12591 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qgl.cpp -->
<title>Qt 4.8: Qt 3 Support Members for QGLWidget</title>
<link rel="stylesheet" type="text/css" href="style/style.css" />
<script src="scripts/jquery.js" type="text/javascript"></script>
<script src="scripts/functions.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style/superfish.css" />
<link rel="stylesheet" type="text/css" href="style/narrow.css" />
<!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->
<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>
</head>
<body class="" onload="CheckEmptyAndLoadList();">
<div class="header" id="qtdocheader">
<div class="content">
<div id="nav-logo">
<a href="index.html">Home</a></div>
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
<div id="narrowsearch"></div>
<div id="nav-topright">
<ul>
<li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
<li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
<li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
DOC</a></li>
<li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
</ul>
</div>
<div id="shortCut">
<ul>
<li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
<li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li>
</ul>
</div>
<ul class="sf-menu" id="narrowmenu">
<li><a href="#">API Lookup</a>
<ul>
<li><a href="classes.html">Class index</a></li>
<li><a href="functions.html">Function index</a></li>
<li><a href="modules.html">Modules</a></li>
<li><a href="namespaces.html">Namespaces</a></li>
<li><a href="qtglobal.html">Global Declarations</a></li>
<li><a href="qdeclarativeelements.html">QML elements</a></li>
</ul>
</li>
<li><a href="#">Qt Topics</a>
<ul>
<li><a href="qt-basic-concepts.html">Programming with Qt</a></li>
<li><a href="qtquick.html">Device UIs & Qt Quick</a></li>
<li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
<li><a href="supported-platforms.html">Supported Platforms</a></li>
<li><a href="technology-apis.html">Qt and Key Technologies</a></li>
<li><a href="best-practices.html">How-To's and Best Practices</a></li>
</ul>
</li>
<li><a href="#">Examples</a>
<ul>
<li><a href="all-examples.html">Examples</a></li>
<li><a href="tutorials.html">Tutorials</a></li>
<li><a href="demos.html">Demos</a></li>
<li><a href="qdeclarativeexamples.html">QML Examples</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="hd">
<span></span>
</div>
<div class="bd group">
<div class="sidebar">
<div class="searchlabel">
Search index:</div>
<div class="search" id="sidebarsearch">
<form id="qtdocsearch" action="" onsubmit="return false;">
<fieldset>
<input type="text" name="searchstring" id="pageType" value="" />
<div id="resultdialog">
<a href="#" id="resultclose">Close</a>
<p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p>
<p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p>
<ul id="resultlist" class="all">
</ul>
</div>
</fieldset>
</form>
</div>
<div class="box first bottombar" id="lookup">
<h2 title="API Lookup"><span></span>
API Lookup</h2>
<div id="list001" class="list">
<ul id="ul001" >
<li class="defaultLink"><a href="classes.html">Class index</a></li>
<li class="defaultLink"><a href="functions.html">Function index</a></li>
<li class="defaultLink"><a href="modules.html">Modules</a></li>
<li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
<li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
<li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
</ul>
</div>
</div>
<div class="box bottombar" id="topics">
<h2 title="Qt Topics"><span></span>
Qt Topics</h2>
<div id="list002" class="list">
<ul id="ul002" >
<li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li>
<li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li>
<li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li>
<li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>
<li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li>
<li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li>
</ul>
</div>
</div>
<div class="box" id="examples">
<h2 title="Examples"><span></span>
Examples</h2>
<div id="list003" class="list">
<ul id="ul003">
<li class="defaultLink"><a href="all-examples.html">Examples</a></li>
<li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
<li class="defaultLink"><a href="demos.html">Demos</a></li>
<li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
</ul>
</div>
</div>
</div>
<div class="wrap">
<div class="toolbar">
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtopengl.html">QtOpenGL</a></li>
<li>QGLWidget</li>
</ul>
</div>
<div class="toolbuttons toolblock">
<ul>
<li id="smallA" class="t_button">A</li>
<li id="medA" class="t_button active">A</li>
<li id="bigA" class="t_button">A</li>
<li id="print" class="t_button"><a href="javascript:this.print();">
<span>Print</span></a></li>
</ul>
</div>
</div>
<div class="content mainContent">
<h1 class="title">Qt 3 Support Members for QGLWidget</h1>
<p><b>The following class members are part of the <a href="qt3support.html">Qt 3 support layer</a>.</b> They are provided to help you port old code to Qt 4. We advise against using them in new code.</p>
<p><ul><li><a href="qglwidget.html">QGLWidget class reference</a></li></ul></p>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglwidget-qt3.html#QGLWidget-4">QGLWidget</a></b> ( QWidget * <i>parent</i>, const char * <i>name</i>, const QGLWidget * <i>shareWidget</i> = 0, Qt::WindowFlags <i>f</i> = 0 )</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglwidget-qt3.html#QGLWidget-5">QGLWidget</a></b> ( const QGLFormat & <i>format</i>, QWidget * <i>parent</i>, const char * <i>name</i>, const QGLWidget * <i>shareWidget</i> = 0, Qt::WindowFlags <i>f</i> = 0 )</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglwidget-qt3.html#QGLWidget-6">QGLWidget</a></b> ( QGLContext * <i>context</i>, QWidget * <i>parent</i>, const char * <i>name</i>, const QGLWidget * <i>shareWidget</i> = 0, Qt::WindowFlags <i>f</i> = 0 )</td></tr>
</table>
<ul>
<li class="fn">60 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">8 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li class="fn">8 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<h2>Member Function Documentation</h2>
<!-- $$$QGLWidget$$$QGLWidgetQWidget*constchar*constQGLWidget*Qt::WindowFlags -->
<h3 class="fn"><a name="QGLWidget-4"></a>QGLWidget::<span class="name">QGLWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type">char</span> * <i>name</i>, const <span class="type">QGLWidget</span> * <i>shareWidget</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>f</i> = 0 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@QGLWidget -->
<!-- $$$QGLWidget$$$QGLWidgetconstQGLFormat&QWidget*constchar*constQGLWidget*Qt::WindowFlags -->
<h3 class="fn"><a name="QGLWidget-5"></a>QGLWidget::<span class="name">QGLWidget</span> ( const <span class="type"><a href="qglformat.html">QGLFormat</a></span> & <i>format</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type">char</span> * <i>name</i>, const <span class="type">QGLWidget</span> * <i>shareWidget</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>f</i> = 0 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@QGLWidget -->
<!-- $$$QGLWidget$$$QGLWidgetQGLContext*QWidget*constchar*constQGLWidget*Qt::WindowFlags -->
<h3 class="fn"><a name="QGLWidget-6"></a>QGLWidget::<span class="name">QGLWidget</span> ( <span class="type"><a href="qglcontext.html">QGLContext</a></span> * <i>context</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i>, const <span class="type">char</span> * <i>name</i>, const <span class="type">QGLWidget</span> * <i>shareWidget</i> = 0, <span class="type"><a href="qt.html#WindowType-enum">Qt::WindowFlags</a></span> <i>f</i> = 0 )</h3>
<p>This is an overloaded function.</p>
<!-- @@@QGLWidget -->
</div>
</div>
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Digia, Qt and their respective logos are trademarks of Digia Plc
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
<script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>
| mit |
pcas/docker-plugin | src/main/java/com/nirima/jenkins/plugins/docker/builder/DockerBuilderControlOption.java | 1388 | package com.nirima.jenkins.plugins.docker.builder;
import com.nirima.docker.client.DockerException;
import com.nirima.jenkins.plugins.docker.action.DockerLaunchAction;
import hudson.model.AbstractBuild;
import hudson.model.Describable;
import hudson.model.Descriptor;
import jenkins.model.Jenkins;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.logging.Logger;
/**
* Created by magnayn on 30/01/2014.
*/
public abstract class DockerBuilderControlOption implements Describable<DockerBuilderControlOption>, Serializable {
protected static final Logger LOGGER = Logger.getLogger(DockerBuilderControl.class.getName());
public abstract void execute(AbstractBuild<?, ?> build) throws DockerException, IOException;
protected DockerLaunchAction getLaunchAction(AbstractBuild<?, ?> build) {
List<DockerLaunchAction> launchActionList = build.getActions(DockerLaunchAction.class);
DockerLaunchAction launchAction;
if( launchActionList.size() > 0 ) {
launchAction = launchActionList.get(0);
} else {
launchAction = new DockerLaunchAction();
build.addAction(launchAction);
}
return launchAction;
}
public Descriptor<DockerBuilderControlOption> getDescriptor() {
return Jenkins.getInstance().getDescriptorOrDie(getClass());
}
}
| mit |
Antonio-Lopez/angularjs-requirejs-typescript | app/tests/require-config.js | 1010 | var allTestFiles = [];
var TEST_REGEXP = /test\.js$/;
var pathToModule = function(path) {
return path.replace(/^\/base\//, '').replace(/\.js$/, '');
};
Object.keys(window.__karma__.files).forEach(function(file) {
if (TEST_REGEXP.test(file)) {
// Normalize paths to RequireJS module names.
allTestFiles.push(pathToModule(file));
}
});
require.config({
// Karma serves files under /base, which is the basePath from your config file
baseUrl: '/base',
// example of using shim, to load non AMD libraries (such as underscore and jquery)
paths: {
'angular': 'bower_components/angular/angular',
'text': 'bower_components/requirejs-text/text',
'_': 'bower_components/underscore/underscore-min'
},
shim: {
'angular': {
exports: 'angular'
},
},
// dynamically load all test files
deps: allTestFiles,
// we have to kickoff jasmine, as it is asynchronous
callback: window.__karma__.start
}); | mit |
alexislefebvre/victoire | Bundle/BlogBundle/Resources/public/js/blog.js | 5952 | /*global blogCategories, $ */
function BlogCategory(blogCategoryElement)
{
this.element = $vic(blogCategoryElement);
if ($vic(blogCategoryElement).data('index')) {
this.index = $vic(blogCategoryElement).data('index');
} else {
this.index = $vic(blogCategoryElement).children('[data-init="true"]').length;
}
var lastMaxId = 0;
$vic('[data-init=true]').each(function(index, el) {
if (!isNaN($vic(el).attr('data-blog-category'))
&& $vic(el).attr('data-blog-category') > lastMaxId) {
lastMaxId = parseInt($vic(el).attr('data-blog-category'));
}
});
this.id = lastMaxId + 1;
this.parentId = $vic(blogCategoryElement).parents('li[role="blogCategory"]').first().data('blog-category');
//get the parent by its id
if (this.parentId == null || this.parentId == 0) {
this.parent = null;
this.parentId = 0;
} else {
this.parent = blogCategories[this.parentId];
}
blogCategories[this.id] = this;
}
function addBlogCategoryRootItem(el)
{
var blogCategoryElement = $vic(el).parents('div').first().prev('ul');
// var parentBlogCategory = $vic('#blogCategory-children');
var blogCategory = new BlogCategory(blogCategoryElement);
blogCategory.init();
blogCategory.append();
}
function addBlogCategoryRow(el)
{
var blogCategoryElement = $vic(el).parents('span.add_blogCategory_link-container').first().next('ul');
// var parentBlogCategory = $vic(el).parents('[role="blogCategory-item"]').first();
var blogCategory = new BlogCategory(blogCategoryElement);
blogCategory.init();
blogCategory.append();
}
function deleteBlogCategoryRow(el)
{
var blogCategory = $vic(el).parents('li[role="blogCategory"]').first();
blogCategories[blogCategory.data('blog-category')] = undefined;
blogCategory.remove();
}
function initBlogCategories()
{
var links = $vic('.add_blogCategory_link');
var blogCategory = {id: 0};
//we want the links from the bottom to the top
$vic.each(links, function (index, link) {
var blogCategoryElement = $vic(link).parents('li[role="blogCategory"]').first();
if (blogCategoryElement.length > 0) {
blogCategory = new BlogCategory(blogCategoryElement);
blogCategory.update();
}
});
//This is exactly the same loop as the one just before
//We need to close the previous loop and iterate on a new one because
//we operated on the DOM that is updated only when the loop ends.
$vic.each(links, function (index, link) {
var blogCategoryElement = $vic(link).parents('li[role="blogCategory"]').first();
var blogCategory = blogCategories[blogCategoryElement.attr('data-blog-category')];
var parentBlogCategoryElement = $vic(blogCategoryElement).parents('li[role="blogCategory"]').first();
var parentBlogCategory = blogCategories[parentBlogCategoryElement.attr('data-blog-category')];
if (parentBlogCategory != undefined) {
blogCategory.parentId = parentBlogCategory.id;
blogCategory.parent = parentBlogCategory;
blogCategories[blogCategory.id] = blogCategory;
}
});
}
BlogCategory.prototype.init = function ()
{
var currentBlogCategory = this;
var name = '[' + currentBlogCategory.index + ']';
var i = 0;
do {
i++;
if (currentBlogCategory.parent != null) {
name = '[' + currentBlogCategory.parent.index + '][children]' + name;
}
currentBlogCategory = currentBlogCategory.parent;
} while (currentBlogCategory != null && i < 10);
var newForm = prototype.replace(/\[__name__\]/g, name);
var name = name.replace(/\]\[/g, '_');
var name = name.replace(/\]/g, '_');
var name = name.replace(/\[/g, '_');
var newForm = newForm.replace(/__name__/g, name);
var newForm = newForm.replace(/__blogCategory_id__/g, this.id);
var newForm = newForm.replace(/__blogCategory_index__/g, this.index);
this.newForm = $vic.parseHTML(newForm);
$vic(this.newForm).attr('data-init', "true");
};
BlogCategory.prototype.update = function ()
{
$vic(this.element).replaceWith(this.element);
$vic(this.element).attr('data-blog-category', this.id);
$vic(this.element).attr('data-init', "true");
};
BlogCategory.prototype.append = function ()
{
$vic('[data-blog-category="' + this.parentId + '"]').children('[role="blogCategory-container"]').first().append(this.newForm);
};
function attachSubmitEventToForm(formSelector, container) {
$vic(document).on('submit', formSelector, function(event) {
event.preventDefault();
var form = $vic(this);
var formData = $vic(form).serializeArray();
formData = $vic.param(formData);
if ($vic(form).attr('enctype') == 'multipart/form-data') {
var formData = new FormData($vic(form)[0]);
var contentType = false;
}
$vic.ajax({
url : $vic(form).attr('action'),
context : document.body,
data : formData,
type : $vic(form).attr('method'),
contentType : 'application/x-www-form-urlencoded; charset=UTF-8',
processData : false,
async : true,
cache : false,
success : function(jsonResponse) {
if (jsonResponse.hasOwnProperty("url")) {
congrat(jsonResponse.message, 10000);
window.location.replace(jsonResponse.url);
}else{
$vic(container).html(jsonResponse.html);
warn(jsonResponse.message, 10000);
}
}
});
});
}
attachSubmitEventToForm('#victoire_blog_settings_form', '#victoire-blog-settings');
attachSubmitEventToForm('#victoire_blog_category_form', '#victoire-blog-category');
| mit |
Kikobeats/worker-farm-cli | bin/parse-args/index.js | 586 | 'use strict'
const isDirectory = require('is-directory').sync
const isFile = require('is-file')
function getFarmArgs (args, fileIndex) {
const start = 0
const end = fileIndex + 1
return args.slice(start, end)
}
function getFileArgs (args, fileIndex) {
const start = fileIndex + 1
const end = args[args.length]
return args.slice(start, end)
}
function parseArgs (args) {
const fileIndex = args.findIndex(arg => isFile(arg) || isDirectory(arg))
return {
farm: getFarmArgs(args, fileIndex),
file: getFileArgs(args, fileIndex)
}
}
module.exports = parseArgs
| mit |
pharring/ApplicationInsights-dotnet | NETCORE/test/IntegrationTests.WebApp/Models/ErrorViewModel.cs | 221 | using System;
namespace IntegrationTests.WebApp.Models
{
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
} | mit |
randorfer/ScorchDev | PowerShellModules/xPSDesiredStateConfiguration/3.9.0.0/DSCPullServerSetup/PublishModulesAndMofsToPullServer.psm1 | 7004 | <#
.Synopsis
Package DSC modules and mof configuration document and publish them on an enterprise DSC pull server in the required format.
.DESCRIPTION
Uses Publish-DSCModulesAndMof function to package DSC modules into zip files with the version info.
Publishes the zip modules on "$env:ProgramFiles\WindowsPowerShell\DscService\Modules".
Publishes all mof configuration documents that are present in the $Source folder on "$env:ProgramFiles\WindowsPowerShell\DscService\Configuration"-
Use $Force to overwrite the version of the module that exists in the PowerShell module path with the version from the $source folder.
Use $ModuleNameList to specify the names of the modules to be published if the modules do not exist in $Source folder.
.EXAMPLE
$ModuleList = @("xWebAdministration", "xPhp")
Publish-DSCModuleAndMof -Source C:\LocalDepot -ModuleNameList $ModuleList
.EXAMPLE
Publish-DSCModuleAndMof -Source C:\LocalDepot -Force
#>
# Tools to use to package DSC modules and mof configuration document and publish them on enterprise DSC pull server in the required format
function Publish-DSCModuleAndMof
{
[CmdletBinding()]
param(
# The folder that contains the configuration mof documents and modules to be published on Pull server.
# Everything in this folder will be packaged and published.
[Parameter(Mandatory=$True)]
[string]$Source = $pwd,
# Switch to overwrite the module in PSModulePath with the version provided in $Sources.
[switch]$Force,
# Package and publish the modules listed in $ModuleNameList based on PowerShell module path content.
[string[]]$ModuleNameList
)
# Create working directory
$tempFolder = "$pwd\temp"
New-Item -Path $tempFolder -ItemType Directory -Force -ErrorAction SilentlyContinue
# Copy the mof documents from the $Source to working dir
Copy-Item -Path "$Source\*.mof" -Destination $tempFolder -Force -Verbose
# Start Deployment!
Log -Scope $MyInvocation -Message 'Start Deployment'
CreateZipFromPSModulePath -ListModuleNames $ModuleNameList -Destination $tempFolder
CreateZipFromSource -Source $Source -Destination $tempFolder
# Generate the checkSum file for all the zip and mof files.
New-DSCCheckSum -Path $tempFolder -Force
# Publish mof and modules to pull server repositories
PublishModulesAndChecksum -Source $tempFolder
PublishMofDocuments -Source $tempFolder
# Deployment is complete!
Remove-Item -Path $tempFolder -Recurse -Force -ErrorAction SilentlyContinue
Log -Scope $MyInvocation -Message 'End Deployment'
}
#Package the modules using powershell module path
function CreateZipFromPSModulePath
{
param($ListModuleNames, $Destination)
# Move all required modules from powershell module path to a temp folder and package them
if ([string]::IsNullOrEmpty($ListModuleNames))
{
Log -Scope $MyInvocation -Message "No additional modules are specified to be packaged."
}
foreach ($module in $ListModuleNames)
{
$allVersions = Get-Module -Name $module -ListAvailable -Verbose
# Package all versions of the module
foreach ($moduleVersion in $allVersions)
{
$name = $moduleVersion.Name
$source = "$Destination\$name"
# Create package zip
$path = $moduleVersion.ModuleBase
$version = $moduleVersion.Version.ToString()
Log -Scope $MyInvocation -Message "Zipping $name ($version)"
Compress-Archive -Path "$path\*" -DestinationPath "$source.zip" -Verbose -Force
$newName = "$Destination\$name" + "_" + "$version" + ".zip"
# Rename the module folder to contain the version info.
if (Test-Path $newName)
{
Remove-Item $newName -Recurse -Force
}
Rename-Item -Path "$source.zip" -NewName $newName -Force
}
}
}
# Function to package modules using a given folder after installing to psmodule path.
function CreateZipFromSource
{
param($Source, $Destination)
# for each module under $Source folder create a zip package that has the same name as the folder.
$allModulesInSource = Get-ChildItem -Path $Source -Directory
$modules = @()
foreach ($item in $allModulesInSource)
{
$name = $Item.Name
$alreadyExists = Get-Module -Name $name -ListAvailable -Verbose
if (($alreadyExists -eq $null) -or ($Force))
{
# Install the modules into PowerShell module path and overwrite the content
Copy-Item -Path $item.FullName -Recurse -Force -Destination "$env:ProgramFiles\WindowsPowerShell\Modules" -Verbose
}
else
{
Write-Warning "Skipping module overwrite. Module with the name $name already exists."
Write-Warning "Please specify -Force to overwrite the module with the local version of the module located in $Source or list names of the modules in ModuleNameList parameter to be packaged from PowerShell module pat instead and remove them from $Source folder"
}
$modules += @("$name")
}
# Package the module in $destination
CreateZipFromPSModulePath -ListModuleNames $modules -Destination $Destination
}
# Deploy modules to the Pull sever repository.
function PublishModulesAndChecksum
{
param($Source)
# Check if the current machine is a server sku.
$moduleRepository = "$env:ProgramFiles\WindowsPowerShell\DscService\Modules"
if ((Get-Module ServerManager -ListAvailable) -and (Test-Path $moduleRepository))
{
Log -Scope $MyInvocation -Message "Copying modules and checksums to [$moduleRepository]."
Copy-Item -Path "$Source\*.zip*" -Destination $moduleRepository -Force -Verbose
}
else
{
Write-Warning "Copying modules to Pull server module repository skipped because the machine is not a server sku or Pull server endpoint is not deployed."
}
}
# function deploy configuration and their checksums.
function PublishMofDocuments
{
param($Source)
# Check if the current machine is a server sku.
$mofRepository = "$env:ProgramFiles\WindowsPowerShell\DscService\Configuration"
if ((Get-Module ServerManager -ListAvailable) -and (Test-Path $mofRepository))
{
Log -Scope $MyInvocation -Message "Copying mofs and checksums to [$mofRepository]."
Copy-Item -Path "$Source\*.mof*" -Destination $mofRepository -Force -Verbose
}
else
{
Write-Warning "Copying configuration(s) to Pull server configuration repository skipped because the machine is not a server sku or Pull server endpoint is not deployed."
}
}
Function Log
{
Param(
$Date = $(Get-Date),
$Scope,
$Message
)
Write-Verbose "$Date [$($Scope.MyCommand)] :: $Message"
}
Export-ModuleMember -Function Publish-DSCModuleAndMof
| mit |
georghinkel/ttc2017smartGrids | solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61970/Informative/InfWork/impl/DesignImpl.java | 23208 | /**
*/
package gluemodel.CIM.IEC61970.Informative.InfWork.impl;
import gluemodel.CIM.IEC61968.Common.impl.DocumentImpl;
import gluemodel.CIM.IEC61968.Work.Work;
import gluemodel.CIM.IEC61968.Work.WorkPackage;
import gluemodel.CIM.IEC61970.Informative.InfERPSupport.ErpBOM;
import gluemodel.CIM.IEC61970.Informative.InfERPSupport.ErpQuoteLineItem;
import gluemodel.CIM.IEC61970.Informative.InfERPSupport.InfERPSupportPackage;
import gluemodel.CIM.IEC61970.Informative.InfWork.ConditionFactor;
import gluemodel.CIM.IEC61970.Informative.InfWork.Design;
import gluemodel.CIM.IEC61970.Informative.InfWork.DesignKind;
import gluemodel.CIM.IEC61970.Informative.InfWork.DesignLocation;
import gluemodel.CIM.IEC61970.Informative.InfWork.DesignLocationCU;
import gluemodel.CIM.IEC61970.Informative.InfWork.InfWorkPackage;
import gluemodel.CIM.IEC61970.Informative.InfWork.WorkCostDetail;
import gluemodel.CIM.IEC61970.Informative.InfWork.WorkTask;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Design</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getCostEstimate <em>Cost Estimate</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getDesignLocations <em>Design Locations</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getDesignLocationsCUs <em>Design Locations CUs</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getWork <em>Work</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getWorkCostDetails <em>Work Cost Details</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getErpBOMs <em>Erp BO Ms</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getErpQuoteLineItem <em>Erp Quote Line Item</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getConditionFactors <em>Condition Factors</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getKind <em>Kind</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getPrice <em>Price</em>}</li>
* <li>{@link gluemodel.CIM.IEC61970.Informative.InfWork.impl.DesignImpl#getWorkTasks <em>Work Tasks</em>}</li>
* </ul>
*
* @generated
*/
public class DesignImpl extends DocumentImpl implements Design {
/**
* The default value of the '{@link #getCostEstimate() <em>Cost Estimate</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCostEstimate()
* @generated
* @ordered
*/
protected static final float COST_ESTIMATE_EDEFAULT = 0.0F;
/**
* The cached value of the '{@link #getCostEstimate() <em>Cost Estimate</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCostEstimate()
* @generated
* @ordered
*/
protected float costEstimate = COST_ESTIMATE_EDEFAULT;
/**
* The cached value of the '{@link #getDesignLocations() <em>Design Locations</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDesignLocations()
* @generated
* @ordered
*/
protected EList<DesignLocation> designLocations;
/**
* The cached value of the '{@link #getDesignLocationsCUs() <em>Design Locations CUs</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDesignLocationsCUs()
* @generated
* @ordered
*/
protected EList<DesignLocationCU> designLocationsCUs;
/**
* The cached value of the '{@link #getWork() <em>Work</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWork()
* @generated
* @ordered
*/
protected Work work;
/**
* The cached value of the '{@link #getWorkCostDetails() <em>Work Cost Details</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWorkCostDetails()
* @generated
* @ordered
*/
protected EList<WorkCostDetail> workCostDetails;
/**
* The cached value of the '{@link #getErpBOMs() <em>Erp BO Ms</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getErpBOMs()
* @generated
* @ordered
*/
protected EList<ErpBOM> erpBOMs;
/**
* The cached value of the '{@link #getErpQuoteLineItem() <em>Erp Quote Line Item</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getErpQuoteLineItem()
* @generated
* @ordered
*/
protected ErpQuoteLineItem erpQuoteLineItem;
/**
* The cached value of the '{@link #getConditionFactors() <em>Condition Factors</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConditionFactors()
* @generated
* @ordered
*/
protected EList<ConditionFactor> conditionFactors;
/**
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected static final DesignKind KIND_EDEFAULT = DesignKind.ESTIMATED;
/**
* The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected DesignKind kind = KIND_EDEFAULT;
/**
* The default value of the '{@link #getPrice() <em>Price</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrice()
* @generated
* @ordered
*/
protected static final float PRICE_EDEFAULT = 0.0F;
/**
* The cached value of the '{@link #getPrice() <em>Price</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrice()
* @generated
* @ordered
*/
protected float price = PRICE_EDEFAULT;
/**
* The cached value of the '{@link #getWorkTasks() <em>Work Tasks</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWorkTasks()
* @generated
* @ordered
*/
protected EList<WorkTask> workTasks;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DesignImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return InfWorkPackage.Literals.DESIGN;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public float getCostEstimate() {
return costEstimate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCostEstimate(float newCostEstimate) {
float oldCostEstimate = costEstimate;
costEstimate = newCostEstimate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfWorkPackage.DESIGN__COST_ESTIMATE, oldCostEstimate, costEstimate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<DesignLocation> getDesignLocations() {
if (designLocations == null) {
designLocations = new EObjectWithInverseResolvingEList.ManyInverse<DesignLocation>(DesignLocation.class, this, InfWorkPackage.DESIGN__DESIGN_LOCATIONS, InfWorkPackage.DESIGN_LOCATION__DESIGNS);
}
return designLocations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<DesignLocationCU> getDesignLocationsCUs() {
if (designLocationsCUs == null) {
designLocationsCUs = new EObjectWithInverseResolvingEList.ManyInverse<DesignLocationCU>(DesignLocationCU.class, this, InfWorkPackage.DESIGN__DESIGN_LOCATIONS_CUS, InfWorkPackage.DESIGN_LOCATION_CU__DESIGNS);
}
return designLocationsCUs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Work getWork() {
if (work != null && work.eIsProxy()) {
InternalEObject oldWork = (InternalEObject)work;
work = (Work)eResolveProxy(oldWork);
if (work != oldWork) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfWorkPackage.DESIGN__WORK, oldWork, work));
}
}
return work;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Work basicGetWork() {
return work;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetWork(Work newWork, NotificationChain msgs) {
Work oldWork = work;
work = newWork;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfWorkPackage.DESIGN__WORK, oldWork, newWork);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setWork(Work newWork) {
if (newWork != work) {
NotificationChain msgs = null;
if (work != null)
msgs = ((InternalEObject)work).eInverseRemove(this, WorkPackage.WORK__DESIGNS, Work.class, msgs);
if (newWork != null)
msgs = ((InternalEObject)newWork).eInverseAdd(this, WorkPackage.WORK__DESIGNS, Work.class, msgs);
msgs = basicSetWork(newWork, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfWorkPackage.DESIGN__WORK, newWork, newWork));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<WorkCostDetail> getWorkCostDetails() {
if (workCostDetails == null) {
workCostDetails = new EObjectWithInverseResolvingEList<WorkCostDetail>(WorkCostDetail.class, this, InfWorkPackage.DESIGN__WORK_COST_DETAILS, InfWorkPackage.WORK_COST_DETAIL__DESIGN);
}
return workCostDetails;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ErpBOM> getErpBOMs() {
if (erpBOMs == null) {
erpBOMs = new EObjectWithInverseResolvingEList<ErpBOM>(ErpBOM.class, this, InfWorkPackage.DESIGN__ERP_BO_MS, InfERPSupportPackage.ERP_BOM__DESIGN);
}
return erpBOMs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ErpQuoteLineItem getErpQuoteLineItem() {
if (erpQuoteLineItem != null && erpQuoteLineItem.eIsProxy()) {
InternalEObject oldErpQuoteLineItem = (InternalEObject)erpQuoteLineItem;
erpQuoteLineItem = (ErpQuoteLineItem)eResolveProxy(oldErpQuoteLineItem);
if (erpQuoteLineItem != oldErpQuoteLineItem) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM, oldErpQuoteLineItem, erpQuoteLineItem));
}
}
return erpQuoteLineItem;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ErpQuoteLineItem basicGetErpQuoteLineItem() {
return erpQuoteLineItem;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetErpQuoteLineItem(ErpQuoteLineItem newErpQuoteLineItem, NotificationChain msgs) {
ErpQuoteLineItem oldErpQuoteLineItem = erpQuoteLineItem;
erpQuoteLineItem = newErpQuoteLineItem;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM, oldErpQuoteLineItem, newErpQuoteLineItem);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setErpQuoteLineItem(ErpQuoteLineItem newErpQuoteLineItem) {
if (newErpQuoteLineItem != erpQuoteLineItem) {
NotificationChain msgs = null;
if (erpQuoteLineItem != null)
msgs = ((InternalEObject)erpQuoteLineItem).eInverseRemove(this, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN, ErpQuoteLineItem.class, msgs);
if (newErpQuoteLineItem != null)
msgs = ((InternalEObject)newErpQuoteLineItem).eInverseAdd(this, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN, ErpQuoteLineItem.class, msgs);
msgs = basicSetErpQuoteLineItem(newErpQuoteLineItem, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM, newErpQuoteLineItem, newErpQuoteLineItem));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ConditionFactor> getConditionFactors() {
if (conditionFactors == null) {
conditionFactors = new EObjectWithInverseResolvingEList.ManyInverse<ConditionFactor>(ConditionFactor.class, this, InfWorkPackage.DESIGN__CONDITION_FACTORS, InfWorkPackage.CONDITION_FACTOR__DESIGNS);
}
return conditionFactors;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DesignKind getKind() {
return kind;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setKind(DesignKind newKind) {
DesignKind oldKind = kind;
kind = newKind == null ? KIND_EDEFAULT : newKind;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfWorkPackage.DESIGN__KIND, oldKind, kind));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public float getPrice() {
return price;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPrice(float newPrice) {
float oldPrice = price;
price = newPrice;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfWorkPackage.DESIGN__PRICE, oldPrice, price));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<WorkTask> getWorkTasks() {
if (workTasks == null) {
workTasks = new EObjectWithInverseResolvingEList<WorkTask>(WorkTask.class, this, InfWorkPackage.DESIGN__WORK_TASKS, InfWorkPackage.WORK_TASK__DESIGN);
}
return workTasks;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getDesignLocations()).basicAdd(otherEnd, msgs);
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS_CUS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getDesignLocationsCUs()).basicAdd(otherEnd, msgs);
case InfWorkPackage.DESIGN__WORK:
if (work != null)
msgs = ((InternalEObject)work).eInverseRemove(this, WorkPackage.WORK__DESIGNS, Work.class, msgs);
return basicSetWork((Work)otherEnd, msgs);
case InfWorkPackage.DESIGN__WORK_COST_DETAILS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getWorkCostDetails()).basicAdd(otherEnd, msgs);
case InfWorkPackage.DESIGN__ERP_BO_MS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getErpBOMs()).basicAdd(otherEnd, msgs);
case InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM:
if (erpQuoteLineItem != null)
msgs = ((InternalEObject)erpQuoteLineItem).eInverseRemove(this, InfERPSupportPackage.ERP_QUOTE_LINE_ITEM__DESIGN, ErpQuoteLineItem.class, msgs);
return basicSetErpQuoteLineItem((ErpQuoteLineItem)otherEnd, msgs);
case InfWorkPackage.DESIGN__CONDITION_FACTORS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getConditionFactors()).basicAdd(otherEnd, msgs);
case InfWorkPackage.DESIGN__WORK_TASKS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getWorkTasks()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS:
return ((InternalEList<?>)getDesignLocations()).basicRemove(otherEnd, msgs);
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS_CUS:
return ((InternalEList<?>)getDesignLocationsCUs()).basicRemove(otherEnd, msgs);
case InfWorkPackage.DESIGN__WORK:
return basicSetWork(null, msgs);
case InfWorkPackage.DESIGN__WORK_COST_DETAILS:
return ((InternalEList<?>)getWorkCostDetails()).basicRemove(otherEnd, msgs);
case InfWorkPackage.DESIGN__ERP_BO_MS:
return ((InternalEList<?>)getErpBOMs()).basicRemove(otherEnd, msgs);
case InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM:
return basicSetErpQuoteLineItem(null, msgs);
case InfWorkPackage.DESIGN__CONDITION_FACTORS:
return ((InternalEList<?>)getConditionFactors()).basicRemove(otherEnd, msgs);
case InfWorkPackage.DESIGN__WORK_TASKS:
return ((InternalEList<?>)getWorkTasks()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case InfWorkPackage.DESIGN__COST_ESTIMATE:
return getCostEstimate();
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS:
return getDesignLocations();
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS_CUS:
return getDesignLocationsCUs();
case InfWorkPackage.DESIGN__WORK:
if (resolve) return getWork();
return basicGetWork();
case InfWorkPackage.DESIGN__WORK_COST_DETAILS:
return getWorkCostDetails();
case InfWorkPackage.DESIGN__ERP_BO_MS:
return getErpBOMs();
case InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM:
if (resolve) return getErpQuoteLineItem();
return basicGetErpQuoteLineItem();
case InfWorkPackage.DESIGN__CONDITION_FACTORS:
return getConditionFactors();
case InfWorkPackage.DESIGN__KIND:
return getKind();
case InfWorkPackage.DESIGN__PRICE:
return getPrice();
case InfWorkPackage.DESIGN__WORK_TASKS:
return getWorkTasks();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case InfWorkPackage.DESIGN__COST_ESTIMATE:
setCostEstimate((Float)newValue);
return;
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS:
getDesignLocations().clear();
getDesignLocations().addAll((Collection<? extends DesignLocation>)newValue);
return;
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS_CUS:
getDesignLocationsCUs().clear();
getDesignLocationsCUs().addAll((Collection<? extends DesignLocationCU>)newValue);
return;
case InfWorkPackage.DESIGN__WORK:
setWork((Work)newValue);
return;
case InfWorkPackage.DESIGN__WORK_COST_DETAILS:
getWorkCostDetails().clear();
getWorkCostDetails().addAll((Collection<? extends WorkCostDetail>)newValue);
return;
case InfWorkPackage.DESIGN__ERP_BO_MS:
getErpBOMs().clear();
getErpBOMs().addAll((Collection<? extends ErpBOM>)newValue);
return;
case InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM:
setErpQuoteLineItem((ErpQuoteLineItem)newValue);
return;
case InfWorkPackage.DESIGN__CONDITION_FACTORS:
getConditionFactors().clear();
getConditionFactors().addAll((Collection<? extends ConditionFactor>)newValue);
return;
case InfWorkPackage.DESIGN__KIND:
setKind((DesignKind)newValue);
return;
case InfWorkPackage.DESIGN__PRICE:
setPrice((Float)newValue);
return;
case InfWorkPackage.DESIGN__WORK_TASKS:
getWorkTasks().clear();
getWorkTasks().addAll((Collection<? extends WorkTask>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case InfWorkPackage.DESIGN__COST_ESTIMATE:
setCostEstimate(COST_ESTIMATE_EDEFAULT);
return;
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS:
getDesignLocations().clear();
return;
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS_CUS:
getDesignLocationsCUs().clear();
return;
case InfWorkPackage.DESIGN__WORK:
setWork((Work)null);
return;
case InfWorkPackage.DESIGN__WORK_COST_DETAILS:
getWorkCostDetails().clear();
return;
case InfWorkPackage.DESIGN__ERP_BO_MS:
getErpBOMs().clear();
return;
case InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM:
setErpQuoteLineItem((ErpQuoteLineItem)null);
return;
case InfWorkPackage.DESIGN__CONDITION_FACTORS:
getConditionFactors().clear();
return;
case InfWorkPackage.DESIGN__KIND:
setKind(KIND_EDEFAULT);
return;
case InfWorkPackage.DESIGN__PRICE:
setPrice(PRICE_EDEFAULT);
return;
case InfWorkPackage.DESIGN__WORK_TASKS:
getWorkTasks().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case InfWorkPackage.DESIGN__COST_ESTIMATE:
return costEstimate != COST_ESTIMATE_EDEFAULT;
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS:
return designLocations != null && !designLocations.isEmpty();
case InfWorkPackage.DESIGN__DESIGN_LOCATIONS_CUS:
return designLocationsCUs != null && !designLocationsCUs.isEmpty();
case InfWorkPackage.DESIGN__WORK:
return work != null;
case InfWorkPackage.DESIGN__WORK_COST_DETAILS:
return workCostDetails != null && !workCostDetails.isEmpty();
case InfWorkPackage.DESIGN__ERP_BO_MS:
return erpBOMs != null && !erpBOMs.isEmpty();
case InfWorkPackage.DESIGN__ERP_QUOTE_LINE_ITEM:
return erpQuoteLineItem != null;
case InfWorkPackage.DESIGN__CONDITION_FACTORS:
return conditionFactors != null && !conditionFactors.isEmpty();
case InfWorkPackage.DESIGN__KIND:
return kind != KIND_EDEFAULT;
case InfWorkPackage.DESIGN__PRICE:
return price != PRICE_EDEFAULT;
case InfWorkPackage.DESIGN__WORK_TASKS:
return workTasks != null && !workTasks.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (costEstimate: ");
result.append(costEstimate);
result.append(", kind: ");
result.append(kind);
result.append(", price: ");
result.append(price);
result.append(')');
return result.toString();
}
} //DesignImpl
| mit |
cncgl/ML-sandbox | tensorflow-nmist.sh | 64 | #!/bin/sh
python -m tensorflow.models.image.mnist.convolutional
| mit |
gs01md/ColorfulWoodUIBase | TestUI/Pods/ColorfulWoodUIBase/ColorfulWoodUIBase/ColorfulWoodUIBase/CocoapodFiles/CWUBModules_Custom/CWUBCell_Company/CWUBCell_Company_One/CWUBCell_Company_One.h | 665 | //
// CWUBCell_Company_One.h
// ColorfulWoodUIBase
//
// Created by 大新 on 2018/6/12.
// Copyright © 2018年 ColorfulWood. All rights reserved.
//
#import "CWUBCellBase.h"
#import "CWUBCell_Company_One_Model.h"
/**
* 消息,用于清除默认图片
*/
#define CWUB_NOTIFICATION_CWUBCell_Company_One @"CWUB_NOTIFICATION_CWUBCell_Company_One"
@protocol CWUBCell_Company_One <NSObject>
@optional
/**
* 点击顶部图片
*/
- (void)CWUBCell_Company_One_topImg;
@end
@interface CWUBCell_Company_One : CWUBCellBase
@property (nonatomic, strong) CWUBCell_Company_One_Model *m_model;
@property (nonatomic,weak) id<CWUBCell_Company_One> delegate;
@end
| mit |
Microsoft/ChakraCore | lib/Backend/TempTracker.cpp | 64404 | //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "Backend.h"
/* ===================================================================================
* TempTracker runs the mark temp algorithm. The template parameter provides information
* what are valid temp use, temp transfer, or temp producing operations and what bit to
* set once a symbol def can be marked temp.
*
* NumberTemp mark temp JavascriptNumber creation for math operations, run during deadstore
*
* ObjectTemp mark temp object allocations, run during backward pass so that it can provide
* information to the globopt to install pre op bailout on implicit call while during stack
* allocation objects.
*
* ObjectTempVerify runs a similar mark temp during deadstore in debug mode to assert
* that globopt have install the pre op necessary and a marked temp def is still valid
* as a mark temp
*
* The basic of the mark temp algorithm is very simple: we keep track if we have seen
* any use of a symbol that is not a valid mark temp (the nonTempSyms bitvector)
* and on definition of the symbol, if the all the use allow temp object (not in nonTempSyms
* bitvector) then it is mark them able.
*
* However, the complication comes when the stack object is transferred to another symbol
* and we are in a loop. We need to make sure that the stack object isn't still referred
* by another symbol when we allocate the number/object in the next iteration
*
* For example:
* Loop top:
* s1 = NewScObject
* = s6
* s6 = s1
* Goto Loop top
*
* We cannot mark them this case because when s1 is created, the object might still be
* referred to by s6 from previous iteration, and thus if we mark them we would have
* change the content of s6 as well.
*
* To detect this dependency, we conservatively collect "all" transfers in the pre pass
* of the loop. We have to be conservative to detect reverse dependencies without
* iterating more than 2 times for the loop.
* =================================================================================== */
JitArenaAllocator *
TempTrackerBase::GetAllocator() const
{
return nonTempSyms.GetAllocator();
}
TempTrackerBase::TempTrackerBase(JitArenaAllocator * alloc, bool inLoop)
: nonTempSyms(alloc), tempTransferredSyms(alloc)
{
if (inLoop)
{
tempTransferDependencies = HashTable<BVSparse<JitArenaAllocator> *>::New(alloc, 16);
}
else
{
tempTransferDependencies = nullptr;
}
}
TempTrackerBase::~TempTrackerBase()
{
if (this->tempTransferDependencies != nullptr)
{
JitArenaAllocator * alloc = this->GetAllocator();
FOREACH_HASHTABLE_ENTRY(BVSparse<JitArenaAllocator> *, bucket, this->tempTransferDependencies)
{
JitAdelete(alloc, bucket.element);
}
NEXT_HASHTABLE_ENTRY;
this->tempTransferDependencies->Delete();
}
}
void
TempTrackerBase::MergeData(TempTrackerBase * fromData, bool deleteData)
{
this->nonTempSyms.Or(&fromData->nonTempSyms);
this->tempTransferredSyms.Or(&fromData->tempTransferredSyms);
this->MergeDependencies(this->tempTransferDependencies, fromData->tempTransferDependencies, deleteData);
if (this->tempTransferDependencies)
{
FOREACH_HASHTABLE_ENTRY(BVSparse<JitArenaAllocator> *, bucket, this->tempTransferDependencies)
{
if (bucket.element->Test(&this->nonTempSyms))
{
this->nonTempSyms.Set(bucket.value);
}
} NEXT_HASHTABLE_ENTRY;
}
}
void
TempTrackerBase::AddTransferDependencies(int sourceId, SymID dstSymID, HashTable<BVSparse<JitArenaAllocator> *> * dependencies)
{
// Add to the transfer dependencies set
BVSparse<JitArenaAllocator> ** pBVSparse = dependencies->FindOrInsertNew(sourceId);
if (*pBVSparse == nullptr)
{
*pBVSparse = JitAnew(this->GetAllocator(), BVSparse<JitArenaAllocator>, this->GetAllocator());
}
AddTransferDependencies(*pBVSparse, dstSymID);
}
void
TempTrackerBase::AddTransferDependencies(BVSparse<JitArenaAllocator> * bv, SymID dstSymID)
{
bv->Set(dstSymID);
// Add the indirect transfers (always from tempTransferDependencies)
BVSparse<JitArenaAllocator> *dstBVSparse = this->tempTransferDependencies->GetAndClear(dstSymID);
if (dstBVSparse != nullptr)
{
bv->Or(dstBVSparse);
JitAdelete(this->GetAllocator(), dstBVSparse);
}
}
template <typename T>
TempTracker<T>::TempTracker(JitArenaAllocator * alloc, bool inLoop):
T(alloc, inLoop)
{
}
template <typename T>
void
TempTracker<T>::MergeData(TempTracker<T> * fromData, bool deleteData)
{
TempTrackerBase::MergeData(fromData, deleteData);
T::MergeData(fromData, deleteData);
if (deleteData)
{
JitAdelete(this->GetAllocator(), fromData);
}
}
void
TempTrackerBase::OrHashTableOfBitVector(HashTable<BVSparse<JitArenaAllocator> *> * toData, HashTable<BVSparse<JitArenaAllocator> *> *& fromData, bool deleteData)
{
Assert(toData != nullptr);
Assert(fromData != nullptr);
toData->Or(fromData,
[=](BVSparse<JitArenaAllocator> * bv1, BVSparse<JitArenaAllocator> * bv2) -> BVSparse<JitArenaAllocator> *
{
if (bv1 == nullptr)
{
if (deleteData)
{
return bv2;
}
return bv2->CopyNew(this->GetAllocator());
}
bv1->Or(bv2);
if (deleteData)
{
JitAdelete(this->GetAllocator(), bv2);
}
return bv1;
});
if (deleteData)
{
fromData->Delete();
fromData = nullptr;
}
}
void
TempTrackerBase::MergeDependencies(HashTable<BVSparse<JitArenaAllocator> *> * toData, HashTable<BVSparse<JitArenaAllocator> *> *& fromData, bool deleteData)
{
if (fromData != nullptr)
{
if (toData != nullptr)
{
OrHashTableOfBitVector(toData, fromData, deleteData);
}
else if (deleteData)
{
FOREACH_HASHTABLE_ENTRY(BVSparse<JitArenaAllocator> *, bucket, fromData)
{
JitAdelete(this->GetAllocator(), bucket.element);
}
NEXT_HASHTABLE_ENTRY;
fromData->Delete();
fromData = nullptr;
}
}
}
#if DBG_DUMP
void
TempTrackerBase::Dump(char16 const * traceName)
{
Output::Print(_u("%s: Non temp syms:"), traceName);
this->nonTempSyms.Dump();
Output::Print(_u("%s: Temp transferred syms:"), traceName);
this->tempTransferredSyms.Dump();
if (this->tempTransferDependencies != nullptr)
{
Output::Print(_u("%s: Temp transfer dependencies:\n"), traceName);
this->tempTransferDependencies->Dump();
}
}
#endif
template <typename T>
void
TempTracker<T>::ProcessUse(StackSym * sym, BackwardPass * backwardPass)
{
// Don't care about type specialized syms
if (!sym->IsVar())
{
return;
}
IR::Instr * instr = backwardPass->currentInstr;
SymID usedSymID = sym->m_id;
bool isTempPropertyTransferStore = T::IsTempPropertyTransferStore(instr, backwardPass);
bool isTempUse = isTempPropertyTransferStore || T::IsTempUse(instr, sym, backwardPass);
if (!isTempUse)
{
this->nonTempSyms.Set(usedSymID);
}
#if DBG
if (T::DoTrace(backwardPass))
{
Output::Print(_u("%s: %8s%4sTemp Use (s%-3d): "), T::GetTraceName(),
backwardPass->IsPrePass() ? _u("Prepass ") : _u(""), isTempUse ? _u("") : _u("Non "), usedSymID);
instr->DumpSimple();
Output::Flush();
}
#endif
if (T::IsTempTransfer(instr))
{
this->tempTransferredSyms.Set(usedSymID);
// Track dependencies if we are in loop only
if (this->tempTransferDependencies != nullptr)
{
IR::Opnd * dstOpnd = instr->GetDst();
if (dstOpnd->IsRegOpnd())
{
SymID dstSymID = dstOpnd->AsRegOpnd()->m_sym->m_id;
if (dstSymID != usedSymID)
{
// Record that the usedSymID may propagate to dstSymID and all the symbols
// that it may propagate to as well
this->AddTransferDependencies(usedSymID, dstSymID, this->tempTransferDependencies);
#if DBG_DUMP
if (T::DoTrace(backwardPass))
{
Output::Print(_u("%s: %8s s%d -> s%d: "), T::GetTraceName(),
backwardPass->IsPrePass() ? _u("Prepass ") : _u(""), dstSymID, usedSymID);
(*this->tempTransferDependencies->Get(usedSymID))->Dump();
}
#endif
}
}
}
}
if (isTempPropertyTransferStore)
{
this->tempTransferredSyms.Set(usedSymID);
PropertySym * propertySym = instr->GetDst()->AsSymOpnd()->m_sym->AsPropertySym();
this->PropagateTempPropertyTransferStoreDependencies(usedSymID, propertySym, backwardPass);
#if DBG_DUMP
if (T::DoTrace(backwardPass) && this->tempTransferDependencies)
{
Output::Print(_u("%s: %8s (PropId:%d)+[] -> s%d: "), T::GetTraceName(),
backwardPass->IsPrePass() ? _u("Prepass ") : _u(""), propertySym->m_propertyId, usedSymID);
BVSparse<JitArenaAllocator> ** transferDependencies = this->tempTransferDependencies->Get(usedSymID);
if (transferDependencies)
{
(*transferDependencies)->Dump();
}
else
{
Output::Print(_u("[]\n"));
}
}
#endif
}
};
template <typename T>
void
TempTracker<T>::DisallowMarkTempAcrossYield(BVSparse<JitArenaAllocator>* bytecodeUpwardExposed)
{
if (bytecodeUpwardExposed != nullptr)
{
this->nonTempSyms.Or(bytecodeUpwardExposed);
}
}
template <typename T>
void
TempTracker<T>::MarkTemp(StackSym * sym, BackwardPass * backwardPass)
{
// Don't care about type specialized syms
Assert(sym->IsVar());
IR::Instr * instr = backwardPass->currentInstr;
BOOLEAN nonTemp = this->nonTempSyms.TestAndClear(sym->m_id);
BOOLEAN isTempTransferred;
BVSparse<JitArenaAllocator> * bvTempTransferDependencies = nullptr;
bool const isTransferOperation =
T::IsTempTransfer(instr)
|| T::IsTempPropertyTransferLoad(instr, backwardPass)
|| T::IsTempIndirTransferLoad(instr, backwardPass);
if (this->tempTransferDependencies != nullptr)
{
// Since we don't iterate "while (!changed)" in loops, we don't have complete accurate dataflow
// for loop carried dependencies. So don't clear the dependency transfer info. WOOB:1121525
// Check if this dst is transferred (assigned) to another symbol
if (isTransferOperation)
{
isTempTransferred = this->tempTransferredSyms.Test(sym->m_id);
}
else
{
isTempTransferred = this->tempTransferredSyms.TestAndClear(sym->m_id);
}
// We only need to look at the dependencies if we are in a loop because of the back edge
// Also we don't need to if we are in pre pass
if (isTempTransferred)
{
if (!backwardPass->IsPrePass())
{
if (isTransferOperation)
{
// Transfer operation, load but not clear the information
BVSparse<JitArenaAllocator> **pBv = this->tempTransferDependencies->Get(sym->m_id);
if (pBv)
{
bvTempTransferDependencies = *pBv;
}
}
else
{
// Non transfer operation, load and clear the information and the dst value is replaced
bvTempTransferDependencies = this->tempTransferDependencies->GetAndClear(sym->m_id);
}
}
else if (!isTransferOperation)
{
// In pre pass, and not a transfer operation (just an assign). We can clear the dependency info
// and not look at it.
this->tempTransferDependencies->Clear(sym->m_id);
}
}
}
else
{
isTempTransferred = this->tempTransferredSyms.TestAndClear(sym->m_id);
}
// Reset the dst is temp bit (we set it optimistically on the loop pre pass)
bool dstIsTemp = false;
bool dstIsTempTransferred = false;
if (nonTemp)
{
#if DBG_DUMP
if (T::DoTrace(backwardPass) && !backwardPass->IsPrePass() && T::CanMarkTemp(instr, backwardPass))
{
Output::Print(_u("%s: Not temp (s%-03d):"), T::GetTraceName(), sym->m_id);
instr->DumpSimple();
}
#endif
}
else if (backwardPass->IsPrePass())
{
// On pre pass, we don't have complete information about whether it is tempable or
// not from the back edge. If we already discovered that it is not a temp (above), then
// we don't mark it, other wise, assume that it is okay to be tempable and have the
// second pass set the bit correctly. The only works on dependency chain that is in order
// e.g.
// s1 = Add
// s2 = s1
// s3 = s2
// The dependencies tracking to catch the case whether the dependency chain is out of order
// e.g
// s1 = Add
// s3 = s2
// s2 = s3
Assert(isTransferOperation == T::IsTempTransfer(instr)
|| T::IsTempPropertyTransferLoad(instr, backwardPass)
|| T::IsTempIndirTransferLoad(instr, backwardPass));
if (isTransferOperation)
{
dstIsTemp = true;
}
}
else if (T::CanMarkTemp(instr, backwardPass))
{
dstIsTemp = true;
if (isTempTransferred)
{
// Track whether the dst is transferred or not, and allocate separate stack slot for them
// so that another dst will not overrides the value
dstIsTempTransferred = true;
// The temp is aliased, need to trace if there is another use of the set of aliased
// sym that is still live so that we won't mark them this symbol and destroy the value
if (bvTempTransferDependencies != nullptr)
{
// Inside a loop we need to track if any of the reg that we transferred to is still live
// s1 = Add
// = s2
// s2 = s1
// Since s2 is still live on the next iteration when we reassign s1, making s1 a temp
// will cause the value of s2 to change before it's use.
// The upwardExposedUses are the live regs, check if it intersect with the set
// of dependency or not.
#if DBG_DUMP
if (T::DoTrace(backwardPass) && Js::Configuration::Global.flags.Verbose)
{
Output::Print(_u("%s: Loop mark temp check instr:\n"), T::GetTraceName());
instr->DumpSimple();
Output::Print(_u("Transfer dependencies: "));
bvTempTransferDependencies->Dump();
Output::Print(_u("Upward exposed Uses : "));
backwardPass->currentBlock->upwardExposedUses->Dump();
Output::Print(_u("\n"));
}
#endif
BVSparse<JitArenaAllocator> * upwardExposedUses = backwardPass->currentBlock->upwardExposedUses;
bool hasExposedDependencies = bvTempTransferDependencies->Test(upwardExposedUses)
|| T::HasExposedFieldDependencies(bvTempTransferDependencies, backwardPass);
if (hasExposedDependencies)
{
#if DBG_DUMP
if (T::DoTrace(backwardPass))
{
Output::Print(_u("%s: Not temp (s%-03d): "), T::GetTraceName(), sym->m_id);
instr->DumpSimple();
Output::Print(_u(" Transferred exposed uses: "));
JitArenaAllocator tempAllocator(_u("temp"), this->GetAllocator()->GetPageAllocator(), Js::Throw::OutOfMemory);
bvTempTransferDependencies->AndNew(upwardExposedUses, &tempAllocator)->Dump();
}
#endif
dstIsTemp = false;
dstIsTempTransferred = false;
#if DBG
if (IsObjectTempVerify<T>())
{
dstIsTemp = ObjectTempVerify::DependencyCheck(instr, bvTempTransferDependencies, backwardPass);
}
#endif
// Only ObjectTmepVerify would do the do anything here. All other returns false
}
}
}
}
T::SetDstIsTemp(dstIsTemp, dstIsTempTransferred, instr, backwardPass);
}
NumberTemp::NumberTemp(JitArenaAllocator * alloc, bool inLoop)
: TempTrackerBase(alloc, inLoop), elemLoadDependencies(alloc), nonTempElemLoad(false),
upwardExposedMarkTempObjectLiveFields(alloc), upwardExposedMarkTempObjectSymsProperties(nullptr)
{
propertyIdsTempTransferDependencies = inLoop ? HashTable<BVSparse<JitArenaAllocator> *>::New(alloc, 16) : nullptr;
}
void
NumberTemp::MergeData(NumberTemp * fromData, bool deleteData)
{
nonTempElemLoad = nonTempElemLoad || fromData->nonTempElemLoad;
if (!nonTempElemLoad) // Don't bother merging other data if we already have a nonTempElemLoad
{
if (IsInLoop())
{
// in loop
elemLoadDependencies.Or(&fromData->elemLoadDependencies);
}
MergeDependencies(propertyIdsTempTransferDependencies, fromData->propertyIdsTempTransferDependencies, deleteData);
if (fromData->upwardExposedMarkTempObjectSymsProperties)
{
if (upwardExposedMarkTempObjectSymsProperties)
{
OrHashTableOfBitVector(upwardExposedMarkTempObjectSymsProperties, fromData->upwardExposedMarkTempObjectSymsProperties, deleteData);
}
else if (deleteData)
{
upwardExposedMarkTempObjectSymsProperties = fromData->upwardExposedMarkTempObjectSymsProperties;
fromData->upwardExposedMarkTempObjectSymsProperties = nullptr;
}
else
{
upwardExposedMarkTempObjectSymsProperties = HashTable<BVSparse<JitArenaAllocator> *>::New(this->GetAllocator(), 16);
OrHashTableOfBitVector(upwardExposedMarkTempObjectSymsProperties, fromData->upwardExposedMarkTempObjectSymsProperties, deleteData);
}
}
upwardExposedMarkTempObjectLiveFields.Or(&fromData->upwardExposedMarkTempObjectLiveFields);
}
}
bool
NumberTemp::IsTempUse(IR::Instr * instr, Sym * sym, BackwardPass * backwardPass)
{
Js::OpCode opcode = instr->m_opcode;
if (OpCodeAttr::NonTempNumberSources(opcode)
|| (OpCodeAttr::TempNumberTransfer(opcode) && !instr->dstIsTempNumber))
{
// For TypedArray stores, we don't store the Var object, so MarkTemp is valid
if (opcode != Js::OpCode::StElemI_A
|| !instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->GetValueType().IsLikelyOptimizedTypedArray())
{
// Mark the symbol as non-tempable if the instruction doesn't allow temp sources,
// or it is transferred to a non-temp dst
return false;
}
}
return true;
}
bool
NumberTemp::IsTempTransfer(IR::Instr * instr)
{
return OpCodeAttr::TempNumberTransfer(instr->m_opcode);
}
bool
NumberTemp::IsTempProducing(IR::Instr * instr)
{
Js::OpCode opcode = instr->m_opcode;
if (OpCodeAttr::TempNumberProducing(opcode))
{
return true;
}
// Loads from float typedArrays usually require a conversion to Var, which we can MarkTemp.
if (opcode == Js::OpCode::LdElemI_A)
{
const ValueType baseValueType(instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->GetValueType());
if (baseValueType.IsLikelyObject()
&& (baseValueType.GetObjectType() == ObjectType::Float32Array
|| baseValueType.GetObjectType() == ObjectType::Float64Array))
{
return true;
}
}
return false;
}
bool
NumberTemp::CanMarkTemp(IR::Instr * instr, BackwardPass * backwardPass)
{
if (IsTempTransfer(instr) || IsTempProducing(instr))
{
return true;
}
// REVIEW: this is added a long time ago, and I am not sure what this is for any more.
if (OpCodeAttr::InlineCallInstr(instr->m_opcode))
{
return true;
}
if (NumberTemp::IsTempIndirTransferLoad(instr, backwardPass)
|| NumberTemp::IsTempPropertyTransferLoad(instr, backwardPass))
{
return true;
}
// the opcode is not temp producing or a transfer, this is not a tmp
// Also mark calls which may get inlined.
return false;
}
void
NumberTemp::ProcessInstr(IR::Instr * instr, BackwardPass * backwardPass)
{
#if DBG
if (instr->m_opcode == Js::OpCode::BailOnNoProfile)
{
// If we see BailOnNoProfile, we shouldn't have any successor to have any non temp syms
Assert(!this->nonTempElemLoad);
Assert(this->nonTempSyms.IsEmpty());
Assert(this->tempTransferredSyms.IsEmpty());
Assert(this->elemLoadDependencies.IsEmpty());
Assert(this->upwardExposedMarkTempObjectLiveFields.IsEmpty());
}
#endif
// We don't get to process all dst in MarkTemp. Do it here for the upwardExposedMarkTempObjectLiveFields
if (!this->DoMarkTempNumbersOnTempObjects(backwardPass))
{
return;
}
IR::Opnd * dst = instr->GetDst();
if (dst == nullptr || !dst->IsRegOpnd())
{
return;
}
StackSym * dstSym = dst->AsRegOpnd()->m_sym;
if (!dstSym->IsVar())
{
dstSym = dstSym->GetVarEquivSym(nullptr);
if (dstSym == nullptr)
{
return;
}
}
SymID dstSymId = dstSym->m_id;
if (this->upwardExposedMarkTempObjectSymsProperties)
{
// We are assigning to dstSym, it no longer has upward exposed use, get the information and clear it from the hash table
BVSparse<JitArenaAllocator> * dstBv = this->upwardExposedMarkTempObjectSymsProperties->GetAndClear(dstSymId);
if (dstBv)
{
// Clear the upward exposed live fields of all the property sym id associated to dstSym
this->upwardExposedMarkTempObjectLiveFields.Minus(dstBv);
if (ObjectTemp::IsTempTransfer(instr) && instr->GetSrc1()->IsRegOpnd())
{
// If it is transfer, copy the dst info to the src
SymID srcStackSymId = instr->GetSrc1()->AsRegOpnd()->m_sym->AsStackSym()->m_id;
SymTable * symTable = backwardPass->func->m_symTable;
FOREACH_BITSET_IN_SPARSEBV(index, dstBv)
{
PropertySym * propertySym = symTable->FindPropertySym(srcStackSymId, index);
if (propertySym)
{
this->upwardExposedMarkTempObjectLiveFields.Set(propertySym->m_id);
}
}
NEXT_BITSET_IN_SPARSEBV;
BVSparse<JitArenaAllocator> ** srcBv = this->upwardExposedMarkTempObjectSymsProperties->FindOrInsert(dstBv, srcStackSymId);
if (srcBv)
{
(*srcBv)->Or(dstBv);
JitAdelete(this->GetAllocator(), dstBv);
}
}
else
{
JitAdelete(this->GetAllocator(), dstBv);
}
}
}
}
void
NumberTemp::SetDstIsTemp(bool dstIsTemp, bool dstIsTempTransferred, IR::Instr * instr, BackwardPass * backwardPass)
{
Assert(dstIsTemp || !dstIsTempTransferred);
Assert(!instr->dstIsTempNumberTransferred);
instr->dstIsTempNumber = dstIsTemp;
instr->dstIsTempNumberTransferred = dstIsTempTransferred;
#if DBG_DUMP
if (!backwardPass->IsPrePass() && IsTempProducing(instr))
{
backwardPass->numMarkTempNumber += dstIsTemp;
backwardPass->numMarkTempNumberTransferred += dstIsTempTransferred;
}
#endif
}
bool
NumberTemp::IsTempPropertyTransferLoad(IR::Instr * instr, BackwardPass * backwardPass)
{
if (DoMarkTempNumbersOnTempObjects(backwardPass))
{
switch (instr->m_opcode)
{
case Js::OpCode::LdFld:
case Js::OpCode::LdFldForTypeOf:
case Js::OpCode::LdMethodFld:
case Js::OpCode::LdFldForCallApplyTarget:
case Js::OpCode::LdMethodFromFlags:
{
// Only care about load from possible stack allocated object.
return instr->GetSrc1()->CanStoreTemp();
}
};
// All other opcode shouldn't have sym opnd that can store temp, See ObjectTemp::IsTempUseOpCodeSym.
Assert(instr->GetSrc1() == nullptr
|| instr->GetDst() == nullptr // this isn't a value loading instruction
|| instr->GetSrc1()->IsIndirOpnd() // this is detected in IsTempIndirTransferLoad
|| !instr->GetSrc1()->CanStoreTemp());
}
return false;
}
bool
NumberTemp::IsTempPropertyTransferStore(IR::Instr * instr, BackwardPass * backwardPass)
{
if (DoMarkTempNumbersOnTempObjects(backwardPass))
{
switch (instr->m_opcode)
{
case Js::OpCode::InitFld:
case Js::OpCode::StFld:
case Js::OpCode::StFldStrict:
{
IR::Opnd * dst = instr->GetDst();
Assert(dst->IsSymOpnd());
if (!dst->CanStoreTemp())
{
return false;
}
// We don't mark temp store of numeric properties (e.g. object literal { 86: foo });
// This should only happen for InitFld, as StFld should have changed to StElem
PropertySym *propertySym = dst->AsSymOpnd()->m_sym->AsPropertySym();
SymID propertySymId = this->GetRepresentativePropertySymId(propertySym, backwardPass);
return !this->nonTempSyms.Test(propertySymId) &&
!instr->m_func->GetThreadContextInfo()->IsNumericProperty(propertySym->m_propertyId);
}
};
// All other opcode shouldn't have sym opnd that can store temp, see ObjectTemp::IsTempUseOpCodeSym.
// We also never mark the dst indir as can store temp for StElemI_A because we don't know what property
// it is storing in (or it could be an array index).
Assert(instr->GetDst() == nullptr || !instr->GetDst()->CanStoreTemp());
}
return false;
}
bool
NumberTemp::IsTempIndirTransferLoad(IR::Instr * instr, BackwardPass * backwardPass)
{
if (DoMarkTempNumbersOnTempObjects(backwardPass))
{
if (instr->m_opcode == Js::OpCode::LdElemI_A)
{
// If the index is an int, then we don't care about the non-temp use
IR::Opnd * src1Opnd = instr->GetSrc1();
IR::RegOpnd * indexOpnd = src1Opnd->AsIndirOpnd()->GetIndexOpnd();
if (indexOpnd && (indexOpnd->m_sym->m_isNotNumber || !indexOpnd->GetValueType().IsInt()))
{
return src1Opnd->CanStoreTemp();
}
}
else
{
// All other opcode shouldn't have sym opnd that can store temp, See ObjectTemp::IsTempUseOpCodeSym.
Assert(instr->GetSrc1() == nullptr || instr->GetSrc1()->IsSymOpnd()
|| !instr->GetSrc1()->CanStoreTemp());
}
}
return false;
}
void
NumberTemp::PropagateTempPropertyTransferStoreDependencies(SymID usedSymID, PropertySym * propertySym, BackwardPass * backwardPass)
{
Assert(!this->nonTempElemLoad);
upwardExposedMarkTempObjectLiveFields.Clear(propertySym->m_id);
if (!this->IsInLoop())
{
// Don't need to track dependencies outside of loop, as we already marked the
// use as temp transfer already and we won't have a case where the "dst" is reused again (outside of loop)
return;
}
Assert(this->tempTransferDependencies != nullptr);
SymID dstSymID = this->GetRepresentativePropertySymId(propertySym, backwardPass);
AddTransferDependencies(usedSymID, dstSymID, this->tempTransferDependencies);
Js::PropertyId storedPropertyId = propertySym->m_propertyId;
// The symbol this properties are transferred to
BVSparse<JitArenaAllocator> ** pPropertyTransferDependencies = this->propertyIdsTempTransferDependencies->Get(storedPropertyId);
BVSparse<JitArenaAllocator> * transferDependencies = nullptr;
if (pPropertyTransferDependencies == nullptr)
{
if (elemLoadDependencies.IsEmpty())
{
// No dependencies to transfer
return;
}
transferDependencies = &elemLoadDependencies;
}
else
{
transferDependencies = *pPropertyTransferDependencies;
}
BVSparse<JitArenaAllocator> ** pBVSparse = this->tempTransferDependencies->FindOrInsertNew(usedSymID);
if (*pBVSparse == nullptr)
{
*pBVSparse = transferDependencies->CopyNew(this->GetAllocator());
}
else
{
(*pBVSparse)->Or(transferDependencies);
}
if (transferDependencies != &elemLoadDependencies)
{
// Always include the element load dependencies as well
(*pBVSparse)->Or(&elemLoadDependencies);
}
// Track the propertySym as well for the case where the dependence is not carried by the use
// Loop1
// o.x = e
// Loop2
// f = o.x
// = f
// e = e + blah
// Here, although we can detect that e and f has dependent relationship, f's life time doesn't cross with e's.
// But o.x will keep the value of e alive, so e can't be mark temp because o.x is still in use (not f)
// We will add the property sym int he dependency set and check with the upward exposed mark temp object live fields
// that we keep track of in NumberTemp
(*pBVSparse)->Set(propertySym->m_id);
}
SymID
NumberTemp::GetRepresentativePropertySymId(PropertySym * propertySym, BackwardPass * backwardPass)
{
// Since we don't track alias with objects, all property accesses are all grouped together.
// Use a single property sym id to represent a propertyId to track dependencies.
SymID symId = SymID_Invalid;
Js::PropertyId propertyId = propertySym->m_propertyId;
if (!backwardPass->numberTempRepresentativePropertySym->TryGetValue(propertyId, &symId))
{
symId = propertySym->m_id;
backwardPass->numberTempRepresentativePropertySym->Add(propertyId, symId);
}
return symId;
}
void
NumberTemp::ProcessIndirUse(IR::IndirOpnd * indirOpnd, IR::Instr * instr, BackwardPass * backwardPass)
{
Assert(backwardPass->DoMarkTempNumbersOnTempObjects());
if (!NumberTemp::IsTempIndirTransferLoad(instr, backwardPass))
{
return;
}
bool isTempUse = instr->dstIsTempNumber;
if (!isTempUse)
{
nonTempElemLoad = true;
}
else if (this->IsInLoop())
{
// We didn't already detect non temp use of this property id. so we should track the dependencies in loops
IR::Opnd * dstOpnd = instr->GetDst();
Assert(dstOpnd->IsRegOpnd());
SymID dstSymID = dstOpnd->AsRegOpnd()->m_sym->m_id;
// Use the no property id as a place holder for elem dependencies
AddTransferDependencies(&elemLoadDependencies, dstSymID);
#if DBG_DUMP
if (NumberTemp::DoTrace(backwardPass))
{
Output::Print(_u("%s: %8s s%d -> []: "), NumberTemp::GetTraceName(),
backwardPass->IsPrePass() ? _u("Prepass ") : _u(""), dstSymID);
elemLoadDependencies.Dump();
}
#endif
}
#if DBG_DUMP
if (NumberTemp::DoTrace(backwardPass))
{
Output::Print(_u("%s: %8s%4sTemp Use ([] )"), NumberTemp::GetTraceName(),
backwardPass->IsPrePass() ? _u("Prepass ") : _u(""), isTempUse ? _u("") : _u("Non "));
instr->DumpSimple();
}
#endif
}
void
NumberTemp::ProcessPropertySymUse(IR::SymOpnd * symOpnd, IR::Instr * instr, BackwardPass * backwardPass)
{
Assert(backwardPass->DoMarkTempNumbersOnTempObjects());
// We only care about instruction that may transfer the property value
if (!NumberTemp::IsTempPropertyTransferLoad(instr, backwardPass))
{
return;
}
PropertySym * propertySym = symOpnd->m_sym->AsPropertySym();
upwardExposedMarkTempObjectLiveFields.Set(propertySym->m_id);
if (upwardExposedMarkTempObjectSymsProperties == nullptr)
{
upwardExposedMarkTempObjectSymsProperties = HashTable<BVSparse<JitArenaAllocator> *>::New(this->GetAllocator(), 16);
}
BVSparse<JitArenaAllocator> ** bv = upwardExposedMarkTempObjectSymsProperties->FindOrInsertNew(propertySym->m_stackSym->m_id);
if (*bv == nullptr)
{
*bv = JitAnew(this->GetAllocator(), BVSparse<JitArenaAllocator>, this->GetAllocator());
}
(*bv)->Set(propertySym->m_propertyId);
SymID propertySymId = this->GetRepresentativePropertySymId(propertySym, backwardPass);
bool isTempUse = instr->dstIsTempNumber;
if (!isTempUse)
{
// Use of the value is non temp, track the property ID's property representative sym so we don't mark temp
// assignment to this property on stack objects.
this->nonTempSyms.Set(propertySymId);
}
else if (this->IsInLoop() && !this->nonTempSyms.Test(propertySymId))
{
// We didn't already detect non temp use of this property id. so we should track the dependencies in loops
IR::Opnd * dstOpnd = instr->GetDst();
Assert(dstOpnd->IsRegOpnd());
SymID dstSymID = dstOpnd->AsRegOpnd()->m_sym->m_id;
AddTransferDependencies(propertySym->m_propertyId, dstSymID, this->propertyIdsTempTransferDependencies);
#if DBG_DUMP
if (NumberTemp::DoTrace(backwardPass))
{
Output::Print(_u("%s: %8s s%d -> PropId:%d: "), NumberTemp::GetTraceName(),
backwardPass->IsPrePass() ? _u("Prepass ") : _u(""), dstSymID, propertySym->m_propertyId);
(*this->propertyIdsTempTransferDependencies->Get(propertySym->m_propertyId))->Dump();
}
#endif
}
#if DBG_DUMP
if (NumberTemp::DoTrace(backwardPass))
{
Output::Print(_u("%s: %8s%4sTemp Use (PropId:%d)"), NumberTemp::GetTraceName(),
backwardPass->IsPrePass() ? _u("Prepass ") : _u(""), isTempUse ? _u("") : _u("Non "), propertySym->m_propertyId);
instr->DumpSimple();
}
#endif
}
bool
NumberTemp::HasExposedFieldDependencies(BVSparse<JitArenaAllocator> * bvTempTransferDependencies, BackwardPass * backwardPass)
{
if (!DoMarkTempNumbersOnTempObjects(backwardPass))
{
return false;
}
return bvTempTransferDependencies->Test(&upwardExposedMarkTempObjectLiveFields);
}
bool
NumberTemp::DoMarkTempNumbersOnTempObjects(BackwardPass * backwardPass) const
{
return backwardPass->DoMarkTempNumbersOnTempObjects() && !this->nonTempElemLoad;
}
#if DBG
void
NumberTemp::Dump(char16 const * traceName)
{
if (nonTempElemLoad)
{
Output::Print(_u("%s: Has Non Temp Elem Load\n"), traceName);
}
else
{
Output::Print(_u("%s: Non Temp Syms"), traceName);
this->nonTempSyms.Dump();
if (this->propertyIdsTempTransferDependencies != nullptr)
{
Output::Print(_u("%s: Temp transfer propertyId dependencies:\n"), traceName);
this->propertyIdsTempTransferDependencies->Dump();
}
}
}
#endif
//=================================================================================================
// ObjectTemp
//=================================================================================================
bool
ObjectTemp::IsTempUse(IR::Instr * instr, Sym * sym, BackwardPass * backwardPass)
{
Js::OpCode opcode = instr->m_opcode;
// If the opcode has implicit call and the profile say we have implicit call, then it is not a temp use
// TODO: More precise implicit call tracking
if (instr->HasAnyImplicitCalls()
&&
((backwardPass->currentBlock->loop != nullptr ?
!GlobOpt::ImplicitCallFlagsAllowOpts(backwardPass->currentBlock->loop) :
!GlobOpt::ImplicitCallFlagsAllowOpts(backwardPass->func))
|| instr->CallsAccessor())
)
{
return false;
}
return IsTempUseOpCodeSym(instr, opcode, sym);
}
bool
ObjectTemp::IsTempUseOpCodeSym(IR::Instr * instr, Js::OpCode opcode, Sym * sym)
{
// Special case ArgOut_A which communicate information about CallDirect
switch (opcode)
{
case Js::OpCode::ArgOut_A:
return instr->dstIsTempObject;
case Js::OpCode::LdLen_A:
if (instr->GetSrc1()->IsRegOpnd())
{
return instr->GetSrc1()->AsRegOpnd()->GetStackSym() == sym;
}
// fall through
case Js::OpCode::LdFld:
case Js::OpCode::LdFldForTypeOf:
case Js::OpCode::LdMethodFld:
case Js::OpCode::LdFldForCallApplyTarget:
case Js::OpCode::LdMethodFromFlags:
return instr->GetSrc1()->AsPropertySymOpnd()->GetObjectSym() == sym;
case Js::OpCode::InitFld:
if (Js::PropertyRecord::DefaultAttributesForPropertyId(
instr->GetDst()->AsPropertySymOpnd()->GetPropertySym()->m_propertyId, true) & PropertyDeleted)
{
// If the property record is marked PropertyDeleted, the InitFld will cause a type handler conversion,
// which may result in creation of a weak reference to the object itself.
return false;
}
// Fall through
case Js::OpCode::StFld:
case Js::OpCode::StFldStrict:
return
!(instr->GetSrc1() && instr->GetSrc1()->GetStackSym() == sym) &&
!(instr->GetSrc2() && instr->GetSrc2()->GetStackSym() == sym) &&
instr->GetDst()->AsPropertySymOpnd()->GetObjectSym() == sym;
case Js::OpCode::LdElemI_A:
return instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym;
case Js::OpCode::StElemI_A:
case Js::OpCode::StElemI_A_Strict:
return instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym && instr->GetSrc1()->GetStackSym() != sym;
case Js::OpCode::Memset:
return instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym || (instr->GetSrc1()->IsRegOpnd() && instr->GetSrc1()->AsRegOpnd()->m_sym == sym);
case Js::OpCode::Memcopy:
return instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym || instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->m_sym == sym;
// Special case FromVar for now until we can allow CallsValueOf opcode to be accept temp use
case Js::OpCode::FromVar:
return true;
}
// TODO: Currently, when we disable implicit call, we still don't allow valueOf/toString that has no side effects
// So we shouldn't mark them if we have use of the sym on opcode that does OpndHasImplicitCall yet.
if (OpCodeAttr::OpndHasImplicitCall(opcode))
{
return false;
}
// Mark the symbol as non-tempable if the instruction doesn't allow temp sources,
// or it is transferred to a non-temp dst
return (OpCodeAttr::TempObjectSources(opcode)
&& (!OpCodeAttr::TempObjectTransfer(opcode) || instr->dstIsTempObject));
}
bool
ObjectTemp::IsTempTransfer(IR::Instr * instr)
{
return OpCodeAttr::TempObjectTransfer(instr->m_opcode);
}
bool
ObjectTemp::IsTempProducing(IR::Instr * instr)
{
Js::OpCode opcode = instr->m_opcode;
if (OpCodeAttr::TempObjectProducing(opcode))
{
if (instr->m_opcode == Js::OpCode::CallDirect)
{
IR::HelperCallOpnd* helper = instr->GetSrc1()->AsHelperCallOpnd();
return HelperMethodAttributes::TempObjectProducing(helper->m_fnHelper);
}
else
{
return true;
}
}
// TODO: Process NewScObject and CallI with isCtorCall when the ctor is fixed
return false;
}
bool
ObjectTemp::CanStoreTemp(IR::Instr * instr)
{
// In order to allow storing temp number on temp objects,
// We have to make sure that if the instr is marked as dstIsTempObject
// we will always generate the code to allocate the object on the stack (so no helper call).
// Currently, we only do this for NewRegEx, NewScObjectSimple, NewScObjectLiteral and
// NewScObjectNoCtor (where the ctor is inlined).
// CONSIDER: review lowering of other TempObjectProducing opcode and see if we can always allocate on the stack
// (for example, NewScArray should be able to, but plain NewScObject can't because the size depends on the
// number inline slots)
Js::OpCode opcode = instr->m_opcode;
if (OpCodeAttr::TempObjectCanStoreTemp(opcode))
{
// Special cases where stack allocation doesn't happen
#if ENABLE_REGEX_CONFIG_OPTIONS
if (opcode == Js::OpCode::NewRegEx && REGEX_CONFIG_FLAG(RegexTracing))
{
return false;
}
#endif
if (opcode == Js::OpCode::NewScObjectNoCtor)
{
if (PHASE_OFF(Js::FixedNewObjPhase, instr->m_func) && PHASE_OFF(Js::ObjTypeSpecNewObjPhase, instr->m_func->GetTopFunc()))
{
return false;
}
// Only if we have BailOutFailedCtorGuardCheck would we generate a stack object.
// Otherwise we will call the helper, which will not generate stack object.
return instr->HasBailOutInfo();
}
return true;
}
return false;
}
bool
ObjectTemp::CanMarkTemp(IR::Instr * instr, BackwardPass * backwardPass)
{
// We mark the ArgOut with the call in ProcessInstr, no need to do it here
return IsTempProducing(instr) || IsTempTransfer(instr);
}
void
ObjectTemp::ProcessBailOnNoProfile(IR::Instr * instr)
{
Assert(instr->m_opcode == Js::OpCode::BailOnNoProfile);
// ObjectTemp is done during Backward pass, which hasn't change all succ to BailOnNoProfile
// to dead yet, so we need to manually clear all the information
this->nonTempSyms.ClearAll();
this->tempTransferredSyms.ClearAll();
if (this->tempTransferDependencies)
{
this->tempTransferDependencies->ClearAll();
}
}
void
ObjectTemp::ProcessInstr(IR::Instr * instr)
{
if (instr->m_opcode != Js::OpCode::CallDirect)
{
return;
}
IR::HelperCallOpnd * helper = instr->GetSrc1()->AsHelperCallOpnd();
switch (helper->m_fnHelper)
{
case IR::JnHelperMethod::HelperString_Match:
case IR::JnHelperMethod::HelperString_Replace:
{
// First (non-this) parameter is either a regexp or search string.
// It doesn't escape.
IR::Instr * instrArgDef = nullptr;
instr->FindCallArgumentOpnd(2, &instrArgDef);
instrArgDef->dstIsTempObject = true;
break;
}
case IR::JnHelperMethod::HelperRegExp_Exec:
{
IR::Instr * instrArgDef = nullptr;
instr->FindCallArgumentOpnd(1, &instrArgDef);
instrArgDef->dstIsTempObject = true;
break;
}
};
}
void
ObjectTemp::SetDstIsTemp(bool dstIsTemp, bool dstIsTempTransferred, IR::Instr * instr, BackwardPass * backwardPass)
{
Assert(dstIsTemp || !dstIsTempTransferred);
// ArgOut_A are marked by CallDirect and don't need to be set
if (instr->m_opcode == Js::OpCode::ArgOut_A)
{
return;
}
instr->dstIsTempObject = dstIsTemp;
if (!backwardPass->IsPrePass())
{
if (OpCodeAttr::TempObjectProducing(instr->m_opcode))
{
backwardPass->func->SetHasMarkTempObjects();
#if DBG_DUMP
backwardPass->numMarkTempObject += dstIsTemp;
#endif
}
}
}
StackSym *
ObjectTemp::GetStackSym(IR::Opnd * opnd, IR::PropertySymOpnd ** pPropertySymOpnd)
{
StackSym * stackSym = nullptr;
switch (opnd->GetKind())
{
case IR::OpndKindReg:
stackSym = opnd->AsRegOpnd()->m_sym;
break;
case IR::OpndKindSym:
{
IR::SymOpnd * symOpnd = opnd->AsSymOpnd();
if (symOpnd->IsPropertySymOpnd())
{
IR::PropertySymOpnd * propertySymOpnd = symOpnd->AsPropertySymOpnd();
*pPropertySymOpnd = propertySymOpnd;
stackSym = propertySymOpnd->GetObjectSym();
}
else if (symOpnd->m_sym->IsPropertySym())
{
stackSym = symOpnd->m_sym->AsPropertySym()->m_stackSym;
}
break;
}
case IR::OpndKindIndir:
stackSym = opnd->AsIndirOpnd()->GetBaseOpnd()->m_sym;
break;
case IR::OpndKindList:
Assert(UNREACHED);
break;
};
return stackSym;
}
#if DBG
//=================================================================================================
// ObjectTempVerify
//=================================================================================================
ObjectTempVerify::ObjectTempVerify(JitArenaAllocator * alloc, bool inLoop)
: TempTrackerBase(alloc, inLoop), removedUpwardExposedUse(alloc)
{
}
bool
ObjectTempVerify::IsTempUse(IR::Instr * instr, Sym * sym, BackwardPass * backwardPass)
{
Js::OpCode opcode = instr->m_opcode;
// If the opcode has implicit call and the profile say we have implicit call, then it is not a temp use.
// TODO: More precise implicit call tracking
bool isLandingPad = backwardPass->currentBlock->IsLandingPad();
if (OpCodeAttr::HasImplicitCall(opcode) && !isLandingPad
&&
((backwardPass->currentBlock->loop != nullptr ?
!GlobOpt::ImplicitCallFlagsAllowOpts(backwardPass->currentBlock->loop) :
!GlobOpt::ImplicitCallFlagsAllowOpts(backwardPass->func))
|| instr->CallsAccessor())
)
{
return false;
}
if (!ObjectTemp::IsTempUseOpCodeSym(instr, opcode, sym))
{
// the opcode and sym is not a temp use, just return
return false;
}
// In the backward pass, this would have been a temp use already. Continue to verify
// if we have install sufficient bailout on implicit call
if (isLandingPad || !GlobOpt::MayNeedBailOnImplicitCall(instr, nullptr, nullptr))
{
// Implicit call would not happen, or we are in the landing pad where implicit call is disabled.
return true;
}
if (instr->HasBailOutInfo())
{
// make sure we have mark the bailout for mark temp object,
// so that we won't optimize it away in DeadStoreImplicitCalls
return ((instr->GetBailOutKind() & IR::BailOutMarkTempObject) != 0);
}
// Review (ObjTypeSpec): This is a bit conservative now that we don't revert from obj type specialized operations to live cache
// access even if the operation is isolated. Once we decide a given instruction is an object type spec candidate, we know it
// will never need an implicit call, so we could basically do opnd->IsObjTypeSpecOptimized() here, instead.
if (GlobOpt::IsTypeCheckProtected(instr))
{
return true;
}
return false;
}
bool
ObjectTempVerify::IsTempTransfer(IR::Instr * instr)
{
if (ObjectTemp::IsTempTransfer(instr)
// Add the Ld_I4, and LdC_A_I4 as the forward pass might have changed Ld_A to these
|| instr->m_opcode == Js::OpCode::Ld_I4
|| instr->m_opcode == Js::OpCode::LdC_A_I4)
{
if (!instr->dstIsTempObject && instr->GetDst() && instr->GetDst()->IsRegOpnd()
&& instr->GetDst()->AsRegOpnd()->GetValueType().IsNotObject())
{
// Globopt has proved that dst is not an object, so this is not really an object transfer.
// This prevents the case where glob opt turned a Conv_Num to Ld_A and expose additional
// transfer.
return false;
}
return true;
}
return false;
}
bool
ObjectTempVerify::CanMarkTemp(IR::Instr * instr, BackwardPass * backwardPass)
{
// We mark the ArgOut with the call in ProcessInstr, no need to do it here
return ObjectTemp::IsTempProducing(instr)
|| IsTempTransfer(instr);
}
void
ObjectTempVerify::ProcessInstr(IR::Instr * instr, BackwardPass * backwardPass)
{
if (instr->m_opcode == Js::OpCode::InlineThrow)
{
// We cannot accurately track mark temp for any upward exposed symbol here
this->removedUpwardExposedUse.Or(backwardPass->currentBlock->byteCodeUpwardExposedUsed);
return;
}
if (instr->m_opcode != Js::OpCode::CallDirect)
{
return;
}
IR::HelperCallOpnd * helper = instr->GetSrc1()->AsHelperCallOpnd();
switch (helper->m_fnHelper)
{
case IR::JnHelperMethod::HelperString_Match:
case IR::JnHelperMethod::HelperString_Replace:
{
// First (non-this) parameter is either a regexp or search string
// It doesn't escape
IR::Instr * instrArgDef;
instr->FindCallArgumentOpnd(2, &instrArgDef);
Assert(instrArgDef->dstIsTempObject);
break;
}
case IR::JnHelperMethod::HelperRegExp_Exec:
{
IR::Instr * instrArgDef;
instr->FindCallArgumentOpnd(1, &instrArgDef);
Assert(instrArgDef->dstIsTempObject);
break;
}
};
}
void
ObjectTempVerify::SetDstIsTemp(bool dstIsTemp, bool dstIsTempTransferred, IR::Instr * instr, BackwardPass * backwardPass)
{
Assert(dstIsTemp || !dstIsTempTransferred);
// ArgOut_A are marked by CallDirect and don't need to be set
if (instr->m_opcode == Js::OpCode::ArgOut_A)
{
return;
}
if (OpCodeAttr::TempObjectProducing(instr->m_opcode))
{
if (!backwardPass->IsPrePass())
{
if (dstIsTemp)
{
// Don't assert if we have detected a removed upward exposed use that could
// expose a new mark temp object. Don't assert if it is set in removedUpwardExposedUse
bool isBailOnNoProfileUpwardExposedUse =
!!this->removedUpwardExposedUse.Test(instr->GetDst()->AsRegOpnd()->m_sym->m_id);
#if DBG
if (DoTrace(backwardPass) && !instr->dstIsTempObject && !isBailOnNoProfileUpwardExposedUse)
{
Output::Print(_u("%s: Missed Mark Temp Object: "), GetTraceName());
instr->DumpSimple();
Output::Flush();
}
#endif
// TODO: Unfortunately we still hit this a lot as we are not accounting for some of the globopt changes
// to the IR. It is just reporting that we have missed mark temp object opportunity, so it doesn't
// indicate a functional failure. Disable for now.
// Assert(instr->dstIsTempObject || isBailOnNoProfileUpwardExposedUse);
}
else
{
// If we have marked the dst is temp in the backward pass, the globopt
// should have maintained it, and it will be wrong to have detect that it is not
// temp now in the deadstore pass (whether there is BailOnNoProfile or not)
#if DBG
if (DoTrace(backwardPass) && instr->dstIsTempObject)
{
Output::Print(_u("%s: Invalid Mark Temp Object: "), GetTraceName());
instr->DumpSimple();
Output::Flush();
}
#endif
// In a generator function, we don't allow marking temp across yields. Since this assert makes
// sure that all instructions whose destinations produce temps are marked, it is not
// applicable for generators
Assert(instr->m_func->GetJITFunctionBody()->IsCoroutine() || !instr->dstIsTempObject);
}
}
}
else if (IsTempTransfer(instr))
{
// Only set the transfer
instr->dstIsTempObject = dstIsTemp;
}
else
{
Assert(!dstIsTemp);
Assert(!instr->dstIsTempObject);
}
// clear or transfer the bailOnNoProfile upward exposed use
if (this->removedUpwardExposedUse.TestAndClear(instr->GetDst()->AsRegOpnd()->m_sym->m_id)
&& IsTempTransfer(instr) && instr->GetSrc1()->IsRegOpnd())
{
this->removedUpwardExposedUse.Set(instr->GetSrc1()->AsRegOpnd()->m_sym->m_id);
}
}
void
ObjectTempVerify::MergeData(ObjectTempVerify * fromData, bool deleteData)
{
this->removedUpwardExposedUse.Or(&fromData->removedUpwardExposedUse);
}
void
ObjectTempVerify::MergeDeadData(BasicBlock * block)
{
MergeData(block->tempObjectVerifyTracker, false);
if (!block->isDead)
{
// If there was dead flow to a block that is not dead, it might expose
// new mark temp object, so all its current used (upwardExposedUsed) and optimized
// use (byteCodeupwardExposedUsed) might not be trace for "missed" mark temp object
this->removedUpwardExposedUse.Or(block->upwardExposedUses);
if (block->byteCodeUpwardExposedUsed)
{
this->removedUpwardExposedUse.Or(block->byteCodeUpwardExposedUsed);
}
}
}
void
ObjectTempVerify::NotifyBailOutRemoval(IR:: Instr * instr, BackwardPass * backwardPass)
{
Js::OpCode opcode = instr->m_opcode;
switch (opcode)
{
case Js::OpCode::LdFld:
case Js::OpCode::LdFldForTypeOf:
case Js::OpCode::LdMethodFld:
((TempTracker<ObjectTempVerify> *)this)->ProcessUse(instr->GetSrc1()->AsPropertySymOpnd()->GetObjectSym(), backwardPass);
break;
case Js::OpCode::InitFld:
case Js::OpCode::StFld:
case Js::OpCode::StFldStrict:
((TempTracker<ObjectTempVerify> *)this)->ProcessUse(instr->GetDst()->AsPropertySymOpnd()->GetObjectSym(), backwardPass);
break;
case Js::OpCode::LdElemI_A:
((TempTracker<ObjectTempVerify> *)this)->ProcessUse(instr->GetSrc1()->AsIndirOpnd()->GetBaseOpnd()->m_sym, backwardPass);
break;
case Js::OpCode::StElemI_A:
((TempTracker<ObjectTempVerify> *)this)->ProcessUse(instr->GetDst()->AsIndirOpnd()->GetBaseOpnd()->m_sym, backwardPass);
break;
}
}
void
ObjectTempVerify::NotifyReverseCopyProp(IR::Instr * instr)
{
Assert(instr->GetDst());
SymID symId = instr->GetDst()->AsRegOpnd()->m_sym->m_id;
this->removedUpwardExposedUse.Clear(symId);
this->nonTempSyms.Clear(symId);
}
void
ObjectTempVerify::NotifyDeadStore(IR::Instr * instr, BackwardPass * backwardPass)
{
// Even if we dead store, simulate the uses
IR::Opnd * src1 = instr->GetSrc1();
if (src1)
{
IR::PropertySymOpnd * propertySymOpnd;
StackSym * stackSym = ObjectTemp::GetStackSym(src1, &propertySymOpnd);
if (stackSym)
{
((TempTracker<ObjectTempVerify> *)this)->ProcessUse(stackSym, backwardPass);
}
IR::Opnd * src2 = instr->GetSrc2();
if (src2)
{
stackSym = ObjectTemp::GetStackSym(src2, &propertySymOpnd);
if (stackSym)
{
((TempTracker<ObjectTempVerify> *)this)->ProcessUse(stackSym, backwardPass);
}
}
}
}
void
ObjectTempVerify::NotifyDeadByteCodeUses(IR::Instr * instr)
{
if (instr->GetDst())
{
SymID symId = instr->GetDst()->AsRegOpnd()->m_sym->m_id;
this->removedUpwardExposedUse.Clear(symId);
this->nonTempSyms.Clear(symId);
}
IR::ByteCodeUsesInstr *byteCodeUsesInstr = instr->AsByteCodeUsesInstr();
const BVSparse<JitArenaAllocator> * byteCodeUpwardExposedUsed = byteCodeUsesInstr->GetByteCodeUpwardExposedUsed();
if (byteCodeUpwardExposedUsed != nullptr)
{
this->removedUpwardExposedUse.Or(byteCodeUpwardExposedUsed);
}
}
bool
ObjectTempVerify::DependencyCheck(IR::Instr * instr, BVSparse<JitArenaAllocator> * bvTempTransferDependencies, BackwardPass * backwardPass)
{
if (!instr->dstIsTempObject)
{
// The instruction is not marked as temp object anyway, no need to do extra check
return false;
}
// Since our algorithm is conservative, there are cases where even though two defs are unrelated, the use will still
// seem like overlapping and not mark-temp-able
// For example:
// = s6.blah
// s1 = LdRootFld
// s6 = s1
// s1 = NewScObject // s1 is dependent of s6, and s6 is upward exposed.
// = s6.blah
// s6 = s1
// Here, although s1 is mark temp able because the s6.blah use is not related, we only know that s1 is dependent of s6
// so it looks like s1 may overlap through the iterations. The backward pass will be able to catch that and not mark temp them
// However, the globopt may create situation like the above while it wasn't there in the backward phase
// For example:
// = s6.blah
// s1 = LdRootFld g
// s6 = s1
// s1 = NewScObject
// s7 = LdRootFld g
// = s7.blah // Globopt copy prop s7 -> s6, creating the example above.
// s6 = s1
// This make it impossible to verify whether we did the right thing using the conservative algorithm.
// Luckily, this case is very rare (ExprGen didn't hit it with > 100K test cases)
// So we can use this rather expensive algorithm to find out if any of upward exposed used that we think overlaps
// really get their value from the marked temp sym or not.
// See unittest\Object\stackobject_dependency.js (with -maxinterpretcount:1 -off:inline)
BasicBlock * currentBlock = backwardPass->currentBlock;
BVSparse<JitArenaAllocator> * upwardExposedUses = currentBlock->upwardExposedUses;
JitArenaAllocator tempAllocator(_u("temp"), instr->m_func->m_alloc->GetPageAllocator(), Js::Throw::OutOfMemory);
BVSparse<JitArenaAllocator> * dependentSyms = bvTempTransferDependencies->AndNew(upwardExposedUses, &tempAllocator);
BVSparse<JitArenaAllocator> * initialDependentSyms = dependentSyms->CopyNew();
Assert(!dependentSyms->IsEmpty());
struct BlockRecord
{
BasicBlock * block;
BVSparse<JitArenaAllocator> * dependentSyms;
};
SList<BlockRecord> blockStack(&tempAllocator);
JsUtil::BaseDictionary<BasicBlock *, BVSparse<JitArenaAllocator> *, JitArenaAllocator> processedSyms(&tempAllocator);
IR::Instr * currentInstr = instr;
Assert(instr->GetDst()->AsRegOpnd()->m_sym->IsVar());
SymID markTempSymId = instr->GetDst()->AsRegOpnd()->m_sym->m_id;
bool initial = true;
while (true)
{
while (currentInstr != currentBlock->GetFirstInstr())
{
if (initial)
{
initial = false;
}
else if (currentInstr == instr)
{
if (dependentSyms->Test(markTempSymId))
{
// One of the dependent sym from the original set get it's value from the current marked temp dst.
// The dst definitely cannot be temp because it's lifetime overlaps across iterations.
return false;
}
// If we have already check the same dependent sym, no need to do it again.
// It will produce the same result anyway.
dependentSyms->Minus(initialDependentSyms);
if (dependentSyms->IsEmpty())
{
break;
}
// Add in newly discovered dependentSym so we won't do it again when it come back here.
initialDependentSyms->Or(dependentSyms);
}
if (currentInstr->GetDst() && currentInstr->GetDst()->IsRegOpnd())
{
// Clear the def and mark the src if it is transferred.
// If the dst sym is a type specialized sym, clear the var sym instead.
StackSym * dstSym = currentInstr->GetDst()->AsRegOpnd()->m_sym;
if (!dstSym->IsVar())
{
dstSym = dstSym->GetVarEquivSym(nullptr);
}
if (dstSym && dependentSyms->TestAndClear(dstSym->m_id) &&
IsTempTransfer(currentInstr) && currentInstr->GetSrc1()->IsRegOpnd())
{
// We only really care about var syms uses for object temp.
StackSym * srcSym = currentInstr->GetSrc1()->AsRegOpnd()->m_sym;
if (srcSym->IsVar())
{
dependentSyms->Set(srcSym->m_id);
}
}
if (dependentSyms->IsEmpty())
{
// No more dependent sym, we found the def of all of them we can move on to the next block.
break;
}
}
currentInstr = currentInstr->m_prev;
}
if (currentBlock->isLoopHeader && !dependentSyms->IsEmpty())
{
Assert(currentInstr == currentBlock->GetFirstInstr());
// If we have try to propagate the symbol through the loop before, we don't need to propagate it again.
BVSparse<JitArenaAllocator> * currentLoopProcessedSyms = processedSyms.Lookup(currentBlock, nullptr);
if (currentLoopProcessedSyms == nullptr)
{
processedSyms.Add(currentBlock, dependentSyms->CopyNew());
}
else
{
dependentSyms->Minus(currentLoopProcessedSyms);
currentLoopProcessedSyms->Or(dependentSyms);
}
}
if (!dependentSyms->IsEmpty())
{
Assert(currentInstr == currentBlock->GetFirstInstr());
FOREACH_PREDECESSOR_BLOCK(predBlock, currentBlock)
{
if (predBlock->loop == nullptr)
{
// No need to track outside of loops.
continue;
}
BlockRecord record;
record.block = predBlock;
record.dependentSyms = dependentSyms->CopyNew();
blockStack.Prepend(record);
}
NEXT_PREDECESSOR_BLOCK;
}
JitAdelete(&tempAllocator, dependentSyms);
if (blockStack.Empty())
{
// No more blocks. We are done.
break;
}
currentBlock = blockStack.Head().block;
dependentSyms = blockStack.Head().dependentSyms;
blockStack.RemoveHead();
currentInstr = currentBlock->GetLastInstr();
}
// All the dependent sym doesn't get their value from the marked temp def, so it can really be marked temp.
#if DBG
if (DoTrace(backwardPass))
{
Output::Print(_u("%s: Unrelated overlap mark temp (s%-3d): "), GetTraceName(), markTempSymId);
instr->DumpSimple();
Output::Flush();
}
#endif
return true;
}
#endif
#if DBG
bool
NumberTemp::DoTrace(BackwardPass * backwardPass)
{
return PHASE_TRACE(Js::MarkTempNumberPhase, backwardPass->func);
}
bool
ObjectTemp::DoTrace(BackwardPass * backwardPass)
{
return PHASE_TRACE(Js::MarkTempObjectPhase, backwardPass->func);
}
bool
ObjectTempVerify::DoTrace(BackwardPass * backwardPass)
{
return PHASE_TRACE(Js::MarkTempObjectPhase, backwardPass->func);
}
#endif
// explicit instantiation
template class TempTracker<NumberTemp>;
template class TempTracker<ObjectTemp>;
#if DBG
template class TempTracker<ObjectTempVerify>;
#endif
| mit |
davidstelter/dabl-mvc | src/helpers/json_encode_all.php | 713 | <?php
/**
* @link https://github.com/ManifestWebDesign/DABL
* @link http://manifestwebdesign.com/redmine/projects/dabl
* @author Manifest Web Design
* @license MIT License
*/
/**
* Convert a value to JSON
*
* This function returns a JSON representation of $param. It uses json_encode
* to accomplish this, but converts objects and arrays containing objects to
* associative arrays first. This way, objects that do not expose (all) their
* properties directly but only through an Iterator interface are also encoded
* correctly.
*/
function json_encode_all(&$param) {
if (is_object($param) || is_array($param)) {
return json_encode(object_to_array($param));
}
return json_encode($param);
} | mit |
michaelneu/MooseMachine | src/com/cs/moose/ui/controls/memorytable/MemoryTableRow.java | 1331 | package com.cs.moose.ui.controls.memorytable;
public class MemoryTableRow {
private final short[] values;
private final int row;
public MemoryTableRow(short[] values, int row) {
this.values = values;
this.row = row;
}
public int getColumn0() {
return row;
}
public short getColumn1() {
return values[0];
}
public short getColumn2() {
return values[1];
}
public short getColumn3() {
return values[2];
}
public short getColumn4() {
return values[3];
}
public short getColumn5() {
return values[4];
}
public short getColumn6() {
return values[5];
}
public short getColumn7() {
return values[6];
}
public short getColumn8() {
return values[7];
}
public short getColumn9() {
return values[8];
}
public short getColumn10() {
return values[9];
}
public static MemoryTableRow[] getRows(short[] memory) {
int rest = memory.length % 10,
count = memory.length / 10;
if (rest > 0) {
count++;
}
MemoryTableRow[] rows = new MemoryTableRow[count];
for (int i = 0; i < count; i++) {
short[] values = new short[10];
for (int j = 0; j < 10; j++) {
int index = i * 10 + j;
if (index < memory.length) {
values[j] = memory[index];
}
}
MemoryTableRow row = new MemoryTableRow(values, i * 10);
rows[i] = row;
}
return rows;
}
}
| mit |
teampl4y4/j2-exchange | web/bundles/j2exchange/js/backbone/form.js | 1175 | (function ($) {
$.extend(Backbone.View.prototype, {
parse: function(objName) {
var self = this,
recurse_form = function(object, objName) {
$.each(object, function(v,k) {
if (k instanceof Object) {
object[v] = recurse_form(k, objName + '[' + v + ']');
} else {
object[v] = self.$('[name="'+ objName + '[' + v + ']"]').val();
}
});
return object;
};
this.model.attributes = recurse_form(this.model.attributes, objName);
},
populate: function(objName) {
var self = this,
recurse_obj = function(object, objName) {
$.each(object, function (v,k) {
if (v instanceof Object) {
recurse_obj(v, k);
} else if (_.isString(v)) {
self.$('[name="'+ objName + '[' + v + ']"]').val(k);
}
});
};
recurse_obj(this.model.attributes, objName);
}
});
})(jQuery); | mit |
Susurrus/nix | test/test_mq.rs | 4429 | use nix::mqueue::{mq_open, mq_close, mq_send, mq_receive, mq_getattr, mq_setattr, mq_unlink, mq_set_nonblock, mq_remove_nonblock};
use nix::mqueue::{O_CREAT, O_WRONLY, O_RDONLY, O_NONBLOCK};
use nix::mqueue::MqAttr;
use nix::sys::stat::{S_IWUSR, S_IRUSR, S_IRGRP, S_IROTH};
use std::ffi::CString;
use std::str;
use libc::c_long;
use nix::errno::Errno::*;
use nix::Error::Sys;
#[test]
fn test_mq_send_and_receive() {
const MSG_SIZE: c_long = 32;
let attr = MqAttr::new(0, 10, MSG_SIZE, 0);
let mq_name= &CString::new(b"/a_nix_test_queue".as_ref()).unwrap();
let mqd0 = mq_open(mq_name, O_CREAT | O_WRONLY,
S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH,
Some(&attr)).unwrap();
let msg_to_send = "msg_1";
mq_send(mqd0, msg_to_send.as_bytes(), 1).unwrap();
let mqd1 = mq_open(mq_name, O_CREAT | O_RDONLY,
S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH,
Some(&attr)).unwrap();
let mut buf = [0u8; 32];
let mut prio = 0u32;
let len = mq_receive(mqd1, &mut buf, &mut prio).unwrap();
assert!(prio == 1);
mq_close(mqd1).unwrap();
mq_close(mqd0).unwrap();
assert_eq!(msg_to_send, str::from_utf8(&buf[0..len]).unwrap());
}
#[test]
fn test_mq_getattr() {
const MSG_SIZE: c_long = 32;
let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0);
let mq_name = &CString::new("/attr_test_get_attr".as_bytes().as_ref()).unwrap();
let mqd = mq_open(mq_name, O_CREAT | O_WRONLY, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH, Some(&initial_attr)).unwrap();
let read_attr = mq_getattr(mqd);
assert!(read_attr.unwrap() == initial_attr);
mq_close(mqd).unwrap();
}
// FIXME: Fix failures for mips in QEMU
#[test]
#[cfg_attr(any(target_arch = "mips", target_arch = "mips64"), ignore)]
fn test_mq_setattr() {
const MSG_SIZE: c_long = 32;
let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0);
let mq_name = &CString::new("/attr_test_get_attr".as_bytes().as_ref()).unwrap();
let mqd = mq_open(mq_name, O_CREAT | O_WRONLY, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH, Some(&initial_attr)).unwrap();
let new_attr = MqAttr::new(0, 20, MSG_SIZE * 2, 100);
let old_attr = mq_setattr(mqd, &new_attr);
assert!(old_attr.unwrap() == initial_attr);
let new_attr_get = mq_getattr(mqd);
// The following tests make sense. No changes here because according to the Linux man page only
// O_NONBLOCK can be set (see tests below)
assert!(new_attr_get.unwrap() != new_attr);
let new_attr_non_blocking = MqAttr::new(O_NONBLOCK.bits() as c_long, 10, MSG_SIZE, 0);
mq_setattr(mqd, &new_attr_non_blocking).unwrap();
let new_attr_get = mq_getattr(mqd);
// now the O_NONBLOCK flag has been set
assert!(new_attr_get.unwrap() != initial_attr);
assert!(new_attr_get.unwrap() == new_attr_non_blocking);
mq_close(mqd).unwrap();
}
// FIXME: Fix failures for mips in QEMU
#[test]
#[cfg_attr(any(target_arch = "mips", target_arch = "mips64"), ignore)]
fn test_mq_set_nonblocking() {
const MSG_SIZE: c_long = 32;
let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0);
let mq_name = &CString::new("/attr_test_get_attr".as_bytes().as_ref()).unwrap();
let mqd = mq_open(mq_name, O_CREAT | O_WRONLY, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH, Some(&initial_attr)).unwrap();
mq_set_nonblock(mqd).unwrap();
let new_attr = mq_getattr(mqd);
assert!(new_attr.unwrap().flags() == O_NONBLOCK.bits() as c_long);
mq_remove_nonblock(mqd).unwrap();
let new_attr = mq_getattr(mqd);
assert!(new_attr.unwrap().flags() == 0);
mq_close(mqd).unwrap();
}
#[test]
fn test_mq_unlink() {
const MSG_SIZE: c_long = 32;
let initial_attr = MqAttr::new(0, 10, MSG_SIZE, 0);
let mq_name_opened = &CString::new("/mq_unlink_test".as_bytes().as_ref()).unwrap();
let mq_name_not_opened = &CString::new("/mq_unlink_test".as_bytes().as_ref()).unwrap();
let mqd = mq_open(mq_name_opened, O_CREAT | O_WRONLY, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH, Some(&initial_attr)).unwrap();
let res_unlink = mq_unlink(mq_name_opened);
assert!(res_unlink == Ok(()) );
let res_unlink_not_opened = mq_unlink(mq_name_not_opened);
assert!(res_unlink_not_opened == Err(Sys(ENOENT)) );
mq_close(mqd).unwrap();
let res_unlink_after_close = mq_unlink(mq_name_opened);
assert!(res_unlink_after_close == Err(Sys(ENOENT)) );
}
| mit |
nvisionative/Dnn.Platform | DNN Platform/Library/Services/Cache/FBCachingProvider.cs | 7037 | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Services.Cache
{
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Web.Caching;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Instrumentation;
public class FBCachingProvider : CachingProvider
{
internal const string CacheFileExtension = ".resources";
internal static string CachingDirectory = "Cache\\";
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FBCachingProvider));
public override void Insert(string cacheKey, object itemToCache, DNNCacheDependency dependency, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority,
CacheItemRemovedCallback onRemoveCallback)
{
// initialize cache dependency
DNNCacheDependency d = dependency;
// if web farm is enabled
if (this.IsWebFarm())
{
// get hashed file name
var f = new string[1];
f[0] = GetFileName(cacheKey);
// create a cache file for item
CreateCacheFile(f[0], cacheKey);
// create a cache dependency on the cache file
d = new DNNCacheDependency(f, null, dependency);
}
// Call base class method to add obect to cache
base.Insert(cacheKey, itemToCache, d, absoluteExpiration, slidingExpiration, priority, onRemoveCallback);
}
public override bool IsWebFarm()
{
bool _IsWebFarm = Null.NullBoolean;
if (!string.IsNullOrEmpty(Config.GetSetting("IsWebFarm")))
{
_IsWebFarm = bool.Parse(Config.GetSetting("IsWebFarm"));
}
return _IsWebFarm;
}
public override string PurgeCache()
{
// called by scheduled job to remove cache files which are no longer active
return this.PurgeCacheFiles(Globals.HostMapPath + CachingDirectory);
}
public override void Remove(string Key)
{
base.Remove(Key);
// if web farm is enabled in config file
if (this.IsWebFarm())
{
// get hashed filename
string f = GetFileName(Key);
// delete cache file - this synchronizes the cache across servers in the farm
DeleteCacheFile(f);
}
}
private static string ByteArrayToString(byte[] arrInput)
{
int i;
var sOutput = new StringBuilder(arrInput.Length);
for (i = 0; i <= arrInput.Length - 1; i++)
{
sOutput.Append(arrInput[i].ToString("X2"));
}
return sOutput.ToString();
}
private static void CreateCacheFile(string FileName, string CacheKey)
{
// declare stream
StreamWriter s = null;
try
{
// if the cache file does not already exist
if (!File.Exists(FileName))
{
// create the cache file
s = File.CreateText(FileName);
// write the CacheKey to the file to provide a documented link between cache item and cache file
s.Write(CacheKey);
// close the stream
}
}
catch (Exception ex)
{
// permissions issue creating cache file or more than one thread may have been trying to write the cache file simultaneously
Exceptions.Exceptions.LogException(ex);
}
finally
{
if (s != null)
{
s.Close();
}
}
}
private static void DeleteCacheFile(string FileName)
{
try
{
if (File.Exists(FileName))
{
File.Delete(FileName);
}
}
catch (Exception ex)
{
// an error occurred when trying to delete the cache file - this is serious as it means that the cache will not be synchronized
Exceptions.Exceptions.LogException(ex);
}
}
private static string GetFileName(string CacheKey)
{
// cache key may contain characters invalid for a filename - this method creates a valid filename
byte[] FileNameBytes = Encoding.ASCII.GetBytes(CacheKey);
using (var sha256 = new SHA256CryptoServiceProvider())
{
FileNameBytes = sha256.ComputeHash(FileNameBytes);
string FinalFileName = ByteArrayToString(FileNameBytes);
return Path.GetFullPath(Globals.HostMapPath + CachingDirectory + FinalFileName + CacheFileExtension);
}
}
private string PurgeCacheFiles(string Folder)
{
// declare counters
int PurgedFiles = 0;
int PurgeErrors = 0;
int i;
// get list of cache files
string[] f;
f = Directory.GetFiles(Folder);
// loop through cache files
for (i = 0; i <= f.Length - 1; i++)
{
// get last write time for file
DateTime dtLastWrite;
dtLastWrite = File.GetLastWriteTime(f[i]);
// if the cache file is more than 2 hours old ( no point in checking most recent cache files )
if (dtLastWrite < DateTime.Now.Subtract(new TimeSpan(2, 0, 0)))
{
// get cachekey
string strCacheKey = Path.GetFileNameWithoutExtension(f[i]);
// if the cache key does not exist in memory
if (DataCache.GetCache(strCacheKey) == null)
{
try
{
// delete the file
File.Delete(f[i]);
PurgedFiles += 1;
}
catch (Exception exc)
{
// an error occurred
Logger.Error(exc);
PurgeErrors += 1;
}
}
}
}
// return a summary message for the job
return string.Format("Cache Synchronization Files Processed: " + f.Length + ", Purged: " + PurgedFiles + ", Errors: " + PurgeErrors);
}
}
}
| mit |
oliverviljamaa/markus-cinema-client | index.js | 76 | const getShows = require('./lib/getShows');
module.exports = { getShows };
| mit |
martinlindhe/rogue | spriteset_test.go | 796 | package rogue
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseSpritesetDefinitionCharacters(t *testing.T) {
ss, err := ParseSpritesetDefinition("resources/assets/tilesets/oddball/characters.yml")
assert.Equal(t, nil, err)
assert.Equal(t, true, len(ss.Tiles) > 2)
}
func TestParseSpritesetDefinitionItems(t *testing.T) {
ss, err := ParseSpritesetDefinition("resources/assets/tilesets/oddball/items.yml")
assert.Equal(t, nil, err)
assert.Equal(t, true, len(ss.Tiles) > 2)
}
func TestGenerateTexturePacker(t *testing.T) {
ss, err := ParseSpritesetDefinition("resources/assets/tilesets/oddball/characters.yml")
assert.Equal(t, nil, err)
assert.Equal(t, true, len(ss.Tiles) > 2)
tp := GenerateTexturePacker(ss)
assert.Equal(t, true, len(tp.Frames) > 2)
}
| mit |
gregwym/joos-compiler-java | testcases/a3/J1_castarrayaccess.java | 197 | // TYPE_CHECKING
public class J1_castarrayaccess {
public J1_castarrayaccess() {}
public static int test() {
String[] s = new String[5];
Object o = (Object)s[1];
return 123;
}
}
| mit |
mmkassem/gitlabhq | spec/lib/gitlab/request_profiler/profile_spec.rb | 1760 | # frozen_string_literal: true
require 'fast_spec_helper'
RSpec.describe Gitlab::RequestProfiler::Profile do
let(:profile) { described_class.new(filename) }
describe '.new' do
context 'using old filename' do
let(:filename) { '|api|v4|version.txt_1562854738.html' }
it 'returns valid data' do
expect(profile).to be_valid
expect(profile.request_path).to eq('/api/v4/version.txt')
expect(profile.time).to eq(Time.at(1562854738).utc)
expect(profile.type).to eq('html')
end
end
context 'using new filename' do
let(:filename) { '|api|v4|version.txt_1563547949_execution.html' }
it 'returns valid data' do
expect(profile).to be_valid
expect(profile.request_path).to eq('/api/v4/version.txt')
expect(profile.profile_mode).to eq('execution')
expect(profile.time).to eq(Time.at(1563547949).utc)
expect(profile.type).to eq('html')
end
end
end
describe '#content_type' do
context 'when using html file' do
let(:filename) { '|api|v4|version.txt_1562854738_memory.html' }
it 'returns valid data' do
expect(profile).to be_valid
expect(profile.content_type).to eq('text/html')
end
end
context 'when using text file' do
let(:filename) { '|api|v4|version.txt_1562854738_memory.txt' }
it 'returns valid data' do
expect(profile).to be_valid
expect(profile.content_type).to eq('text/plain')
end
end
context 'when file is unknown' do
let(:filename) { '|api|v4|version.txt_1562854738_memory.xxx' }
it 'returns valid data' do
expect(profile).not_to be_valid
expect(profile.content_type).to be_nil
end
end
end
end
| mit |
tum-i22/obfuscated-programs | tigress-generated-programs/empty-Seed4-RandomFuns-Type_int-ControlStructures_14-BB2-ForBound_input-Operators_PlusA_MinusA_Lt_Gt_Le_Ge_Eq_Ne_Mult_Div_Mod.c | 3745 | /* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned int input[1] , unsigned int output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
void RandomFunc(unsigned int input[1] , unsigned int output[1] )
{
unsigned int state[1] ;
unsigned int local1 ;
unsigned short copy11 ;
unsigned short copy13 ;
char copy14 ;
{
state[0UL] = (input[0UL] + 914778474UL) * 2674260758U;
local1 = 0UL;
while (local1 < input[1UL]) {
if (state[0UL] < local1) {
if (state[0UL] != local1) {
copy11 = *((unsigned short *)(& state[local1]) + 0);
*((unsigned short *)(& state[local1]) + 0) = *((unsigned short *)(& state[local1]) + 1);
*((unsigned short *)(& state[local1]) + 1) = copy11;
} else {
state[0UL] = state[local1] + state[local1];
state[0UL] += state[0UL];
}
} else
if (state[0UL] <= local1) {
copy13 = *((unsigned short *)(& state[0UL]) + 1);
*((unsigned short *)(& state[0UL]) + 1) = *((unsigned short *)(& state[0UL]) + 0);
*((unsigned short *)(& state[0UL]) + 0) = copy13;
copy13 = *((unsigned short *)(& state[0UL]) + 0);
*((unsigned short *)(& state[0UL]) + 0) = *((unsigned short *)(& state[0UL]) + 1);
*((unsigned short *)(& state[0UL]) + 1) = copy13;
copy14 = *((char *)(& state[0UL]) + 3);
*((char *)(& state[0UL]) + 3) = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = copy14;
} else {
state[0UL] -= state[local1];
state[local1] = state[0UL] + state[0UL];
}
local1 ++;
}
output[0UL] = state[0UL] + 1059477100UL;
}
}
void megaInit(void)
{
{
}
}
int main(int argc , char *argv[] )
{
unsigned int input[1] ;
unsigned int output[1] ;
int randomFuns_i5 ;
unsigned int randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = (unsigned int )strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 4242424242U) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
| mit |
camperjz/trident | modules/boonex/russian/install/config.php | 1513 | <?php
/**
* Copyright (c) UNA, Inc - https://una.io
* MIT License - https://opensource.org/licenses/MIT
*
* @defgroup Russian Russian language
* @ingroup UnaModules
*
* @{
*/
$aConfig = array(
/**
* Main Section.
*/
'type' => BX_DOL_MODULE_TYPE_LANGUAGE,
'name' => 'bx_ru',
'title' => 'Russian',
'note' => 'Language file',
'version' => '9.0.12.DEV',
'vendor' => 'Boonex',
'help_url' => 'http://feed.una.io/?section={module_name}',
'compatible_with' => array(
'9.0.x'
),
/**
* 'home_dir' and 'home_uri' - should be unique. Don't use spaces in 'home_uri' and the other special chars.
*/
'home_dir' => 'boonex/russian/',
'home_uri' => 'ru',
'db_prefix' => 'bx_rsn_',
'class_prefix' => 'BxRsn',
/**
* Category for language keys.
*/
'language_category' => 'BoonEx Russian',
/**
* Installation/Uninstallation Section.
* NOTE. The sequence of actions is critical. Don't change the order.
*/
'install' => array(
'execute_sql' => 1,
'update_languages' => 1,
'install_language' => 1,
'clear_db_cache' => 1
),
'uninstall' => array (
'update_languages' => 1,
'execute_sql' => 1,
'clear_db_cache' => 1
),
'enable' => array(
'execute_sql' => 1
),
'disable' => array(
'execute_sql' => 1
),
/**
* Dependencies Section
*/
'dependencies' => array(),
);
/** @} */
| mit |
quasoft/backgammonjs | app/server/README.md | 63 | # backgammon.js-server
See [`project README`](../../README.md) | mit |
peppy/osu | osu.Game/Rulesets/Mods/DifficultyAdjustSettingsControl.cs | 5254 | // Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Beatmaps;
using osu.Game.Overlays.Settings;
namespace osu.Game.Rulesets.Mods
{
public class DifficultyAdjustSettingsControl : SettingsItem<float?>
{
[Resolved]
private IBindable<WorkingBeatmap> beatmap { get; set; }
/// <summary>
/// Used to track the display value on the setting slider.
/// </summary>
/// <remarks>
/// When the mod is overriding a default, this will match the value of <see cref="Current"/>.
/// When there is no override (ie. <see cref="Current"/> is null), this value will match the beatmap provided default via <see cref="updateCurrentFromSlider"/>.
/// </remarks>
private readonly BindableNumber<float> sliderDisplayCurrent = new BindableNumber<float>();
protected override Drawable CreateControl() => new SliderControl(sliderDisplayCurrent);
/// <summary>
/// Guards against beatmap values displayed on slider bars being transferred to user override.
/// </summary>
private bool isInternalChange;
private DifficultyBindable difficultyBindable;
public override Bindable<float?> Current
{
get => base.Current;
set
{
// Intercept and extract the internal number bindable from DifficultyBindable.
// This will provide bounds and precision specifications for the slider bar.
difficultyBindable = (DifficultyBindable)value.GetBoundCopy();
sliderDisplayCurrent.BindTo(difficultyBindable.CurrentNumber);
base.Current = difficultyBindable;
}
}
protected override void LoadComplete()
{
base.LoadComplete();
Current.BindValueChanged(current => updateCurrentFromSlider());
beatmap.BindValueChanged(b => updateCurrentFromSlider(), true);
sliderDisplayCurrent.BindValueChanged(number =>
{
// this handles the transfer of the slider value to the main bindable.
// as such, should be skipped if the slider is being updated via updateFromDifficulty().
if (!isInternalChange)
Current.Value = number.NewValue;
});
}
private void updateCurrentFromSlider()
{
if (Current.Value != null)
{
// a user override has been added or updated.
sliderDisplayCurrent.Value = Current.Value.Value;
return;
}
var difficulty = beatmap.Value.BeatmapInfo.Difficulty;
// generally should always be implemented, else the slider will have a zero default.
if (difficultyBindable.ReadCurrentFromDifficulty == null)
return;
isInternalChange = true;
sliderDisplayCurrent.Value = difficultyBindable.ReadCurrentFromDifficulty(difficulty);
isInternalChange = false;
}
private class SliderControl : CompositeDrawable, IHasCurrentValue<float?>
{
// This is required as SettingsItem relies heavily on this bindable for internal use.
// The actual update flow is done via the bindable provided in the constructor.
private readonly DifficultyBindableWithCurrent current = new DifficultyBindableWithCurrent();
public Bindable<float?> Current
{
get => current.Current;
set => current.Current = value;
}
public SliderControl(BindableNumber<float> currentNumber)
{
InternalChildren = new Drawable[]
{
new SettingsSlider<float>
{
ShowsDefaultIndicator = false,
Current = currentNumber,
KeyboardStep = 0.1f,
}
};
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
}
}
private class DifficultyBindableWithCurrent : DifficultyBindable, IHasCurrentValue<float?>
{
private Bindable<float?> currentBound;
public Bindable<float?> Current
{
get => this;
set
{
if (value == null)
throw new ArgumentNullException(nameof(value));
if (currentBound != null) UnbindFrom(currentBound);
BindTo(currentBound = value);
}
}
public DifficultyBindableWithCurrent(float? defaultValue = default)
: base(defaultValue)
{
}
protected override Bindable<float?> CreateInstance() => new DifficultyBindableWithCurrent();
}
}
}
| mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.