text
stringlengths
2
99.9k
meta
dict
Block element characteristics The difference between `visibility:hidden` and `display:none` Disable resizable property of `textarea` Use `:not()` to apply/unapply styles Styling elements using `::before` and `::after`
{ "pile_set_name": "Github" }
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ssh import ( "bytes" "errors" "fmt" "io" ) type authResult int const ( authFailure authResult = iota authPartialSuccess authSuccess ) // clientAuthenticate authenticates with the remote server. See RFC 4252. func (c *connection) clientAuthenticate(config *ClientConfig) error { // initiate user auth session if err := c.transport.writePacket(Marshal(&serviceRequestMsg{serviceUserAuth})); err != nil { return err } packet, err := c.transport.readPacket() if err != nil { return err } var serviceAccept serviceAcceptMsg if err := Unmarshal(packet, &serviceAccept); err != nil { return err } // during the authentication phase the client first attempts the "none" method // then any untried methods suggested by the server. tried := make(map[string]bool) var lastMethods []string sessionID := c.transport.getSessionID() for auth := AuthMethod(new(noneAuth)); auth != nil; { ok, methods, err := auth.auth(sessionID, config.User, c.transport, config.Rand) if err != nil { return err } if ok == authSuccess { // success return nil } else if ok == authFailure { tried[auth.method()] = true } if methods == nil { methods = lastMethods } lastMethods = methods auth = nil findNext: for _, a := range config.Auth { candidateMethod := a.method() if tried[candidateMethod] { continue } for _, meth := range methods { if meth == candidateMethod { auth = a break findNext } } } } return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", keys(tried)) } func keys(m map[string]bool) []string { s := make([]string, 0, len(m)) for key := range m { s = append(s, key) } return s } // An AuthMethod represents an instance of an RFC 4252 authentication method. type AuthMethod interface { // auth authenticates user over transport t. // Returns true if authentication is successful. // If authentication is not successful, a []string of alternative // method names is returned. If the slice is nil, it will be ignored // and the previous set of possible methods will be reused. auth(session []byte, user string, p packetConn, rand io.Reader) (authResult, []string, error) // method returns the RFC 4252 method name. method() string } // "none" authentication, RFC 4252 section 5.2. type noneAuth int func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { if err := c.writePacket(Marshal(&userAuthRequestMsg{ User: user, Service: serviceSSH, Method: "none", })); err != nil { return authFailure, nil, err } return handleAuthResponse(c) } func (n *noneAuth) method() string { return "none" } // passwordCallback is an AuthMethod that fetches the password through // a function call, e.g. by prompting the user. type passwordCallback func() (password string, err error) func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { type passwordAuthMsg struct { User string `sshtype:"50"` Service string Method string Reply bool Password string } pw, err := cb() // REVIEW NOTE: is there a need to support skipping a password attempt? // The program may only find out that the user doesn't have a password // when prompting. if err != nil { return authFailure, nil, err } if err := c.writePacket(Marshal(&passwordAuthMsg{ User: user, Service: serviceSSH, Method: cb.method(), Reply: false, Password: pw, })); err != nil { return authFailure, nil, err } return handleAuthResponse(c) } func (cb passwordCallback) method() string { return "password" } // Password returns an AuthMethod using the given password. func Password(secret string) AuthMethod { return passwordCallback(func() (string, error) { return secret, nil }) } // PasswordCallback returns an AuthMethod that uses a callback for // fetching a password. func PasswordCallback(prompt func() (secret string, err error)) AuthMethod { return passwordCallback(prompt) } type publickeyAuthMsg struct { User string `sshtype:"50"` Service string Method string // HasSig indicates to the receiver packet that the auth request is signed and // should be used for authentication of the request. HasSig bool Algoname string PubKey []byte // Sig is tagged with "rest" so Marshal will exclude it during // validateKey Sig []byte `ssh:"rest"` } // publicKeyCallback is an AuthMethod that uses a set of key // pairs for authentication. type publicKeyCallback func() ([]Signer, error) func (cb publicKeyCallback) method() string { return "publickey" } func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { // Authentication is performed by sending an enquiry to test if a key is // acceptable to the remote. If the key is acceptable, the client will // attempt to authenticate with the valid key. If not the client will repeat // the process with the remaining keys. signers, err := cb() if err != nil { return authFailure, nil, err } var methods []string for _, signer := range signers { ok, err := validateKey(signer.PublicKey(), user, c) if err != nil { return authFailure, nil, err } if !ok { continue } pub := signer.PublicKey() pubKey := pub.Marshal() sign, err := signer.Sign(rand, buildDataSignedForAuth(session, userAuthRequestMsg{ User: user, Service: serviceSSH, Method: cb.method(), }, []byte(pub.Type()), pubKey)) if err != nil { return authFailure, nil, err } // manually wrap the serialized signature in a string s := Marshal(sign) sig := make([]byte, stringLength(len(s))) marshalString(sig, s) msg := publickeyAuthMsg{ User: user, Service: serviceSSH, Method: cb.method(), HasSig: true, Algoname: pub.Type(), PubKey: pubKey, Sig: sig, } p := Marshal(&msg) if err := c.writePacket(p); err != nil { return authFailure, nil, err } var success authResult success, methods, err = handleAuthResponse(c) if err != nil { return authFailure, nil, err } // If authentication succeeds or the list of available methods does not // contain the "publickey" method, do not attempt to authenticate with any // other keys. According to RFC 4252 Section 7, the latter can occur when // additional authentication methods are required. if success == authSuccess || !containsMethod(methods, cb.method()) { return success, methods, err } } return authFailure, methods, nil } func containsMethod(methods []string, method string) bool { for _, m := range methods { if m == method { return true } } return false } // validateKey validates the key provided is acceptable to the server. func validateKey(key PublicKey, user string, c packetConn) (bool, error) { pubKey := key.Marshal() msg := publickeyAuthMsg{ User: user, Service: serviceSSH, Method: "publickey", HasSig: false, Algoname: key.Type(), PubKey: pubKey, } if err := c.writePacket(Marshal(&msg)); err != nil { return false, err } return confirmKeyAck(key, c) } func confirmKeyAck(key PublicKey, c packetConn) (bool, error) { pubKey := key.Marshal() algoname := key.Type() for { packet, err := c.readPacket() if err != nil { return false, err } switch packet[0] { case msgUserAuthBanner: if err := handleBannerResponse(c, packet); err != nil { return false, err } case msgUserAuthPubKeyOk: var msg userAuthPubKeyOkMsg if err := Unmarshal(packet, &msg); err != nil { return false, err } if msg.Algo != algoname || !bytes.Equal(msg.PubKey, pubKey) { return false, nil } return true, nil case msgUserAuthFailure: return false, nil default: return false, unexpectedMessageError(msgUserAuthSuccess, packet[0]) } } } // PublicKeys returns an AuthMethod that uses the given key // pairs. func PublicKeys(signers ...Signer) AuthMethod { return publicKeyCallback(func() ([]Signer, error) { return signers, nil }) } // PublicKeysCallback returns an AuthMethod that runs the given // function to obtain a list of key pairs. func PublicKeysCallback(getSigners func() (signers []Signer, err error)) AuthMethod { return publicKeyCallback(getSigners) } // handleAuthResponse returns whether the preceding authentication request succeeded // along with a list of remaining authentication methods to try next and // an error if an unexpected response was received. func handleAuthResponse(c packetConn) (authResult, []string, error) { for { packet, err := c.readPacket() if err != nil { return authFailure, nil, err } switch packet[0] { case msgUserAuthBanner: if err := handleBannerResponse(c, packet); err != nil { return authFailure, nil, err } case msgUserAuthFailure: var msg userAuthFailureMsg if err := Unmarshal(packet, &msg); err != nil { return authFailure, nil, err } if msg.PartialSuccess { return authPartialSuccess, msg.Methods, nil } return authFailure, msg.Methods, nil case msgUserAuthSuccess: return authSuccess, nil, nil default: return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0]) } } } func handleBannerResponse(c packetConn, packet []byte) error { var msg userAuthBannerMsg if err := Unmarshal(packet, &msg); err != nil { return err } transport, ok := c.(*handshakeTransport) if !ok { return nil } if transport.bannerCallback != nil { return transport.bannerCallback(msg.Message) } return nil } // KeyboardInteractiveChallenge should print questions, optionally // disabling echoing (e.g. for passwords), and return all the answers. // Challenge may be called multiple times in a single session. After // successful authentication, the server may send a challenge with no // questions, for which the user and instruction messages should be // printed. RFC 4256 section 3.3 details how the UI should behave for // both CLI and GUI environments. type KeyboardInteractiveChallenge func(user, instruction string, questions []string, echos []bool) (answers []string, err error) // KeyboardInteractive returns an AuthMethod using a prompt/response // sequence controlled by the server. func KeyboardInteractive(challenge KeyboardInteractiveChallenge) AuthMethod { return challenge } func (cb KeyboardInteractiveChallenge) method() string { return "keyboard-interactive" } func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { type initiateMsg struct { User string `sshtype:"50"` Service string Method string Language string Submethods string } if err := c.writePacket(Marshal(&initiateMsg{ User: user, Service: serviceSSH, Method: "keyboard-interactive", })); err != nil { return authFailure, nil, err } for { packet, err := c.readPacket() if err != nil { return authFailure, nil, err } // like handleAuthResponse, but with less options. switch packet[0] { case msgUserAuthBanner: if err := handleBannerResponse(c, packet); err != nil { return authFailure, nil, err } continue case msgUserAuthInfoRequest: // OK case msgUserAuthFailure: var msg userAuthFailureMsg if err := Unmarshal(packet, &msg); err != nil { return authFailure, nil, err } if msg.PartialSuccess { return authPartialSuccess, msg.Methods, nil } return authFailure, msg.Methods, nil case msgUserAuthSuccess: return authSuccess, nil, nil default: return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0]) } var msg userAuthInfoRequestMsg if err := Unmarshal(packet, &msg); err != nil { return authFailure, nil, err } // Manually unpack the prompt/echo pairs. rest := msg.Prompts var prompts []string var echos []bool for i := 0; i < int(msg.NumPrompts); i++ { prompt, r, ok := parseString(rest) if !ok || len(r) == 0 { return authFailure, nil, errors.New("ssh: prompt format error") } prompts = append(prompts, string(prompt)) echos = append(echos, r[0] != 0) rest = r[1:] } if len(rest) != 0 { return authFailure, nil, errors.New("ssh: extra data following keyboard-interactive pairs") } answers, err := cb(msg.User, msg.Instruction, prompts, echos) if err != nil { return authFailure, nil, err } if len(answers) != len(prompts) { return authFailure, nil, errors.New("ssh: not enough answers from keyboard-interactive callback") } responseLength := 1 + 4 for _, a := range answers { responseLength += stringLength(len(a)) } serialized := make([]byte, responseLength) p := serialized p[0] = msgUserAuthInfoResponse p = p[1:] p = marshalUint32(p, uint32(len(answers))) for _, a := range answers { p = marshalString(p, []byte(a)) } if err := c.writePacket(serialized); err != nil { return authFailure, nil, err } } } type retryableAuthMethod struct { authMethod AuthMethod maxTries int } func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader) (ok authResult, methods []string, err error) { for i := 0; r.maxTries <= 0 || i < r.maxTries; i++ { ok, methods, err = r.authMethod.auth(session, user, c, rand) if ok != authFailure || err != nil { // either success, partial success or error terminate return ok, methods, err } } return ok, methods, err } func (r *retryableAuthMethod) method() string { return r.authMethod.method() } // RetryableAuthMethod is a decorator for other auth methods enabling them to // be retried up to maxTries before considering that AuthMethod itself failed. // If maxTries is <= 0, will retry indefinitely // // This is useful for interactive clients using challenge/response type // authentication (e.g. Keyboard-Interactive, Password, etc) where the user // could mistype their response resulting in the server issuing a // SSH_MSG_USERAUTH_FAILURE (rfc4252 #8 [password] and rfc4256 #3.4 // [keyboard-interactive]); Without this decorator, the non-retryable // AuthMethod would be removed from future consideration, and never tried again // (and so the user would never be able to retry their entry). func RetryableAuthMethod(auth AuthMethod, maxTries int) AuthMethod { return &retryableAuthMethod{authMethod: auth, maxTries: maxTries} }
{ "pile_set_name": "Github" }
//===- llvm/Support/FileUtilities.h - File System Utilities -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines a family of utility functions which are useful for doing // various things with files. // //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_FILEUTILITIES_H #define LLVM_SUPPORT_FILEUTILITIES_H #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" namespace llvm { /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if /// the files match, 1 if they are different, and 2 if there is a file error. /// This function allows you to specify an absolute and relative FP error that /// is allowed to exist. If you specify a string to fill in for the error /// option, it will set the string to an error message if an error occurs, or /// if the files are different. /// int DiffFilesWithTolerance(const sys::PathWithStatus &FileA, const sys::PathWithStatus &FileB, double AbsTol, double RelTol, std::string *Error = 0); /// FileRemover - This class is a simple object meant to be stack allocated. /// If an exception is thrown from a region, the object removes the filename /// specified (if deleteIt is true). /// class FileRemover { SmallString<128> Filename; bool DeleteIt; public: FileRemover() : DeleteIt(false) {} explicit FileRemover(const Twine& filename, bool deleteIt = true) : DeleteIt(deleteIt) { filename.toVector(Filename); } ~FileRemover() { if (DeleteIt) { // Ignore problems deleting the file. bool existed; sys::fs::remove(Filename.str(), existed); } } /// setFile - Give ownership of the file to the FileRemover so it will /// be removed when the object is destroyed. If the FileRemover already /// had ownership of a file, remove it first. void setFile(const Twine& filename, bool deleteIt = true) { if (DeleteIt) { // Ignore problems deleting the file. bool existed; sys::fs::remove(Filename.str(), existed); } Filename.clear(); filename.toVector(Filename); DeleteIt = deleteIt; } /// releaseFile - Take ownership of the file away from the FileRemover so it /// will not be removed when the object is destroyed. void releaseFile() { DeleteIt = false; } }; } // End llvm namespace #endif
{ "pile_set_name": "Github" }
{% from 'flagit/includes/macros.html' import date_by_user with context %} <h3 class="sumo-page-intro">{{ _('Title:') }}</h3> <p class="title">{{ object.content_object.thread.title }}</p> <h3 class="sumo-page-intro">{{ _('Content:') }}</h3> <div class="content">{{ object.content_object.content_parsed }}</div> <h3 class="sumo-page-intro">{{ _('Created:') }}</h3> <p class="created"> {% set author = object.content_object.author if object.content_object.author else object.content_object.creator %} {{ date_by_user(object.content_object.created, author) }} </p> {% if object.content_object.updated_by %} <h3 class="sumo-page-intro">{{ _('Updated:') }}</h3> <p class="updated"> {{ date_by_user(object.content_object.updated, object.content_object.updated_by) }} </p> {% endif %} <h3 class="sumo-page-intro">{{ _('Flagged:') }}</h3> <p class="flagged"> {{ date_by_user(object.created, object.creator) }} </p> <h3 class="sumo-page-intro">{{ _('Take Action:') }}</h3> <div class="actions sumo-button-wrap"> <a class="sumo-button button-sm" href="{{ object.content_object.get_absolute_url() }}">View</a> {% if object.content_type.name == 'KB Forum Post' %} {% if user.has_perm('kbforums.change_post') %} <a class="sumo-button button-sm edit" href="{{ url('wiki.discuss.edit_post', object.content_object.thread.document.slug, object.content_object.thread.id, object.content_object.id) }}">{{ _('Edit') }}</a> {% endif %} {% if user.has_perm('kbforums.delete_post') %} <a class="sumo-button button-sm delete" href="{{ url('wiki.discuss.delete_post', object.content_object.thread.document.slug, object.content_object.thread.id, object.content_object.id) }}">{{ _('Delete') }}</a> {% endif %} {% endif %} </div>
{ "pile_set_name": "Github" }
/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: k8s.io/kubernetes/vendor/k8s.io/api/discovery/v1beta1/generated.proto package v1beta1 import ( fmt "fmt" io "io" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" k8s_io_api_core_v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" math "math" math_bits "math/bits" reflect "reflect" strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package func (m *Endpoint) Reset() { *m = Endpoint{} } func (*Endpoint) ProtoMessage() {} func (*Endpoint) Descriptor() ([]byte, []int) { return fileDescriptor_ece80bbc872d519b, []int{0} } func (m *Endpoint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *Endpoint) XXX_Merge(src proto.Message) { xxx_messageInfo_Endpoint.Merge(m, src) } func (m *Endpoint) XXX_Size() int { return m.Size() } func (m *Endpoint) XXX_DiscardUnknown() { xxx_messageInfo_Endpoint.DiscardUnknown(m) } var xxx_messageInfo_Endpoint proto.InternalMessageInfo func (m *EndpointConditions) Reset() { *m = EndpointConditions{} } func (*EndpointConditions) ProtoMessage() {} func (*EndpointConditions) Descriptor() ([]byte, []int) { return fileDescriptor_ece80bbc872d519b, []int{1} } func (m *EndpointConditions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *EndpointConditions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *EndpointConditions) XXX_Merge(src proto.Message) { xxx_messageInfo_EndpointConditions.Merge(m, src) } func (m *EndpointConditions) XXX_Size() int { return m.Size() } func (m *EndpointConditions) XXX_DiscardUnknown() { xxx_messageInfo_EndpointConditions.DiscardUnknown(m) } var xxx_messageInfo_EndpointConditions proto.InternalMessageInfo func (m *EndpointPort) Reset() { *m = EndpointPort{} } func (*EndpointPort) ProtoMessage() {} func (*EndpointPort) Descriptor() ([]byte, []int) { return fileDescriptor_ece80bbc872d519b, []int{2} } func (m *EndpointPort) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *EndpointPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *EndpointPort) XXX_Merge(src proto.Message) { xxx_messageInfo_EndpointPort.Merge(m, src) } func (m *EndpointPort) XXX_Size() int { return m.Size() } func (m *EndpointPort) XXX_DiscardUnknown() { xxx_messageInfo_EndpointPort.DiscardUnknown(m) } var xxx_messageInfo_EndpointPort proto.InternalMessageInfo func (m *EndpointSlice) Reset() { *m = EndpointSlice{} } func (*EndpointSlice) ProtoMessage() {} func (*EndpointSlice) Descriptor() ([]byte, []int) { return fileDescriptor_ece80bbc872d519b, []int{3} } func (m *EndpointSlice) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *EndpointSlice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *EndpointSlice) XXX_Merge(src proto.Message) { xxx_messageInfo_EndpointSlice.Merge(m, src) } func (m *EndpointSlice) XXX_Size() int { return m.Size() } func (m *EndpointSlice) XXX_DiscardUnknown() { xxx_messageInfo_EndpointSlice.DiscardUnknown(m) } var xxx_messageInfo_EndpointSlice proto.InternalMessageInfo func (m *EndpointSliceList) Reset() { *m = EndpointSliceList{} } func (*EndpointSliceList) ProtoMessage() {} func (*EndpointSliceList) Descriptor() ([]byte, []int) { return fileDescriptor_ece80bbc872d519b, []int{4} } func (m *EndpointSliceList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } func (m *EndpointSliceList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } func (m *EndpointSliceList) XXX_Merge(src proto.Message) { xxx_messageInfo_EndpointSliceList.Merge(m, src) } func (m *EndpointSliceList) XXX_Size() int { return m.Size() } func (m *EndpointSliceList) XXX_DiscardUnknown() { xxx_messageInfo_EndpointSliceList.DiscardUnknown(m) } var xxx_messageInfo_EndpointSliceList proto.InternalMessageInfo func init() { proto.RegisterType((*Endpoint)(nil), "k8s.io.api.discovery.v1beta1.Endpoint") proto.RegisterMapType((map[string]string)(nil), "k8s.io.api.discovery.v1beta1.Endpoint.TopologyEntry") proto.RegisterType((*EndpointConditions)(nil), "k8s.io.api.discovery.v1beta1.EndpointConditions") proto.RegisterType((*EndpointPort)(nil), "k8s.io.api.discovery.v1beta1.EndpointPort") proto.RegisterType((*EndpointSlice)(nil), "k8s.io.api.discovery.v1beta1.EndpointSlice") proto.RegisterType((*EndpointSliceList)(nil), "k8s.io.api.discovery.v1beta1.EndpointSliceList") } func init() { proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/api/discovery/v1beta1/generated.proto", fileDescriptor_ece80bbc872d519b) } var fileDescriptor_ece80bbc872d519b = []byte{ // 745 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcf, 0x6b, 0xdb, 0x48, 0x14, 0xb6, 0xe2, 0x88, 0x95, 0xc6, 0x31, 0x9b, 0x0c, 0x7b, 0x30, 0xde, 0x20, 0x19, 0x2f, 0x2c, 0x66, 0x43, 0xa4, 0x75, 0xc8, 0x2e, 0x61, 0xf7, 0x14, 0xed, 0x86, 0xb6, 0xd0, 0x36, 0x66, 0x1a, 0x28, 0x94, 0x1e, 0x3a, 0x96, 0x26, 0xb2, 0x6a, 0x5b, 0x23, 0x34, 0x63, 0x83, 0x6f, 0xfd, 0x13, 0xfa, 0xf7, 0xf4, 0x5a, 0x28, 0x39, 0xe6, 0x98, 0x93, 0xa8, 0xd5, 0xff, 0x22, 0xa7, 0x32, 0xa3, 0x5f, 0x76, 0xdd, 0x1f, 0xbe, 0xcd, 0x7c, 0xf3, 0xbe, 0xef, 0xbd, 0xf7, 0xcd, 0x7b, 0xe0, 0x62, 0x7c, 0xc6, 0xac, 0x80, 0xda, 0xe3, 0xd9, 0x90, 0xc4, 0x21, 0xe1, 0x84, 0xd9, 0x73, 0x12, 0x7a, 0x34, 0xb6, 0xf3, 0x07, 0x1c, 0x05, 0xb6, 0x17, 0x30, 0x97, 0xce, 0x49, 0xbc, 0xb0, 0xe7, 0xfd, 0x21, 0xe1, 0xb8, 0x6f, 0xfb, 0x24, 0x24, 0x31, 0xe6, 0xc4, 0xb3, 0xa2, 0x98, 0x72, 0x0a, 0x0f, 0xb3, 0x68, 0x0b, 0x47, 0x81, 0x55, 0x46, 0x5b, 0x79, 0x74, 0xfb, 0xd8, 0x0f, 0xf8, 0x68, 0x36, 0xb4, 0x5c, 0x3a, 0xb5, 0x7d, 0xea, 0x53, 0x5b, 0x92, 0x86, 0xb3, 0x6b, 0x79, 0x93, 0x17, 0x79, 0xca, 0xc4, 0xda, 0xdd, 0x95, 0xd4, 0x2e, 0x8d, 0x89, 0x3d, 0xdf, 0x48, 0xd8, 0x3e, 0xad, 0x62, 0xa6, 0xd8, 0x1d, 0x05, 0xa1, 0xa8, 0x2e, 0x1a, 0xfb, 0x02, 0x60, 0xf6, 0x94, 0x70, 0xfc, 0x35, 0x96, 0xfd, 0x2d, 0x56, 0x3c, 0x0b, 0x79, 0x30, 0x25, 0x1b, 0x84, 0xbf, 0x7f, 0x44, 0x60, 0xee, 0x88, 0x4c, 0xf1, 0x97, 0xbc, 0xee, 0xbb, 0x3a, 0xd0, 0x2e, 0x42, 0x2f, 0xa2, 0x41, 0xc8, 0xe1, 0x11, 0xd0, 0xb1, 0xe7, 0xc5, 0x84, 0x31, 0xc2, 0x5a, 0x4a, 0xa7, 0xde, 0xd3, 0x9d, 0x66, 0x9a, 0x98, 0xfa, 0x79, 0x01, 0xa2, 0xea, 0x1d, 0x7a, 0x00, 0xb8, 0x34, 0xf4, 0x02, 0x1e, 0xd0, 0x90, 0xb5, 0x76, 0x3a, 0x4a, 0xaf, 0x71, 0xf2, 0xa7, 0xf5, 0x3d, 0x7b, 0xad, 0x22, 0xd1, 0x7f, 0x25, 0xcf, 0x81, 0x37, 0x89, 0x59, 0x4b, 0x13, 0x13, 0x54, 0x18, 0x5a, 0xd1, 0x85, 0x3d, 0xa0, 0x8d, 0x28, 0xe3, 0x21, 0x9e, 0x92, 0x56, 0xbd, 0xa3, 0xf4, 0x74, 0x67, 0x2f, 0x4d, 0x4c, 0xed, 0x61, 0x8e, 0xa1, 0xf2, 0x15, 0x0e, 0x80, 0xce, 0x71, 0xec, 0x13, 0x8e, 0xc8, 0x75, 0x6b, 0x57, 0x96, 0xf3, 0xdb, 0x6a, 0x39, 0xe2, 0x83, 0xac, 0x79, 0xdf, 0xba, 0x1c, 0xbe, 0x26, 0xae, 0x08, 0x22, 0x31, 0x09, 0x5d, 0x92, 0x75, 0x78, 0x55, 0x30, 0x51, 0x25, 0x02, 0x87, 0x40, 0xe3, 0x34, 0xa2, 0x13, 0xea, 0x2f, 0x5a, 0x6a, 0xa7, 0xde, 0x6b, 0x9c, 0x9c, 0x6e, 0xd7, 0x9f, 0x75, 0x95, 0xd3, 0x2e, 0x42, 0x1e, 0x2f, 0x9c, 0xfd, 0xbc, 0x47, 0xad, 0x80, 0x51, 0xa9, 0xdb, 0xfe, 0x17, 0x34, 0xd7, 0x82, 0xe1, 0x3e, 0xa8, 0x8f, 0xc9, 0xa2, 0xa5, 0x88, 0x5e, 0x91, 0x38, 0xc2, 0x5f, 0x80, 0x3a, 0xc7, 0x93, 0x19, 0x91, 0x1e, 0xeb, 0x28, 0xbb, 0xfc, 0xb3, 0x73, 0xa6, 0x74, 0xff, 0x02, 0x70, 0xd3, 0x52, 0x68, 0x02, 0x35, 0x26, 0xd8, 0xcb, 0x34, 0x34, 0x47, 0x4f, 0x13, 0x53, 0x45, 0x02, 0x40, 0x19, 0xde, 0xfd, 0xa0, 0x80, 0xbd, 0x82, 0x37, 0xa0, 0x31, 0x87, 0x87, 0x60, 0x57, 0x1a, 0x2c, 0x93, 0x3a, 0x5a, 0x9a, 0x98, 0xbb, 0x4f, 0x85, 0xb9, 0x12, 0x85, 0x0f, 0x80, 0x26, 0x67, 0xc5, 0xa5, 0x93, 0xac, 0x04, 0xe7, 0x48, 0x34, 0x33, 0xc8, 0xb1, 0xfb, 0xc4, 0xfc, 0x75, 0x73, 0x0f, 0xac, 0xe2, 0x19, 0x95, 0x64, 0x91, 0x26, 0xa2, 0x31, 0x97, 0xff, 0xa8, 0x66, 0x69, 0x44, 0x7a, 0x24, 0x51, 0xd8, 0x07, 0x0d, 0x1c, 0x45, 0x05, 0x4d, 0xfe, 0xa0, 0xee, 0xfc, 0x9c, 0x26, 0x66, 0xe3, 0xbc, 0x82, 0xd1, 0x6a, 0x4c, 0x77, 0xb9, 0x03, 0x9a, 0x45, 0x23, 0xcf, 0x26, 0x81, 0x4b, 0xe0, 0x2b, 0xa0, 0x89, 0x95, 0xf2, 0x30, 0xc7, 0xb2, 0x9b, 0xf5, 0x91, 0x2c, 0x37, 0xc3, 0x8a, 0xc6, 0xbe, 0x00, 0x98, 0x25, 0xa2, 0xab, 0xa9, 0x78, 0x42, 0x38, 0xae, 0x46, 0xb2, 0xc2, 0x50, 0xa9, 0x0a, 0xff, 0x07, 0x8d, 0x7c, 0x07, 0xae, 0x16, 0x11, 0xc9, 0xcb, 0xec, 0xe6, 0x94, 0xc6, 0x79, 0xf5, 0x74, 0xbf, 0x7e, 0x45, 0xab, 0x34, 0xf8, 0x1c, 0xe8, 0x24, 0x2f, 0x5c, 0xec, 0x8e, 0x98, 0xad, 0xdf, 0xb7, 0x9b, 0x2d, 0xe7, 0x20, 0xcf, 0xa5, 0x17, 0x08, 0x43, 0x95, 0x16, 0xbc, 0x04, 0xaa, 0x70, 0x93, 0xb5, 0xea, 0x52, 0xf4, 0x8f, 0xed, 0x44, 0xc5, 0x37, 0x38, 0xcd, 0x5c, 0x58, 0x15, 0x37, 0x86, 0x32, 0x9d, 0xee, 0x7b, 0x05, 0x1c, 0xac, 0x79, 0xfc, 0x38, 0x60, 0x1c, 0xbe, 0xdc, 0xf0, 0xd9, 0xda, 0xce, 0x67, 0xc1, 0x96, 0x2e, 0x97, 0x4b, 0x51, 0x20, 0x2b, 0x1e, 0x0f, 0x80, 0x1a, 0x70, 0x32, 0x2d, 0x9c, 0x39, 0xda, 0xae, 0x09, 0x59, 0x5d, 0xd5, 0xc5, 0x23, 0xa1, 0x80, 0x32, 0x21, 0xe7, 0xf8, 0x66, 0x69, 0xd4, 0x6e, 0x97, 0x46, 0xed, 0x6e, 0x69, 0xd4, 0xde, 0xa4, 0x86, 0x72, 0x93, 0x1a, 0xca, 0x6d, 0x6a, 0x28, 0x77, 0xa9, 0xa1, 0x7c, 0x4c, 0x0d, 0xe5, 0xed, 0x27, 0xa3, 0xf6, 0xe2, 0xa7, 0x5c, 0xf2, 0x73, 0x00, 0x00, 0x00, 0xff, 0xff, 0x29, 0x1a, 0xa2, 0x6f, 0x6d, 0x06, 0x00, 0x00, } func (m *Endpoint) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *Endpoint) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Topology) > 0 { keysForTopology := make([]string, 0, len(m.Topology)) for k := range m.Topology { keysForTopology = append(keysForTopology, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForTopology) for iNdEx := len(keysForTopology) - 1; iNdEx >= 0; iNdEx-- { v := m.Topology[string(keysForTopology[iNdEx])] baseI := i i -= len(v) copy(dAtA[i:], v) i = encodeVarintGenerated(dAtA, i, uint64(len(v))) i-- dAtA[i] = 0x12 i -= len(keysForTopology[iNdEx]) copy(dAtA[i:], keysForTopology[iNdEx]) i = encodeVarintGenerated(dAtA, i, uint64(len(keysForTopology[iNdEx]))) i-- dAtA[i] = 0xa i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0x2a } } if m.TargetRef != nil { { size, err := m.TargetRef.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x22 } if m.Hostname != nil { i -= len(*m.Hostname) copy(dAtA[i:], *m.Hostname) i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Hostname))) i-- dAtA[i] = 0x1a } { size, err := m.Conditions.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 if len(m.Addresses) > 0 { for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.Addresses[iNdEx]) copy(dAtA[i:], m.Addresses[iNdEx]) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Addresses[iNdEx]))) i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } func (m *EndpointConditions) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *EndpointConditions) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *EndpointConditions) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Ready != nil { i-- if *m.Ready { dAtA[i] = 1 } else { dAtA[i] = 0 } i-- dAtA[i] = 0x8 } return len(dAtA) - i, nil } func (m *EndpointPort) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *EndpointPort) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *EndpointPort) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.AppProtocol != nil { i -= len(*m.AppProtocol) copy(dAtA[i:], *m.AppProtocol) i = encodeVarintGenerated(dAtA, i, uint64(len(*m.AppProtocol))) i-- dAtA[i] = 0x22 } if m.Port != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) i-- dAtA[i] = 0x18 } if m.Protocol != nil { i -= len(*m.Protocol) copy(dAtA[i:], *m.Protocol) i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Protocol))) i-- dAtA[i] = 0x12 } if m.Name != nil { i -= len(*m.Name) copy(dAtA[i:], *m.Name) i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } func (m *EndpointSlice) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *EndpointSlice) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *EndpointSlice) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l i -= len(m.AddressType) copy(dAtA[i:], m.AddressType) i = encodeVarintGenerated(dAtA, i, uint64(len(m.AddressType))) i-- dAtA[i] = 0x22 if len(m.Ports) > 0 { for iNdEx := len(m.Ports) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Ports[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x1a } } if len(m.Endpoints) > 0 { for iNdEx := len(m.Endpoints) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Endpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func (m *EndpointSliceList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } return dAtA[:n], nil } func (m *EndpointSliceList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } func (m *EndpointSliceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } } { size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } i -= size i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return base } func (m *Endpoint) Size() (n int) { if m == nil { return 0 } var l int _ = l if len(m.Addresses) > 0 { for _, s := range m.Addresses { l = len(s) n += 1 + l + sovGenerated(uint64(l)) } } l = m.Conditions.Size() n += 1 + l + sovGenerated(uint64(l)) if m.Hostname != nil { l = len(*m.Hostname) n += 1 + l + sovGenerated(uint64(l)) } if m.TargetRef != nil { l = m.TargetRef.Size() n += 1 + l + sovGenerated(uint64(l)) } if len(m.Topology) > 0 { for k, v := range m.Topology { _ = k _ = v mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } return n } func (m *EndpointConditions) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Ready != nil { n += 2 } return n } func (m *EndpointPort) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Name != nil { l = len(*m.Name) n += 1 + l + sovGenerated(uint64(l)) } if m.Protocol != nil { l = len(*m.Protocol) n += 1 + l + sovGenerated(uint64(l)) } if m.Port != nil { n += 1 + sovGenerated(uint64(*m.Port)) } if m.AppProtocol != nil { l = len(*m.AppProtocol) n += 1 + l + sovGenerated(uint64(l)) } return n } func (m *EndpointSlice) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Endpoints) > 0 { for _, e := range m.Endpoints { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } if len(m.Ports) > 0 { for _, e := range m.Ports { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } l = len(m.AddressType) n += 1 + l + sovGenerated(uint64(l)) return n } func (m *EndpointSliceList) Size() (n int) { if m == nil { return 0 } var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *Endpoint) String() string { if this == nil { return "nil" } keysForTopology := make([]string, 0, len(this.Topology)) for k := range this.Topology { keysForTopology = append(keysForTopology, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForTopology) mapStringForTopology := "map[string]string{" for _, k := range keysForTopology { mapStringForTopology += fmt.Sprintf("%v: %v,", k, this.Topology[k]) } mapStringForTopology += "}" s := strings.Join([]string{`&Endpoint{`, `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, `Conditions:` + strings.Replace(strings.Replace(this.Conditions.String(), "EndpointConditions", "EndpointConditions", 1), `&`, ``, 1) + `,`, `Hostname:` + valueToStringGenerated(this.Hostname) + `,`, `TargetRef:` + strings.Replace(fmt.Sprintf("%v", this.TargetRef), "ObjectReference", "v1.ObjectReference", 1) + `,`, `Topology:` + mapStringForTopology + `,`, `}`, }, "") return s } func (this *EndpointConditions) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&EndpointConditions{`, `Ready:` + valueToStringGenerated(this.Ready) + `,`, `}`, }, "") return s } func (this *EndpointPort) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&EndpointPort{`, `Name:` + valueToStringGenerated(this.Name) + `,`, `Protocol:` + valueToStringGenerated(this.Protocol) + `,`, `Port:` + valueToStringGenerated(this.Port) + `,`, `AppProtocol:` + valueToStringGenerated(this.AppProtocol) + `,`, `}`, }, "") return s } func (this *EndpointSlice) String() string { if this == nil { return "nil" } repeatedStringForEndpoints := "[]Endpoint{" for _, f := range this.Endpoints { repeatedStringForEndpoints += strings.Replace(strings.Replace(f.String(), "Endpoint", "Endpoint", 1), `&`, ``, 1) + "," } repeatedStringForEndpoints += "}" repeatedStringForPorts := "[]EndpointPort{" for _, f := range this.Ports { repeatedStringForPorts += strings.Replace(strings.Replace(f.String(), "EndpointPort", "EndpointPort", 1), `&`, ``, 1) + "," } repeatedStringForPorts += "}" s := strings.Join([]string{`&EndpointSlice{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v11.ObjectMeta", 1), `&`, ``, 1) + `,`, `Endpoints:` + repeatedStringForEndpoints + `,`, `Ports:` + repeatedStringForPorts + `,`, `AddressType:` + fmt.Sprintf("%v", this.AddressType) + `,`, `}`, }, "") return s } func (this *EndpointSliceList) String() string { if this == nil { return "nil" } repeatedStringForItems := "[]EndpointSlice{" for _, f := range this.Items { repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "EndpointSlice", "EndpointSlice", 1), `&`, ``, 1) + "," } repeatedStringForItems += "}" s := strings.Join([]string{`&EndpointSliceList{`, `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v11.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + repeatedStringForItems + `,`, `}`, }, "") return s } func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *Endpoint) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: Endpoint: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: Endpoint: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Conditions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Hostname", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } s := string(dAtA[iNdEx:postIndex]) m.Hostname = &s iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TargetRef", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.TargetRef == nil { m.TargetRef = &v1.ObjectReference{} } if err := m.TargetRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if m.Topology == nil { m.Topology = make(map[string]string) } var mapkey string var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapvalue |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { return ErrInvalidLengthGenerated } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue < 0 { return ErrInvalidLengthGenerated } if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Topology[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *EndpointConditions) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: EndpointConditions: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: EndpointConditions: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Ready", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int(b&0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.Ready = &b default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *EndpointPort) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: EndpointPort: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: EndpointPort: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } s := string(dAtA[iNdEx:postIndex]) m.Name = &s iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Protocol", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } s := k8s_io_api_core_v1.Protocol(dAtA[iNdEx:postIndex]) m.Protocol = &s iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Port", wireType) } var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= int32(b&0x7F) << shift if b < 0x80 { break } } m.Port = &v case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AppProtocol", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } s := string(dAtA[iNdEx:postIndex]) m.AppProtocol = &s iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *EndpointSlice) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: EndpointSlice: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: EndpointSlice: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Endpoints", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Endpoints = append(m.Endpoints, Endpoint{}) if err := m.Endpoints[len(m.Endpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Ports", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Ports = append(m.Ports, EndpointPort{}) if err := m.Ports[len(m.Ports)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AddressType", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.AddressType = AddressType(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *EndpointSliceList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= uint64(b&0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: EndpointSliceList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: EndpointSliceList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= int(b&0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, EndpointSlice{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } case 1: iNdEx += 8 case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if length < 0 { return 0, ErrInvalidLengthGenerated } iNdEx += length case 3: depth++ case 4: if depth == 0 { return 0, ErrUnexpectedEndOfGroupGenerated } depth-- case 5: iNdEx += 4 default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { return 0, ErrInvalidLengthGenerated } if depth == 0 { return iNdEx, nil } } return 0, io.ErrUnexpectedEOF } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") )
{ "pile_set_name": "Github" }
apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: grafanadashboards.integreatly.org spec: group: integreatly.org names: kind: GrafanaDashboard listKind: GrafanaDashboardList plural: grafanadashboards singular: grafanadashboard scope: Namespaced subresources: status: {} version: v1alpha1 validation: openAPIV3Schema: properties: spec: properties: name: type: string json: type: string url: type: string description: URL to dashboard json datasources: type: array items: description: Input datasources to resolve before importing type: object plugins: type: array items: description: Grafana Plugin Object type: object
{ "pile_set_name": "Github" }
/* * * 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. */ package org.apache.royale.display.js { COMPILE::JS /** * @royaleignorecoercion SVGElement */ public function createGraphicsSVG(elementName:String, noPointerEvents:Boolean = true):SVGElement { var svgElement:SVGElement = document.createElementNS('http://www.w3.org/2000/svg', elementName) as SVGElement; //Graphics (emulation) has no inherent pointer-events because it is supposed to be visual only, //but elements inside 'defs' don't need this, so it is avoidable when not needed: if (noPointerEvents) svgElement.setAttribute('pointer-events', 'none'); return svgElement; } }
{ "pile_set_name": "Github" }
:vars { color1: rgb(0, 255, 0, 0.8); } .root { color: value(color1); }
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace TX.Framework.WindowUI.Controls { [ToolboxBitmap(typeof(DateTimePicker))] public class TXDateTimePicker : DateTimePicker { #region fileds private int _Margin = 2; private int _CornerRadius = 0; private Color _BackColor = Color.White; private bool DroppedDown = false; private int InvalidateSince = 0; #endregion #region Initializes public TXDateTimePicker() : base() { this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.DoubleBuffer, true); this.UpdateStyles(); this.Size = new Size(150, 20); base.CalendarForeColor = Color.Blue; base.CalendarTrailingForeColor = Color.CadetBlue; base.CalendarMonthBackground = SkinManager.CurrentSkin.DefaultControlColor.First; base.CalendarTitleBackColor = SkinManager.CurrentSkin.CaptionColor.First; this.ShowCheckBox = true; this.Checked = true; } #endregion #region Properties [Category("TXProperties")] [Description("获取或者设置控件的事件日期时间值")] [Browsable(true)] public new DateTime? Value { get { if (this.Checked) { return base.Value; } return null; } set { if (value == null || value == DateTime.MinValue || value == DateTime.MaxValue) { this.ShowCheckBox = true; this.Checked = false; base.Value = DateTime.Now; } else { base.Value = (DateTime)value; } } } internal Rectangle ButtonRect { get { return this.GetDropDownButtonRect(); } } [Browsable(false)] public new Color BackColor { get { return base.BackColor; } } [Browsable(false)] public new RightToLeft RightToLeft { get { return base.RightToLeft; } } #endregion #region Override methods protected override void OnDropDown(EventArgs eventargs) { InvalidateSince = 0; DroppedDown = true; base.OnDropDown(eventargs); } protected override void OnCloseUp(EventArgs eventargs) { DroppedDown = false; base.OnCloseUp(eventargs); this.Invalidate(this.ButtonRect); } protected override void WndProc(ref Message m) { IntPtr hDC = IntPtr.Zero; Graphics gdc = null; switch (m.Msg) { case (int)WindowMessages.WM_NCPAINT: hDC = Win32.GetWindowDC(m.HWnd); Win32.SendMessage(this.Handle, (int)WindowMessages.WM_ERASEBKGND, hDC, 0); this.SendPrintClientMsg(); m.Result = Win32.TRUE; Win32.ReleaseDC(m.HWnd, hDC); break; case (int)WindowMessages.WM_PAINT: base.WndProc(ref m); hDC = Win32.GetWindowDC(m.HWnd); gdc = Graphics.FromHdc(hDC); this.DrawButton(gdc); this.DrawComboBoxBorder(gdc); Win32.ReleaseDC(m.HWnd, hDC); gdc.Dispose(); break; case (int)WindowMessages.WM_SETCURSOR: base.WndProc(ref m); //The value 3 is discovered by trial on error, and cover all kinds of scenarios //InvalidateSince < 2 wil have problem if the control is not in focus and dropdown is clicked //if (DroppedDown && InvalidateSince < 3) //{ // Invalidate(); // InvalidateSince++; //} break; default: base.WndProc(ref m); break; } } private void SendPrintClientMsg() { Graphics gClient = this.CreateGraphics(); IntPtr ptrClientDC = gClient.GetHdc(); Win32.SendMessage(this.Handle, (int)WindowMessages.WM_PRINTCLIENT, ptrClientDC, 0); gClient.ReleaseHdc(ptrClientDC); gClient.Dispose(); } #endregion #region private methods #region RenderComboBox /// <summary> /// 绘制下拉框区域. /// </summary> /// <param name="g">The Graphics.</param> /// User:Ryan CreateTime:2011-07-29 15:44. private void DrawComboBoxBorder(Graphics g) { GDIHelper.InitializeGraphics(g); Rectangle rect = new Rectangle(Point.Empty, this.Size); rect.Width--; rect.Height--; using (Pen pen = new Pen(SkinManager.CurrentSkin.BorderColor, 1)) { g.DrawRectangle(pen, rect); } } /// <summary> /// 绘制按钮 /// </summary> /// <param name="g">The Graphics.</param> /// User:Ryan CreateTime:2011-08-02 14:23. private void DrawButton(Graphics g) { GDIHelper.InitializeGraphics(g); RoundRectangle btnRoundRect = new RoundRectangle(this.ButtonRect, 0); Color c = this.Enabled ? this._BackColor : SystemColors.Control; Size btnSize = new Size(20, 20); GDIHelper.FillRectangle(g, btnRoundRect, c); GDIHelper.DrawImage(g, this.ButtonRect, Properties.Resources.calendar, btnSize); } #endregion #region GetBoxInfo private Rectangle GetDropDownButtonRect() { ComboBox cb = new ComboBox(); ComboBoxInfo cbi = new ComboBoxInfo(); cbi.cbSize = Marshal.SizeOf(cbi); Win32.GetComboBoxInfo(cb.Handle, ref cbi); cb.Dispose(); int width = cbi.rcButton.Rect.Width; Rectangle rect = new Rectangle(this.Width - width - this._Margin * 2, this._Margin, this.Height - this._Margin, this.Height - this._Margin * 2); return rect; } #endregion #region ResetRegion private void ResetRegion() { if (this._CornerRadius > 0) { Rectangle rect = new Rectangle(Point.Empty, this.Size); RoundRectangle roundRect = new RoundRectangle(rect, new CornerRadius(this._CornerRadius)); if (this.Region != null) { this.Region.Dispose(); } this.Region = new Region(roundRect.ToGraphicsBezierPath()); } } #endregion #endregion } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Configuration for traced components, spans and logs. * * @see io.helidon.tracing.config.TracingConfig */ package io.helidon.tracing.config;
{ "pile_set_name": "Github" }
"""This script contains classes to help export nif header information.""" # ***** BEGIN LICENSE BLOCK ***** # # Copyright © 2016, NIF File Format Library and Tools contributors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # * 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. # # * Neither the name of the NIF File Format Library and Tools # project nor the names of its contributors may be used to endorse # or promote products derived from this software without specific # prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "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 # COPYRIGHT OWNER 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. # # ***** END LICENSE BLOCK ***** import bpy from io_scene_nif.utils.util_global import NifOp from io_scene_nif.utils.util_logging import NifLog from pyffi.formats.nif import NifFormat def get_version_data(): """ Returns NifFormat.Data of the correct version and user versions """ b_scene = bpy.context.scene.niftools_scene game = b_scene.game version = b_scene.nif_version NifLog.info("Writing NIF version 0x%08X" % version) # get user version and user version 2 for export user_version = b_scene.user_version if b_scene.user_version else b_scene.USER_VERSION.get(game, 0) user_version_2 = b_scene.user_version_2 if b_scene.user_version_2 else b_scene.USER_VERSION_2.get(game, 0) return version, NifFormat.Data(version, user_version, user_version_2)
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Bucket type = "1" version = "2.0"> </Bucket>
{ "pile_set_name": "Github" }
/* * DRAM/SDRAM initialization - alter with care * This file is intended to be included from other assembler files * * Note: This file may not modify r8 or r9 because they are used to * carry information from the decompresser to the kernel * * Copyright (C) 2000-2007 Axis Communications AB * * Authors: Mikael Starvik <[email protected]> */ /* Just to be certain the config file is included, we include it here * explicitely instead of depending on it being included in the file that * uses this code. */ #include <hwregs/asm/reg_map_asm.h> #include <hwregs/asm/bif_core_defs_asm.h> ;; WARNING! The registers r8 and r9 are used as parameters carrying ;; information from the decompressor (if the kernel was compressed). ;; They should not be used in the code below. ; Refer to BIF MDS for a description of SDRAM initialization ; Bank configuration move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp0), $r0 move.d CONFIG_ETRAX_SDRAM_GRP0_CONFIG, $r1 move.d $r1, [$r0] move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp1), $r0 move.d CONFIG_ETRAX_SDRAM_GRP1_CONFIG, $r1 move.d $r1, [$r0] ; Calculate value of mrs_data ; CAS latency = 2 && bus_width = 32 => 0x40 ; CAS latency = 3 && bus_width = 32 => 0x60 ; CAS latency = 2 && bus_width = 16 => 0x20 ; CAS latency = 3 && bus_width = 16 => 0x30 ; Check if value is already supplied in kernel config move.d CONFIG_ETRAX_SDRAM_COMMAND, $r2 bne _set_timing nop move.d 0x40, $r4 ; Assume 32 bits and CAS latency = 2 move.d CONFIG_ETRAX_SDRAM_TIMING, $r1 and.d 0x07, $r1 ; Get CAS latency cmpq 2, $r1 ; CL = 2 ? beq _bw_check nop move.d 0x60, $r4 _bw_check: ; Assume that group 0 width is equal to group 1. This assumption ; is wrong for a group 1 only hardware (such as the grand old ; StorPoint+). move.d CONFIG_ETRAX_SDRAM_GRP0_CONFIG, $r1 and.d 0x200, $r1 ; DRAM width is bit 9 beq _set_timing lslq 2, $r4 ; mrs_data starts at bit 2 lsrq 1, $r4 ; 16 bits. Shift down value. ; Set timing parameters (refresh off to avoid Guinness TR 83) _set_timing: move.d CONFIG_ETRAX_SDRAM_TIMING, $r1 and.d ~(3 << reg_bif_core_rw_sdram_timing___ref___lsb), $r1 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing), $r0 move.d $r1, [$r0] ; Issue NOP command move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cmd), $r5 moveq regk_bif_core_nop, $r1 move.d $r1, [$r5] ; Wait 200us move.d 10000, $r2 1: bne 1b subq 1, $r2 ; Issue initialization command sequence lapc _sdram_commands_start, $r2 lapc _sdram_commands_end, $r3 1: clear.d $r6 move.b [$r2+], $r6 ; Load command or.d $r4, $r6 ; Add calculated mrs move.d $r6, [$r5] ; Write rw_sdram_cmd ; Wait 80 ns between each command move.d 4000, $r7 2: bne 2b subq 1, $r7 cmp.d $r2, $r3 ; Last command? bne 1b nop ; Start refresh move.d CONFIG_ETRAX_SDRAM_TIMING, $r1 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing), $r0 move.d $r1, [$r0] ; Initialization finished ba _sdram_commands_end nop _sdram_commands_start: .byte regk_bif_core_pre ; Precharge .byte regk_bif_core_ref ; refresh .byte regk_bif_core_ref ; refresh .byte regk_bif_core_ref ; refresh .byte regk_bif_core_ref ; refresh .byte regk_bif_core_ref ; refresh .byte regk_bif_core_ref ; refresh .byte regk_bif_core_ref ; refresh .byte regk_bif_core_ref ; refresh .byte regk_bif_core_mrs ; mrs _sdram_commands_end:
{ "pile_set_name": "Github" }
# This file contains a list of people who've made non-trivial # contribution to the Google C++ Testing Framework project. People # who commit code to the project are encouraged to add their names # here. Please keep the list sorted by first names. Ajay Joshi <[email protected]> Balázs Dán <[email protected]> Bharat Mediratta <[email protected]> Chandler Carruth <[email protected]> Chris Prince <[email protected]> Chris Taylor <[email protected]> Dan Egnor <[email protected]> Eric Roman <[email protected]> Hady Zalek <[email protected]> Jeffrey Yasskin <[email protected]> Jói Sigurðsson <[email protected]> Keir Mierle <[email protected]> Keith Ray <[email protected]> Kenton Varda <[email protected]> Manuel Klimek <[email protected]> Markus Heule <[email protected]> Mika Raento <[email protected]> Miklós Fazekas <[email protected]> Pasi Valminen <[email protected]> Patrick Hanna <[email protected]> Patrick Riley <[email protected]> Peter Kaminski <[email protected]> Preston Jackson <[email protected]> Rainer Klaffenboeck <[email protected]> Russ Cox <[email protected]> Russ Rufer <[email protected]> Sean Mcafee <[email protected]> Sigurður Ásgeirsson <[email protected]> Tracy Bialik <[email protected]> Vadim Berman <[email protected]> Vlad Losev <[email protected]> Zhanyong Wan <[email protected]>
{ "pile_set_name": "Github" }
config VIDEO_TLG2300 tristate "Telegent TLG2300 USB video capture support" depends on VIDEO_DEV && I2C && SND && DVB_CORE select VIDEO_TUNER select VIDEO_TVEEPROM depends on RC_CORE select VIDEOBUF_VMALLOC select SND_PCM select VIDEOBUF_DVB ---help--- This is a video4linux driver for Telegent tlg2300 based TV cards. The driver supports V4L2, DVB-T and radio. To compile this driver as a module, choose M here: the module will be called poseidon
{ "pile_set_name": "Github" }
{ key: value, // with comment key2: value, 'key-3': value, key4: false ? undefined : true }
{ "pile_set_name": "Github" }
div // es5 only in pug .b-poll .poll .name= model.name .text!= model.text_html .poll-variants for poll_variant in model.variants if can_vote .poll-variant.pending label.b-radio input( name='poll_' + model.id type='radio' value=poll_variant.id ) .radio-label = poll_variant.label else .poll-variant.result .votes-total= poll_variant.votes_total .votes-percent #{bar_percent(poll_variant)}% label = poll_variant.label if model.vote && model.vote.variant_id == poll_variant.id .voted-for ✓ .bar.simple.horizontal .line .bar( class=bar_class(poll_variant) style='width: ' + bar_percent(poll_variant) + '%' ) if can_vote .poll-actions .vote.hidden= I18n.t('frontend.polls.vote') .abstain.hidden= I18n.t('frontend.polls.abstain')
{ "pile_set_name": "Github" }
// // Panels // -------------------------------------------------- // Base class .panel { margin-bottom: @line-height-computed; background-color: @panel-bg; border: 1px solid transparent; border-radius: @panel-border-radius; .box-shadow(0 1px 1px rgba(0,0,0,.05)); } // Panel contents .panel-body { padding: @panel-body-padding; &:extend(.clearfix all); } // Optional heading .panel-heading { padding: @panel-heading-padding; border-bottom: 1px solid transparent; .border-top-radius((@panel-border-radius - 1)); > .dropdown .dropdown-toggle { color: inherit; } } // Within heading, strip any `h*` tag of its default margins for spacing. .panel-title { margin-top: 0; margin-bottom: 0; font-size: ceil((@font-size-base * 1.125)); color: inherit; > a, > small, > .small, > small > a, > .small > a { color: inherit; } } // Optional footer (stays gray in every modifier class) .panel-footer { padding: @panel-footer-padding; background-color: @panel-footer-bg; border-top: 1px solid @panel-inner-border; .border-bottom-radius((@panel-border-radius - 1)); } // List groups in panels // // By default, space out list group content from panel headings to account for // any kind of custom content between the two. .panel { > .list-group, > .panel-collapse > .list-group { margin-bottom: 0; .list-group-item { border-width: 1px 0; border-radius: 0; } // Add border top radius for first one &:first-child { .list-group-item:first-child { border-top: 0; .border-top-radius((@panel-border-radius - 1)); } } // Add border bottom radius for last one &:last-child { .list-group-item:last-child { border-bottom: 0; .border-bottom-radius((@panel-border-radius - 1)); } } } > .panel-heading + .panel-collapse > .list-group { .list-group-item:first-child { .border-top-radius(0); } } } // Collapse space between when there's no additional content. .panel-heading + .list-group { .list-group-item:first-child { border-top-width: 0; } } .list-group + .panel-footer { border-top-width: 0; } // Tables in panels // // Place a non-bordered `.table` within a panel (not within a `.panel-body`) and // watch it go full width. .panel { > .table, > .table-responsive > .table, > .panel-collapse > .table { margin-bottom: 0; caption { padding-left: @panel-body-padding; padding-right: @panel-body-padding; } } // Add border top radius for first one > .table:first-child, > .table-responsive:first-child > .table:first-child { .border-top-radius((@panel-border-radius - 1)); > thead:first-child, > tbody:first-child { > tr:first-child { border-top-left-radius: (@panel-border-radius - 1); border-top-right-radius: (@panel-border-radius - 1); td:first-child, th:first-child { border-top-left-radius: (@panel-border-radius - 1); } td:last-child, th:last-child { border-top-right-radius: (@panel-border-radius - 1); } } } } // Add border bottom radius for last one > .table:last-child, > .table-responsive:last-child > .table:last-child { .border-bottom-radius((@panel-border-radius - 1)); > tbody:last-child, > tfoot:last-child { > tr:last-child { border-bottom-left-radius: (@panel-border-radius - 1); border-bottom-right-radius: (@panel-border-radius - 1); td:first-child, th:first-child { border-bottom-left-radius: (@panel-border-radius - 1); } td:last-child, th:last-child { border-bottom-right-radius: (@panel-border-radius - 1); } } } } > .panel-body + .table, > .panel-body + .table-responsive, > .table + .panel-body, > .table-responsive + .panel-body { border-top: 1px solid @table-border-color; } > .table > tbody:first-child > tr:first-child th, > .table > tbody:first-child > tr:first-child td { border-top: 0; } > .table-bordered, > .table-responsive > .table-bordered { border: 0; > thead, > tbody, > tfoot { > tr { > th:first-child, > td:first-child { border-left: 0; } > th:last-child, > td:last-child { border-right: 0; } } } > thead, > tbody { > tr:first-child { > td, > th { border-bottom: 0; } } } > tbody, > tfoot { > tr:last-child { > td, > th { border-bottom: 0; } } } } > .table-responsive { border: 0; margin-bottom: 0; } } // Collapsable panels (aka, accordion) // // Wrap a series of panels in `.panel-group` to turn them into an accordion with // the help of our collapse JavaScript plugin. .panel-group { margin-bottom: @line-height-computed; // Tighten up margin so it's only between panels .panel { margin-bottom: 0; border-radius: @panel-border-radius; + .panel { margin-top: 5px; } } .panel-heading { border-bottom: 0; + .panel-collapse > .panel-body, + .panel-collapse > .list-group { border-top: 1px solid @panel-inner-border; } } .panel-footer { border-top: 0; + .panel-collapse .panel-body { border-bottom: 1px solid @panel-inner-border; } } } // Contextual variations .panel-default { .panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border); } .panel-primary { .panel-variant(@panel-primary-border; @panel-primary-text; @panel-primary-heading-bg; @panel-primary-border); } .panel-success { .panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border); } .panel-info { .panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border); } .panel-warning { .panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border); } .panel-danger { .panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border); }
{ "pile_set_name": "Github" }
// // ViewController.swift // Demo // // Created by CHEN Xian’an on 1/16/16. // Copyright © 2016 lazyapps. All rights reserved. // import UIKit import MenuItemKit class ViewController: UIViewController { @IBOutlet var button: UIButton! override func viewDidLoad() { super.viewDidLoad() button.addTarget(self, action: #selector(self.tapButton(_:)), for: .touchUpInside) } @objc func tapButton(_ sender: AnyObject?) { let controller = UIMenuController.shared let textItem = UIMenuItem(title: "Text") { [weak self] _ in self?.showAlertWithTitle("text item tapped") } let image = UIImage(named: "Image") let imageItem = UIMenuItem(title: "Image", image: image) { [weak self] _ in self?.showAlertWithTitle("image item tapped") } let colorImage = UIImage(named: "ColorImage") let colorImageItem = UIMenuItem(title: "ColorImage", image: colorImage) { [weak self] _ in self?.showAlertWithTitle("color image item tapped") } let nextItem = UIMenuItem(title: "Show More Items...") { _ in let action: MenuItemAction = { [weak self] in self?.showAlertWithTitle($0.title + " tapped") } let item1 = UIMenuItem(title: "1", action: action) let item2 = UIMenuItem(title: "2", action: action) let item3 = UIMenuItem(title: "3", action: action) controller.menuItems = [item1, item2, item3] if #available(iOS 13.0, *) { controller.isMenuVisible = true } else { controller.setMenuVisible(true, animated: true) } } controller.menuItems = [textItem, imageItem, colorImageItem, nextItem] if #available(iOS 13.0, *) { controller.showMenu(from: button, rect: button.bounds) } else { controller.setTargetRect(button.bounds, in: button) controller.setMenuVisible(true, animated: true) } } func showAlertWithTitle(_ title: String) { let alertVC = UIAlertController(title: title, message: nil, preferredStyle: .alert) alertVC.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: { _ in })) present(alertVC, animated: true, completion: nil) } }
{ "pile_set_name": "Github" }
@available(watchOS 2.0, *) class CNContactRelation : NSObject, NSCopying, NSSecureCoding { init(name name: String) var name: String { get } @available(watchOS 2.0, *) func copy(with zone: NSZone = nil) -> AnyObject @available(watchOS 2.0, *) class func supportsSecureCoding() -> Bool @available(watchOS 2.0, *) func encode(with aCoder: NSCoder) init?(coder aDecoder: NSCoder) } @available(watchOS 2.0, *) let CNLabelContactRelationFather: String @available(watchOS 2.0, *) let CNLabelContactRelationMother: String @available(watchOS 2.0, *) let CNLabelContactRelationParent: String @available(watchOS 2.0, *) let CNLabelContactRelationBrother: String @available(watchOS 2.0, *) let CNLabelContactRelationSister: String @available(watchOS 2.0, *) let CNLabelContactRelationChild: String @available(watchOS 2.0, *) let CNLabelContactRelationFriend: String @available(watchOS 2.0, *) let CNLabelContactRelationSpouse: String @available(watchOS 2.0, *) let CNLabelContactRelationPartner: String @available(watchOS 2.0, *) let CNLabelContactRelationAssistant: String @available(watchOS 2.0, *) let CNLabelContactRelationManager: String
{ "pile_set_name": "Github" }
#include <iostream> #include <unistd.h> #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <string.h> #include <libgo/libgo.h> #include <atomic> #include <poll.h> #include <fcntl.h> using namespace std; #define OUT(x) cout << #x << " = " << x << endl #define O(x) cout << x << endl #define ASSERT_RES(res) \ if (res < 0) { \ printf("LINE:%d\n", __LINE__); \ perror(""); \ exit(1); \ } enum eTestType { oneway, pingpong, nonblock_pingpong, }; int testType = 0; int cBufSize = 64 * 1024; int nConnection = 1; bool openCoroutine = true; std::atomic<long> gBytes{0}; std::atomic<long> gQps{0}; void show() { long lastBytes = 0; long lastQps = 0; for (;;) { sleep(1); long bytes = gBytes - lastBytes; long qps = gQps - lastQps; printf("%ld MB/s, QPS: %ld\n", bytes / 1024 / 1024, qps); lastBytes += bytes; lastQps += qps; } } template <typename F> void routineCreate(F f) { if (openCoroutine) { printf("routine create by libgo\n"); go f; } else { printf("routine create by std::thread\n"); std::thread(f).detach(); } } void initSock(int sock) { if (testType == nonblock_pingpong) { int flag = fcntl(sock, F_GETFL); ASSERT_RES(flag); int res = fcntl(sock, F_SETFL, flag | O_NONBLOCK); ASSERT_RES(res); } } ssize_t recv(int sock, char *buf, size_t len) { if (testType == nonblock_pingpong) { struct pollfd pfd; pfd.fd = sock; pfd.events = POLLIN; poll(&pfd, 1, -1); if (pfd.revents & POLLIN) { return ::read(sock, buf, len); } } return ::read(sock, buf, len); } ssize_t send(int sock, char *buf, size_t len) { if (testType == nonblock_pingpong) { ssize_t res = ::write(sock, buf, len); if (res > 0) return res; struct pollfd pfd; pfd.fd = sock; pfd.events = POLLOUT; poll(&pfd, 1, -1); if (pfd.revents & POLLOUT) { return ::write(sock, buf, len); } } return ::write(sock, buf, len); } void doRecv(int sock) { printf("fd %d connected.\n", sock); initSock(sock); char *buf = new char[cBufSize]; for (;;) { ssize_t res = recv(sock, buf, cBufSize); if (res == -1 && res == EAGAIN) continue; if (res <= 0) { printf("fd %d closed.\n", sock); close(sock); return ; } gBytes += res; gQps ++; if (testType != oneway) { send(sock, buf, res); } } } void doAccept() { int sock = socket(AF_INET, SOCK_STREAM, 0); ASSERT_RES(sock); struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(9007); addr.sin_addr.s_addr = inet_addr("127.0.0.1"); int res = ::bind(sock, (struct sockaddr*)&addr, sizeof(addr)); ASSERT_RES(res); res = listen(sock, 128); ASSERT_RES(res); for (;;) { struct sockaddr_in addr = {}; socklen_t len = sizeof(addr); res = accept(sock, (struct sockaddr*)&addr, &len); if (res == -1) continue; routineCreate([=]{ doRecv(res); }); } } void doSend(int sock) { printf("fd %d connected.\n", sock); initSock(sock); char *buf = new char[cBufSize]; for (;;) { ssize_t res = send(sock, buf, cBufSize); if (res == -1 && res == EAGAIN) continue; if (res <= 0) { printf("fd %d closed.\n", sock); close(sock); return ; } gBytes += res; gQps ++; if (testType != oneway) { recv(sock, buf, cBufSize); } } } void doConnect() { int sock = socket(AF_INET, SOCK_STREAM, 0); ASSERT_RES(sock); struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(9007); addr.sin_addr.s_addr = inet_addr("127.0.0.1"); int res = connect(sock, (struct sockaddr*)&addr, sizeof(addr)); ASSERT_RES(res); doSend(sock); } int main(int argc, char** argv) { if (argc <= 1) { printf("Usage: %s ClientOrServer OpenCoroutine TestType Conn BufSize\n", argv[0]); printf("\n"); printf("ClientOrServer: 0 - server, 1 - client\n"); printf("TestType: 0 - oneway, 1 - pingpong, 2 - nonblock_pingpong\n"); exit(1); } int clientOrServer = 0; if (argc >= 2) clientOrServer = atoi(argv[1]); if (argc >= 3) openCoroutine = !!atoi(argv[2]); if (argc >= 4) testType = atoi(argv[3]); if (argc >= 5) nConnection = atoi(argv[4]); if (argc >= 6) cBufSize = atoi(argv[5]); std::thread(&show).detach(); if (clientOrServer == 1) { for (int i = 0; i < nConnection; ++i) routineCreate(&doConnect); } else routineCreate(&doAccept); co_sched.Start(); }
{ "pile_set_name": "Github" }
namespace Models { public sealed class Country : ICountry { public string Name { get; set; } public string ImagePath { get; set; } public override string ToString() => Name; } }
{ "pile_set_name": "Github" }
category:刑事 title:保安砍死同事后安然入睡 两次精神鉴定结果不一 content:今年1月,合肥市政务区水墨兰亭小区发生一起惨案,一名保安砍杀同事之后还安然入睡。记者昨日获悉,该案已经由公安机关移送至检察机关审查起诉。调查显示,沙某之所以砍死同事,是因为在向该同事借钱时被拒继而发生纠纷。案发当天凌晨1时许,居民听到两人居 今年1月,合肥市政务区水墨兰亭小区发生一起惨案,一名保安砍杀同事之后还安然入睡。记者昨日获悉,该案已经由公安机关移送至检察机关审查起诉。 调查显示,沙某之所以砍死同事,是因为在向该同事借钱时被拒继而发生纠纷。案发当天凌晨1时许,居民听到两人居住的员工宿舍传出争执声,持续近2个小时。当天17时许,居民再度听到嘈杂声,有业主前去查看,却发现骇人一幕:一名男子倒在地上,头部被砍身亡。 调查期间,警方为沙某做了两份精神鉴定,但结果却不一致。第一次鉴定显示,沙某被判定在作案时,处于精神类疾病的发病期,不具有行为能力。 第二次精神鉴定中,沙某被认定虽有药物依赖,但案发时其意识清醒,完全可以控制自己的行为,具有完全行为能力。 目前,此案已经由公安机关移送到检察机关审查起诉。(记者周勇)
{ "pile_set_name": "Github" }
GAMEDEF limit numPlayers = 3 numRounds = 1 blind = 1 1 1 raiseSize = 1 firstPlayer = 1 maxRaises = 1 numSuits = 1 numRanks = 4 numHoleCards = 1 numBoardCards = 0 END GAMEDEF
{ "pile_set_name": "Github" }
#ifndef EMPTY_GLU #define EMPTY_GLU inline void gluOrtho2D( int a,int b, int c ,int d ) { } ; inline void gluLookAt( GLfloat a,GLfloat b, GLfloat c, GLfloat d,GLfloat e, GLfloat f, GLfloat g,GLfloat h, GLfloat i ) { }; #define GLU_FILL 1 #define GLU_SMOOTH 2 typedef int GLUquadric; typedef GLUquadric GLUquadricObj; inline GLUquadric *gluNewQuadric() { return (GLUquadric *)1; }; inline void gluQuadricDrawStyle( GLUquadric *o, int mode) {}; inline void gluQuadricNormals( GLUquadric *o, int mode) {}; inline void gluDeleteQuadric( GLUquadric *q) {}; inline void gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops) {}; inline void gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks) {}; inline int gluBuild2DMipmaps (GLenum target, GLint components, GLint width, GLint height, GLenum format, GLenum type, const void *data) { return 0;} #endif
{ "pile_set_name": "Github" }
## This file is part of Scapy ## See http://www.secdev.org/projects/scapy for more informations ## Copyright (C) Philippe Biondi <[email protected]> ## This program is published under a GPLv2 license """ Packet holding data in Abstract Syntax Notation (ASN.1). """ from packet import * class ASN1_Packet(Packet): ASN1_root = None ASN1_codec = None def init_fields(self): flist = self.ASN1_root.get_fields_list() self.do_init_fields(flist) self.fields_desc = flist def self_build(self): if self.raw_packet_cache is not None: return self.raw_packet_cache return self.ASN1_root.build(self) def do_dissect(self, x): return self.ASN1_root.dissect(self, x)
{ "pile_set_name": "Github" }
/* * 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. */ package org.apache.karaf.jaas.modules.properties; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; import java.io.Closeable; import java.io.File; import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.WatchEvent; import java.nio.file.WatchKey; import java.nio.file.WatchService; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.felix.utils.properties.Properties; import org.apache.karaf.jaas.modules.encryption.EncryptionSupport; import org.apache.karaf.util.StreamUtils; import org.apache.karaf.util.ThreadUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class AutoEncryptionSupport implements Runnable, Closeable { private final Logger LOGGER = LoggerFactory.getLogger(AutoEncryptionSupport.class); private volatile boolean running; private EncryptionSupport encryptionSupport; private ExecutorService executor; private String usersFileName; public AutoEncryptionSupport(Map<String, Object> properties) { running = true; encryptionSupport = new EncryptionSupport(properties); Object usersFile = properties.get(PropertiesLoginModule.USER_FILE); if (usersFile instanceof File) { usersFileName = ((File) usersFile).getAbsolutePath(); } else if (usersFile != null) { usersFileName = usersFile.toString(); } executor = Executors.newSingleThreadExecutor(ThreadUtils.namedThreadFactory("encryption")); executor.execute(this); } public void close() { running = false; executor.shutdown(); try { executor.awaitTermination(10, TimeUnit.SECONDS); } catch (InterruptedException e) { // Ignore } } @Override public void run() { WatchService watchService = null; try { watchService = FileSystems.getDefault().newWatchService(); Path dir = null; Path file = null; if (usersFileName == null) { dir = Paths.get(System.getProperty("karaf.etc")); file = dir.resolve("users.properties"); } else { file = new File(usersFileName).toPath(); dir = file.getParent(); } dir.register(watchService, ENTRY_MODIFY); encryptedPassword(new Properties(file.toFile())); while (running) { try { WatchKey key = watchService.poll(1, TimeUnit.SECONDS); if (key == null) { continue; } for (WatchEvent<?> event : key.pollEvents()) { @SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>)event; // Context for directory entry event is the file name of entry Path name = dir.resolve(ev.context()); if (file.equals(name)) { encryptedPassword(new Properties(file.toFile())); } } key.reset(); } catch (IOException e) { LOGGER.warn(e.getMessage(), e); } catch (InterruptedException e) { // Ignore as this happens on shutdown } } } catch (IOException e) { LOGGER.warn(e.getMessage(), e); } finally { StreamUtils.close(watchService); } } void encryptedPassword(Properties users) throws IOException { boolean changed = false; for (String userName : users.keySet()) { String user = userName; String userInfos = users.get(user); if (user.startsWith(PropertiesBackingEngine.GROUP_PREFIX)) { continue; } // the password is in the first position String[] infos = userInfos.split(","); String storedPassword = infos[0]; // check if the stored password is flagged as encrypted String encryptedPassword = encryptionSupport.encrypt(storedPassword); if (!storedPassword.equals(encryptedPassword)) { LOGGER.debug("The password isn't flagged as encrypted, encrypt it."); StringBuilder userInfosBuilder = new StringBuilder(encryptedPassword); for (int i = 1; i < infos.length; i++) { userInfosBuilder.append(',').append(infos[i]); } userInfos = userInfosBuilder.toString(); if (user.contains("\\")) { users.remove(user); user = user.replace("\\", "\\\\"); } users.put(user, userInfos); changed = true; } } if (changed) { users.save(); } } }
{ "pile_set_name": "Github" }
{ "cells": [ { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "请输入一个符号:*\n", "请输入行数:5\n", " * \n", " * * \n", " * * * \n", " * * * * \n", "* * * * * \n", " * * * * \n", " * * * \n", " * * \n", " * \n" ] } ], "source": [ "#1、写函数,给定符号和行数,如’*’,5,可打印相应行数的如下菱形。主程序输入符号和行数调用该函数进行验证。(20分)\n", "\n", "def a():\n", " m=input('请输入一个符号:')\n", " n=int(input('请输入行数:'))\n", " i=1\n", " while i<=n:\n", " print(' '*(n-i)+(m+' ')*i)\n", " i=i+1\n", " i=i-2\n", " while i>0:\n", " print(' '*(n-i)+(m+' ')*i)\n", " i=i-1\n", "a()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "409114\n" ] } ], "source": [ "#2.用递归和非递归分别实现函数求1!+2!+3!+...+n!,主程序以n=10分别调用。(20分)\n", "\n", "#递归\n", "def recusive_factorial(n):\n", " if n == 0:\n", " return 1\n", " else:\n", " return n*recusive_factorial(n-1)\n", "def a(n):\n", " sum=0\n", " for i in range(1,n+1):\n", " sum=sum+(recusive_factorial(i-1))\n", " return sum\n", "\n", "print(a(10))" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "409114\n" ] } ], "source": [ "#非递归\n", "def a(n):\n", " total=1\n", " if n==0:\n", " return 1\n", " else:\n", " for i in range(1,n):\n", " total=total*i\n", " return total\n", "def b(n):\n", " sum=0\n", " for i in range(1,n+1):\n", " sum=sum+a(i)\n", " return sum\n", "\n", "print(b(10))" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "ename": "IndexError", "evalue": "list assignment index out of range", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m<ipython-input-27-e0f2090f80c2>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mnumbers\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0mnumbers\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mchoice\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'ABCDEFGHJKLMNPQRST'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0ma\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m6\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mnumbers\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrandint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[0;31mIndexError\u001b[0m: list assignment index out of range" ] } ], "source": [ "#3、北京车牌号的一般形式为:“京X-YYYYY”,其中X为字母,Y为字母或者数字,字母不能为I或者O,数字只能0-9之间.\n", "# 请编写程序模拟选号过程:一次可以随机生成10个车牌号(不能有重复),依次将其编号为0-9,显示给用户。(20分)\n", "\n", "import random\n", "numbers=[]\n", "for i in range(10):\n", " numbers[i]=(random.choice('ABCDEFGHJKLMNPQRST'))\n", " for a in range(1,6):\n", " numbers[i].append(random.randint(0,10))\n", "for i in range(10):\n", " print(i,'京',numbers[i])" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "4.803844614152614\n" ] } ], "source": [ "#4.两个向量间的距离可定义为两个向量间的夹角余弦值,给定三个向量,求向量间距离的最小值。三个向量为:[1,2,3,4],[4,5,6,7],[7,8,9,10](20分)\n", "\n", "import math\n", "\n", "line1=[1,2,3,4]\n", "line2=[4,5,6,7]\n", "line3=[7,8,9,10]\n", "a=0\n", "b=0\n", "c=0\n", "for i in range(4):\n", " a=a+line1[i]*line2[i]\n", "A=a/(math.sqrt(156))\n", "for i in range(4):\n", " b=b+line2[i]*line3[i]\n", "B=b/(math.sqrt(420))\n", "for i in range(4):\n", " c=c+line1[i]*line3[i]\n", "C=c/(math.sqrt(324))\n", "if A<B:\n", " d=A\n", "else:\n", " d=B\n", "if C<d:\n", " d=C\n", "else:\n", " d=d\n", "print(d)" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "ename": "FileNotFoundError", "evalue": "[Errno 2] No such file or directory: 'd:\\\\temp\\\\a.txt'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m<ipython-input-28-27f95a66c5e6>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0mA\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrandint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m10000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0mB\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrandom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrandint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m15000\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m---> 14\u001b[0;31m \u001b[0mfh\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34mr'd:\\temp\\a.txt'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'w'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 15\u001b[0m \u001b[0mfh\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34mr'd:\\temp\\b.txt'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'w'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[1;32min\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'd:\\\\temp\\\\a.txt'" ] } ], "source": [ "#随机生成100000个整数(1-10000之间)作为集合A,随机生成100000个整数(1-15000之间)作为集合B。\n", "#(a)得到A,B所有出现的数及出现次数,分别输出到文件a.txt,b.txt中(新建文件),请输出多行,每行为两个数,两个数之间用逗号分隔(5分);\n", "#(b)列出A中所有回文数(例:12321)以及出现的次数(5分);\n", "#(c)列出B中分别由1-5个数字组成的数各自的总次数与总和,并按照总次数排序输出(如223就是3个数字组成的数,2834就是4个数字组成的数)(5分);\n", "#(d)从a.txt,b.txt读入得到A与B中出现的数(注意不要次数),计算既出现在A又出现在B中的数,追加输出到文件a.txt(5分)。\n", "\n", "import random\n", "\n", "A=[]\n", "B=[]\n", "for i in range(100):\n", " A.append(random.randint(1,10000))\n", " B.append(random.randint(1,15000))\n", "fh = open(r'd:\\temp\\a.txt', 'w')\n", "fh = open(r'd:\\temp\\b.txt', 'w')\n", "for i in a:\n", " a.append(A[i]+' ')\n", " fh.writelines(A)\n", "for j in b:\n", " b.append(B[i]+' ')\n", " fh.writelines(B)\n", "count_words_freq(a,numbers)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }
{ "pile_set_name": "Github" }
.smile.icon i { position: absolute; left: 3px; top: 3px; width: 8px; height: 8px; border-radius: 50%; border-top: solid 1px transparent; border-bottom: solid 1px currentColor; border-left: solid 1px transparent; border-right: solid 1px transparent; }
{ "pile_set_name": "Github" }
; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> AXFR lexus. @k.gmoregistry.net. +nocomments +nocmd +noquestion +nostats +time=15 ;; global options: +cmd ; Transfer failed.
{ "pile_set_name": "Github" }
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } /** * * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. * * SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd. * Copyright (C) 2011 - 2018 SalesAgility Ltd. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not * reasonably feasible for technical reasons, the Appropriate Legal Notices must * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". */ /********************************************************************************* * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ $viewdefs = array( 'Prospects' => array( 'QuickCreate' => array( 'templateMeta' => array( 'maxColumns' => '2', 'widths' => array( 0 => array( 'label' => '10', 'field' => '30', ), 1 => array( 'label' => '10', 'field' => '30', ), ), ), 'panels' => array( 'LBL_PROSPECT_INFORMATION' => array( 0 => array( 0 => array( 'name' => 'first_name', ), 1 => array( 'name' => 'phone_work', ), ), 1 => array( 0 => array( 'name' => 'last_name', 'displayParams'=>array('required'=>true) ), 1 => array( 'name' => 'phone_mobile', ), ), 2 => array( 0 => array( 'name' => 'account_name', ), 1 => array( 'name' => 'phone_fax', ), ), 3 => array( 0 => array( 'name' => 'title', ), 1 => array( 'name' => 'department', ), ), 4 => array( 0 => array( 'name' => 'team_name', ), 1 => array( 'name' => 'do_not_call', ), ), 5 => array( 0 => array( 'name' => 'assigned_user_name', ), ), ), 'lbl_email_addresses' => array( 0 => array( 0 => array( 'name' => 'email1', ), ), ), 'LBL_ADDRESS_INFORMATION' => array( 0 => array( 0 => array( 'name' => 'primary_address_street', ), 1 => array( 'name' => 'alt_address_street', ), ), ), ), ), ), );
{ "pile_set_name": "Github" }
/* This is un example howto use Touch Intrrerupts The bigger the threshold, the more sensible is the touch */ int threshold = 40; bool touch1detected = false; bool touch2detected = false; void gotTouch1(){ touch1detected = true; } void gotTouch2(){ touch2detected = true; } void setup() { Serial.begin(115200); delay(1000); // give me time to bring up serial monitor Serial.println("ESP32 Touch Interrupt Test"); touchAttachInterrupt(T2, gotTouch1, threshold); touchAttachInterrupt(T3, gotTouch2, threshold); } void loop(){ if(touch1detected){ touch1detected = false; Serial.println("Touch 1 detected"); } if(touch2detected){ touch2detected = false; Serial.println("Touch 2 detected"); } }
{ "pile_set_name": "Github" }
/** * 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.recoveryservices.backup.v2017_07_01; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; /** * Daily retention format. */ public class DailyRetentionFormat { /** * List of days of the month. */ @JsonProperty(value = "daysOfTheMonth") private List<Day> daysOfTheMonth; /** * Get list of days of the month. * * @return the daysOfTheMonth value */ public List<Day> daysOfTheMonth() { return this.daysOfTheMonth; } /** * Set list of days of the month. * * @param daysOfTheMonth the daysOfTheMonth value to set * @return the DailyRetentionFormat object itself. */ public DailyRetentionFormat withDaysOfTheMonth(List<Day> daysOfTheMonth) { this.daysOfTheMonth = daysOfTheMonth; return this; } }
{ "pile_set_name": "Github" }
7e69ff9d5485e45958612d2b489d550e9aa23134
{ "pile_set_name": "Github" }
@model PickupPointModel <div asp-validation-summary="All"></div> <input asp-for="Id" type="hidden" /> <input id="active-menu-item" type="hidden" value="/@Constants.AreaAdmin/Shipping/PickupPoints" /> <div class="form-horizontal"> <div class="form-body"> <div class="form-group"> <admin-label asp-for="Name" /> <div class="col-md-9 col-sm-9"> <admin-input asp-for="Name" /> <span asp-validation-for="Name"></span> </div> </div> <div class="form-group"> <admin-label asp-for="Description" /> <div class="col-md-9 col-sm-9"> <admin-input asp-for="Description" /> <span asp-validation-for="Description"></span> </div> </div> <div class="form-group"> <admin-label asp-for="AdminComment" /> <div class="col-md-9 col-sm-9"> <admin-textarea asp-for="AdminComment"></admin-textarea> <span asp-validation-for="AdminComment"></span> </div> </div> <div class="form-group"> <admin-input asp-for="Address" asp-template="Address" /> </div> <div class="form-group"> <admin-label asp-for="AvailableStores" /> <div class="col-md-9 col-sm-9"> <admin-select asp-for="StoreId" asp-items="Model.AvailableStores" /> <span asp-validation-for="AvailableStores"></span> </div> </div> <div class="form-group"> <admin-label asp-for="AvailableWarehouses" /> <div class="col-md-9 col-sm-9"> <admin-select asp-for="WarehouseId" asp-items="Model.AvailableWarehouses" /> <span asp-validation-for="AvailableWarehouses"></span> </div> </div> <div class="form-group"> <admin-label asp-for="PickupFee" /> <div class="col-md-9 col-sm-9"> <admin-input asp-for="PickupFee" /> <span asp-validation-for="PickupFee"></span> </div> </div> <div class="form-group"> <admin-label asp-for="DisplayOrder" /> <div class="col-md-9 col-sm-9"> <admin-input asp-for="DisplayOrder" /> <span asp-validation-for="DisplayOrder"></span> </div> </div> </div> </div>
{ "pile_set_name": "Github" }
/* Copyright (C) 2010 Srivats P. This file is part of "Ostinato" This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/> */ #include "mainwindow.h" #if 0 #include "dbgthread.h" #endif #include "clipboardhelper.h" #include "jumpurl.h" #include "logsmodel.h" #include "logswindow.h" #include "params.h" #include "portgrouplist.h" #include "portstatswindow.h" #include "portswindow.h" #include "preferences.h" #include "sessionfileformat.h" #include "settings.h" #include "ui_about.h" #include "updater.h" #include "fileformat.pb.h" #include <QDate> #include <QDesktopServices> #include <QDockWidget> #include <QFileDialog> #include <QMessageBox> #include <QProcess> #include <QProgressDialog> #include <QTimer> #include <QUrl> #ifdef Q_OS_WIN32 #define WIN32_NO_STATUS #include <windows.h> #undef WIN32_NO_STATUS #include <ntstatus.h> #endif extern const char* version; extern const char* revision; PortGroupList *pgl; LogsModel *appLogs; ClipboardHelper *clipboardHelper; MainWindow::MainWindow(QWidget *parent) : QMainWindow (parent) { Updater *updater = new Updater(); if (appParams.optLocalDrone()) { QString serverApp = QCoreApplication::applicationDirPath(); #ifdef Q_OS_MAC // applicationDirPath() does not return bundle, // but executable inside bundle serverApp.replace("Ostinato.app", "drone.app"); #endif #ifdef Q_OS_WIN32 serverApp.append("/drone.exe"); #else serverApp.append("/drone"); #endif qDebug("staring local server - %s", qPrintable(serverApp)); localServer_ = new QProcess(this); connect(localServer_, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(onLocalServerFinished(int, QProcess::ExitStatus))); connect(localServer_, SIGNAL(error(QProcess::ProcessError)), SLOT(onLocalServerError(QProcess::ProcessError))); localServer_->setProcessChannelMode(QProcess::ForwardedChannels); localServer_->start(serverApp, QStringList()); QTimer::singleShot(5000, this, SLOT(stopLocalServerMonitor())); } else localServer_ = NULL; pgl = new PortGroupList; appLogs = new LogsModel(this); clipboardHelper = new ClipboardHelper(this); portsWindow = new PortsWindow(pgl, this); statsWindow = new PortStatsWindow(pgl, this); portsDock = new QDockWidget(tr("Ports and Streams"), this); portsDock->setObjectName("portsDock"); portsDock->setFeatures( portsDock->features() & ~QDockWidget::DockWidgetClosable); statsDock = new QDockWidget(tr("Port Statistics"), this); statsDock->setObjectName("statsDock"); statsDock->setFeatures( statsDock->features() & ~QDockWidget::DockWidgetClosable); logsDock_ = new QDockWidget(tr("Logs"), this); logsDock_->setObjectName("logsDock"); logsDock_->setFeatures( logsDock_->features() & ~QDockWidget::DockWidgetClosable); logsWindow_ = new LogsWindow(appLogs, logsDock_); setupUi(this); menuFile->insertActions(menuFile->actions().at(3), portsWindow->actions()); menuEdit->addActions(clipboardHelper->actions()); statsDock->setWidget(statsWindow); addDockWidget(Qt::BottomDockWidgetArea, statsDock); logsDock_->setWidget(logsWindow_); addDockWidget(Qt::BottomDockWidgetArea, logsDock_); tabifyDockWidget(statsDock, logsDock_); statsDock->show(); statsDock->raise(); portsDock->setWidget(portsWindow); addDockWidget(Qt::TopDockWidgetArea, portsDock); #if QT_VERSION >= 0x050600 // Set top and bottom docks to equal height resizeDocks({portsDock, statsDock}, {height()/2, height()/2}, Qt::Vertical); #endif portsWindow->setFocus(); // Save the default window geometry and layout ... defaultGeometry_ = geometry(); defaultLayout_ = saveState(0); // ... before restoring the last used settings QRect geom = appSettings->value(kApplicationWindowGeometryKey).toRect(); if (!geom.isNull()) setGeometry(geom); QByteArray layout = appSettings->value(kApplicationWindowLayout) .toByteArray(); if (layout.size()) restoreState(layout, 0); connect(actionFileExit, SIGNAL(triggered()), this, SLOT(close())); connect(actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(actionViewShowMyReservedPortsOnly, SIGNAL(toggled(bool)), portsWindow, SLOT(showMyReservedPortsOnly(bool))); connect(actionViewShowMyReservedPortsOnly, SIGNAL(toggled(bool)), statsWindow, SLOT(showMyReservedPortsOnly(bool))); connect(updater, SIGNAL(newVersionAvailable(QString)), this, SLOT(onNewVersion(QString))); updater->checkForNewVersion(); // Add the "Local" Port Group if (appParams.optLocalDrone()) { PortGroup *pg = new PortGroup; pgl->addPortGroup(*pg); } if (appParams.argumentCount()) { QString fileName = appParams.argument(0); if (QFile::exists(fileName)) openSession(fileName); else QMessageBox::information(NULL, qApp->applicationName(), QString("File not found: " + fileName)); } #if 0 { DbgThread *dbg = new DbgThread(pgl); dbg->start(); } #endif } MainWindow::~MainWindow() { stopLocalServerMonitor(); if (localServer_) { #ifdef Q_OS_WIN32 //! \todo - find a way to terminate cleanly localServer_->kill(); #else localServer_->terminate(); #endif } delete pgl; // We don't want to save state for Stream Stats Docks - so delete them QList<QDockWidget*> streamStatsDocks = findChildren<QDockWidget*>("streamStatsDock"); foreach(QDockWidget *dock, streamStatsDocks) delete dock; Q_ASSERT(findChildren<QDockWidget*>("streamStatsDock").size() == 0); QByteArray layout = saveState(0); appSettings->setValue(kApplicationWindowLayout, layout); appSettings->setValue(kApplicationWindowGeometryKey, geometry()); if (localServer_) { localServer_->waitForFinished(); delete localServer_; } } void MainWindow::openSession(QString fileName) { qDebug("Open Session Action (%s)", qPrintable(fileName)); static QString dirName; QStringList fileTypes = SessionFileFormat::supportedFileTypes( SessionFileFormat::kOpenFile); QString fileType; QString errorStr; bool ret; if (!fileName.isEmpty()) goto _skip_prompt; if (portsWindow->portGroupCount()) { if (QMessageBox::question(this, tr("Open Session"), tr("Existing session will be lost. Proceed?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) goto _exit; } if (fileTypes.size()) fileType = fileTypes.at(0); fileName = QFileDialog::getOpenFileName(this, tr("Open Session"), dirName, fileTypes.join(";;"), &fileType); if (fileName.isEmpty()) goto _exit; _skip_prompt: ret = openSession(fileName, errorStr); if (!ret || !errorStr.isEmpty()) { QMessageBox msgBox(this); QStringList str = errorStr.split("\n\n\n\n"); msgBox.setIcon(ret ? QMessageBox::Warning : QMessageBox::Critical); msgBox.setWindowTitle(qApp->applicationName()); msgBox.setText(str.at(0)); if (str.size() > 1) msgBox.setDetailedText(str.at(1)); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.exec(); } dirName = QFileInfo(fileName).absolutePath(); _exit: return; } void MainWindow::on_actionOpenSession_triggered() { openSession(); } void MainWindow::on_actionSaveSession_triggered() { qDebug("Save Session Action"); static QString fileName; QStringList fileTypes = SessionFileFormat::supportedFileTypes( SessionFileFormat::kSaveFile); QString fileType; QString errorStr; QFileDialog::Options options; if (portsWindow->reservedPortCount()) { QString myself = appSettings->value(kUserKey, kUserDefaultValue) .toString(); if (QMessageBox::question(this, tr("Save Session"), QString("Some ports are reserved!\n\nOnly ports reserved by %1 will be saved. Proceed?").arg(myself), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) goto _exit; } // On Mac OS with Native Dialog, getSaveFileName() ignores fileType. // Although currently there's only one supported file type, we may // have more in the future #if defined(Q_OS_MAC) options |= QFileDialog::DontUseNativeDialog; #endif if (fileTypes.size()) fileType = fileTypes.at(0); _retry: fileName = QFileDialog::getSaveFileName(this, tr("Save Session"), fileName, fileTypes.join(";;"), &fileType, options); if (fileName.isEmpty()) goto _exit; if (QFileInfo(fileName).suffix().isEmpty()) { QString fileExt = fileType.section(QRegExp("[\\*\\)]"), 1, 1); qDebug("Adding extension '%s' to '%s'", qPrintable(fileExt), qPrintable(fileName)); fileName.append(fileExt); if (QFileInfo(fileName).exists()) { if (QMessageBox::warning(this, tr("Overwrite File?"), QString("The file \"%1\" already exists.\n\n" "Do you wish to overwrite it?") .arg(QFileInfo(fileName).fileName()), QMessageBox::Yes|QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) goto _retry; } } if (!saveSession(fileName, fileType, errorStr)) QMessageBox::critical(this, qApp->applicationName(), errorStr); else if (!errorStr.isEmpty()) QMessageBox::warning(this, qApp->applicationName(), errorStr); fileName = QFileInfo(fileName).absolutePath(); _exit: return; } void MainWindow::on_actionPreferences_triggered() { Preferences *preferences = new Preferences(); preferences->exec(); delete preferences; } void MainWindow::on_actionViewRestoreDefaults_triggered() { // Use the saved default geometry/layout, however keep the // window location same defaultGeometry_.moveTo(geometry().topLeft()); setGeometry(defaultGeometry_); restoreState(defaultLayout_, 0); // Add streamStats as tabs QList<QDockWidget*> streamStatsDocks = findChildren<QDockWidget*>("streamStatsDock"); foreach(QDockWidget *dock, streamStatsDocks) { dock->setFloating(false); tabifyDockWidget(statsDock, dock); } statsDock->show(); statsDock->raise(); actionViewShowMyReservedPortsOnly->setChecked(false); portsWindow->clearCurrentSelection(); statsWindow->clearCurrentSelection(); logsWindow_->clearCurrentSelection(); } void MainWindow::on_actionHelpOnline_triggered() { QDesktopServices::openUrl(QUrl(jumpUrl("help", "app", "menu"))); } void MainWindow::on_actionDonate_triggered() { QDesktopServices::openUrl(QUrl(jumpUrl("donate", "app", "menu"))); } void MainWindow::on_actionCheckForUpdates_triggered() { Updater *updater = new Updater(); connect(updater, SIGNAL(latestVersion(QString)), this, SLOT(onLatestVersion(QString))); updater->checkForNewVersion(); } void MainWindow::on_actionHelpAbout_triggered() { QDialog *aboutDialog = new QDialog; Ui::About about; about.setupUi(aboutDialog); about.versionLabel->setText( QString("Version: %1 Revision: %2").arg(version).arg(revision)); aboutDialog->exec(); delete aboutDialog; } void MainWindow::stopLocalServerMonitor() { // We are only interested in startup errors disconnect(localServer_, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onLocalServerError(QProcess::ProcessError))); disconnect(localServer_, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onLocalServerFinished(int, QProcess::ExitStatus))); } void MainWindow::onLocalServerFinished(int exitCode, QProcess::ExitStatus /*exitStatus*/) { if (exitCode) reportLocalServerError(); } void MainWindow::onLocalServerError(QProcess::ProcessError /*error*/) { reportLocalServerError(); } void MainWindow::reportLocalServerError() { QMessageBox msgBox(this); msgBox.setIcon(QMessageBox::Warning); msgBox.setTextFormat(Qt::RichText); msgBox.setStyleSheet("messagebox-text-interaction-flags: 5"); // mouse copy QString errorStr = tr("<p>Failed to start the local drone agent - " "error 0x%1, exit status 0x%2 exit code 0x%3.</p>") .arg(localServer_->error(), 0, 16) .arg(localServer_->exitStatus(), 0, 16) .arg(localServer_->exitCode(), 0, 16); if (localServer_->error() == QProcess::FailedToStart) errorStr.append(tr("<p>The drone program does not exist at %1 or you " "don't have sufficient permissions to execute it." "</p>") .arg(QCoreApplication::applicationDirPath())); if (localServer_->exitCode() == 1) errorStr.append(tr("<p>The drone program was not able to bind to " "TCP port 7878 - maybe a drone process is already " "running?</p>")); #ifdef Q_OS_WIN32 if (localServer_->exitCode() == STATUS_DLL_NOT_FOUND) errorStr.append(tr("<p>This is most likely because Packet.dll " "was not found - make sure you have " "<a href='%1'>WinPcap" "</a> installed.</p>") .arg(jumpUrl("winpcap"))); #endif msgBox.setText(errorStr); msgBox.setInformativeText(tr("Try running drone directly.")); msgBox.exec(); QMessageBox::information(this, QString(), tr("<p>If you have remote drone agents running, you can still add " "and connect to them.</p>" "<p>If you don't want to start the local drone agent at startup, " "provide the <b>-c</b> option to Ostinato on the command line.</p>" "<p>Learn about Ostinato's <a href='%1'>Controller-Agent " "architecture</a></p>").arg(jumpUrl("arch"))); } void MainWindow::onNewVersion(QString newVersion) { QDate today = QDate::currentDate(); QDate lastChecked = QDate::fromString( appSettings->value(kLastUpdateCheck).toString(), Qt::ISODate); if (lastChecked.daysTo(today) >= 5) { QMessageBox::information(this, tr("Update check"), tr("<p><b>Ostinato version %1 is now available</b> (you have %2). " "See <a href='%3'>change log</a>.</p>" "<p>Visit <a href='%4'>ostinato.org</a> to download.</p>") .arg(newVersion) .arg(version) .arg(jumpUrl("changelog", "app", "status", "update")) .arg(jumpUrl("download", "app", "status", "update"))); } else { QLabel *msg = new QLabel(tr("New Ostinato version %1 available. Visit " "<a href='%2'>ostinato.org</a> to download") .arg(newVersion) .arg(jumpUrl("download", "app", "status", "update"))); msg->setOpenExternalLinks(true); statusBar()->addPermanentWidget(msg); } appSettings->setValue(kLastUpdateCheck, today.toString(Qt::ISODate)); sender()->deleteLater(); } void MainWindow::onLatestVersion(QString latestVersion) { if (version != latestVersion) { QMessageBox::information(this, tr("Update check"), tr("<p><b>Ostinato version %1 is now available</b> (you have %2). " "See <a href='%3'>change log</a>.</p>" "<p>Visit <a href='%4'>ostinato.org</a> to download.</p>") .arg(latestVersion) .arg(version) .arg(jumpUrl("changelog", "app", "status", "update")) .arg(jumpUrl("download", "app", "status", "update"))); } else { QMessageBox::information(this, tr("Update check"), tr("You are already running the latest Ostinato version - %1") .arg(version)); } sender()->deleteLater(); } //! Returns true on success (or user cancel) and false on failure bool MainWindow::openSession(QString fileName, QString &error) { bool ret = false; QDialog *optDialog; QProgressDialog progress("Opening Session", "Cancel", 0, 0, this); OstProto::SessionContent session; SessionFileFormat *fmt = SessionFileFormat::fileFormatFromFile(fileName); if (fmt == NULL) { error = tr("Unknown session file format"); goto _fail; } if ((optDialog = fmt->openOptionsDialog())) { int ret; optDialog->setParent(this, Qt::Dialog); ret = optDialog->exec(); optDialog->setParent(0, Qt::Dialog); if (ret == QDialog::Rejected) goto _user_opt_cancel; } progress.setAutoReset(false); progress.setAutoClose(false); progress.setMinimumDuration(0); progress.show(); setDisabled(true); progress.setEnabled(true); // to override the mainWindow disable connect(fmt, SIGNAL(status(QString)),&progress,SLOT(setLabelText(QString))); connect(fmt, SIGNAL(target(int)), &progress, SLOT(setMaximum(int))); connect(fmt, SIGNAL(progress(int)), &progress, SLOT(setValue(int))); connect(&progress, SIGNAL(canceled()), fmt, SLOT(cancel())); fmt->openAsync(fileName, session, error); qDebug("after open async"); while (!fmt->isFinished()) qApp->processEvents(); qDebug("wait over for async operation"); if (!fmt->result()) goto _fail; // process any remaining events posted from the thread for (int i = 0; i < 10; i++) qApp->processEvents(); // XXX: user can't cancel operation from here on! progress.close(); portsWindow->openSession(&session, error); _user_opt_cancel: ret = true; _fail: progress.close(); setEnabled(true); return ret; } bool MainWindow::saveSession(QString fileName, QString fileType, QString &error) { bool ret = false; QProgressDialog progress("Saving Session", "Cancel", 0, 0, this); SessionFileFormat *fmt = SessionFileFormat::fileFormatFromType(fileType); OstProto::SessionContent session; if (fmt == NULL) goto _fail; progress.setAutoReset(false); progress.setAutoClose(false); progress.setMinimumDuration(0); progress.show(); setDisabled(true); progress.setEnabled(true); // to override the mainWindow disable // Fill in session ret = portsWindow->saveSession(&session, error, &progress); if (!ret) goto _user_cancel; connect(fmt, SIGNAL(status(QString)),&progress,SLOT(setLabelText(QString))); connect(fmt, SIGNAL(target(int)), &progress, SLOT(setMaximum(int))); connect(fmt, SIGNAL(progress(int)), &progress, SLOT(setValue(int))); connect(&progress, SIGNAL(canceled()), fmt, SLOT(cancel())); fmt->saveAsync(session, fileName, error); qDebug("after save async"); while (!fmt->isFinished()) qApp->processEvents(); qDebug("wait over for async operation"); ret = fmt->result(); goto _exit; _user_cancel: goto _exit; _fail: error = QString("Unsupported File Type - %1").arg(fileType); goto _exit; _exit: progress.close(); setEnabled(true); return ret; }
{ "pile_set_name": "Github" }
#import <Foundation/Foundation.h> @interface PodsDummy_SDWebImage : NSObject @end @implementation PodsDummy_SDWebImage @end
{ "pile_set_name": "Github" }
<?php /** * PemFTP - An Ftp implementation in pure PHP * * @package PemFTP * @since 2.5.0 * * @version 1.0 * @copyright Alexey Dotsenko * @author Alexey Dotsenko * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html * @license LGPL https://opensource.org/licenses/lgpl-license.html */ /** * FTP implementation using fsockopen to connect. * * @package PemFTP * @subpackage Pure * @since 2.5.0 * * @version 1.0 * @copyright Alexey Dotsenko * @author Alexey Dotsenko * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html * @license LGPL https://opensource.org/licenses/lgpl-license.html */ class ftp_pure extends ftp_base { function __construct($verb=FALSE, $le=FALSE) { parent::__construct(false, $verb, $le); } // <!-- --------------------------------------------------------------------------------------- --> // <!-- Private functions --> // <!-- --------------------------------------------------------------------------------------- --> function _settimeout($sock) { if(!@stream_set_timeout($sock, $this->_timeout)) { $this->PushError('_settimeout','socket set send timeout'); $this->_quit(); return FALSE; } return TRUE; } function _connect($host, $port) { $this->SendMSG("Creating socket"); $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); if (!$sock) { $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); return FALSE; } $this->_connected=true; return $sock; } function _readmsg($fnction="_readmsg"){ if(!$this->_connected) { $this->PushError($fnction, 'Connect first'); return FALSE; } $result=true; $this->_message=""; $this->_code=0; $go=true; do { $tmp=@fgets($this->_ftp_control_sock, 512); if($tmp===false) { $go=$result=false; $this->PushError($fnction,'Read failed'); } else { $this->_message.=$tmp; if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; } } while($go); if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; $this->_code=(int)$regs[1]; return $result; } function _exec($cmd, $fnction="_exec") { if(!$this->_ready) { $this->PushError($fnction,'Connect first'); return FALSE; } if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); if($status===false) { $this->PushError($fnction,'socket write failed'); return FALSE; } $this->_lastaction=time(); if(!$this->_readmsg($fnction)) return FALSE; return TRUE; } function _data_prepare($mode=FTP_ASCII) { if(!$this->_settype($mode)) return FALSE; if($this->_passive) { if(!$this->_exec("PASV", "pasv")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); if(!$this->_ftp_data_sock) { $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); $this->_data_close(); return FALSE; } else $this->_ftp_data_sock; } else { $this->SendMSG("Only passive connections available!"); return FALSE; } return TRUE; } function _data_read($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } while (!feof($this->_ftp_data_sock)) { $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); else $out.=$block; } return $out; } function _data_write($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } if(is_resource($fp)) { while(!feof($fp)) { $block=fread($fp, $this->_ftp_buff_size); if(!$this->_data_write_block($mode, $block)) return false; } } elseif(!$this->_data_write_block($mode, $fp)) return false; return TRUE; } function _data_write_block($mode, $block) { if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); do { if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { $this->PushError("_data_write","Can't write to socket"); return FALSE; } $block=substr($block, $t); } while(!empty($block)); return true; } function _data_close() { @fclose($this->_ftp_data_sock); $this->SendMSG("Disconnected data from remote host"); return TRUE; } function _quit($force=FALSE) { if($this->_connected or $force) { @fclose($this->_ftp_control_sock); $this->_connected=false; $this->SendMSG("Socket closed"); } } } ?>
{ "pile_set_name": "Github" }
# vue hello-world# ## 环境前提 ## 安装vue-cli npm install --global vue-cli ## 创建应用 ## vue init webpack my-app ## 启动应用 ## vue run dev ## 打包应用 ## vue run build ## 问题处理 ## index页面打开空白 config 下index.js assetsPublicPath:'/' 替换为 assetsPublicPath:'./' 参考链接 [https://www.cnblogs.com/xtjatswc/p/10306567.html](https://www.cnblogs.com/xtjatswc/p/10306567.html)
{ "pile_set_name": "Github" }
package com.zoe.weiya.model; import java.io.Serializable; /** * Created by chenghui on 2017/1/10. */ public class Message extends LuckyUser implements Serializable { private String message; private ZoeDate createTime; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public ZoeDate getCreateTime() { return createTime; } public void setCreateTime(ZoeDate createTime) { this.createTime = createTime; } }
{ "pile_set_name": "Github" }
'use strict' angular.module '<%= appname %>' .filter '<%= compname %>', -> (input) -> '<%= compname %> filter: ' + input
{ "pile_set_name": "Github" }
/* * Copyright (c) 2014-2020 Bjoern Kimminich. * SPDX-License-Identifier: MIT */ const chai = require('chai') const sinonChai = require('sinon-chai') const expect = chai.expect const net = require('net') chai.use(sinonChai) const semver = require('semver') const { checkIfRunningOnSupportedNodeVersion, checkIfPortIsAvailable } = require('../../lib/startup/validatePreconditions') describe('preconditionValidation', () => { describe('checkIfRunningOnSupportedNodeVersion', () => { const supportedVersion = require('./../../package.json').engines.node it('should define the supported semver range as 10 - 14', () => { expect(supportedVersion).to.equal('10 - 14') expect(semver.validRange(supportedVersion)).to.not.equal(null) }) it('should accept a supported version', () => { expect(checkIfRunningOnSupportedNodeVersion('14.0.0')).to.equal(true) expect(checkIfRunningOnSupportedNodeVersion('13.13.0')).to.equal(true) expect(checkIfRunningOnSupportedNodeVersion('12.16.2')).to.equal(true) expect(checkIfRunningOnSupportedNodeVersion('11.14.0')).to.equal(true) expect(checkIfRunningOnSupportedNodeVersion('10.20.0')).to.equal(true) }) it('should fail for an unsupported version', () => { expect(checkIfRunningOnSupportedNodeVersion('15.0.0')).to.equal(false) expect(checkIfRunningOnSupportedNodeVersion('9.11.2')).to.equal(false) expect(checkIfRunningOnSupportedNodeVersion('8.12.0')).to.equal(false) expect(checkIfRunningOnSupportedNodeVersion('7.10.1')).to.equal(false) expect(checkIfRunningOnSupportedNodeVersion('6.14.4')).to.equal(false) expect(checkIfRunningOnSupportedNodeVersion('4.9.1')).to.equal(false) expect(checkIfRunningOnSupportedNodeVersion('0.12.8')).to.equal(false) }) }) describe('checkIfPortIsAvailable', () => { it('should resolve when port 3000 is closed', async () => { const success = await checkIfPortIsAvailable(3000) expect(success).to.equal(true) }) describe('open a server before running the test', () => { const testServer = net.createServer() before((done) => { testServer.listen(3000, done) }) it('should reject when port 3000 is open', async () => { const success = await checkIfPortIsAvailable(3000) expect(success).to.equal(false) }) after((done) => { testServer.close(done) }) }) }) })
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ pipe2py.modules.pipefetchpage ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ http://pipes.yahoo.com/pipes/docs?doc=sources#FetchPage """ # Author: Gerrit Riessen, [email protected] # Copyright (C) 2011 Gerrit Riessen # This code is licensed under the GNU Public License. from urllib2 import urlopen from pipe2py.lib import utils from pipe2py.lib.dotdict import DotDict def _parse_content(content, conf, **kwargs): from_delimiter = conf.get("from", **kwargs) to_delimiter = conf.get("to", **kwargs) # determine from location, i.e. from where to start reading # content from_location = 0 if from_delimiter != "": from_location = content.find(from_delimiter) # Yahoo! does not strip off the from_delimiter. # if from_location > 0: # from_location += len(from_delimiter) # determine to location, i.e. where to stop reading content to_location = 0 if to_delimiter != "": to_location = content.find(to_delimiter, from_location) # reduce the content depended on the to/from locations if from_location > 0 and to_location > 0: parsed = content[from_location:to_location] elif from_location > 0: parsed = content[from_location:] elif to_location > 0: parsed = content[:to_location] return parsed def pipe_fetchpage(context=None, _INPUT=None, conf=None, **kwargs): """A source that fetches the content of a given web site as a string. Loopable. context : pipe2py.Context object _INPUT : pipeforever asyncPipe or an iterable of items or fields conf : dict URL -- url object contain the URL to download from -- string from where to start the input to -- string to limit the input token -- if present, split the input on this token to generate items Description: http://pipes.yahoo.com/pipes/docs?doc=sources#FetchPage TODOS: - don't retrieve pages larger than 200k - don't retrieve if page is not indexable. - item delimiter removes the closing tag if using a HTML tag (not documented but happens) - items should be cleaned, i.e. stripped of HTML tags Yields ------ _OUTPUT : items """ conf = DotDict(conf) split_token = conf.get('token', **kwargs) urls = utils.listize(conf['URL']) for item in _INPUT: for item_url in urls: url = utils.get_value(DotDict(item_url), DotDict(item), **kwargs) url = utils.get_abspath(url) if not url: continue f = urlopen(url) # TODO: it seems that Yahoo! converts relative links to # absolute. This needs to be done on the content but seems to # be a non-trival task python? content = unicode(f.read(), 'utf-8') if context and context.verbose: print '............Content .................' print content print '...............EOF...................' parsed = _parse_content(content, conf, **kwargs) items = parsed.split(split_token) if split_token else [parsed] if context and context.verbose: print "FetchPage: found count items:", len(items) for i in items: if context and context.verbose: print "--------------item data --------------------" print i print "--------------EOF item data ----------------" yield {"content": i} if item.get('forever'): # _INPUT is pipeforever and not a loop, # so we just yield our item once break
{ "pile_set_name": "Github" }
/*********************************************************************** * Software License Agreement (BSD License) * * Copyright 2008-2009 Marius Muja ([email protected]). All rights reserved. * Copyright 2008-2009 David G. Lowe ([email protected]). All rights reserved. * * THE BSD LICENSE * * 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 above 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. *************************************************************************/ #ifndef OPENCV_FLANN_GENERAL_H_ #define OPENCV_FLANN_GENERAL_H_ #include "opencv2/core.hpp" namespace cvflann { class FLANNException : public cv::Exception { public: FLANNException(const char* message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } FLANNException(const cv::String& message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } }; } #endif /* OPENCV_FLANN_GENERAL_H_ */
{ "pile_set_name": "Github" }
{ "name": "BBC News پښتو", "short_name": "BBC News پښتو", "Scope": "/pashto/", "background_color": "#b80000", "display": "standalone", "theme_color": "#b80000", "icons": [ { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-72x72.png", "sizes": "72x72", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-96x96.png", "sizes": "96x96", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-128x128.png", "sizes": "128x128", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-144x144.png", "sizes": "144x144", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-152x152.png", "sizes": "152x152", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-180x180.png", "sizes": "180x180", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-384x384.png", "sizes": "384x384", "type": "image/png" }, { "src": "https://news.files.bbci.co.uk/include/articles/public/pashto/images/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png" } ], "splash_pages": null }
{ "pile_set_name": "Github" }
## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Pricing < Domain class V1 < Version class VoiceList < ListResource class CountryList < ListResource ## # Initialize the CountryList # @param [Version] version Version that contains the resource # @return [CountryList] CountryList def initialize(version) super(version) # Path Solution @solution = {} @uri = "/Voice/Countries" end ## # Lists CountryInstance records from the API as a list. # Unlike stream(), this operation is eager and will load `limit` records into # memory before returning. # @param [Integer] limit Upper limit for the number of records to return. stream() # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when # not set will use the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the limit with the most # efficient page size, i.e. min(limit, 1000) # @return [Array] Array of up to limit results def list(limit: nil, page_size: nil) self.stream(limit: limit, page_size: page_size).entries end ## # Streams CountryInstance records from the API as an Enumerable. # This operation lazily loads records as efficiently as possible until the limit # is reached. # @param [Integer] limit Upper limit for the number of records to return. stream() # guarantees to never return more than limit. Default is no limit. # @param [Integer] page_size Number of records to fetch per request, when # not set will use the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the limit with the most # efficient page size, i.e. min(limit, 1000) # @return [Enumerable] Enumerable that will yield up to limit results def stream(limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page(page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end ## # When passed a block, yields CountryInstance records from the API. # This operation lazily loads records as efficiently as possible until the limit # is reached. def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end ## # Retrieve a single page of CountryInstance records from the API. # Request is executed immediately. # @param [String] page_token PageToken provided by the API # @param [Integer] page_number Page Number, this value is simply for client state # @param [Integer] page_size Number of records to return, defaults to 50 # @return [Page] Page of CountryInstance def page(page_token: :unset, page_number: :unset, page_size: :unset) params = Twilio::Values.of({ 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) response = @version.page('GET', @uri, params: params) CountryPage.new(@version, response, @solution) end ## # Retrieve a single page of CountryInstance records from the API. # Request is executed immediately. # @param [String] target_url API-generated URL for the requested results page # @return [Page] Page of CountryInstance def get_page(target_url) response = @version.domain.request( 'GET', target_url ) CountryPage.new(@version, response, @solution) end ## # Provide a user friendly representation def to_s '#<Twilio.Pricing.V1.CountryList>' end end class CountryPage < Page ## # Initialize the CountryPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [CountryPage] CountryPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of CountryInstance # @param [Hash] payload Payload response from the API # @return [CountryInstance] CountryInstance def get_instance(payload) CountryInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '<Twilio.Pricing.V1.CountryPage>' end end class CountryContext < InstanceContext ## # Initialize the CountryContext # @param [Version] version Version that contains the resource # @param [String] iso_country The {ISO country # code}[http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the pricing # information to fetch. # @return [CountryContext] CountryContext def initialize(version, iso_country) super(version) # Path Solution @solution = {iso_country: iso_country, } @uri = "/Voice/Countries/#{@solution[:iso_country]}" end ## # Fetch the CountryInstance # @return [CountryInstance] Fetched CountryInstance def fetch payload = @version.fetch('GET', @uri) CountryInstance.new(@version, payload, iso_country: @solution[:iso_country], ) end ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V1.CountryContext #{context}>" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Pricing.V1.CountryContext #{context}>" end end class CountryInstance < InstanceResource ## # Initialize the CountryInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] iso_country The {ISO country # code}[http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the pricing # information to fetch. # @return [CountryInstance] CountryInstance def initialize(version, payload, iso_country: nil) super(version) # Marshaled Properties @properties = { 'country' => payload['country'], 'iso_country' => payload['iso_country'], 'outbound_prefix_prices' => payload['outbound_prefix_prices'], 'inbound_call_prices' => payload['inbound_call_prices'], 'price_unit' => payload['price_unit'], 'url' => payload['url'], } # Context @instance_context = nil @params = {'iso_country' => iso_country || @properties['iso_country'], } 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 [CountryContext] CountryContext for this CountryInstance def context unless @instance_context @instance_context = CountryContext.new(@version, @params['iso_country'], ) end @instance_context end ## # @return [String] The name of the country def country @properties['country'] end ## # @return [String] The ISO country code def iso_country @properties['iso_country'] end ## # @return [String] The list of OutboundPrefixPrice records def outbound_prefix_prices @properties['outbound_prefix_prices'] end ## # @return [String] The list of InboundCallPrice records def inbound_call_prices @properties['inbound_call_prices'] end ## # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) def price_unit @properties['price_unit'] end ## # @return [String] The absolute URL of the resource def url @properties['url'] end ## # Fetch the CountryInstance # @return [CountryInstance] Fetched CountryInstance def fetch context.fetch end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Pricing.V1.CountryInstance #{values}>" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Pricing.V1.CountryInstance #{values}>" end end end end end end end
{ "pile_set_name": "Github" }
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class Foam::PtrDictionary Description Template dictionary class which does not manages the storage associated with it. It is derived from DictionaryBase instantiated on a non-memory managed form of intrusive doubly-linked list of T. SourceFiles PtrDictionary.C \*---------------------------------------------------------------------------*/ #ifndef PtrDictionary_H #define PtrDictionary_H #include "DictionaryBase.H" #include "DLPtrList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ Class PtrDictionary Declaration \*---------------------------------------------------------------------------*/ template<class T> class PtrDictionary : public DictionaryBase<DLPtrList<T>, T> { public: // Constructors //- Construct given initial table size PtrDictionary(const label size = 128); //- Copy construct PtrDictionary(const PtrDictionary&); //- Construct from Istream using given Istream constructor class template<class INew> PtrDictionary(Istream&, const INew&); //- Construct from Istream PtrDictionary(Istream&); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository # include "PtrDictionary.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //
{ "pile_set_name": "Github" }
// Copyright 2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * 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. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "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 COPYRIGHT // OWNER 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. function XXX(x) { var k = delete x; return k; } assertFalse(XXX('Hello'));
{ "pile_set_name": "Github" }
Connection: keep-alive Content-Length: 0 Date: Fri, 06 Oct 2017 09:58:39 GMT Server: JBoss-EAP/7 X-Powered-By: Undertow/1
{ "pile_set_name": "Github" }
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using AutoLotDAL.Models.Base; namespace AutoLotDAL.Models { [Table("Inventory")] public partial class Inventory : EntityBase { [StringLength(50)] public string Make { get; set; } [StringLength(50)] public string Color { get; set; } [StringLength(50)] public string PetName { get; set; } public virtual ICollection<Order> Orders { get; set; } = new HashSet<Order>(); } }
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0-only /* * AMD Cryptographic Coprocessor (CCP) AES CMAC crypto API support * * Copyright (C) 2013,2018 Advanced Micro Devices, Inc. * * Author: Tom Lendacky <[email protected]> */ #include <linux/module.h> #include <linux/sched.h> #include <linux/delay.h> #include <linux/scatterlist.h> #include <linux/crypto.h> #include <crypto/algapi.h> #include <crypto/aes.h> #include <crypto/hash.h> #include <crypto/internal/hash.h> #include <crypto/scatterwalk.h> #include "ccp-crypto.h" static int ccp_aes_cmac_complete(struct crypto_async_request *async_req, int ret) { struct ahash_request *req = ahash_request_cast(async_req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req); unsigned int digest_size = crypto_ahash_digestsize(tfm); if (ret) goto e_free; if (rctx->hash_rem) { /* Save remaining data to buffer */ unsigned int offset = rctx->nbytes - rctx->hash_rem; scatterwalk_map_and_copy(rctx->buf, rctx->src, offset, rctx->hash_rem, 0); rctx->buf_count = rctx->hash_rem; } else { rctx->buf_count = 0; } /* Update result area if supplied */ if (req->result && rctx->final) memcpy(req->result, rctx->iv, digest_size); e_free: sg_free_table(&rctx->data_sg); return ret; } static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes, unsigned int final) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct ccp_ctx *ctx = crypto_ahash_ctx(tfm); struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req); struct scatterlist *sg, *cmac_key_sg = NULL; unsigned int block_size = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm)); unsigned int need_pad, sg_count; gfp_t gfp; u64 len; int ret; if (!ctx->u.aes.key_len) return -EINVAL; if (nbytes) rctx->null_msg = 0; len = (u64)rctx->buf_count + (u64)nbytes; if (!final && (len <= block_size)) { scatterwalk_map_and_copy(rctx->buf + rctx->buf_count, req->src, 0, nbytes, 0); rctx->buf_count += nbytes; return 0; } rctx->src = req->src; rctx->nbytes = nbytes; rctx->final = final; rctx->hash_rem = final ? 0 : len & (block_size - 1); rctx->hash_cnt = len - rctx->hash_rem; if (!final && !rctx->hash_rem) { /* CCP can't do zero length final, so keep some data around */ rctx->hash_cnt -= block_size; rctx->hash_rem = block_size; } if (final && (rctx->null_msg || (len & (block_size - 1)))) need_pad = 1; else need_pad = 0; sg_init_one(&rctx->iv_sg, rctx->iv, sizeof(rctx->iv)); /* Build the data scatterlist table - allocate enough entries for all * possible data pieces (buffer, input data, padding) */ sg_count = (nbytes) ? sg_nents(req->src) + 2 : 2; gfp = req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL : GFP_ATOMIC; ret = sg_alloc_table(&rctx->data_sg, sg_count, gfp); if (ret) return ret; sg = NULL; if (rctx->buf_count) { sg_init_one(&rctx->buf_sg, rctx->buf, rctx->buf_count); sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->buf_sg); if (!sg) { ret = -EINVAL; goto e_free; } } if (nbytes) { sg = ccp_crypto_sg_table_add(&rctx->data_sg, req->src); if (!sg) { ret = -EINVAL; goto e_free; } } if (need_pad) { int pad_length = block_size - (len & (block_size - 1)); rctx->hash_cnt += pad_length; memset(rctx->pad, 0, sizeof(rctx->pad)); rctx->pad[0] = 0x80; sg_init_one(&rctx->pad_sg, rctx->pad, pad_length); sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->pad_sg); if (!sg) { ret = -EINVAL; goto e_free; } } if (sg) { sg_mark_end(sg); sg = rctx->data_sg.sgl; } /* Initialize the K1/K2 scatterlist */ if (final) cmac_key_sg = (need_pad) ? &ctx->u.aes.k2_sg : &ctx->u.aes.k1_sg; memset(&rctx->cmd, 0, sizeof(rctx->cmd)); INIT_LIST_HEAD(&rctx->cmd.entry); rctx->cmd.engine = CCP_ENGINE_AES; rctx->cmd.u.aes.type = ctx->u.aes.type; rctx->cmd.u.aes.mode = ctx->u.aes.mode; rctx->cmd.u.aes.action = CCP_AES_ACTION_ENCRYPT; rctx->cmd.u.aes.key = &ctx->u.aes.key_sg; rctx->cmd.u.aes.key_len = ctx->u.aes.key_len; rctx->cmd.u.aes.iv = &rctx->iv_sg; rctx->cmd.u.aes.iv_len = AES_BLOCK_SIZE; rctx->cmd.u.aes.src = sg; rctx->cmd.u.aes.src_len = rctx->hash_cnt; rctx->cmd.u.aes.dst = NULL; rctx->cmd.u.aes.cmac_key = cmac_key_sg; rctx->cmd.u.aes.cmac_key_len = ctx->u.aes.kn_len; rctx->cmd.u.aes.cmac_final = final; ret = ccp_crypto_enqueue_request(&req->base, &rctx->cmd); return ret; e_free: sg_free_table(&rctx->data_sg); return ret; } static int ccp_aes_cmac_init(struct ahash_request *req) { struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req); memset(rctx, 0, sizeof(*rctx)); rctx->null_msg = 1; return 0; } static int ccp_aes_cmac_update(struct ahash_request *req) { return ccp_do_cmac_update(req, req->nbytes, 0); } static int ccp_aes_cmac_final(struct ahash_request *req) { return ccp_do_cmac_update(req, 0, 1); } static int ccp_aes_cmac_finup(struct ahash_request *req) { return ccp_do_cmac_update(req, req->nbytes, 1); } static int ccp_aes_cmac_digest(struct ahash_request *req) { int ret; ret = ccp_aes_cmac_init(req); if (ret) return ret; return ccp_aes_cmac_finup(req); } static int ccp_aes_cmac_export(struct ahash_request *req, void *out) { struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req); struct ccp_aes_cmac_exp_ctx state; /* Don't let anything leak to 'out' */ memset(&state, 0, sizeof(state)); state.null_msg = rctx->null_msg; memcpy(state.iv, rctx->iv, sizeof(state.iv)); state.buf_count = rctx->buf_count; memcpy(state.buf, rctx->buf, sizeof(state.buf)); /* 'out' may not be aligned so memcpy from local variable */ memcpy(out, &state, sizeof(state)); return 0; } static int ccp_aes_cmac_import(struct ahash_request *req, const void *in) { struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req); struct ccp_aes_cmac_exp_ctx state; /* 'in' may not be aligned so memcpy to local variable */ memcpy(&state, in, sizeof(state)); memset(rctx, 0, sizeof(*rctx)); rctx->null_msg = state.null_msg; memcpy(rctx->iv, state.iv, sizeof(rctx->iv)); rctx->buf_count = state.buf_count; memcpy(rctx->buf, state.buf, sizeof(rctx->buf)); return 0; } static int ccp_aes_cmac_setkey(struct crypto_ahash *tfm, const u8 *key, unsigned int key_len) { struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm)); struct ccp_crypto_ahash_alg *alg = ccp_crypto_ahash_alg(crypto_ahash_tfm(tfm)); u64 k0_hi, k0_lo, k1_hi, k1_lo, k2_hi, k2_lo; u64 rb_hi = 0x00, rb_lo = 0x87; struct crypto_aes_ctx aes; __be64 *gk; int ret; switch (key_len) { case AES_KEYSIZE_128: ctx->u.aes.type = CCP_AES_TYPE_128; break; case AES_KEYSIZE_192: ctx->u.aes.type = CCP_AES_TYPE_192; break; case AES_KEYSIZE_256: ctx->u.aes.type = CCP_AES_TYPE_256; break; default: return -EINVAL; } ctx->u.aes.mode = alg->mode; /* Set to zero until complete */ ctx->u.aes.key_len = 0; /* Set the key for the AES cipher used to generate the keys */ ret = aes_expandkey(&aes, key, key_len); if (ret) return ret; /* Encrypt a block of zeroes - use key area in context */ memset(ctx->u.aes.key, 0, sizeof(ctx->u.aes.key)); aes_encrypt(&aes, ctx->u.aes.key, ctx->u.aes.key); memzero_explicit(&aes, sizeof(aes)); /* Generate K1 and K2 */ k0_hi = be64_to_cpu(*((__be64 *)ctx->u.aes.key)); k0_lo = be64_to_cpu(*((__be64 *)ctx->u.aes.key + 1)); k1_hi = (k0_hi << 1) | (k0_lo >> 63); k1_lo = k0_lo << 1; if (ctx->u.aes.key[0] & 0x80) { k1_hi ^= rb_hi; k1_lo ^= rb_lo; } gk = (__be64 *)ctx->u.aes.k1; *gk = cpu_to_be64(k1_hi); gk++; *gk = cpu_to_be64(k1_lo); k2_hi = (k1_hi << 1) | (k1_lo >> 63); k2_lo = k1_lo << 1; if (ctx->u.aes.k1[0] & 0x80) { k2_hi ^= rb_hi; k2_lo ^= rb_lo; } gk = (__be64 *)ctx->u.aes.k2; *gk = cpu_to_be64(k2_hi); gk++; *gk = cpu_to_be64(k2_lo); ctx->u.aes.kn_len = sizeof(ctx->u.aes.k1); sg_init_one(&ctx->u.aes.k1_sg, ctx->u.aes.k1, sizeof(ctx->u.aes.k1)); sg_init_one(&ctx->u.aes.k2_sg, ctx->u.aes.k2, sizeof(ctx->u.aes.k2)); /* Save the supplied key */ memset(ctx->u.aes.key, 0, sizeof(ctx->u.aes.key)); memcpy(ctx->u.aes.key, key, key_len); ctx->u.aes.key_len = key_len; sg_init_one(&ctx->u.aes.key_sg, ctx->u.aes.key, key_len); return ret; } static int ccp_aes_cmac_cra_init(struct crypto_tfm *tfm) { struct ccp_ctx *ctx = crypto_tfm_ctx(tfm); struct crypto_ahash *ahash = __crypto_ahash_cast(tfm); ctx->complete = ccp_aes_cmac_complete; ctx->u.aes.key_len = 0; crypto_ahash_set_reqsize(ahash, sizeof(struct ccp_aes_cmac_req_ctx)); return 0; } int ccp_register_aes_cmac_algs(struct list_head *head) { struct ccp_crypto_ahash_alg *ccp_alg; struct ahash_alg *alg; struct hash_alg_common *halg; struct crypto_alg *base; int ret; ccp_alg = kzalloc(sizeof(*ccp_alg), GFP_KERNEL); if (!ccp_alg) return -ENOMEM; INIT_LIST_HEAD(&ccp_alg->entry); ccp_alg->mode = CCP_AES_MODE_CMAC; alg = &ccp_alg->alg; alg->init = ccp_aes_cmac_init; alg->update = ccp_aes_cmac_update; alg->final = ccp_aes_cmac_final; alg->finup = ccp_aes_cmac_finup; alg->digest = ccp_aes_cmac_digest; alg->export = ccp_aes_cmac_export; alg->import = ccp_aes_cmac_import; alg->setkey = ccp_aes_cmac_setkey; halg = &alg->halg; halg->digestsize = AES_BLOCK_SIZE; halg->statesize = sizeof(struct ccp_aes_cmac_exp_ctx); base = &halg->base; snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "cmac(aes)"); snprintf(base->cra_driver_name, CRYPTO_MAX_ALG_NAME, "cmac-aes-ccp"); base->cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_KERN_DRIVER_ONLY | CRYPTO_ALG_NEED_FALLBACK; base->cra_blocksize = AES_BLOCK_SIZE; base->cra_ctxsize = sizeof(struct ccp_ctx); base->cra_priority = CCP_CRA_PRIORITY; base->cra_init = ccp_aes_cmac_cra_init; base->cra_module = THIS_MODULE; ret = crypto_register_ahash(alg); if (ret) { pr_err("%s ahash algorithm registration error (%d)\n", base->cra_name, ret); kfree(ccp_alg); return ret; } list_add(&ccp_alg->entry, head); return 0; }
{ "pile_set_name": "Github" }
package test; import java.util.List; import com.mashibing.etl.util.IPSeekerExt; import com.mashibing.etl.util.IPSeekerExt.RegionInfo; public class TestIPSeekerExt { public static void main(String[] args) { IPSeekerExt ipSeekerExt = new IPSeekerExt(); RegionInfo info = ipSeekerExt.analyticIp("114.114.114.114"); System.out.println(info); List<String> ips = ipSeekerExt.getAllIp(); for (String ip : ips) { System.out.println(ip + " --- " + ipSeekerExt.analyticIp(ip)); } } }
{ "pile_set_name": "Github" }
{ "name": "colors", "description": "get colors in your node.js console like what", "version": "0.6.2", "author": { "name": "Marak Squires" }, "homepage": "https://github.com/Marak/colors.js", "bugs": { "url": "https://github.com/Marak/colors.js/issues" }, "keywords": [ "ansi", "terminal", "colors" ], "repository": { "type": "git", "url": "http://github.com/Marak/colors.js.git" }, "engines": { "node": ">=0.1.90" }, "main": "colors", "readme": "# colors.js - get color and style in your node.js console ( and browser ) like what\n\n<img src=\"http://i.imgur.com/goJdO.png\" border = \"0\"/>\n\n\n## Installation\n\n npm install colors\n\n## colors and styles!\n\n- bold\n- italic\n- underline\n- inverse\n- yellow\n- cyan\n- white\n- magenta\n- green\n- red\n- grey\n- blue\n- rainbow\n- zebra\n- random\n\n## Usage\n\n``` js\nvar colors = require('./colors');\n\nconsole.log('hello'.green); // outputs green text\nconsole.log('i like cake and pies'.underline.red) // outputs red underlined text\nconsole.log('inverse the color'.inverse); // inverses the color\nconsole.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)\n```\n\n# Creating Custom themes\n\n```js\n\nvar colors = require('colors');\n\ncolors.setTheme({\n silly: 'rainbow',\n input: 'grey',\n verbose: 'cyan',\n prompt: 'grey',\n info: 'green',\n data: 'grey',\n help: 'cyan',\n warn: 'yellow',\n debug: 'blue',\n error: 'red'\n});\n\n// outputs red text\nconsole.log(\"this is an error\".error);\n\n// outputs yellow text\nconsole.log(\"this is a warning\".warn);\n```\n\n\n### Contributors \n\nMarak (Marak Squires)\nAlexis Sellier (cloudhead)\nmmalecki (Maciej Małecki)\nnicoreed (Nico Reed)\nmorganrallen (Morgan Allen)\nJustinCampbell (Justin Campbell)\nded (Dustin Diaz)\n\n\n#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded)\n", "readmeFilename": "ReadMe.md", "_id": "[email protected]", "_from": "colors@~0.6.2" }
{ "pile_set_name": "Github" }
# This is the official list of GoGo authors for copyright purposes. # This file is distinct from the CONTRIBUTORS file, which # lists people. For example, employees are listed in CONTRIBUTORS, # but not in AUTHORS, because the employer holds the copyright. # Names should be added to this file as one of # Organization's name # Individual's name <submission email address> # Individual's name <submission email address> <email2> <emailN> # Please keep the list sorted. Sendgrid, Inc Vastech SA (PTY) LTD Walter Schulze <[email protected]>
{ "pile_set_name": "Github" }
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Libxt(AutotoolsPackage, XorgPackage): """libXt - X Toolkit Intrinsics library.""" homepage = "http://cgit.freedesktop.org/xorg/lib/libXt" xorg_mirror_path = "lib/libXt-1.1.5.tar.gz" version('1.1.5', sha256='b59bee38a9935565fa49dc1bfe84cb30173e2e07e1dcdf801430d4b54eb0caa3') depends_on('libsm') depends_on('libice') depends_on('libx11') depends_on('xproto', type='build') depends_on('kbproto', type='build') depends_on('pkgconfig', type='build') depends_on('util-macros', type='build') @property def libs(self): return find_libraries( 'libXt', root=self.prefix, shared=True, recursive=True )
{ "pile_set_name": "Github" }
/*============================================================================= Copyright (c) 2001-2007 Joel de Guzman Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(FUSION_INCLUDE_VALUE_AT_KEY) #define FUSION_INCLUDE_VALUE_AT_KEY #include <boost/fusion/support/config.hpp> #include <boost/fusion/sequence/intrinsic/value_at_key.hpp> #endif
{ "pile_set_name": "Github" }
-- | A fragment profile determines what features a program can use. module DDC.Core.Fragment.Profile ( Profile (..) , mapFeaturesOfProfile , zeroProfile , Features(..) , zeroFeatures , setFeature) where import DDC.Core.Exp.Literal import DDC.Core.Fragment.Feature import DDC.Type.DataDef import DDC.Type.Exp import DDC.Type.Env (KindEnv, TypeEnv) import DDC.Data.SourcePos import qualified DDC.Type.Env as Env -- | The fragment profile describes the language features and -- primitive operators available in the language. data Profile n = Profile { -- | The name of this profile. profileName :: !String -- | Permitted language features. , profileFeatures :: !Features -- | Primitive data type declarations. , profilePrimDataDefs :: !(DataDefs n) -- | Kinds of primitive types. , profilePrimKinds :: !(KindEnv n) -- | Types of primitive operators. , profilePrimTypes :: !(TypeEnv n) -- | Check whether a type is an unboxed type. -- Some fragments limit how these can be used. , profileTypeIsUnboxed :: !(Type n -> Bool) -- | Check whether some name represents a hole that needs -- to be filled in by the type checker. , profileNameIsHole :: !(Maybe (n -> Bool)) -- | Convert a literal to a name, -- given the source position, literal value and whether -- the literal should be taken as a language primitive -- (with a trailing '#'). , profileMakeLiteralName :: Maybe (SourcePos -> Literal -> Bool -> Maybe n) } -- | Apply a function to the `Features` of a `Profile`. mapFeaturesOfProfile :: (Features -> Features) -> Profile n -> Profile n mapFeaturesOfProfile f profile = profile { profileFeatures = f (profileFeatures profile) } -- | A language profile with no features or primitive operators. -- -- This provides a simple first-order language. zeroProfile :: Profile n zeroProfile = Profile { profileName = "Zero" , profileFeatures = zeroFeatures , profilePrimDataDefs = emptyDataDefs , profilePrimKinds = Env.empty , profilePrimTypes = Env.empty , profileTypeIsUnboxed = const False , profileNameIsHole = Nothing , profileMakeLiteralName = Nothing } -- | A flattened set of features, for easy lookup. data Features = Features { featuresTrackedEffects :: Bool , featuresTrackedClosures :: Bool , featuresFunctionalEffects :: Bool , featuresFunctionalClosures :: Bool , featuresEffectCapabilities :: Bool , featuresImplicitRun :: Bool , featuresImplicitBox :: Bool , featuresMetaVariables :: Bool , featuresPartialPrims :: Bool , featuresPartialApplication :: Bool , featuresGeneralApplication :: Bool , featuresNestedFunctions :: Bool , featuresGeneralLetRec :: Bool , featuresDebruijnBinders :: Bool , featuresUnboundLevel0Vars :: Bool , featuresNameShadowing :: Bool , featuresUnusedBindings :: Bool , featuresUnusedMatches :: Bool } -- | An emtpy feature set, with all flags set to `False`. zeroFeatures :: Features zeroFeatures = Features { featuresTrackedEffects = False , featuresTrackedClosures = False , featuresFunctionalEffects = False , featuresFunctionalClosures = False , featuresEffectCapabilities = False , featuresImplicitRun = False , featuresImplicitBox = False , featuresMetaVariables = False , featuresPartialPrims = False , featuresPartialApplication = False , featuresGeneralApplication = False , featuresNestedFunctions = False , featuresGeneralLetRec = False , featuresDebruijnBinders = False , featuresUnboundLevel0Vars = False , featuresNameShadowing = False , featuresUnusedBindings = False , featuresUnusedMatches = False } -- | Set a language `Flag` in the `Profile`. setFeature :: Feature -> Bool -> Features -> Features setFeature feature val features = case feature of TrackedEffects -> features { featuresTrackedEffects = val } TrackedClosures -> features { featuresTrackedClosures = val } FunctionalEffects -> features { featuresFunctionalEffects = val } FunctionalClosures -> features { featuresFunctionalClosures = val } EffectCapabilities -> features { featuresEffectCapabilities = val } ImplicitRun -> features { featuresImplicitRun = val } ImplicitBox -> features { featuresImplicitBox = val } MetaVariables -> features { featuresMetaVariables = val } PartialPrims -> features { featuresPartialPrims = val } PartialApplication -> features { featuresPartialApplication = val } GeneralApplication -> features { featuresGeneralApplication = val } NestedFunctions -> features { featuresNestedFunctions = val } GeneralLetRec -> features { featuresGeneralLetRec = val } DebruijnBinders -> features { featuresDebruijnBinders = val } UnboundLevel0Vars -> features { featuresUnboundLevel0Vars = val } NameShadowing -> features { featuresNameShadowing = val } UnusedBindings -> features { featuresUnusedBindings = val } UnusedMatches -> features { featuresUnusedMatches = val }
{ "pile_set_name": "Github" }
/* Copyright 2019 The Jetstack cert-manager contributors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Package meta contains meta types for cert-manager APIs // +k8s:deepcopy-gen=package // +k8s:openapi-gen=true // +k8s:defaulter-gen=TypeMeta // +gencrdrefdocs:force // +groupName=meta.cert-manager.io package v1
{ "pile_set_name": "Github" }
// Go support for Protocol Buffers - Google's data interchange format // // Copyright 2011 The Go Authors. All rights reserved. // https://github.com/golang/protobuf // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * 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. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "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 COPYRIGHT // OWNER 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. // Protocol buffer deep copy and merge. // TODO: RawMessage. package proto import ( "fmt" "log" "reflect" "strings" ) // Clone returns a deep copy of a protocol buffer. func Clone(src Message) Message { in := reflect.ValueOf(src) if in.IsNil() { return src } out := reflect.New(in.Type().Elem()) dst := out.Interface().(Message) Merge(dst, src) return dst } // Merger is the interface representing objects that can merge messages of the same type. type Merger interface { // Merge merges src into this message. // Required and optional fields that are set in src will be set to that value in dst. // Elements of repeated fields will be appended. // // Merge may panic if called with a different argument type than the receiver. Merge(src Message) } // generatedMerger is the custom merge method that generated protos will have. // We must add this method since a generate Merge method will conflict with // many existing protos that have a Merge data field already defined. type generatedMerger interface { XXX_Merge(src Message) } // Merge merges src into dst. // Required and optional fields that are set in src will be set to that value in dst. // Elements of repeated fields will be appended. // Merge panics if src and dst are not the same type, or if dst is nil. func Merge(dst, src Message) { if m, ok := dst.(Merger); ok { m.Merge(src) return } in := reflect.ValueOf(src) out := reflect.ValueOf(dst) if out.IsNil() { panic("proto: nil destination") } if in.Type() != out.Type() { panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) } if in.IsNil() { return // Merge from nil src is a noop } if m, ok := dst.(generatedMerger); ok { m.XXX_Merge(src) return } mergeStruct(out.Elem(), in.Elem()) } func mergeStruct(out, in reflect.Value) { sprop := GetProperties(in.Type()) for i := 0; i < in.NumField(); i++ { f := in.Type().Field(i) if strings.HasPrefix(f.Name, "XXX_") { continue } mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i]) } if emIn, err := extendable(in.Addr().Interface()); err == nil { emOut, _ := extendable(out.Addr().Interface()) mIn, muIn := emIn.extensionsRead() if mIn != nil { mOut := emOut.extensionsWrite() muIn.Lock() mergeExtension(mOut, mIn) muIn.Unlock() } } uf := in.FieldByName("XXX_unrecognized") if !uf.IsValid() { return } uin := uf.Bytes() if len(uin) > 0 { out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...)) } } // mergeAny performs a merge between two values of the same type. // viaPtr indicates whether the values were indirected through a pointer (implying proto2). // prop is set if this is a struct field (it may be nil). func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) { if in.Type() == protoMessageType { if !in.IsNil() { if out.IsNil() { out.Set(reflect.ValueOf(Clone(in.Interface().(Message)))) } else { Merge(out.Interface().(Message), in.Interface().(Message)) } } return } switch in.Kind() { case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.String, reflect.Uint32, reflect.Uint64: if !viaPtr && isProto3Zero(in) { return } out.Set(in) case reflect.Interface: // Probably a oneof field; copy non-nil values. if in.IsNil() { return } // Allocate destination if it is not set, or set to a different type. // Otherwise we will merge as normal. if out.IsNil() || out.Elem().Type() != in.Elem().Type() { out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T) } mergeAny(out.Elem(), in.Elem(), false, nil) case reflect.Map: if in.Len() == 0 { return } if out.IsNil() { out.Set(reflect.MakeMap(in.Type())) } // For maps with value types of *T or []byte we need to deep copy each value. elemKind := in.Type().Elem().Kind() for _, key := range in.MapKeys() { var val reflect.Value switch elemKind { case reflect.Ptr: val = reflect.New(in.Type().Elem().Elem()) mergeAny(val, in.MapIndex(key), false, nil) case reflect.Slice: val = in.MapIndex(key) val = reflect.ValueOf(append([]byte{}, val.Bytes()...)) default: val = in.MapIndex(key) } out.SetMapIndex(key, val) } case reflect.Ptr: if in.IsNil() { return } if out.IsNil() { out.Set(reflect.New(in.Elem().Type())) } mergeAny(out.Elem(), in.Elem(), true, nil) case reflect.Slice: if in.IsNil() { return } if in.Type().Elem().Kind() == reflect.Uint8 { // []byte is a scalar bytes field, not a repeated field. // Edge case: if this is in a proto3 message, a zero length // bytes field is considered the zero value, and should not // be merged. if prop != nil && prop.proto3 && in.Len() == 0 { return } // Make a deep copy. // Append to []byte{} instead of []byte(nil) so that we never end up // with a nil result. out.SetBytes(append([]byte{}, in.Bytes()...)) return } n := in.Len() if out.IsNil() { out.Set(reflect.MakeSlice(in.Type(), 0, n)) } switch in.Type().Elem().Kind() { case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.String, reflect.Uint32, reflect.Uint64: out.Set(reflect.AppendSlice(out, in)) default: for i := 0; i < n; i++ { x := reflect.Indirect(reflect.New(in.Type().Elem())) mergeAny(x, in.Index(i), false, nil) out.Set(reflect.Append(out, x)) } } case reflect.Struct: mergeStruct(out, in) default: // unknown type, so not a protocol buffer log.Printf("proto: don't know how to copy %v", in) } } func mergeExtension(out, in map[int32]Extension) { for extNum, eIn := range in { eOut := Extension{desc: eIn.desc} if eIn.value != nil { v := reflect.New(reflect.TypeOf(eIn.value)).Elem() mergeAny(v, reflect.ValueOf(eIn.value), false, nil) eOut.value = v.Interface() } if eIn.enc != nil { eOut.enc = make([]byte, len(eIn.enc)) copy(eOut.enc, eIn.enc) } out[extNum] = eOut } }
{ "pile_set_name": "Github" }
#!/bin/bash APPLICATION_NAME=external_petsc_solver # If $METHOD is not set, use opt if [ -z $METHOD ]; then export METHOD=opt fi if [ -e ./unit/$APPLICATION_NAME-unit-$METHOD ] then ./unit/$APPLICATION_NAME-unit-$METHOD elif [ -e ./$APPLICATION_NAME-unit-$METHOD ] then ./$APPLICATION_NAME-unit-$METHOD else echo "Executable missing!" exit 1 fi
{ "pile_set_name": "Github" }
/** * 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. */ package org.apache.tez.dag.app.rm.container; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.tez.dag.app.dag.event.DiagnosableEvent; public class AMContainerEventNodeFailed extends AMContainerEvent implements DiagnosableEvent { private final String message; public AMContainerEventNodeFailed(ContainerId containerId, String message) { super(containerId, AMContainerEventType.C_NODE_FAILED); this.message = message; } @Override public String getDiagnosticInfo() { return message; } }
{ "pile_set_name": "Github" }
package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", ) go_test( name = "go_default_test", srcs = ["ssh_test.go"], embed = [":go_default_library"], deps = [ "//staging/src/k8s.io/apimachinery/pkg/util/clock:go_default_library", "//vendor/github.com/stretchr/testify/assert:go_default_library", ], ) go_library( name = "go_default_library", srcs = ["ssh.go"], importpath = "k8s.io/kubernetes/pkg/controlplane/tunneler", deps = [ "//pkg/ssh:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/clock:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//vendor/k8s.io/klog/v2:go_default_library", "//vendor/k8s.io/utils/path:go_default_library", ], ) filegroup( name = "package-srcs", srcs = glob(["**"]), tags = ["automanaged"], visibility = ["//visibility:private"], ) filegroup( name = "all-srcs", srcs = [":package-srcs"], tags = ["automanaged"], )
{ "pile_set_name": "Github" }
import React, { Component } from 'react' import PropTypes from 'prop-types' import { Link } from 'gatsby' import { Menu } from 'semantic-ui-react' class MenuLink extends Component { render() { const { children, strict, to, ...rest } = this.props return ( <Menu.Item color="red" as={Link} to={to} activeClassName="active" isActive={MenuLink.isActive(to, strict)} {...rest} > {children} </Menu.Item> ) } } MenuLink.propTypes = { strict: PropTypes.bool.isRequired, to: PropTypes.string.isRequired, } MenuLink.defaultProps = { strict: false, } MenuLink.isActive = (path, strict = false) => { const check = strict ? (pathname) => pathname === path : (pathname) => pathname.startsWith(path) return (match, { pathname }) => check(pathname) } export default MenuLink
{ "pile_set_name": "Github" }
#region License // Copyright (c) 2013, ClearCanvas Inc. // All rights reserved. // http://www.clearcanvas.ca // // This file is part of the ClearCanvas RIS/PACS open source project. // // The ClearCanvas RIS/PACS open source project is free software: you can // redistribute it and/or modify it under the terms of the GNU General Public // License as published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // The ClearCanvas RIS/PACS open source project is distributed in the hope that it // will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General // Public License for more details. // // You should have received a copy of the GNU General Public License along with // the ClearCanvas RIS/PACS open source project. If not, see // <http://www.gnu.org/licenses/>. #endregion using System; using System.Drawing; using ClearCanvas.Dicom; using ClearCanvas.Dicom.Iod; using ClearCanvas.ImageViewer.Imaging; using ClearCanvas.ImageViewer.Mathematics; namespace ClearCanvas.ImageViewer.TestTools { public class PixelAspectRatioChanger { public PixelAspectRatioChanger() { NewAspectRatio = new PixelAspectRatio(0, 0); } public bool RemoveCalibration { get; set; } public bool IncreasePixelDimensions { get; set; } public PixelAspectRatio NewAspectRatio { get; set; } private PixelDataInfo OldInfo { get; set; } private PixelDataInfo NewInfo { get; set; } public void ChangeAspectRatio(DicomFile file) { if (NewAspectRatio.IsNull || FloatComparer.AreEqual(NewAspectRatio.Value, 1)) throw new InvalidOperationException("Invalid new aspect ratio"); if (file.TransferSyntax.Encapsulated) file.ChangeTransferSyntax(TransferSyntax.ExplicitVrLittleEndian); OldInfo = new PixelDataInfo(file.DataSet); if (!OldInfo.IsSquare) throw new ArgumentException("Pixels are already non-square."); NewInfo = OldInfo.Clone(); NewInfo.AspectRatio = NewAspectRatio; if (IncreasePixelDimensions) { if (NewAspectRatio.Value < 1) NewInfo.Rows = (int)(OldInfo.Rows / NewAspectRatio.Value + 0.5); else NewInfo.Columns = (int)(OldInfo.Columns * NewAspectRatio.Value + 0.5); } else { if (NewAspectRatio.Value < 1) NewInfo.Columns = (int)(OldInfo.Columns * NewAspectRatio.Value + 0.5); else NewInfo.Rows = (int)(OldInfo.Rows / NewAspectRatio.Value + 0.5); } float rowScale = OldInfo.Rows / (float)NewInfo.Rows; float colScale = OldInfo.Columns / (float)NewInfo.Columns; if (RemoveCalibration) { NewInfo.PixelSpacing = new PixelSpacing(0, 0); NewInfo.ImagerPixelSpacing = new PixelSpacing(0, 0); } else { NewInfo.PixelSpacing = new PixelSpacing(NewInfo.PixelSpacing.Row * rowScale, NewInfo.PixelSpacing.Column * colScale); NewInfo.ImagerPixelSpacing = new PixelSpacing(NewInfo.ImagerPixelSpacing.Row * rowScale, NewInfo.ImagerPixelSpacing.Column * colScale); } ValidateNewInfo(); NewInfo.SeriesDescription = (OldInfo.SeriesDescription ?? "") + String.Format(" ({0}:{1}, dim/cal={2}/{3})", NewAspectRatio.Row, NewAspectRatio.Column, IncreasePixelDimensions ? "y" : "n", NewInfo.IsCalibrated ? "y" : "n"); NewInfo.PlanarConfiguration = 0; PixelData oldPixelData = OldInfo.GetPixelData(); PixelData newPixelData = NewInfo.GetPixelData(); for (int row = 0; row < NewInfo.Rows; ++row) { for (int column = 0; column < NewInfo.Columns; ++column) { var sourcePoint = new PointF(column * colScale, row * rowScale); int interpolated = PerformBilinearInterpolationAt(oldPixelData, sourcePoint); newPixelData.SetPixel(column, row, interpolated); } } NewInfo.SetPixelData(newPixelData); NewInfo.UpdateDataSet(file.DataSet); } private void ValidateNewInfo() { SizeF? dimensions = NewInfo.GetRealDimensions(); if (dimensions.HasValue) { SizeF? oldDimensions = OldInfo.GetRealDimensions(); if (Math.Abs(dimensions.Value.Width - oldDimensions.Value.Width) > OldInfo.GetPixelSpacing().Column || Math.Abs(dimensions.Value.Height - oldDimensions.Value.Height) > OldInfo.GetPixelSpacing().Row) throw new ApplicationException("Inconsistent real size"); } else { SizeF effDimensions = NewInfo.GetEffectiveDimensions(); SizeF oldEffDimensions = OldInfo.GetEffectiveDimensions(); if (IncreasePixelDimensions) { if (NewInfo.AspectRatio.Value >= 1) oldEffDimensions = new SizeF(oldEffDimensions.Width * NewInfo.AspectRatio.Value, oldEffDimensions.Height * NewInfo.AspectRatio.Value); else oldEffDimensions = new SizeF(oldEffDimensions.Width / NewInfo.AspectRatio.Value, oldEffDimensions.Height / NewInfo.AspectRatio.Value); } if (Math.Abs(effDimensions.Width - oldEffDimensions.Width) >= NewInfo.AspectRatio.Column || Math.Abs(effDimensions.Height - oldEffDimensions.Height) >= NewInfo.AspectRatio.Row) throw new ApplicationException("Effective sizes not consistent"); } } private static int PerformBilinearInterpolationAt(PixelData pixelData, PointF point00) { if (point00.Y < 0) point00.Y = 0; if (point00.X < 0) point00.X = 0; if (point00.X > (pixelData.Columns - 1.001F)) point00.X = (pixelData.Columns - 1.001F); if (point00.Y > (pixelData.Rows - 1.001F)) point00.Y = (pixelData.Rows - 1.001F); var srcPointInt00 = new Point((int)point00.X, (int)point00.Y); var arrayOfValues = new float[2, 2] { { 0, 0 }, { 0, 0 } }; if (pixelData is ColorPixelData) { var colorPixelData = (ColorPixelData)pixelData; //Just test the R value, the calculation is done in exactly the same way //for G & B, so if it's OK for the R channel it's OK for them too. //Get the 4 neighbour pixels for performing bilinear interpolation. arrayOfValues[0, 0] = colorPixelData.GetPixelAsColor(srcPointInt00.X, srcPointInt00.Y).R; arrayOfValues[0, 1] = colorPixelData.GetPixelAsColor(srcPointInt00.X, srcPointInt00.Y + 1).R; arrayOfValues[1, 0] = colorPixelData.GetPixelAsColor(srcPointInt00.X + 1, srcPointInt00.Y).R; arrayOfValues[1, 1] = colorPixelData.GetPixelAsColor(srcPointInt00.X + 1, srcPointInt00.Y + 1).R; var r = (byte)Interpolate(arrayOfValues, point00, srcPointInt00); arrayOfValues[0, 0] = colorPixelData.GetPixelAsColor(srcPointInt00.X, srcPointInt00.Y).G; arrayOfValues[0, 1] = colorPixelData.GetPixelAsColor(srcPointInt00.X, srcPointInt00.Y + 1).G; arrayOfValues[1, 0] = colorPixelData.GetPixelAsColor(srcPointInt00.X + 1, srcPointInt00.Y).G; arrayOfValues[1, 1] = colorPixelData.GetPixelAsColor(srcPointInt00.X + 1, srcPointInt00.Y + 1).G; var g = (byte)Interpolate(arrayOfValues, point00, srcPointInt00); arrayOfValues[0, 0] = colorPixelData.GetPixelAsColor(srcPointInt00.X, srcPointInt00.Y).B; arrayOfValues[0, 1] = colorPixelData.GetPixelAsColor(srcPointInt00.X, srcPointInt00.Y + 1).B; arrayOfValues[1, 0] = colorPixelData.GetPixelAsColor(srcPointInt00.X + 1, srcPointInt00.Y).B; arrayOfValues[1, 1] = colorPixelData.GetPixelAsColor(srcPointInt00.X + 1, srcPointInt00.Y + 1).B; var b = (byte)Interpolate(arrayOfValues, point00, srcPointInt00); return Color.FromArgb(255, r, g, b).ToArgb(); } else { var grayscalePixelData = (GrayscalePixelData)pixelData; if (pixelData.BitsAllocated == 16) { //Get the 4 neighbour pixels for performing bilinear interpolation. arrayOfValues[0, 0] = grayscalePixelData.GetPixel(srcPointInt00.X, srcPointInt00.Y); arrayOfValues[0, 1] = grayscalePixelData.GetPixel(srcPointInt00.X, srcPointInt00.Y + 1); arrayOfValues[1, 0] = grayscalePixelData.GetPixel(srcPointInt00.X + 1, srcPointInt00.Y); arrayOfValues[1, 1] = grayscalePixelData.GetPixel(srcPointInt00.X + 1, srcPointInt00.Y + 1); return Interpolate(arrayOfValues, point00, srcPointInt00); } else // if (pixelData.BitsAllocated == 8) { //Get the 4 neighbour pixels for performing bilinear interpolation. arrayOfValues[0, 0] = grayscalePixelData.GetPixel(srcPointInt00.X, srcPointInt00.Y); arrayOfValues[0, 1] = grayscalePixelData.GetPixel(srcPointInt00.X, srcPointInt00.Y + 1); arrayOfValues[1, 0] = grayscalePixelData.GetPixel(srcPointInt00.X + 1, srcPointInt00.Y); arrayOfValues[1, 1] = grayscalePixelData.GetPixel(srcPointInt00.X + 1, srcPointInt00.Y + 1); return Interpolate(arrayOfValues, point00, srcPointInt00); } } } private static int Interpolate(float[,] values, PointF point, Point point00) { const float fixedScale = 128; const int fixedPrecision = 7; //this actually performs the bilinear interpolation within the source image using 4 neighbour pixels. float dx = point.X - point00.X; float dy = point.Y - point00.Y; var dyFixed = (int)(dy * fixedScale); var dxFixed = (int)(dx * fixedScale); int yInterpolated1 = (((int)(values[0, 0])) << fixedPrecision) + ((dyFixed * ((int)((values[0, 1] - values[0, 0])) << fixedPrecision)) >> fixedPrecision); int yInterpolated2 = (((int)(values[1, 0])) << fixedPrecision) + ((dyFixed * ((int)((values[1, 1] - values[1, 0])) << fixedPrecision)) >> fixedPrecision); int interpolated = (yInterpolated1 + (((dxFixed) * (yInterpolated2 - yInterpolated1)) >> fixedPrecision)) >> fixedPrecision; return interpolated; } } }
{ "pile_set_name": "Github" }
from __future__ import unicode_literals from django import http from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site, get_current_site from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext as _ def shortcut(request, content_type_id, object_id): """ Redirect to an object's page based on a content-type ID and an object ID. """ # Look up the object, making sure it's got a get_absolute_url() function. try: content_type = ContentType.objects.get(pk=content_type_id) if not content_type.model_class(): raise http.Http404(_("Content type %(ct_id)s object has no associated model") % {'ct_id': content_type_id}) obj = content_type.get_object_for_this_type(pk=object_id) except (ObjectDoesNotExist, ValueError): raise http.Http404(_("Content type %(ct_id)s object %(obj_id)s doesn't exist") % {'ct_id': content_type_id, 'obj_id': object_id}) try: get_absolute_url = obj.get_absolute_url except AttributeError: raise http.Http404(_("%(ct_name)s objects don't have a get_absolute_url() method") % {'ct_name': content_type.name}) absurl = get_absolute_url() # Try to figure out the object's domain, so we can do a cross-site redirect # if necessary. # If the object actually defines a domain, we're done. if absurl.startswith('http://') or absurl.startswith('https://'): return http.HttpResponseRedirect(absurl) # Otherwise, we need to introspect the object's relationships for a # relation to the Site object object_domain = None if Site._meta.installed: opts = obj._meta # First, look for an many-to-many relationship to Site. for field in opts.many_to_many: if field.rel.to is Site: try: # Caveat: In the case of multiple related Sites, this just # selects the *first* one, which is arbitrary. object_domain = getattr(obj, field.name).all()[0].domain except IndexError: pass if object_domain is not None: break # Next, look for a many-to-one relationship to Site. if object_domain is None: for field in obj._meta.fields: if field.rel and field.rel.to is Site: try: object_domain = getattr(obj, field.name).domain except Site.DoesNotExist: pass if object_domain is not None: break # Fall back to the current site (if possible). if object_domain is None: try: object_domain = get_current_site(request).domain except Site.DoesNotExist: pass # If all that malarkey found an object domain, use it. Otherwise, fall back # to whatever get_absolute_url() returned. if object_domain is not None: protocol = request.is_secure() and 'https' or 'http' return http.HttpResponseRedirect('%s://%s%s' % (protocol, object_domain, absurl)) else: return http.HttpResponseRedirect(absurl)
{ "pile_set_name": "Github" }
////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // // copyright : (C) 2014 Eran Ifrah // file name : continousbuildconf.h // // ------------------------------------------------------------------------- // A // _____ _ _ _ _ // / __ \ | | | | (_) | // | / \/ ___ __| | ___| | _| |_ ___ // | | / _ \ / _ |/ _ \ | | | __/ _ ) // | \__/\ (_) | (_| | __/ |___| | || __/ // \____/\___/ \__,_|\___\_____/_|\__\___| // // F i l e // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #ifndef __continousbuildconf__ #define __continousbuildconf__ #include "serialized_object.h" class ContinousBuildConf : public SerializedObject { bool m_enabled; size_t m_parallelProcesses; public: ContinousBuildConf(); virtual ~ContinousBuildConf(); public: virtual void DeSerialize(Archive &arch); virtual void Serialize(Archive &arch); void SetEnabled(const bool& enabled) { this->m_enabled = enabled; } void SetParallelProcesses(const size_t& parallelProcesses) { this->m_parallelProcesses = parallelProcesses; } const bool& GetEnabled() const { return m_enabled; } const size_t& GetParallelProcesses() const { return m_parallelProcesses; } }; #endif // __continousbuildconf__
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="ca_ES" sourcelanguage="en_US"> <context> <name>AppsListModel</name> <message> <location filename="../apps/appslistmodel.cpp" line="70"/> <source>Application</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="128"/> <source>Power Off</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="130"/> <source>Power off this device</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="135"/> <source>Reboot</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="137"/> <source>Reboot this device</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="142"/> <source>Log Out</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="144"/> <source>End your session</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="153"/> <source>Run Command</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="163"/> <source>Open webpage</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="171"/> <source>Open Folder</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="181"/> <source>Open File</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="207"/> <source>System settings</source> <translation type="unfinished"></translation> </message> <message> <location filename="../apps/appslistmodel.cpp" line="209"/> <source>System Configuration</source> <translation type="unfinished"></translation> </message> </context> <context> <name>BTHandsfree</name> <message> <location filename="../bthandsfree.cpp" line="89"/> <source>In call</source> <translation type="unfinished"></translation> </message> <message> <location filename="../bthandsfree.cpp" line="93"/> <source>Dialling...</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Background</name> <message> <location filename="../background.ui" line="176"/> <source>Sorry, there was a problem displaying the background.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="198"/> <source>Try Again</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="379"/> <source>Background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="427"/> <source>IMAGE</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="434"/> <source>Select an image to display on your background and lock screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="522"/> <source>COMMUNITY BACKGROUNDS</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="529"/> <source>Images from the theShell community will be cycled through every so often.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="536"/> <source>Show image information</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="584"/> <source>STRETCH</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="591"/> <source>Select how you&apos;d like the background image to be sized</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="603"/> <source>Stretch To Fit</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="629"/> <source>Zoom and Crop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="655"/> <source>Center</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="681"/> <source>Tile</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="707"/> <source>Zoom To Fit</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="756"/> <source>Change Background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="765"/> <source>Open Status Center</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.ui" line="774"/> <source>Open System Settings</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.cpp" line="202"/> <source>by %1</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.cpp" line="315"/> <source>For desktop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.cpp" line="317"/> <source>For system</source> <translation type="unfinished"></translation> </message> <message> <location filename="../background.cpp" line="382"/> <source>Select Background</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ChooseBackground</name> <message> <location filename="../choosebackground.ui" line="14"/> <source>Choose Background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="44"/> <source>Inbuilt</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="57"/> <source>Community</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="70"/> <source>Custom</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="184"/> <source>Images from the theShell community will be cycled through every so often.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="194"/> <source>Show Image information</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="203"/> <source>Change image after</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="226"/> <source>minutes</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="279"/> <source>Current Background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="325"/> <source>TextLabel</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="332"/> <source>License</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="339"/> <source>More Information</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="350"/> <source>by</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="379"/> <source>Select a file to display as your desktop background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="391"/> <source>Browse...</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="453"/> <source>Image Sizing</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="461"/> <source>Stretch to Fit</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="466"/> <source>Zoom and Crop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="471"/> <source>Center</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="476"/> <source>Tile</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="481"/> <source>Zoom and Fit</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.ui" line="506"/> <source>Done</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.cpp" line="93"/> <source>by %1</source> <translation type="unfinished"></translation> </message> <message> <location filename="../choosebackground.cpp" line="170"/> <source>Select Background</source> <translation type="unfinished"></translation> </message> </context> <context> <name>DbusEvents</name> <message> <location filename="../dbusevents.cpp" line="100"/> <source>Perform Action...</source> <translation type="unfinished"></translation> </message> <message> <location filename="../dbusevents.cpp" line="105"/> <location filename="../dbusevents.cpp" line="171"/> <source>%1 Connected</source> <translation type="unfinished"></translation> </message> <message> <location filename="../dbusevents.cpp" line="105"/> <location filename="../dbusevents.cpp" line="171"/> <source>%1 has been connected to this PC.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../dbusevents.cpp" line="128"/> <source>%1 was just connected. What do you want to do?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../dbusevents.cpp" line="164"/> <source>iOS Device</source> <translation type="unfinished"></translation> </message> </context> <context> <name>EndSessionWait</name> <message> <location filename="../endsessionwait.ui" line="146"/> <source>Waiting for apps to close...</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="180"/> <location filename="../endsessionwait.ui" line="770"/> <source>Cancel</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="206"/> <source>End Now</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="300"/> <source>End Session</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="310"/> <source>You&apos;re about to power off your PC. Are you sure?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="347"/> <location filename="../endsessionwait.ui" line="855"/> <location filename="../endsessionwait.cpp" line="64"/> <location filename="../endsessionwait.cpp" line="88"/> <location filename="../endsessionwait.cpp" line="486"/> <location filename="../endsessionwait.cpp" line="864"/> <source>Power Off</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="395"/> <source>If you don&apos;t do anything, we&apos;ll power off for you in 30 seconds.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="430"/> <location filename="../endsessionwait.cpp" line="92"/> <location filename="../endsessionwait.cpp" line="493"/> <source>Reboot</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="462"/> <location filename="../endsessionwait.cpp" line="500"/> <source>Log Out</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="494"/> <source>Suspend</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="526"/> <source>Fake Exit</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="593"/> <location filename="../endsessionwait.ui" line="756"/> <source>Terminate App</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="603"/> <source>Select the app that you want to terminate</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="626"/> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Terminating an app will allow the app to clean up and then exit. If that doesn&apos;t work, you can kill the app, however, killing an app won&apos;t let it finish what it&apos;s doing. &lt;span style=&quot; font-weight:600;&quot;&gt;If you kill an app, you&apos;ll lose all unsaved work in that app.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="663"/> <source>Terminate</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="680"/> <source>Kill</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="694"/> <source>Done</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.ui" line="865"/> <source>All apps will be closed and your device will turn off completely.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.cpp" line="59"/> <source>If you don&apos;t do anything, we&apos;ll power off for you in %1 seconds.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.cpp" line="96"/> <source>Log out</source> <translation type="unfinished"></translation> </message> <message> <location filename="../endsessionwait.cpp" line="100"/> <location filename="../endsessionwait.cpp" line="793"/> <source>Dummy</source> <translation type="unfinished"></translation> </message> </context> <context> <name>InfoPaneDropdown</name> <message> <location filename="../infopanedropdown.ui" line="123"/> <source>Overview</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="170"/> <location filename="../infopanedropdown.ui" line="367"/> <source>System Settings</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="192"/> <source>Flight Mode</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="222"/> <source>Power Stretch</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="409"/> <location filename="../infopanedropdown.ui" line="659"/> <source>Startup</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="418"/> <location filename="../infopanedropdown.ui" line="962"/> <source>Gateway and Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="427"/> <location filename="../infopanedropdown.ui" line="1229"/> <source>Theme</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="436"/> <location filename="../infopanedropdown.ui" line="1563"/> <location filename="../infopanedropdown.cpp" line="142"/> <source>Location</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="445"/> <location filename="../infopanedropdown.ui" line="1831"/> <source>Power</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="454"/> <location filename="../infopanedropdown.ui" line="2365"/> <source>Lock Screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="463"/> <location filename="../infopanedropdown.ui" line="2601"/> <source>Accessibility</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="472"/> <location filename="../infopanedropdown.ui" line="2761"/> <location filename="../infopanedropdown.cpp" line="1798"/> <source>Unavailable Panes</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="481"/> <location filename="../infopanedropdown.ui" line="2841"/> <location filename="../infopanedropdown.cpp" line="1802"/> <source>Advanced</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="490"/> <location filename="../infopanedropdown.cpp" line="1804"/> <source>About</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="556"/> <source>SETTINGS NOT APPLIED</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="563"/> <source>Some settings you just changed may require you to log out and then log back in before they are applied completely.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="588"/> <location filename="../infopanedropdown.cpp" line="1944"/> <source>Log Out Now</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="728"/> <source>Remove</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="739"/> <source>New App</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="755"/> <source>Autostart with</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="784"/> <source>Which app do you want to automatically start with theShell?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="796"/> <location filename="../infopanedropdown.ui" line="860"/> <source>Back</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="820"/> <location filename="../infopanedropdown.ui" line="848"/> <source>Command</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="884"/> <source>Add App</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="897"/> <source>Enter details of the app to autostart</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="907"/> <source>Application Name</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="927"/> <source>Only autostart this app in theShell</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1002"/> <source>When this is checked, hovering over the Status Bar will automatically expand the bar. Otherwise, clicking on the Status Bar will expand the bar.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1012"/> <source>End Session Confirmation</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1019"/> <source>The Compact Bar is a smaller version of the traditional bar which arranges all the elements in one row to save vertical space.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1056"/> <source>Automatically show bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1091"/> <source>Within &amp;Gateway</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1098"/> <source>Fu&amp;ll Screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1121"/> <source>Show Bar on bottom of screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1138"/> <source>Use Compact Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1152"/> <source>The Status Bar is a shown when a window is maximised.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1162"/> <source>Use Status Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1169"/> <source>Show text on window buttons</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1183"/> <source>Show windows from other desktops</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1269"/> <source>Accent Color</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1310"/> <source>&amp;Light</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1317"/> <source>Dar&amp;k</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1324"/> <source>Black</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1331"/> <source>&amp;Gray</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1338"/> <source>Decorati&amp;ve</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1351"/> <source>Color Scheme</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1390"/> <source>System Font</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1420"/> <source>Icon Theme</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1427"/> <source>Use for GTK</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1438"/> <source>Widget Theme</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1497"/> <source>GTK3 Font</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1504"/> <source>GTK3 Theme</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1611"/> <source>Permission Required</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1621"/> <source>To manage location settings in theShell, you&apos;ll need to give us permission to be a geoclue agent.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1646"/> <source>Allow theShell to be a geoclue agent</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1672"/> <source>Have your administrator password ready</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1698"/> <source>If you wish to manually configure theShell as a geoclue agent, you&apos;ll need to edit /etc/geoclue/geoclue.conf and append &quot;theshell&quot; to the end of the whitelist setting.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1760"/> <source>Allow apps to access your physical location</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1900"/> <source>ON BATTERY</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1907"/> <location filename="../infopanedropdown.ui" line="2029"/> <source>Turn off screen after</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="1914"/> <location filename="../infopanedropdown.ui" line="1983"/> <source>Suspend after</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2042"/> <source>ON AC</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2049"/> <source>Drag the slider to the right to turn off power management</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2088"/> <source>Power Button</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2105"/> <source>Ask me what to do</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2114"/> <source>Power Off</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2123"/> <source>Reboot</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2132"/> <source>Log Out</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2141"/> <source>Suspend</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2150"/> <source>Lock</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2159"/> <source>Turn Off Screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2168"/> <source>Hibernate</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2186"/> <source>PHYSICAL BUTTONS</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2231"/> <source>ON SUSPENSION</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2253"/> <source>Suspend nor&amp;mally</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2260"/> <source>This will save power, but stop everything that you&apos;re doing until you wake your device. Recommended for most users</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2270"/> <source>&amp;Just turn off the screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2277"/> <source>This will consume more power but continue to run any tasks you were doing. For example, music will continue playing. When you wake this device, it will wake immediately. Not recommended if you don&apos;t have a solid state drive as the drive will not be turned off while you&apos;re moving it around. Recommended for tablets and tablet PCs.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2287"/> <source>Hibernate instead</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2294"/> <source>This will save a lot of power but will take a while to wake up again. Everything stops while your device is hibernating.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2405"/> <source>SuspendLockScreenSwitch</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2423"/> <source>Browse...</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2445"/> <source>Background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2452"/> <source>Lock screen after returning from suspend</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2459"/> <source>To change your password, go to User settings</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2503"/> <source>Set Up</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2514"/> <source>Remove Mouse Password</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2540"/> <location filename="../infopanedropdown.cpp" line="2153"/> <location filename="../infopanedropdown.cpp" line="2159"/> <source>Mouse Password</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2547"/> <source>A mouse password trades security for convenience on the lock screen by substituting your password with a sequence of mouse buttons. &lt;b&gt;This can only be used on the lock screen, not while logging in.&lt;/b&gt;</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2641"/> <source>Large Text</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2648"/> <source>High Contrast</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2655"/> <source>System Animations</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2675"/> <source>LargeTextSwitch</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2685"/> <source>Tone on Caps Lock and Num Lock</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2692"/> <source>HighContrastSwitch</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2702"/> <source>SystemAnimationsAccessibilitySwitch</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2715"/> <source>CapsNumLockBellSwitch</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2784"/> <source>There were errors loading the following items:</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2881"/> <source>Window Manager Command</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2894"/> <source>Reset Device</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2905"/> <location filename="../infopanedropdown.cpp" line="951"/> <source>Reset theShell</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2916"/> <source>The items under here can do some bad things. Make sure you know what you&apos;re doing.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="2986"/> <source>System Information</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3036"/> <source>Support</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3053"/> <source>You&apos;re using</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3086"/> <source>DISTRIBUTION</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3125"/> <source>Available Memory</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3139"/> <source>Processor</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3146"/> <source>Available Swap</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3173"/> <source>Qt Version</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3193"/> <source>HARDWARE AND SOFTWARE</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3207"/> <source>Kernel Version</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3267"/> <source>Desktop Environment</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3286"/> <source>Website</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3297"/> <source>File Bug</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.ui" line="3308"/> <source>Sources</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="155"/> <source>Copyright © Victor Tran %1. Licensed under the terms of the GNU General Public License, version 3 or later.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="439"/> <source>Unknown</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="446"/> <source>theShell %1 - Blueprint</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="447"/> <source>You compiled theShell on %1</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="449"/> <source>theShell %1</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="503"/> <location filename="../infopanedropdown.cpp" line="2058"/> <source>Keyboard Layout</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="503"/> <source>Keyboard Layout set to %1</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="510"/> <source>Critical Only</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="514"/> <source>No Notifications</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="518"/> <source>Mute</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="522"/> <source>Sound</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="699"/> <source>No plugins were loaded because you&apos;ve started theShell in Safe Mode.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="704"/> <source>Safe Mode</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="952"/> <source>All settings will be reset to default, and you will be logged out. Are you sure you want to do this?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1534"/> <source>Oxygen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1535"/> <source>Breeze</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1538"/> <source>Blue</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1539"/> <source>Green</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1540"/> <source>Orange</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1541"/> <source>Pink</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1542"/> <source>Turquoise</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1716"/> <location filename="../infopanedropdown.cpp" line="1726"/> <location filename="../infopanedropdown.cpp" line="1736"/> <location filename="../infopanedropdown.cpp" line="1746"/> <source>Never</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> <location filename="../infopanedropdown.cpp" line="1718"/> <location filename="../infopanedropdown.cpp" line="1728"/> <location filename="../infopanedropdown.cpp" line="1738"/> <location filename="../infopanedropdown.cpp" line="1748"/> <source>%n min(s)</source> <translation type="unfinished"> <numerusform></numerusform> <numerusform></numerusform> </translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1947"/> <source>Logoff Required</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1950"/> <source>In order to enable the Compact Bar, you&apos;ll need to log out and then log back on.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="1952"/> <source>In order to disable the Compact Bar, you&apos;ll need to log out and then log back on.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="2071"/> <source>Show Touch Keyboard</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="2109"/> <location filename="../infopanedropdown.cpp" line="2129"/> <source>Unauthorized</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="2109"/> <location filename="../infopanedropdown.cpp" line="2129"/> <source>Polkit does not allow you to set up a mouse password.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="2124"/> <source>Remove Mouse Password?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="2124"/> <source>Do you want to remove the Mouse Password for this account?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="2154"/> <source>Mouse Password was removed successfully</source> <translation type="unfinished"></translation> </message> <message> <location filename="../infopanedropdown.cpp" line="2160"/> <source>Mouse Password couldn&apos;t be removed</source> <translation type="unfinished"></translation> </message> </context> <context> <name>LocationRequestDialog</name> <message> <location filename="../location/locationrequestdialog.ui" line="69"/> <source>Location</source> <translation type="unfinished"></translation> </message> <message> <location filename="../location/locationrequestdialog.ui" line="111"/> <source>Deny</source> <translation type="unfinished"></translation> </message> <message> <location filename="../location/locationrequestdialog.ui" line="122"/> <source>Allow</source> <translation type="unfinished"></translation> </message> <message> <location filename="../location/locationrequestdialog.ui" line="135"/> <source>Location access can be revoked at any time under Location in System Settings.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../location/locationrequestdialog.cpp" line="47"/> <source>Allow &lt;b&gt;%1&lt;/b&gt; to use your physical location?</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MainWindow</name> <message> <location filename="../mainwindow.ui" line="123"/> <location filename="../mainwindow.ui" line="829"/> <source>Open the Gateway to your PC</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="152"/> <location filename="../mainwindow.cpp" line="1171"/> <source>Open Status Center</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="316"/> <source>Screen Brightness</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="446"/> <source>Stop Screen Recording</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="518"/> <location filename="../mainwindow.cpp" line="336"/> <source>Quiet Mode</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="631"/> <source>Select Media Player</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="653"/> <source>Previous</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="676"/> <source>Pause</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="699"/> <source>Next</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="732"/> <source>Keyboard Layout</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="793"/> <source>Your location is currently being used</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="879"/> <source>Previous Desktop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="903"/> <source>Next Desktop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="1078"/> <source>Click to show bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="1143"/> <source>Sound</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="1152"/> <source>No Notifications</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="1161"/> <source>Mute</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.ui" line="1170"/> <source>Critical Only</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="92"/> <source>Media Player</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="378"/> <source>Recording Screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="384"/> <source>Processing Screen Recording...</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="1152"/> <source>For Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="1154"/> <source>Move to bottom</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="1159"/> <source>Move to top</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="1165"/> <source>Gateway and Bar Settings</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="1170"/> <source>For System</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="1174"/> <source>Open System Settings</source> <translation type="unfinished"></translation> </message> <message> <location filename="../mainwindow.cpp" line="1183"/> <source>Open Gateway</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Menu</name> <message> <location filename="../menu.ui" line="96"/> <source>Install theShell OS</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="149"/> <source>Open theShell OS Installer</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="160"/> <source>Give theShell OS a permanant place on your PC. Install theOS on your hard drive, either replacing another operating system or next to another operating system.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="198"/> <source>Gateway</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="250"/> <source>Start typing to search, run a command, or open a web address</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="307"/> <source>File Bug</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="324"/> <source>Help</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="341"/> <location filename="../menu.ui" line="417"/> <location filename="../menu.ui" line="774"/> <source>End Session</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="448"/> <source>You&apos;re about to power off your PC. Are you sure?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="479"/> <source>Exit theShell</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="492"/> <source>Exits theShell, leaving everything else open</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="499"/> <source>Fake Exit</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="516"/> <source>Power Off</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="529"/> <source>Turns off your computer</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="540"/> <source>Reboot</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="553"/> <source>Turns off your computer and turns it back on again</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="560"/> <source>Log Out</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="573"/> <source>Ends your session and keeps the computer on for other people to use</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="583"/> <source>Suspend</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="596"/> <source>Puts your computer in a low power state so that it opens up quickly</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="606"/> <source>Lock</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="619"/> <source>Locks your workspace with your password</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="626"/> <source>Turn Off Screen</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="639"/> <source>Turns off the screen, but keeps everything else running in the background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="655"/> <location filename="../menu.ui" line="927"/> <source>Switch Users</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="668"/> <source>Switches to the logon screen and keeps your session in the background</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="678"/> <source>Hibernate</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="694"/> <source>Powers off your computer, but when powered back on, restores the session.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="799"/> <source>Before you end your session, here are some things you might want to know</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="952"/> <source>Who are you switching to?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="993"/> <source>Start a new session</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="1061"/> <source>Failed to start app</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.ui" line="1096"/> <source>Try starting the app again, and if problems persist, try reinstalling the app.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="81"/> <location filename="../menu.cpp" line="83"/> <source>Hey, %1!</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="314"/> <source>Power Off Anyway</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="326"/> <source>Reboot Anyway</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="338"/> <source>Log Out Anyway</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="579"/> <source>%1 on X11 display %2</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="581"/> <source>on %1</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="583"/> <source>%1 on VT #%2</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="585"/> <source>Session</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="697"/> <source>Save Debug Introspection File</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="704"/> <source>theShell</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="704"/> <source>Debug Introspection Data collected</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="704"/> <source>Debug data has been collected and saved to %1.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="717"/> <source>%1 can&apos;t start.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="724"/> <source>Actions for &quot;%1&quot;</source> <translation type="unfinished"></translation> </message> <message> <location filename="../menu.cpp" line="762"/> <source>For &quot;%1&quot;</source> <translation type="unfinished"></translation> </message> </context> <context> <name>MousePassword</name> <message> <location filename="../locktypes/mousepassword.ui" line="14"/> <source>Form</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.ui" line="70"/> <source>Set up Mouse Password</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.ui" line="112"/> <source>A Mouse Password trades security for convenience when unlocking your computer from the lock screen.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.ui" line="149"/> <location filename="../locktypes/mousepassword.cpp" line="148"/> <source>Go for it!</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.ui" line="193"/> <source>Reset</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.ui" line="203"/> <location filename="../locktypes/mousepassword.cpp" line="248"/> <source>Next</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="196"/> <source>Your Mouse Password needs to contain at least 5 events.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="208"/> <source>Unfortunately that wasn&apos;t correct. Please try again.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="214"/> <source>Set Mouse Password</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="222"/> <source>Unauthorized</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="222"/> <source>Polkit does not allow you to set up a mouse password.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="240"/> <location filename="../locktypes/mousepassword.cpp" line="254"/> <source>Mouse Password</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="240"/> <source>Mouse Password couldn&apos;t be saved.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.cpp" line="255"/> <source>Mouse Password was set successfully</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.h" line="74"/> <source>To get started, use the mouse to input a sequence of button events now.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.h" line="75"/> <source>Now, confirm the Mouse Password you chose by entering it again.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../locktypes/mousepassword.h" line="76"/> <source>Your Mouse Password is ready to be saved.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>NewMedia</name> <message> <location filename="../newmedia.ui" line="25"/> <source>New Media Inserted</source> <translation type="unfinished"></translation> </message> <message> <location filename="../newmedia.ui" line="32"/> <source>What would you like to do?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../newmedia.ui" line="54"/> <source>Open In theFile</source> <translation type="unfinished"></translation> </message> <message> <location filename="../newmedia.ui" line="74"/> <location filename="../newmedia.ui" line="144"/> <source>Do Nothing</source> <translation type="unfinished"></translation> </message> <message> <location filename="../newmedia.ui" line="124"/> <source>Alternatively, remove the media now. (It&apos;s already ejected!)</source> <translation type="unfinished"></translation> </message> </context> <context> <name>Onboarding</name> <message> <location filename="../onboarding.ui" line="87"/> <source>Select Language</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="310"/> <source>What&apos;s New?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="374"/> <source>Compact Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="414"/> <source>The Compact Bar is a smaller version of the traditional bar which arranges all the elements in one row to save vertical space.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="472"/> <source>Use the Compact Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="479"/> <source>Don&apos;t use the Compact Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="535"/> <source>Status Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="575"/> <source>The Status Bar is a smaller version of the bar that is always visible and shows system status icons.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="624"/> <source>The Status Bar will appear once the bar moves far enough out of the way.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="656"/> <source>Use the Status Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="663"/> <source>Don&apos;t use the Status Bar</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="742"/> <source>Thank you.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="759"/> <source>You&apos;re ready to start using theShell.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="829"/> <source>Cancel Setup</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="860"/> <source>You haven&apos;t finished setting up theShell. What would you like to do?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="902"/> <source>Return to theShell Setup</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="909"/> <source>Log Out</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="923"/> <source>Power Off</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="1045"/> <source>Back</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.ui" line="1056"/> <location filename="../onboarding.cpp" line="197"/> <source>Next</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.cpp" line="142"/> <location filename="../onboarding.cpp" line="309"/> <source>Welcome to theShell %1!</source> <translation type="unfinished"></translation> </message> <message> <location filename="../onboarding.cpp" line="213"/> <source>Start</source> <translation type="unfinished"></translation> </message> </context> <context> <name>RunDialog</name> <message> <location filename="../rundialog.ui" line="50"/> <source>Cancel</source> <translation type="unfinished"></translation> </message> <message> <location filename="../rundialog.ui" line="81"/> <location filename="../rundialog.ui" line="97"/> <source>Run</source> <translation type="unfinished"></translation> </message> <message> <location filename="../rundialog.ui" line="132"/> <source>Enter a command to run</source> <translation type="unfinished"></translation> </message> <message> <location filename="../rundialog.ui" line="150"/> <source>Enter Command</source> <translation type="unfinished"></translation> </message> <message> <location filename="../rundialog.cpp" line="62"/> <source>Couldn&apos;t run that command.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../rundialog.cpp" line="149"/> <source>Can&apos;t find that command</source> <translation type="unfinished"></translation> </message> </context> <context> <name>ScreenRecorder</name> <message> <location filename="../screenrecorder.cpp" line="49"/> <location filename="../screenrecorder.cpp" line="74"/> <location filename="../screenrecorder.cpp" line="109"/> <location filename="../screenrecorder.cpp" line="121"/> <source>Screen Recorder</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenrecorder.cpp" line="49"/> <source>To record your screen, you&apos;ll need to install ffmpeg</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenrecorder.cpp" line="74"/> <source>Couldn&apos;t start screen recording</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenrecorder.cpp" line="109"/> <source>Screen Recording saved in Recordings folder</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenrecorder.cpp" line="121"/> <source>Screen Recording failed</source> <translation type="unfinished"></translation> </message> </context> <context> <name>SysTrayIcons</name> <message> <location filename="../systrayicons.cpp" line="43"/> <location filename="../systrayicons.cpp" line="50"/> <location filename="../systrayicons.cpp" line="67"/> <source>System Tray Unavailable.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TaskbarButton</name> <message> <location filename="../taskbarbutton.cpp" line="169"/> <source>For %1</source> <translation type="unfinished"></translation> </message> <message> <location filename="../taskbarbutton.cpp" line="170"/> <source>Close</source> <translation type="unfinished"></translation> </message> </context> <context> <name>TutorialWindow</name> <message> <location filename="../tutorialwindow.ui" line="82"/> <source>Ready to begin?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="89"/> <source>The gateway is the portal to everything on your PC. To open it, click the theShell icon, or hit the Super key.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="146"/> <source>Where&apos;d the bar go!?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="153"/> <source>The bar moves off the screen to make way for other windows. Move your mouse to the top of the screen to get to the bar.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="207"/> <source>Do stuff super speedy!</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="214"/> <source>Just open the gateway and type what you want. You don&apos;t even need to click on the search box!</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="224"/> <source>- Open apps by typing in the name of the app - Get information about playing media by typing in &quot;current song&quot; (or something like that) - Open websites by typing in the address</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="299"/> <source>Missed a notification?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="306"/> <source>Check what you missed on the bar. Click &quot;1 Notification&quot; on the bar.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../tutorialwindow.ui" line="318"/> <source>OK</source> <translation type="unfinished"></translation> </message> </context> <context> <name>main</name> <message> <location filename="../main.cpp" line="220"/> <source>Start in Safe Mode?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../main.cpp" line="221"/> <source>You&apos;re holding the CTRL key. Do you want to start theShell in Safe Mode?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../main.cpp" line="245"/> <source>theShell already running</source> <translation type="unfinished"></translation> </message> <message> <location filename="../main.cpp" line="246"/> <source>theShell seems to already be running. Do you wish to start theShell anyway?</source> <translation type="unfinished"></translation> </message> <message> <location filename="../main.cpp" line="287"/> <source>Window Manager couldn&apos;t start</source> <translation type="unfinished"></translation> </message> <message> <location filename="../main.cpp" line="288"/> <source>The window manager &quot;%1&quot; could not start. Enter the name or path of a window manager to attempt to start a different windowmanager, or hit &apos;Cancel&apos; to start theShell without a window manager.</source> <translation type="unfinished"></translation> </message> </context> <context> <name>screenshotWindow</name> <message> <location filename="../screenshotwindow.ui" line="46"/> <location filename="../screenshotwindow.cpp" line="392"/> <source>Select a region using the mouse.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.ui" line="80"/> <source>Crop</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.ui" line="106"/> <source>Redact</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.ui" line="129"/> <source>Highlight</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.ui" line="162"/> <source>Discard</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.ui" line="179"/> <source>Copy</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.ui" line="196"/> <source>Save</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.ui" line="223"/> <source>Reset Modificiations</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.cpp" line="398"/> <source>Redact a region using the mouse.</source> <translation type="unfinished"></translation> </message> <message> <location filename="../screenshotwindow.cpp" line="404"/> <source>Highlight part of the image using the mouse.</source> <translation type="unfinished"></translation> </message> </context> </TS>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2018-2020 "Graph Foundation" * Graph Foundation, Inc. [https://graphfoundation.org] * * Copyright (c) 2002-2020 "Neo4j," * Neo4j Sweden AB [http://neo4j.com] * * This file is part of ONgDB. * * ONgDB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.cypher.internal.compatibility.v3_6.runtime.profiler import org.neo4j.cypher.result.{OperatorProfile, QueryProfile} import org.neo4j.cypher.internal.v3_6.util.attribution.Id import scala.collection.mutable class InterpretedProfileInformation extends QueryProfile { case class OperatorData(override val dbHits: Long, override val rows: Long, override val pageCacheHits: Long, override val pageCacheMisses: Long) extends OperatorProfile { override def time: Long = OperatorProfile.NO_DATA } val pageCacheMap: mutable.Map[Id, PageCacheStats] = mutable.Map.empty val dbHitsMap: mutable.Map[Id, ProfilingPipeQueryContext] = mutable.Map.empty val rowMap: mutable.Map[Id, ProfilingIterator] = mutable.Map.empty def operatorProfile(operatorId: Int): OperatorProfile = { val id = Id(operatorId) val rows = rowMap.get(id).map(_.count).getOrElse(0L) val dbHits = dbHitsMap.get(id).map(_.count).getOrElse(0L) val pageCacheStats = pageCacheMap.getOrElse(id, PageCacheStats(0L, 0L)) OperatorData(dbHits, rows, pageCacheStats.hits, pageCacheStats.misses) } } case class PageCacheStats(hits: Long, misses: Long)
{ "pile_set_name": "Github" }
package net.finmath.equities.models; import java.time.LocalDate; import java.util.ArrayList; import net.finmath.equities.marketdata.VolatilityPoint; /** * This class implements the volatility interfaces for a flat volatility surface. * * @author Andreas Grotz */ public class FlatVolatilitySurface implements VolatilitySurface, ShiftedVolatilitySurface { private final double volatility; private final double volShift; public FlatVolatilitySurface(double volatility) { this(volatility, 0.0); } public FlatVolatilitySurface(double volatility, double volShift) { this.volatility = volatility; this.volShift = volShift; } @Override public ShiftedVolatilitySurface getShiftedSurface(double shift) { assert volShift == 0.0 : "Surface is already shifted"; return new FlatVolatilitySurface(this.volatility, shift); } public double getShift() { return volShift; } @Override public double getVolatility( double strike, LocalDate expiryDate, EquityForwardStructure currentForwardStructure) { return volatility + volShift; } @Override public double getVolatility(double strike, double timeToMaturity, EquityForwardStructure currentForwardStructure) { return volatility + volShift; } @Override public double getLocalVolatility( double strike, LocalDate expiryDate, EquityForwardStructure currentForwardStructure, double strikeShift, double timeShift) { return volatility + volShift; } @Override public double getLocalVolatility( double logStrike, double timeToMaturity, EquityForwardStructure currentForwardStructure, double strikeShift, double timeShift) { return volatility + volShift; } public void calibrate( EquityForwardStructure forwardStructure, ArrayList<VolatilityPoint> volaPoints) { assert false : "A flat surface cannot be calibrated"; } }
{ "pile_set_name": "Github" }
<!-- Worksheet AR-by-row Template All data is available using the worksheet dictionary. Example for accessing and displaying data: <p tal:content="python:worksheet['laboratory']['title']"></p> or <p tal:content="worksheet/laboratory/title"></p> See README.txt for further details about the dict structure --> <tal:print tal:define="worksheet python:view.getWorksheet(); laboratory worksheet/laboratory; portal worksheet/portal; ars worksheet/ars; anstitles worksheet/analyses_titles;"> <div id="header"> <div class='barcode-container'> <div class='barcode' data-code='code128' data-showHRI='false' data-barHeight='15' data-addQuietZone='true' tal:attributes="data-id worksheet/id"> </div> </div> <div class='lab-logo'> <a tal:attributes="href laboratory/url"> <img tal:attributes="src laboratory/logo"/> </a> </div> <h1> <a tal:attributes="href worksheet/url" tal:content="worksheet/id"></a> </h1> </div> <div class="subheader"> <div> <span i18n:translate="">Created on</span>&nbsp; <span tal:content="worksheet/date_created"></span>&nbsp; <span i18n:translate="">by</span>&nbsp; <a tal:attributes="href python:('mailto:%s' % worksheet['createdby']['email'])" tal:content="worksheet/createdby/fullname"></a> </div> <div> <span i18n:translate="">Printed on</span>&nbsp; <span tal:content="worksheet/date_printed"></span>&nbsp; <span i18n:translate="">by</span>&nbsp; <a tal:attributes="href python:('mailto:%s' % worksheet['printedby']['email'])" tal:content="worksheet/printedby/fullname"></a> </div> <div> <span i18n:translate="">Analysed by</span>:&nbsp; <a tal:attributes="href python:('mailto:%s' % worksheet['analyst']['email'])" tal:content="worksheet/analyst/fullname"></a> </div> </div> <!-- Repeat the table every 6 Analyses --> <div class="content" tal:repeat="anst python:view.splitList(anstitles,view.getNumColumns())"> <table> <thead> <tr> <th i18n:translate="">Request ID</th> <th tal:repeat="ans anst" tal:content="ans"></th> </tr> </thead> <tbody> <tr tal:repeat="ar ars"> <td class="requestid"> <div class='barcode' data-code='code128' data-showHRI='false' data-barHeight='15' data-addQuietZone='true' tal:attributes="data-id ar/id"></div> <div class="arinfo"> <a tal:attributes="href ar/client/url" tal:content="ar/client/name"></a><br/> <a tal:attributes="href ar/sample/sample_type/url" tal:content="ar/sample/sample_type/title" tal:condition="ar/sample/sample_type"></a><br/> <span tal:content="ar/date_received"></span> </div> </td> <tal:results repeat="ans anst"> <td tal:attributes="class python:'result' if ans in [an['title'] for an in ar['analyses']] else 'result no-result';"><div>&nbsp;</div></td> </tal:results> </tr> </tbody> </table> </div> </tal:print>
{ "pile_set_name": "Github" }
//**********************************************************************` //* This is an include file generated by EtwPlusTool. *` //* *` //* Copyright (c) Microsoft Corporation. All Rights Reserved. *` //**********************************************************************` #pragma once #pragma pack(push, 16) #include "EtwPlus.h" #if defined(__cplusplus) extern "C" { #endif // Field Descriptors, used in the ETX_EVENT_DESCRIPTOR array below // EXTERN_C __declspec(selectany) ETX_FIELD_DESCRIPTOR ATGSampleTelemetry_SampleLoaded_Fields[2] = {{EtxFieldType_UnicodeString,0},{EtxFieldType_UnicodeString,0}}; // Event name mapping // #define SampleLoaded_value 1 // Event Descriptor array // EXTERN_C __declspec(selectany) ETX_EVENT_DESCRIPTOR ATGSampleTelemetryEvents[1] = { {{ 1, 1, 0, 0, 0, 0, 0x0 }, "SampleLoaded", "0.7.0.1", ATGSampleTelemetry_SampleLoaded_Fields, 2, 0, EtxEventEnabledState_Undefined, EtxEventEnabledState_ProviderDefault, EtxPopulationSample_Undefined, 100, EtxEventLatency_Undefined, EtxEventLatency_ProviderDefault, EtxEventPriority_Undefined, EtxEventPriority_ProviderDefault }}; // Provider Descriptor for ATGSampleTelemetry // EXTERN_C __declspec(selectany) ETX_PROVIDER_DESCRIPTOR ATGSampleTelemetryProvider = {"ATGSampleTelemetry", {0x1d9d44d6,0x4b94,0x4b72,{0xa8,0xa4,0xda,0x77,0xe0,0x50,0x9e,0xbb}}, 1, (ETX_EVENT_DESCRIPTOR*)&ATGSampleTelemetryEvents, 0, EtxProviderEnabledState_Undefined, EtxProviderEnabledState_OnByDefault, 0, 100, EtxProviderLatency_Undefined, EtxProviderLatency_Normal, EtxProviderPriority_Undefined, EtxProviderPriority_Normal}; // ETW handle for ATGSampleTelemetry // EXTERN_C __declspec(selectany) REGHANDLE ATGSampleTelemetryHandle = (REGHANDLE)0; /*++ Routine Description: Register the provider with ETW+. Arguments: None Remarks: ERROR_SUCCESS if success or if the provider was already registered. Otherwise, an error code. --*/ #define EventRegisterATGSampleTelemetry() EtxRegister(&ATGSampleTelemetryProvider, &ATGSampleTelemetryHandle) /*++ Routine Description: Unregister the provider from ETW+. Arguments: None Remarks: ERROR_SUCCESS if success or if the provider was not registered. Otherwise, an error code. --*/ #define EventUnregisterATGSampleTelemetry() EtxUnregister(&ATGSampleTelemetryProvider, &ATGSampleTelemetryHandle) #define EventEnabledSampleLoaded() (TRUE) // Entry point to log the event SampleLoaded // __inline ULONG EventWriteSampleLoaded(__in_opt PCWSTR ExeName) { #define ARGUMENT_COUNT_ATGSampleTelemetry_SampleLoaded 2 EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_ATGSampleTelemetry_SampleLoaded]; UINT8 scratch[64]; EtxFillCommonFields_v7(&EventData[0], scratch, 64); EventDataDescCreate(&EventData[1], (ExeName != NULL) ? ExeName : L"", (ExeName != NULL) ? (ULONG)((wcslen(ExeName) + 1) * sizeof(WCHAR)) : (ULONG)sizeof(L"")); return EtxEventWrite(&ATGSampleTelemetryEvents[0], &ATGSampleTelemetryProvider, ATGSampleTelemetryHandle, ARGUMENT_COUNT_ATGSampleTelemetry_SampleLoaded, EventData); } #if defined(__cplusplus) }; #endif #pragma pack(pop)
{ "pile_set_name": "Github" }
package images import ( "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/pagination" ) // GetResult is the response from a Get operation. Call its Extract method to // interpret it as an Image. type GetResult struct { gophercloud.Result } // DeleteResult is the result from a Delete operation. Call its ExtractErr // method to determine if the call succeeded or failed. type DeleteResult struct { gophercloud.ErrResult } // Extract interprets a GetResult as an Image. func (r GetResult) Extract() (*Image, error) { var s struct { Image *Image `json:"image"` } err := r.ExtractInto(&s) return s.Image, err } // Image represents an Image returned by the Compute API. type Image struct { // ID is the unique ID of an image. ID string // Created is the date when the image was created. Created string // MinDisk is the minimum amount of disk a flavor must have to be able // to create a server based on the image, measured in GB. MinDisk int // MinRAM is the minimum amount of RAM a flavor must have to be able // to create a server based on the image, measured in MB. MinRAM int // Name provides a human-readable moniker for the OS image. Name string // The Progress and Status fields indicate image-creation status. Progress int // Status is the current status of the image. Status string // Update is the date when the image was updated. Updated string // Metadata provides free-form key/value pairs that further describe the // image. Metadata map[string]interface{} } // ImagePage contains a single page of all Images returne from a ListDetail // operation. Use ExtractImages to convert it into a slice of usable structs. type ImagePage struct { pagination.LinkedPageBase } // IsEmpty returns true if an ImagePage contains no Image results. func (page ImagePage) IsEmpty() (bool, error) { images, err := ExtractImages(page) return len(images) == 0, err } // NextPageURL uses the response's embedded link reference to navigate to the // next page of results. func (page ImagePage) NextPageURL() (string, error) { var s struct { Links []gophercloud.Link `json:"images_links"` } err := page.ExtractInto(&s) if err != nil { return "", err } return gophercloud.ExtractNextURL(s.Links) } // ExtractImages converts a page of List results into a slice of usable Image // structs. func ExtractImages(r pagination.Page) ([]Image, error) { var s struct { Images []Image `json:"images"` } err := (r.(ImagePage)).ExtractInto(&s) return s.Images, err }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT) * All rights reserved. * * This software may be modified and distributed under the terms of the * BSD-3-Clause license. See the accompanying LICENSE file for details. */ // This is an automatically generated file. // Generated from the following "std_msgs/Byte" msg definition: // byte data // Instances of this class can be read and written with YARP ports, // using a ROS-compatible format. #ifndef YARP_ROSMSG_std_msgs_Byte_h #define YARP_ROSMSG_std_msgs_Byte_h #include <yarp/os/Wire.h> #include <yarp/os/Type.h> #include <yarp/os/idl/WireTypes.h> #include <string> #include <vector> namespace yarp { namespace rosmsg { namespace std_msgs { class Byte : public yarp::os::idl::WirePortable { public: std::uint8_t data; Byte() : data(0) { } void clear() { // *** data *** data = 0; } bool readBare(yarp::os::ConnectionReader& connection) override { // *** data *** data = connection.expectInt8(); return !connection.isError(); } bool readBottle(yarp::os::ConnectionReader& connection) override { connection.convertTextMode(); yarp::os::idl::WireReader reader(connection); if (!reader.readListHeader(1)) { return false; } // *** data *** data = reader.expectInt8(); return !connection.isError(); } using yarp::os::idl::WirePortable::read; bool read(yarp::os::ConnectionReader& connection) override { return (connection.isBareMode() ? readBare(connection) : readBottle(connection)); } bool writeBare(yarp::os::ConnectionWriter& connection) const override { // *** data *** connection.appendInt8(data); return !connection.isError(); } bool writeBottle(yarp::os::ConnectionWriter& connection) const override { connection.appendInt32(BOTTLE_TAG_LIST); connection.appendInt32(1); // *** data *** connection.appendInt32(BOTTLE_TAG_INT8); connection.appendInt8(data); connection.convertTextMode(); return !connection.isError(); } using yarp::os::idl::WirePortable::write; bool write(yarp::os::ConnectionWriter& connection) const override { return (connection.isBareMode() ? writeBare(connection) : writeBottle(connection)); } // This class will serialize ROS style or YARP style depending on protocol. // If you need to force a serialization style, use one of these classes: typedef yarp::os::idl::BareStyle<yarp::rosmsg::std_msgs::Byte> rosStyle; typedef yarp::os::idl::BottleStyle<yarp::rosmsg::std_msgs::Byte> bottleStyle; // The name for this message, ROS will need this static constexpr const char* typeName = "std_msgs/Byte"; // The checksum for this message, ROS will need this static constexpr const char* typeChecksum = "ad736a2e8818154c487bb80fe42ce43b"; // The source text for this message, ROS will need this static constexpr const char* typeText = "\ byte data\n\ "; yarp::os::Type getType() const override { yarp::os::Type typ = yarp::os::Type::byName(typeName, typeName); typ.addProperty("md5sum", yarp::os::Value(typeChecksum)); typ.addProperty("message_definition", yarp::os::Value(typeText)); return typ; } }; } // namespace std_msgs } // namespace rosmsg } // namespace yarp #endif // YARP_ROSMSG_std_msgs_Byte_h
{ "pile_set_name": "Github" }
/* Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package validation import ( "fmt" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/validation" "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/kubernetes/pkg/apis/core" ) const ( ReportingInstanceLengthLimit = 128 ActionLengthLimit = 128 ReasonLengthLimit = 128 NoteLengthLimit = 1024 ) // ValidateEvent makes sure that the event makes sense. func ValidateEvent(event *core.Event) field.ErrorList { allErrs := field.ErrorList{} // Because go zeroTime := time.Time{} // "New" Events need to have EventTime set, so it's validating old object. if event.EventTime.Time == zeroTime { // Make sure event.Namespace and the involvedInvolvedObject.Namespace agree if len(event.InvolvedObject.Namespace) == 0 { // event.Namespace must also be empty (or "default", for compatibility with old clients) if event.Namespace != metav1.NamespaceNone && event.Namespace != metav1.NamespaceDefault { allErrs = append(allErrs, field.Invalid(field.NewPath("involvedObject", "namespace"), event.InvolvedObject.Namespace, "does not match event.namespace")) } } else { // event namespace must match if event.Namespace != event.InvolvedObject.Namespace { allErrs = append(allErrs, field.Invalid(field.NewPath("involvedObject", "namespace"), event.InvolvedObject.Namespace, "does not match event.namespace")) } } } else { if len(event.InvolvedObject.Namespace) == 0 && event.Namespace != metav1.NamespaceSystem { allErrs = append(allErrs, field.Invalid(field.NewPath("involvedObject", "namespace"), event.InvolvedObject.Namespace, "does not match event.namespace")) } if len(event.ReportingController) == 0 { allErrs = append(allErrs, field.Required(field.NewPath("reportingController"), "")) } for _, msg := range validation.IsQualifiedName(event.ReportingController) { allErrs = append(allErrs, field.Invalid(field.NewPath("reportingController"), event.ReportingController, msg)) } if len(event.ReportingInstance) == 0 { allErrs = append(allErrs, field.Required(field.NewPath("reportingInstance"), "")) } if len(event.ReportingInstance) > ReportingInstanceLengthLimit { allErrs = append(allErrs, field.Invalid(field.NewPath("repotingIntance"), "", fmt.Sprintf("can have at most %v characters", ReportingInstanceLengthLimit))) } if len(event.Action) == 0 { allErrs = append(allErrs, field.Required(field.NewPath("action"), "")) } if len(event.Action) > ActionLengthLimit { allErrs = append(allErrs, field.Invalid(field.NewPath("action"), "", fmt.Sprintf("can have at most %v characters", ActionLengthLimit))) } if len(event.Reason) == 0 { allErrs = append(allErrs, field.Required(field.NewPath("reason"), "")) } if len(event.Reason) > ReasonLengthLimit { allErrs = append(allErrs, field.Invalid(field.NewPath("reason"), "", fmt.Sprintf("can have at most %v characters", ReasonLengthLimit))) } if len(event.Message) > NoteLengthLimit { allErrs = append(allErrs, field.Invalid(field.NewPath("message"), "", fmt.Sprintf("can have at most %v characters", NoteLengthLimit))) } } for _, msg := range validation.IsDNS1123Subdomain(event.Namespace) { allErrs = append(allErrs, field.Invalid(field.NewPath("namespace"), event.Namespace, msg)) } return allErrs }
{ "pile_set_name": "Github" }
(class { ; ; ; ; });
{ "pile_set_name": "Github" }
package net.osmand.aidlapi.contextmenu; parcelable UpdateContextMenuButtonsParams;
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Jetson Inference: jetson-utils/cudaBayer.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Jetson Inference </div> <div id="projectbrief">DNN Vision Library</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('cudaBayer_8h_source.html','');}); </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="headertitle"> <div class="title">cudaBayer.h</div> </div> </div><!--header--> <div class="contents"> <a href="cudaBayer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> * copy of this software and associated documentation files (the &quot;Software&quot;),</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> * to deal in the Software without restriction, including without limitation</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"> * Software is furnished to do so, subject to the following conditions:</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> * The above copyright notice and this permission notice shall be included in</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> * all copies or substantial portions of the Software.</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="comment"> * DEALINGS IN THE SOFTWARE.</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#ifndef __CUDA_BAYER_H__</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#define __CUDA_BAYER_H__</span></div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="cudaUtility_8h.html">cudaUtility.h</a>&quot;</span></div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="imageFormat_8h.html">imageFormat.h</a>&quot;</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;cudaError_t <a class="code" href="cudaBayer_8h.html#a6cf20486164158f6c9cb95a069151658">cudaBayerToRGB</a>( uint8_t* input, uchar3* output, <span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height, <a class="code" href="group__imageFormat.html#ga931c48e08f361637d093355d64583406">imageFormat</a> format );</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;cudaError_t <a class="code" href="cudaBayer_8h.html#afa2c41e38d1f04c70284142c9a69eeb2">cudaBayerToRGBA</a>( uint8_t* input, uchar3* output, <span class="keywordtype">size_t</span> width, <span class="keywordtype">size_t</span> height, <a class="code" href="group__imageFormat.html#ga931c48e08f361637d093355d64583406">imageFormat</a> format );</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;</div><div class="ttc" id="cudaBayer_8h_html_afa2c41e38d1f04c70284142c9a69eeb2"><div class="ttname"><a href="cudaBayer_8h.html#afa2c41e38d1f04c70284142c9a69eeb2">cudaBayerToRGBA</a></div><div class="ttdeci">cudaError_t cudaBayerToRGBA(uint8_t *input, uchar3 *output, size_t width, size_t height, imageFormat format)</div><div class="ttdoc">Demosaick an 8-bit Bayer image to uchar4 RGBA. </div></div> <div class="ttc" id="cudaBayer_8h_html_a6cf20486164158f6c9cb95a069151658"><div class="ttname"><a href="cudaBayer_8h.html#a6cf20486164158f6c9cb95a069151658">cudaBayerToRGB</a></div><div class="ttdeci">cudaError_t cudaBayerToRGB(uint8_t *input, uchar3 *output, size_t width, size_t height, imageFormat format)</div><div class="ttdoc">Demosaick an 8-bit Bayer image to uchar3 RGB. </div></div> <div class="ttc" id="imageFormat_8h_html"><div class="ttname"><a href="imageFormat_8h.html">imageFormat.h</a></div></div> <div class="ttc" id="group__imageFormat_html_ga931c48e08f361637d093355d64583406"><div class="ttname"><a href="group__imageFormat.html#ga931c48e08f361637d093355d64583406">imageFormat</a></div><div class="ttdeci">imageFormat</div><div class="ttdoc">The imageFormat enum is used to identify the pixel format and colorspace of an image. </div><div class="ttdef"><b>Definition:</b> imageFormat.h:49</div></div> <div class="ttc" id="cudaUtility_8h_html"><div class="ttname"><a href="cudaUtility_8h.html">cudaUtility.h</a></div></div> </div><!-- fragment --></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="dir_54a0acf6da04fe2ed9410b4c6369bc5d.html">jetson-utils</a></li><li class="navelem"><a class="el" href="cudaBayer_8h.html">cudaBayer.h</a></li> <li class="footer">Generated on Tue Jul 14 2020 21:59:33 for Jetson Inference by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> </ul> </div> </body> </html>
{ "pile_set_name": "Github" }
fails(not implemented, jruby/jruby#6149):TracePoint#eval_script is the evald source code
{ "pile_set_name": "Github" }
# -*- coding: utf-8 -*- import pandas as pd # ==========导入上证指数的原始数据 # 注意:这里请填写数据文件在您电脑中的路径,并注意路径中斜杠的方向 index_data = pd.read_csv('index data/sh600000.csv', parse_dates=['date']) # 保留这几个需要的字段:'date', 'high', 'low', 'close', 'change' index_data = index_data[['date', 'high', 'low', 'close', 'change']] # 对数据按照【date】交易日期从小到大排序 index_data.sort('date', inplace=True) # ==========计算海龟交易法则的买卖点 # 设定海龟交易法则的两个参数,当收盘价大于最近N1天的最高价时买入,当收盘价低于最近N2天的最低价时卖出 # 这两个参数可以自行调整大小,但是一般N1 > N2 N1 = 20 N2 = 10 # 通过rolling_max方法计算最近N1个交易日的最高价 index_data['最近N1个交易日的最高点'] = pd.rolling_max(index_data['high'], N1) # 对于上市不足N1天的数据,取上市至今的最高价 index_data['最近N1个交易日的最高点'].fillna(value=pd.expanding_max(index_data['high']), inplace=True) # 通过相似的方法计算最近N2个交易日的最低价 index_data['最近N2个交易日的最低点'] = pd.rolling_min(index_data['low'], N1) index_data['最近N2个交易日的最低点'].fillna(value=pd.expanding_min(index_data['low']), inplace=True) # 当当天的【close】> 昨天的【最近N1个交易日的最高点】时,将【收盘发出的信号】设定为1 buy_index = index_data[index_data['close'] > index_data['最近N1个交易日的最高点'].shift(1)].index index_data.loc[buy_index, '收盘发出的信号'] = 1 # 当当天的【close】< 昨天的【最近N2个交易日的最低点】时,将【收盘发出的信号】设定为0 sell_index = index_data[index_data['close'] < index_data['最近N2个交易日的最低点'].shift(1)].index index_data.loc[sell_index, '收盘发出的信号'] = 0 # 计算每天的仓位,当天持有上证指数时,仓位为1,当天不持有上证指数时,仓位为0 index_data['当天的仓位'] = index_data['收盘发出的信号'].shift(1) index_data['当天的仓位'].fillna(method='ffill', inplace=True) # 取1992年之后的数据,排出较早的数据 index_data = index_data[index_data['date'] >= pd.to_datetime('19930101')] # 当仓位为1时,买入上证指数,当仓位为0时,空仓。计算从19920101至今的资金指数 index_data['资金指数'] = (index_data['change'] * index_data['当天的仓位'] + 1.0).cumprod() initial_idx = index_data.iloc[0]['close'] / (1 + index_data.iloc[0]['change']) index_data['资金指数'] *= initial_idx # 输出数据到指定文件 index_data[['date', 'high', 'low', 'close', 'change', '最近N1个交易日的最高点', '最近N2个交易日的最低点', '当天的仓位', '资金指数']].to_csv('turtle.csv', index=False, encoding='gbk') # ==========计算每年指数的收益以及海龟交易法则的收益 index_data['海龟法则每日涨跌幅'] = index_data['change'] * index_data['当天的仓位'] year_rtn = index_data.set_index('date')[['change', '海龟法则每日涨跌幅']].\ resample('A', how=lambda x: (x+1.0).prod() - 1.0) * 100 print year_rtn
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleDisplayName</key> <string>GoogleSigninSampleApp</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>$(PRODUCT_NAME)</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> <string>1.0</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>1</string> <key>LSRequiresIPhoneOS</key> <true/> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSExceptionDomains</key> <dict> <key>localhost</key> <dict> <key>NSExceptionAllowsInsecureHTTPLoads</key> <true/> </dict> </dict> </dict> <key>NSLocationWhenInUseUsageDescription</key> <string></string> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UIRequiredDeviceCapabilities</key> <array> <string>armv7</string> </array> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UIViewControllerBasedStatusBarAppearance</key> <false/> </dict> </plist>
{ "pile_set_name": "Github" }
// Copyright 2015 Eivind Vegsundvåg // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package ninja.eivind.hotsreplayuploader.utils; import ninja.eivind.hotsreplayuploader.models.ReplayFile; import java.io.File; import java.util.Comparator; /** * {@link Comparator} for comparing two {@link ReplayFile}s.<br> * Will order by newest files first. */ public class ReplayFileComparator implements Comparator<ReplayFile> { @Override public int compare(ReplayFile o1, ReplayFile o2) { if (o1 == o2) { return 0; } final File file1 = o1.getFile(); final File file2 = o2.getFile(); return -Long.compare(file1.lastModified(), file2.lastModified()); } }
{ "pile_set_name": "Github" }
StartChar: Cacute.sq Encoding: 1114197 -1 686 Width: 1024 VWidth: 0 Flags: W HStem: -16 240<494.678 955.608> 1031 21G<885.5 930> 1056 240<493.97 925.892> 1408 21G<512 744.844> VStem: 112 256<369.394 908.636> LayerCount: 5 Back Fore SplineSet 653 1296 m 4 750 1296 844 1286 930 1271 c 5 930 1031 l 5 841 1046 741 1056 652 1056 c 4 543 1056 476 1019 430 948 c 4 383 875 368 767 368 640 c 4 368 513 382 405 430 332 c 4 477 260 543 224 659 224 c 4 755 224 864 235 960 249 c 5 960 9 l 5 869 -5 767 -16 663 -16 c 4 457 -16 319 49 223 186 c 4 138 307 112 461 112 640 c 4 112 819 138 973 223 1094 c 4 318 1230 457 1296 653 1296 c 4 512 1408 m 1 654 1664 l 1 920 1664 l 1 730 1408 l 1 512 1408 l 1 EndSplineSet Validated: 1 Layer: 2 Layer: 3 Layer: 4 EndChar
{ "pile_set_name": "Github" }
/* * Copyright 2016-present Open Networking Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.atomix.core.election; import io.atomix.core.cache.CachedPrimitiveBuilder; import io.atomix.primitive.PrimitiveManagementService; import io.atomix.primitive.protocol.PrimitiveProtocol; import io.atomix.primitive.protocol.ProxyCompatibleBuilder; import io.atomix.primitive.protocol.ProxyProtocol; /** * Builder for constructing new {@link AsyncLeaderElector} instances. */ public abstract class LeaderElectorBuilder<T> extends CachedPrimitiveBuilder<LeaderElectorBuilder<T>, LeaderElectorConfig, LeaderElector<T>> implements ProxyCompatibleBuilder<LeaderElectorBuilder<T>> { protected LeaderElectorBuilder(String name, LeaderElectorConfig config, PrimitiveManagementService managementService) { super(LeaderElectorType.instance(), name, config, managementService); } @Override public LeaderElectorBuilder<T> withProtocol(ProxyProtocol protocol) { return withProtocol((PrimitiveProtocol) protocol); } }
{ "pile_set_name": "Github" }
:root { // Custom variable values only support SassScript inside `#{}`. @each $color, $value in $colors { --#{$color}: #{$value}; } @each $color, $value in $theme-colors { --#{$color}: #{$value}; } @each $bp, $value in $grid-breakpoints { --breakpoint-#{$bp}: #{$value}; } // Use `inspect` for lists so that quoted items keep the quotes. // See https://github.com/sass/sass/issues/2383#issuecomment-336349172 --font-family-sans-serif: #{inspect($font-family-sans-serif)}; --font-family-monospace: #{inspect($font-family-monospace)}; }
{ "pile_set_name": "Github" }
import React from 'react'; import Timer from 'material-ui/svg-icons/image/timer'; import { amber800, red500 } from 'material-ui/styles/colors'; const DueDate = ({ due }) => { const colors = { tomorrow: amber800, today: red500, }; const styles = { tomorrow: { color: amber800, }, today: { color: red500, }, icon: { width: 16, height: 16, }, }; switch (due) { case 'tomorrow': return ( <span className="DueDate"> <span> <Timer style={styles.icon} color={colors.tomorrow} /> <small style={styles.tomorrow}>Tomorrow</small> </span> </span> ); case 'today': return ( <span className="DueDate"> <span> <Timer style={styles.icon} color={colors.today} /> <small style={styles.today}>Today</small> </span> </span> ); default: return ( <span className="DueDate"> <span /> </span> ); } }; export default DueDate;
{ "pile_set_name": "Github" }
/* * Copyright 2008-2017 Katherine Flavel * * See LICENCE for the full copyright terms. */ #include <assert.h> #include <stdlib.h> #include <limits.h> #include <ctype.h> #include <adt/set.h> #include <fsm/fsm.h> #include <fsm/cost.h> #include "../internal.h" static int isother(int c) { (void) c; return 1; } unsigned fsm_cost_legible(fsm_state_t from, fsm_state_t to, char c) { size_t i; /* * Costs here approximate legibility; in particular needing an * escape sequence is seen as worth avoiding where possible. Add * a base cost for the character class, and then the character * value itself as a tiebreaker, so lower character values have * precedence over higher (e.g. 'a' is preferable to 'z'). */ struct { int (*is)(int); unsigned cost; } a[] = { { islower, 1 }, { isupper, 2 }, { isdigit, 3 }, { ispunct, 4 }, { isspace, 5 }, { isprint, 8 }, { isother, 10 } }; /* * The legibility of edges depends only on the FSM transition letter, * regardless of the "from" or "to" states. */ (void) from; (void) to; for (i = 0; i < sizeof a / sizeof *a; i++) { if (a[i].is(c)) { const unsigned char_class_cost = 1000 * a[i].cost; return char_class_cost + (unsigned)c; } } assert(!"unreached"); return FSM_COST_INFINITY; }
{ "pile_set_name": "Github" }
'use strict'; var $export = require('./_export'); var $reduce = require('./_array-reduce'); $export($export.P + $export.F * !require('./_strict-method')([].reduceRight, true), 'Array', { // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) reduceRight: function reduceRight(callbackfn /* , initialValue */) { return $reduce(this, callbackfn, arguments.length, arguments[1], true); } });
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <title>WebSocket Echo Test</title> <script type="text/javascript" src="/Js/echotest.js"> </script> </head> <body> <h2>WebSocket Echo Test</h2> <div id="output"></div> </body> </html>
{ "pile_set_name": "Github" }
package godo import ( "fmt" "github.com/digitalocean/godo/context" ) const floatingBasePath = "v2/floating_ips" // FloatingIPsService is an interface for interfacing with the floating IPs // endpoints of the Digital Ocean API. // See: https://developers.digitalocean.com/documentation/v2#floating-ips type FloatingIPsService interface { List(context.Context, *ListOptions) ([]FloatingIP, *Response, error) Get(context.Context, string) (*FloatingIP, *Response, error) Create(context.Context, *FloatingIPCreateRequest) (*FloatingIP, *Response, error) Delete(context.Context, string) (*Response, error) } // FloatingIPsServiceOp handles communication with the floating IPs related methods of the // DigitalOcean API. type FloatingIPsServiceOp struct { client *Client } var _ FloatingIPsService = &FloatingIPsServiceOp{} // FloatingIP represents a Digital Ocean floating IP. type FloatingIP struct { Region *Region `json:"region"` Droplet *Droplet `json:"droplet"` IP string `json:"ip"` } func (f FloatingIP) String() string { return Stringify(f) } type floatingIPsRoot struct { FloatingIPs []FloatingIP `json:"floating_ips"` Links *Links `json:"links"` } type floatingIPRoot struct { FloatingIP *FloatingIP `json:"floating_ip"` Links *Links `json:"links,omitempty"` } // FloatingIPCreateRequest represents a request to create a floating IP. // If DropletID is not empty, the floating IP will be assigned to the // droplet. type FloatingIPCreateRequest struct { Region string `json:"region"` DropletID int `json:"droplet_id,omitempty"` } // List all floating IPs. func (f *FloatingIPsServiceOp) List(ctx context.Context, opt *ListOptions) ([]FloatingIP, *Response, error) { path := floatingBasePath path, err := addOptions(path, opt) if err != nil { return nil, nil, err } req, err := f.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err } root := new(floatingIPsRoot) resp, err := f.client.Do(ctx, req, root) if err != nil { return nil, resp, err } if l := root.Links; l != nil { resp.Links = l } return root.FloatingIPs, resp, err } // Get an individual floating IP. func (f *FloatingIPsServiceOp) Get(ctx context.Context, ip string) (*FloatingIP, *Response, error) { path := fmt.Sprintf("%s/%s", floatingBasePath, ip) req, err := f.client.NewRequest(ctx, "GET", path, nil) if err != nil { return nil, nil, err } root := new(floatingIPRoot) resp, err := f.client.Do(ctx, req, root) if err != nil { return nil, resp, err } return root.FloatingIP, resp, err } // Create a floating IP. If the DropletID field of the request is not empty, // the floating IP will also be assigned to the droplet. func (f *FloatingIPsServiceOp) Create(ctx context.Context, createRequest *FloatingIPCreateRequest) (*FloatingIP, *Response, error) { path := floatingBasePath req, err := f.client.NewRequest(ctx, "POST", path, createRequest) if err != nil { return nil, nil, err } root := new(floatingIPRoot) resp, err := f.client.Do(ctx, req, root) if err != nil { return nil, resp, err } if l := root.Links; l != nil { resp.Links = l } return root.FloatingIP, resp, err } // Delete a floating IP. func (f *FloatingIPsServiceOp) Delete(ctx context.Context, ip string) (*Response, error) { path := fmt.Sprintf("%s/%s", floatingBasePath, ip) req, err := f.client.NewRequest(ctx, "DELETE", path, nil) if err != nil { return nil, err } resp, err := f.client.Do(ctx, req, nil) return resp, err }
{ "pile_set_name": "Github" }
// Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_NETBASE_H #define BITCOIN_NETBASE_H #if defined(HAVE_CONFIG_H) #include "config/bitcoin-config.h" #endif #include "compat.h" #include "netaddress.h" #include "serialize.h" #include <stdint.h> #include <string> #include <vector> extern int nConnectTimeout; extern bool fNameLookup; //! -timeout default static const int DEFAULT_CONNECT_TIMEOUT = 5000; //! -dns default static const int DEFAULT_NAME_LOOKUP = true; class proxyType { public: proxyType(): randomize_credentials(false) {} proxyType(const CService &_proxy, bool _randomize_credentials=false): proxy(_proxy), randomize_credentials(_randomize_credentials) {} bool IsValid() const { return proxy.IsValid(); } CService proxy; bool randomize_credentials; }; enum Network ParseNetwork(std::string net); std::string GetNetworkName(enum Network net); void SplitHostPort(std::string in, int &portOut, std::string &hostOut); bool SetProxy(enum Network net, const proxyType &addrProxy); bool GetProxy(enum Network net, proxyType &proxyInfoOut); bool IsProxy(const CNetAddr &addr); bool SetNameProxy(const proxyType &addrProxy); bool HaveNameProxy(); bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup); bool LookupHost(const char *pszName, CNetAddr& addr, bool fAllowLookup); bool Lookup(const char *pszName, CService& addr, int portDefault, bool fAllowLookup); bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions); CService LookupNumeric(const char *pszName, int portDefault = 0); bool LookupSubNet(const char *pszName, CSubNet& subnet); bool ConnectSocket(const CService &addr, SOCKET& hSocketRet, int nTimeout, bool *outProxyConnectionFailed = 0); bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault, int nTimeout, bool *outProxyConnectionFailed = 0); /** Return readable error string for a network error code */ std::string NetworkErrorString(int err); /** Close socket and set hSocket to INVALID_SOCKET */ bool CloseSocket(SOCKET& hSocket); /** Disable or enable blocking-mode for a socket */ bool SetSocketNonBlocking(SOCKET& hSocket, bool fNonBlocking); /** * Convert milliseconds to a struct timeval for e.g. select. */ struct timeval MillisToTimeval(int64_t nTimeout); void InterruptSocks5(bool interrupt); #endif // BITCOIN_NETBASE_H
{ "pile_set_name": "Github" }
/* * 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. */ /* * Description : Create primary & secondary indexes & query Metadata dataset to verify. * Expected Res : Success * Date : 15 Sep 2012 */ drop dataverse testdv if exists; create dataverse testdv; create type testdv.testtype as open { id : int32, name : string } create dataset testdv.t1(testtype) primary key id; create index idx1 on testdv.t1(name);
{ "pile_set_name": "Github" }
HTTP/1.0 200 Ok Server: CppCMS-Embedded/1.2.1 Connection: close Content-Type: text/plain; charset=utf-8 X-Powered-By: CppCMS/1.2.1 CONTENT_LENGTH:11 CONTENT_TYPE:application/x-www-form-urlencoded; charset=utf-8 GATEWAY_INTERFACE:CGI/1.0 PATH_INFO: REMOTE_ADDR:127.0.0.1 REMOTE_HOST:127.0.0.1 REQUEST_METHOD:POST SCRIPT_NAME:/test SERVER_NAME:127.0.0.1 SERVER_PORT:8080 SERVER_PROTOCOL:HTTP/1.0 SERVER_SOFTWARE:CppCMS/1.2.1 1=2 foo=bar
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Linq; using System.Workflow.Activities; using Composite.C1Console.Actions; using Composite.Data; using Composite.Data.Types; using Composite.Core.Extensions; using Composite.Core.Types; using Composite.C1Console.Workflow; namespace Composite.Plugins.Elements.ElementProviders.MethodBasedFunctionProviderElementProvider { [EntityTokenLock()] [AllowPersistingWorkflow(WorkflowPersistingType.Idle)] public sealed partial class EditMethodBasedFunctionWorkflow : Composite.C1Console.Workflow.Activities.FormsWorkflow { public EditMethodBasedFunctionWorkflow() { InitializeComponent(); } private void initializeCodeActivity_ExecuteCode(object sender, EventArgs e) { DataEntityToken dataEntityToken = (DataEntityToken)this.EntityToken; this.Bindings.Add("CurrentMethodFunctionInfo", dataEntityToken.Data); this.Bindings.Add("ErrorMessage", null); } private void IsValidData(object sender, ConditionalEventArgs e) { e.Result = false; IMethodBasedFunctionInfo function = this.GetBinding<IMethodBasedFunctionInfo>("CurrentMethodFunctionInfo"); if (function.UserMethodName == String.Empty) { this.ShowFieldMessage("CurrentMethodFunctionInfo.UserMethodName", "${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.MethodNameEmpty}"); return; } if (!function.Namespace.IsCorrectNamespace('.')) { this.ShowFieldMessage("CurrentMethodFunctionInfo.UserMethodName", "${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.InvalidNamespace}"); return; } Type type = TypeManager.TryGetType(function.Type); if (type == null) { this.ShowFieldMessage("CurrentMethodFunctionInfo.Type", "${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.TypeNotFound}"); return; } List<string> methodNames = (from methodInfo in type.GetMethods() select methodInfo.Name).ToList(); if (!methodNames.Contains(function.MethodName)) { this.ShowFieldMessage("CurrentMethodFunctionInfo.MethodName", "${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.MethodNotInType}"); return; } if (methodNames.Count == 0) { this.ShowFieldMessage("CurrentMethodFunctionInfo.Type", "${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.NoValidMethod}"); return; } int destinctCount = methodNames.Distinct().Count(); if (destinctCount != methodNames.Count) { this.ShowFieldMessage("CurrentMethodFunctionInfo.Type", "${Composite.Plugins.MethodBasedFunctionProviderElementProvider, EditFunction.MethodOverloadsNotAllowed}"); return; } e.Result = true; } private void saveCodeActivity_ExecuteCode(object sender, EventArgs e) { UpdateTreeRefresher updateTreeRefresher = this.CreateUpdateTreeRefresher(this.EntityToken); IMethodBasedFunctionInfo methodBasedFunctionInfo = this.GetBinding<IMethodBasedFunctionInfo>("CurrentMethodFunctionInfo"); DataFacade.Update(methodBasedFunctionInfo); SetSaveStatus(true); updateTreeRefresher.PostRefreshMesseges(methodBasedFunctionInfo.GetDataEntityToken()); } } }
{ "pile_set_name": "Github" }
extern "C" { #include <ccv.h> #include <ccv_internal.h> #include <nnc/ccv_nnc.h> #include <nnc/ccv_nnc_easy.h> #include <nnc/ccv_nnc_internal.h> } #include <nnc/gpu/ccv_nnc_compat.h> #if defined(HAVE_CUDA) && defined(HAVE_CUB) #include <cub/util_type.cuh> #include <cub/device/device_radix_sort.cuh> #include <cub/thread/thread_load.cuh> #include <cub/thread/thread_store.cuh> struct float5 { float v[5]; }; __global__ void _ccv_nnc_scatter_rank_kernel(const int n, const float* const a, float* const b, float* const rank) { CUDA_1D_KERNEL_LOOP(i, n) { rank[i] = a[i * 5]; ((int *)b)[i * 5] = i; b[i * 5 + 1] = a[i * 5 + 1]; b[i * 5 + 2] = a[i * 5 + 2]; b[i * 5 + 3] = a[i * 5 + 3]; b[i * 5 + 4] = a[i * 5 + 4]; } } __global__ void _ccv_nnc_merge_rank_kernel(const int n, float* const b, float* const rank, int* const c) { CUDA_1D_KERNEL_LOOP(i, n) { c[i] = ((int*)b)[i * 5]; b[i * 5] = rank[i]; } } template<int threadsPerBlock> __global__ void _ccv_nnc_iou_mask_kernel(const int gm, const int m, const float iou_threshold, const float* const b, uint64_t* const iou_mask) { // Compute only upper-left triangle. int row_start = blockIdx.x / (gm + 1); int col_start = blockIdx.x % (gm + 1); if (col_start > row_start) { col_start = col_start - row_start - 1; row_start = gm - 1 - row_start; } const int row_size = min(m - row_start * threadsPerBlock, threadsPerBlock); const int col_size = min(m - col_start * threadsPerBlock, threadsPerBlock); __shared__ float boxes[threadsPerBlock * 4]; if (threadIdx.x < col_size) { boxes[threadIdx.x * 4] = b[(threadsPerBlock * col_start + threadIdx.x) * 5 + 1]; boxes[threadIdx.x * 4 + 1] = b[(threadsPerBlock * col_start + threadIdx.x) * 5 + 2]; boxes[threadIdx.x * 4 + 2] = b[(threadsPerBlock * col_start + threadIdx.x) * 5 + 3]; boxes[threadIdx.x * 4 + 3] = b[(threadsPerBlock * col_start + threadIdx.x) * 5 + 4]; } __syncthreads(); if (threadIdx.x < row_size) { const int row_idx = threadsPerBlock * row_start + threadIdx.x; const float* const bp = b + row_idx * 5; int i; int end = (row_start == col_start) ? threadIdx.x : col_size; uint64_t t = 0; const float area1 = bp[3] * bp[4]; for (i = 0; i < end; i++) { const float area2 = boxes[i * 4 + 2] * boxes[i * 4 + 3]; const float xdiff = ccv_max(0, ccv_min(bp[1] + bp[3], boxes[i * 4] + boxes[i * 4 + 2]) - ccv_max(bp[1], boxes[i * 4])); const float ydiff = ccv_max(0, ccv_min(bp[2] + bp[4], boxes[i * 4 + 1] + boxes[i * 4 + 3]) - ccv_max(bp[2], boxes[i * 4 + 1])); const float intersection = xdiff * ydiff; const float iou = intersection / (area1 + area2 - intersection); if (iou >= iou_threshold) t |= (1ULL << i); } iou_mask[row_idx * gm + col_start] = t; } } __global__ void _ccv_nnc_nms_zero_flags(const int n, int* const flags) { CUDA_1D_KERNEL_LOOP(i, n) { flags[i] = 0; } } template<int threadsPerBlock> __global__ void _ccv_nnc_iou_postproc_kernel(const int gm, const int m, const uint64_t* const iou_mask, int* const flags, float* const b, int* const c) { const int row_idx = threadsPerBlock * blockIdx.x + threadIdx.x; int i; int suppressed = (row_idx >= m); for (i = 0; i < blockIdx.x; i++) // Compute whether we depends on these, for each of them. { const uint64_t ious = row_idx < m ? iou_mask[row_idx * gm + i] : 0; if (threadIdx.x == 0) // Wait flags to turn to 1. while (cub::ThreadLoad<cub::LOAD_CG>(flags + i) == 0) __threadfence_block(); __syncthreads(); // Now it is available. Sync all threads to this point. if (suppressed) continue; int j; const int col_size = min(m - i * threadsPerBlock, threadsPerBlock); for (j = 0; j < col_size; j++) if (ious & (1ULL << j)) // And it overlaps. Mark this one as not good. if (c[i * threadsPerBlock + j] != -1) // If this is not marked as unavailable. c[row_idx] = -1, suppressed = 1; } __shared__ int bc[threadsPerBlock]; bc[threadIdx.x] = row_idx < m ? c[row_idx] : 0; // Now, go over it internally. const uint64_t ious = row_idx < m ? iou_mask[row_idx * gm + blockIdx.x] : 0; #pragma unroll threadsPerBlock for (i = 0; i < threadsPerBlock; i++) { __syncthreads(); // Need to sync on every round. if (i >= threadIdx.x) continue; if (ious & (1ULL << i)) // And it overlaps. Mark this one as not good. if (bc[i] != -1) // If this is not marked as unavailable. bc[threadIdx.x] = -1; } // Write back. if (row_idx < m) c[row_idx] = bc[threadIdx.x]; // Done mine. Mark it visible for other blocks. Store the flag. __syncthreads(); if (threadIdx.x == 0) cub::ThreadStore<cub::STORE_CG>(flags + blockIdx.x, 1); // If I am the last one, I am responsible for removing suppressed values. if (blockIdx.x == gm - 1 && threadIdx.x == 0) { int j; for (i = 0, j = 0; i < m; i++) if (c[i] != -1) { int k; if (i != j) { for (k = 0; k < 5; k++) b[j * 5 + k] = b[i * 5 + k]; c[j] = c[i]; } ++j; } for (i = j; i < m; i++) c[i] = -1, b[i * 5] = -FLT_MAX; } } static int _ccv_nnc_nms_forw(const ccv_nnc_cmd_t cmd, const ccv_nnc_hint_t hint, const int flags, ccv_nnc_tensor_t* const* const inputs, const int input_size, ccv_nnc_tensor_t* const* const outputs, const int output_size, ccv_nnc_stream_context_t* const stream_context) { assert(input_size == 1); const ccv_nnc_tensor_view_t* a = (ccv_nnc_tensor_view_t*)inputs[0]; assert(output_size == 2); ccv_nnc_tensor_view_t* b = (ccv_nnc_tensor_view_t*)outputs[0]; ccv_nnc_tensor_view_t* c = (ccv_nnc_tensor_view_t*)outputs[1]; const int a_nd = ccv_nnc_tensor_nd(a->info.dim); const int b_nd = ccv_nnc_tensor_nd(b->info.dim); const int c_nd = ccv_nnc_tensor_nd(c->info.dim); assert(a_nd == b_nd); int i; for (i = 0; i < a_nd; i++) { assert(a->info.dim[i] == b->info.dim[i]); } const int* ainc = CCV_IS_TENSOR_VIEW(a) ? a->inc : a->info.dim; const int* binc = CCV_IS_TENSOR_VIEW(b) ? b->inc : b->info.dim; const int* cinc = CCV_IS_TENSOR_VIEW(c) ? c->inc : c->info.dim; const int n = a_nd >= 3 ? a->info.dim[0] : 1; const int aninc = a_nd >= 3 ? ainc[1] * ainc[2] : 0; const int bninc = b_nd >= 3 ? binc[1] * binc[2] : 0; const int cninc = c_nd >= 2 ? cinc[1] : 0; const int m = a_nd >= 3 ? a->info.dim[1] : a->info.dim[0]; if (c_nd == 1) { assert(m == c->info.dim[0]); } else { assert(c_nd == 2 && n == c->info.dim[0] && m == c->info.dim[1]); } const float iou_threshold = cmd.info.nms.iou_threshold; assert((a_nd <= 1 ? 1 : a->info.dim[a_nd - 1]) == 5 && ainc[a_nd - 1] == 5 && ainc[a_nd - 1] == binc[b_nd - 1]); size_t temp_storage_bytes = 0; cub::DeviceRadixSort::SortPairsDescending(0, temp_storage_bytes, a->data.f32, b->data.f32, (float5*)b->data.f32, (float5*)b->data.i32, m, 0, sizeof(float) * 8, 0); size_t aligned_temp_storage_bytes = ((temp_storage_bytes + 511) / 512) * 512; const int gm = (m + 63) / 64; // Use full parallelism to compute whether it overlaps or not (iou >= iou_threshold). size_t iou_bytes = ((sizeof(uint64_t) * (m * gm) + 511) / 512) * 512; size_t flag_bytes = sizeof(int) * gm; size_t total_bytes = ccv_max(iou_bytes + flag_bytes, aligned_temp_storage_bytes + sizeof(float) * m); uint8_t* const d_temp_storage = (uint8_t*)ccv_nnc_stream_context_get_workspace(stream_context, total_bytes, CCV_TENSOR_GPU_MEMORY); float* const rank = (float*)(d_temp_storage + aligned_temp_storage_bytes); uint64_t* const d_ious = (uint64_t*)d_temp_storage; int* const d_flags = (int*)((uint8_t*)d_ious + iou_bytes); cudaStream_t stream = ccv_nnc_stream_context_get_stream(stream_context); for (i = 0; i < n; i++) { const float* const ap = a->data.f32 + i * aninc; float* const bp = b->data.f32 + i * bninc; int* const cp = c->data.i32 + i * cninc; // Scatter to ranks, so we can sort by these floating-points. _ccv_nnc_scatter_rank_kernel<<<CUDA_GET_BLOCKS(m), CUDA_NUM_THREADS, 0, stream>>>(m, ap, bp, rank); // Sorting. cub::DeviceRadixSort::SortPairsDescending(d_temp_storage, temp_storage_bytes, rank, rank, (float5*)bp, (float5*)bp, m, 0, sizeof(float) * 8, stream); // Merging back into respective arrays. _ccv_nnc_merge_rank_kernel<<<CUDA_GET_BLOCKS(m), CUDA_NUM_THREADS, 0, stream>>>(m, bp, rank, cp); // Compute whether it overlaps or not with the other. There is no dependencies between them. const int block_size = (gm + 1) * gm / 2; _ccv_nnc_iou_mask_kernel<64><<<block_size, 64, 0, stream>>>(gm, m, iou_threshold, bp, d_ious); _ccv_nnc_nms_zero_flags<<<CUDA_GET_BLOCKS(gm), CUDA_NUM_THREADS, 0, stream>>>(gm, d_flags); // Remove overlap items. There are dependencies, because we only remove items that overlap with existing items. _ccv_nnc_iou_postproc_kernel<64><<<gm, 64, 0, stream>>>(gm, m, d_ious, d_flags, bp, cp); } return CCV_NNC_EXEC_SUCCESS; } __global__ void _ccv_nnc_nms_zero_kernel(const int n, float* const b) { CUDA_1D_KERNEL_LOOP(i, n) { b[i * 5] = 0; b[i * 5 + 1] = 0; b[i * 5 + 2] = 0; b[i * 5 + 3] = 0; b[i * 5 + 4] = 0; } } __global__ void _ccv_nnc_nms_back_kernel(const int n, const float* const a, const int* const idx, float* const b) { CUDA_1D_KERNEL_LOOP(i, n) { const int j = idx[i]; if (j >= 0) { b[j * 5] = a[i * 5]; b[j * 5 + 1] = a[i * 5 + 1]; b[j * 5 + 2] = a[i * 5 + 2]; b[j * 5 + 3] = a[i * 5 + 3]; b[j * 5 + 4] = a[i * 5 + 4]; } } } static int _ccv_nnc_nms_back(const ccv_nnc_cmd_t cmd, const ccv_nnc_hint_t hint, const int flags, ccv_nnc_tensor_t* const* const inputs, const int input_size, ccv_nnc_tensor_t* const* const outputs, const int output_size, ccv_nnc_stream_context_t* const stream_context) { assert(input_size >= 5); const ccv_nnc_tensor_view_t* a = (ccv_nnc_tensor_view_t*)inputs[0]; const ccv_nnc_tensor_view_t* c = (ccv_nnc_tensor_view_t*)inputs[4]; assert(output_size == 1); ccv_nnc_tensor_view_t* b = (ccv_nnc_tensor_view_t*)outputs[0]; const int a_nd = ccv_nnc_tensor_nd(a->info.dim); const int b_nd = ccv_nnc_tensor_nd(b->info.dim); const int c_nd = ccv_nnc_tensor_nd(c->info.dim); assert(a_nd == b_nd); int i; for (i = 0; i < a_nd; i++) { assert(a->info.dim[i] == b->info.dim[i]); } const int* ainc = CCV_IS_TENSOR_VIEW(a) ? a->inc : a->info.dim; const int* binc = CCV_IS_TENSOR_VIEW(b) ? b->inc : b->info.dim; const int* cinc = CCV_IS_TENSOR_VIEW(c) ? c->inc : c->info.dim; const int n = a_nd >= 3 ? a->info.dim[0] : 1; const int aninc = a_nd >= 3 ? ainc[1] * ainc[2] : 0; const int bninc = b_nd >= 3 ? binc[1] * binc[2] : 0; const int cninc = c_nd >= 2 ? cinc[1] : 0; const int m = a_nd >= 3 ? a->info.dim[1] : a->info.dim[0]; if (c_nd == 1) { assert(m == c->info.dim[0]); } else { assert(c_nd == 2 && n == c->info.dim[0] && m == c->info.dim[1]); } assert((a_nd <= 1 ? 1 : a->info.dim[a_nd - 1]) == 5 && ainc[a_nd - 1] == 5 && ainc[a_nd - 1] == binc[b_nd - 1]); cudaStream_t stream = ccv_nnc_stream_context_get_stream(stream_context); for (i = 0; i < n; i++) { const float* const ap = a->data.f32 + i * aninc; float* const bp = b->data.f32 + i * bninc; int* const cp = c->data.i32 + i * cninc; _ccv_nnc_nms_zero_kernel<<<CUDA_GET_BLOCKS(m), CUDA_NUM_THREADS, 0, stream>>>(m, bp); _ccv_nnc_nms_back_kernel<<<CUDA_GET_BLOCKS(m), CUDA_NUM_THREADS, 0, stream>>>(m, ap, cp, bp); } return CCV_NNC_EXEC_SUCCESS; } #endif REGISTER_COMMAND_BACKEND(CCV_NNC_NMS_FORWARD, CCV_NNC_BACKEND_GPU_REF)(ccv_nnc_cmd_backend_registry_t* const registry) { #if defined(HAVE_CUDA) && defined(HAVE_CUB) registry->tensor_formats = CCV_TENSOR_FORMAT_NCHW | CCV_TENSOR_FORMAT_NHWC; registry->tensor_datatypes = CCV_32F | CCV_32S; registry->tensor_memory = CCV_TENSOR_GPU_MEMORY; registry->algorithms = 1; registry->exec = _ccv_nnc_nms_forw; #endif } REGISTER_COMMAND_BACKEND(CCV_NNC_NMS_BACKWARD, CCV_NNC_BACKEND_GPU_REF)(ccv_nnc_cmd_backend_registry_t* const registry) { #if defined(HAVE_CUDA) && defined(HAVE_CUB) registry->tensor_formats = CCV_TENSOR_FORMAT_NCHW | CCV_TENSOR_FORMAT_NHWC; registry->tensor_datatypes = CCV_32F | CCV_32S; registry->tensor_memory = CCV_TENSOR_GPU_MEMORY; registry->algorithms = 1; registry->exec = _ccv_nnc_nms_back; #endif }
{ "pile_set_name": "Github" }
<html> <head> <title>Canvas - Single Image</title> <style> #sprite-cache { visibility: hidden; } </style> <script type="text/javascript" src="bench.js"></script> <script type="text/javascript" src="sprites.js"></script> <script type="text/javascript"> window.onload = init; var NUM_SPRITES = 2000; var canvas; var context; function init() { canvas = document.getElementById('canvas'); context = canvas.getContext('2d'); sprites.init(canvas.width, canvas.height); var image = document.getElementById('sprite-cache').children[0]; for (var i = 0; i < NUM_SPRITES; ++i) { sprites.add(image); }; bench.run(draw); }; function draw() { context.clearRect(0, 0, canvas.width, canvas.height); sprites.draw(context); }; </script> </head> <body> <canvas id="canvas" width="800" height = "600"> <div id="sprite-cache"> <img src="images/image1_t.png" /> </div> </body> </html>
{ "pile_set_name": "Github" }
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package internal import ( "context" "encoding/json" "errors" "fmt" "io" "io/ioutil" "math" "mime" "net/http" "net/url" "strconv" "strings" "sync" "time" "golang.org/x/net/context/ctxhttp" ) // Token represents the credentials used to authorize // the requests to access protected resources on the OAuth 2.0 // provider's backend. // // This type is a mirror of oauth2.Token and exists to break // an otherwise-circular dependency. Other internal packages // should convert this Token into an oauth2.Token before use. type Token struct { // AccessToken is the token that authorizes and authenticates // the requests. AccessToken string // TokenType is the type of token. // The Type method returns either this or "Bearer", the default. TokenType string // RefreshToken is a token that's used by the application // (as opposed to the user) to refresh the access token // if it expires. RefreshToken string // Expiry is the optional expiration time of the access token. // // If zero, TokenSource implementations will reuse the same // token forever and RefreshToken or equivalent // mechanisms for that TokenSource will not be used. Expiry time.Time // Raw optionally contains extra metadata from the server // when updating a token. Raw interface{} } // tokenJSON is the struct representing the HTTP response from OAuth2 // providers returning a token in JSON form. type tokenJSON struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` RefreshToken string `json:"refresh_token"` ExpiresIn expirationTime `json:"expires_in"` // at least PayPal returns string, while most return number Expires expirationTime `json:"expires"` // broken Facebook spelling of expires_in } func (e *tokenJSON) expiry() (t time.Time) { if v := e.ExpiresIn; v != 0 { return time.Now().Add(time.Duration(v) * time.Second) } if v := e.Expires; v != 0 { return time.Now().Add(time.Duration(v) * time.Second) } return } type expirationTime int32 func (e *expirationTime) UnmarshalJSON(b []byte) error { if len(b) == 0 || string(b) == "null" { return nil } var n json.Number err := json.Unmarshal(b, &n) if err != nil { return err } i, err := n.Int64() if err != nil { return err } if i > math.MaxInt32 { i = math.MaxInt32 } *e = expirationTime(i) return nil } // RegisterBrokenAuthHeaderProvider previously did something. It is now a no-op. // // Deprecated: this function no longer does anything. Caller code that // wants to avoid potential extra HTTP requests made during // auto-probing of the provider's auth style should set // Endpoint.AuthStyle. func RegisterBrokenAuthHeaderProvider(tokenURL string) {} // AuthStyle is a copy of the golang.org/x/oauth2 package's AuthStyle type. type AuthStyle int const ( AuthStyleUnknown AuthStyle = 0 AuthStyleInParams AuthStyle = 1 AuthStyleInHeader AuthStyle = 2 ) // authStyleCache is the set of tokenURLs we've successfully used via // RetrieveToken and which style auth we ended up using. // It's called a cache, but it doesn't (yet?) shrink. It's expected that // the set of OAuth2 servers a program contacts over time is fixed and // small. var authStyleCache struct { sync.Mutex m map[string]AuthStyle // keyed by tokenURL } // ResetAuthCache resets the global authentication style cache used // for AuthStyleUnknown token requests. func ResetAuthCache() { authStyleCache.Lock() defer authStyleCache.Unlock() authStyleCache.m = nil } // lookupAuthStyle reports which auth style we last used with tokenURL // when calling RetrieveToken and whether we have ever done so. func lookupAuthStyle(tokenURL string) (style AuthStyle, ok bool) { authStyleCache.Lock() defer authStyleCache.Unlock() style, ok = authStyleCache.m[tokenURL] return } // setAuthStyle adds an entry to authStyleCache, documented above. func setAuthStyle(tokenURL string, v AuthStyle) { authStyleCache.Lock() defer authStyleCache.Unlock() if authStyleCache.m == nil { authStyleCache.m = make(map[string]AuthStyle) } authStyleCache.m[tokenURL] = v } // newTokenRequest returns a new *http.Request to retrieve a new token // from tokenURL using the provided clientID, clientSecret, and POST // body parameters. // // inParams is whether the clientID & clientSecret should be encoded // as the POST body. An 'inParams' value of true means to send it in // the POST body (along with any values in v); false means to send it // in the Authorization header. func newTokenRequest(tokenURL, clientID, clientSecret string, v url.Values, authStyle AuthStyle) (*http.Request, error) { if authStyle == AuthStyleInParams { v = cloneURLValues(v) if clientID != "" { v.Set("client_id", clientID) } if clientSecret != "" { v.Set("client_secret", clientSecret) } } req, err := http.NewRequest("POST", tokenURL, strings.NewReader(v.Encode())) if err != nil { return nil, err } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") if authStyle == AuthStyleInHeader { req.SetBasicAuth(url.QueryEscape(clientID), url.QueryEscape(clientSecret)) } return req, nil } func cloneURLValues(v url.Values) url.Values { v2 := make(url.Values, len(v)) for k, vv := range v { v2[k] = append([]string(nil), vv...) } return v2 } func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values, authStyle AuthStyle) (*Token, error) { needsAuthStyleProbe := authStyle == 0 if needsAuthStyleProbe { if style, ok := lookupAuthStyle(tokenURL); ok { authStyle = style needsAuthStyleProbe = false } else { authStyle = AuthStyleInHeader // the first way we'll try } } req, err := newTokenRequest(tokenURL, clientID, clientSecret, v, authStyle) if err != nil { return nil, err } token, err := doTokenRoundTrip(ctx, req) if err != nil && needsAuthStyleProbe { // If we get an error, assume the server wants the // clientID & clientSecret in a different form. // See https://code.google.com/p/goauth2/issues/detail?id=31 for background. // In summary: // - Reddit only accepts client secret in the Authorization header // - Dropbox accepts either it in URL param or Auth header, but not both. // - Google only accepts URL param (not spec compliant?), not Auth header // - Stripe only accepts client secret in Auth header with Bearer method, not Basic // // We used to maintain a big table in this code of all the sites and which way // they went, but maintaining it didn't scale & got annoying. // So just try both ways. authStyle = AuthStyleInParams // the second way we'll try req, _ = newTokenRequest(tokenURL, clientID, clientSecret, v, authStyle) token, err = doTokenRoundTrip(ctx, req) } if needsAuthStyleProbe && err == nil { setAuthStyle(tokenURL, authStyle) } // Don't overwrite `RefreshToken` with an empty value // if this was a token refreshing request. if token != nil && token.RefreshToken == "" { token.RefreshToken = v.Get("refresh_token") } return token, err } func doTokenRoundTrip(ctx context.Context, req *http.Request) (*Token, error) { r, err := ctxhttp.Do(ctx, ContextClient(ctx), req) if err != nil { return nil, err } body, err := ioutil.ReadAll(io.LimitReader(r.Body, 1<<20)) r.Body.Close() if err != nil { return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err) } if code := r.StatusCode; code < 200 || code > 299 { return nil, &RetrieveError{ Response: r, Body: body, } } var token *Token content, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type")) switch content { case "application/x-www-form-urlencoded", "text/plain": vals, err := url.ParseQuery(string(body)) if err != nil { return nil, err } token = &Token{ AccessToken: vals.Get("access_token"), TokenType: vals.Get("token_type"), RefreshToken: vals.Get("refresh_token"), Raw: vals, } e := vals.Get("expires_in") if e == "" || e == "null" { // TODO(jbd): Facebook's OAuth2 implementation is broken and // returns expires_in field in expires. Remove the fallback to expires, // when Facebook fixes their implementation. e = vals.Get("expires") } expires, _ := strconv.Atoi(e) if expires != 0 { token.Expiry = time.Now().Add(time.Duration(expires) * time.Second) } default: var tj tokenJSON if err = json.Unmarshal(body, &tj); err != nil { return nil, err } token = &Token{ AccessToken: tj.AccessToken, TokenType: tj.TokenType, RefreshToken: tj.RefreshToken, Expiry: tj.expiry(), Raw: make(map[string]interface{}), } json.Unmarshal(body, &token.Raw) // no error checks for optional fields } if token.AccessToken == "" { return nil, errors.New("oauth2: server response missing access_token") } return token, nil } type RetrieveError struct { Response *http.Response Body []byte } func (r *RetrieveError) Error() string { return fmt.Sprintf("oauth2: cannot fetch token: %v\nResponse: %s", r.Response.Status, r.Body) }
{ "pile_set_name": "Github" }
/** * This is a basic phantomJS script that will be used together * with the xssValidator burp extender. * * This script launches a web server that listens by default * on 127.0.0.1:8093. The server listens for POST requests with * http-response data. * * http-response should contain base64 encoded HTTP response as * passed from burp intruder. The server will decode this data, * and build a WebPage bassed of the markup provided. * * The WebPage will be injected with the js-overrides.js file, * which contains triggers for suspicious JS functions, such as * alert, confirm, etc. The page will be evaluated, and the DOM * triggers will alert us of any suspicious JS. */ var DEBUG = false var system = require('system'); var fs = require('fs'); // Create xss object that will be used to track XSS information var xss = new Object(); xss.value = 0; xss.msg = ""; // Create webserver object var webserver = require('webserver'); server = webserver.create(); // Server config details var host = '127.0.0.1'; var port = '8093'; /** * parse incoming HTTP responses that are provided via BURP intruder. * data is base64 encoded to prevent issues passing via HTTP. * * This function appends the js-overrides.js file to all responses * to inject xss triggers into every page. Webkit will parse all responses * and alert us of any seemingly malicious Javascript execution, such as * alert, confirm, fromCharCode, etc. */ parsePage = function(data) { if (DEBUG) { console.log("Beginning to parse page"); } var html_response = ""; wp.content = data; // Evaluate page, rendering javascript xssInfo = wp.evaluate(function (wp) { // Return information from page, if necessary }, wp); if(xss) { // xss detected, return return xss; } return false; }; /** * After retriving data it is important to reinitialize certain * variables, specifically those related to the WebPage objects. * Without reinitializing the WebPage object may contain old data, * and as such, trigger false-positive messages. */ reInitializeWebPage = function() { wp = new WebPage(); xss = new Object(); xss.value = 0; xss.msg = ""; // web page settings necessary to adequately detect XSS wp.settings = { loadImages: true, localToRemoteUrlAccessEnabled: true, javascriptEnabled: true, webSecurityEnabled: false, XSSAuditingEnabled: false }; // Custom handler for alert functionality wp.onAlert = function(msg) { console.log("On alert: " + msg); xss.value = 1; xss.msg += 'XSS found: alert(' + msg + ')'; }; wp.onConsoleMessage = function(msg) { console.log("On console.log: " + msg); xss.value = 1; xss.msg += 'XSS found: console.log(' + msg + ')'; }; wp.onConfirm = function(msg) { console.log("On confirm: " + msg); xss.value = 1; xss.msg += 'XSS found: confirm(' + msg + ')'; }; return wp; }; // Initialize webpage to ensure that all variables are // initialized. var wp = reInitializeWebPage(); // Start web server and listen for requests var service = server.listen(host + ":" + port, function(request, response) { if(DEBUG) { console.log("\nReceived request with method type: " + request.method); } // At this point in time we're only concerned with POST requests // As such, only process those. if(request.method == "POST") { if(DEBUG) { console.log("Processing Post Request"); } // Grab pageResponse from POST Data and base64 decode. // pass result to parsePage function to search for XSS. var pageResponse = request.post['http-response']; pageResponse = atob(pageResponse); xssResults = parsePage(pageResponse); // Return XSS Results if(xssResults) { // XSS is found, return information here response.statusCode = 200; response.write(JSON.stringify(xssResults)); response.close(); } else { response.statusCode = 201; response.write("No XSS found in response"); response.close(); } } else { response.statusCode = 500; response.write("Server is only designed to handle GET requests"); response.close(); } // Re-initialize webpage after parsing request wp = reInitializeWebPage(); pageResponse = null; xssResults = null; });
{ "pile_set_name": "Github" }
/* * 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. */ package org.apache.wicket.markup.html.link; import org.apache.wicket.IRequestListener; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.request.resource.IResource; import org.apache.wicket.request.resource.IResource.Attributes; import org.apache.wicket.request.resource.ResourceReference; /** * A link to any ResourceReference. * * @author Jonathan Locke * @param <T> * type of model object */ public class ResourceLink<T> extends Link<T> implements IRequestListener { private static final long serialVersionUID = 1L; /** The Resource reference */ private final ResourceReference resourceReference; /** The Resource */ private final IResource resource; /** The resource parameters */ private final PageParameters resourceParameters; /** * Constructs an ResourceLink from an resourcereference. That resource reference will bind its * resource to the current SharedResources. * * @param id * See Component * @param resourceReference * The shared resource to link to */ public ResourceLink(final String id, final ResourceReference resourceReference) { this(id, resourceReference, null); } /** * Constructs an ResourceLink from an resourcereference. That resource reference will bind its * resource to the current SharedResources. * * @param id * See Component * @param resourceReference * The shared resource to link to * @param resourceParameters * The resource parameters */ public ResourceLink(final String id, final ResourceReference resourceReference, PageParameters resourceParameters) { super(id); this.resourceReference = resourceReference; this.resourceParameters = resourceParameters; resource = null; } /** * Constructs a link directly to the provided resource. * * @param id * See Component * @param resource * The resource */ public ResourceLink(final String id, final IResource resource) { super(id); this.resource = resource; resourceReference = null; resourceParameters = null; } @Override public void onClick() { } @Override public boolean rendersPage() { return false; } /** * For {@link ResourceReference}s this link is stateless. * * @return <code>true</code> if a resourceReference was provided to the * constructor * * @see ResourceLink#ResourceLink(String, ResourceReference) * @see ResourceLink#ResourceLink(String, ResourceReference, PageParameters) */ @Override protected boolean getStatelessHint() { return resourceReference != null; } @Override protected final CharSequence getURL() { if (resourceReference != null) { // TODO post 1.2: should we have support for locale changes when the // resource reference (or resource??) is set manually.. // We should get a new resource reference for the current locale // then // that points to the same resource but with another locale if it // exists. // something like // SharedResource.getResourceReferenceForLocale(resourceReference); if (resourceReference.canBeRegistered()) { getApplication().getResourceReferenceRegistry().registerResourceReference( resourceReference); } return getRequestCycle().urlFor( new ResourceReferenceRequestHandler(resourceReference, resourceParameters)); } return urlForListener(resourceParameters); } @Override public final void onRequest() { Attributes a = new Attributes(RequestCycle.get().getRequest(), RequestCycle.get() .getResponse(), null); resource.respond(a); super.onRequest(); } }
{ "pile_set_name": "Github" }
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2011 Bucknell University * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: L. Felipe Perrone ([email protected]) * Tiago G. Rodrigues ([email protected]) * * Modified by: Mitch Watrous ([email protected]) * Adapted to Ipv6 by: Tommaso Pecorella ([email protected]) */ #ifndef IPV6_PACKET_PROBE_H #define IPV6_PACKET_PROBE_H #include "ns3/object.h" #include "ns3/callback.h" #include "ns3/boolean.h" #include "ns3/nstime.h" #include "ns3/packet.h" #include "ns3/ipv6.h" #include "ns3/traced-value.h" #include "ns3/simulator.h" #include "ns3/probe.h" namespace ns3 { /** * \ingroup ipv6 * * This class is designed to probe an underlying ns3 TraceSource * exporting a packet, an IPv6 object, and an interface. This probe * exports a trace source "Output" with arguments of type Ptr<const Packet>, * Ptr<Ipv6>, and uint32_t. The Output trace source emits a value * when either the trace source emits a new value, or when SetValue () * is called. */ class Ipv6PacketProbe : public Probe { public: /** * \brief Get the type ID. * \return the object TypeId */ static TypeId GetTypeId (); Ipv6PacketProbe (); virtual ~Ipv6PacketProbe (); /** * \brief Set a probe value * * \param packet set the traced packet equal to this * \param ipv6 set the IPv6 object for the traced packet equal to this * \param interface set the IPv6 interface for the traced packet equal to this */ void SetValue (Ptr<const Packet> packet, Ptr<Ipv6> ipv6, uint32_t interface); /** * \brief Set a probe value by its name in the Config system * * \param path config path to access the probe * \param packet set the traced packet equal to this * \param ipv6 set the IPv6 object for the traced packet equal to this * \param interface set the IPv6 interface for the traced packet equal to this */ static void SetValueByPath (std::string path, Ptr<const Packet> packet, Ptr<Ipv6> ipv6, uint32_t interface); /** * \brief connect to a trace source attribute provided by a given object * * \param traceSource the name of the attribute TraceSource to connect to * \param obj ns3::Object to connect to * \return true if the trace source was successfully connected */ virtual bool ConnectByObject (std::string traceSource, Ptr<Object> obj); /** * \brief connect to a trace source provided by a config path * * \param path Config path to bind to * * Note, if an invalid path is provided, the probe will not be connected * to anything. */ virtual void ConnectByPath (std::string path); private: /** * \brief Method to connect to an underlying ns3::TraceSource with * arguments of type Ptr<const Packet>, Ptr<Ipv6>, and uint32_t * * \param packet the traced packet * \param ipv6 the IPv6 object for the traced packet * \param interface the IPv6 interface for the traced packet */ void TraceSink (Ptr<const Packet> packet, Ptr<Ipv6> ipv6, uint32_t interface); /// Traced Callback: the packet, the Ipv6 object and the interface. ns3::TracedCallback<Ptr<const Packet>, Ptr<Ipv6>, uint32_t> m_output; /// Traced Callback: the previous packet's size and the actual packet's size. ns3::TracedCallback<uint32_t, uint32_t> m_outputBytes; /// The traced packet. Ptr<const Packet> m_packet; /// The IPv6 object for the traced packet. Ptr<Ipv6> m_ipv6; /// The IPv6 interface for the traced packet. uint32_t m_interface; /// The size of the traced packet. uint32_t m_packetSizeOld; }; } // namespace ns3 #endif // IPV6_PACKET_PROBE_H
{ "pile_set_name": "Github" }
--TEST-- Test strftime() function : usage variation - Passing month related format strings to format argument. --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) * Description: Format a local time/date according to locale settings * Source code: ext/date/php_date.c * Alias to functions: */ echo "*** Testing strftime() : usage variation ***\n"; date_default_timezone_set("Asia/Calcutta"); // Initialise function arguments not being substituted (if any) $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( 'Abbreviated month name' => "%b", 'Full month name' => "%B", 'Month as decimal' => "%m", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; print_r( strftime($value) ); echo PHP_EOL; var_dump( strftime($value, $timestamp) ); }; ?> ===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** --Abbreviated month name-- %s string(3) "Aug" --Full month name-- %s string(6) "August" --Month as decimal-- %s string(2) "08" ===DONE===
{ "pile_set_name": "Github" }