text stringlengths 1 1.05M |
|---|
<!DOCTYPE html>
<html>
<head>
<title>Movie Ticket Booking</title>
<style>
body {
background-color: #FFFFFF;
font-family: sans-serif;
}
.container {
width: 1080px;
margin: auto;
}
.ticket-form {
width: 400px;
background-color: #F8F9FA;
margin: 20px auto;
padding: 20px;
}
h1 {
text-align: center;
}
.form-group {
margin: 1em 0;
padding: 1em 0;
}
</style>
</head>
<body>
<div class="container">
<h1>Movie Ticket Booking</h1>
<form class="ticket-form" action="book.php" method="post">
<div class="form-group">
<label for="movie-name">Movie Name: </label>
<input type="text" id="movie-name" name="movie-name" required>
</div>
<div class="form-group">
<label for="theater-name">Theater Name: </label>
<input type="text" id="theater-name" name="theater-name" required>
</div>
<div class="form-group">
<label for="date">Date: </label>
<input type="date" id="date" name="date" required>
</div>
<div class="form-group">
<label for="time">Time: </label>
<input type="time" id="time" name="time" required>
</div>
<div class="form-group">
<label for="number-of-tickets">Number of Tickets: </label>
<input type="number" id="number-of-tickets" name="number-of-tickets" min="1" max="10" required>
</div>
<div class="form-group">
<input type="submit" value="Submit">
</div>
</form>
</div>
</body>
</html> |
import { getAxiosInstance, getRbacGroupApi } from '../shared/user-login';
import { RBAC_API_BASE } from '../../utilities/constants';
import { SelectOptions } from '../../types/common-types';
export interface GroupOut {
name: string;
description?: string;
id: string;
created: string;
modified: string;
principalCount?: number;
roleCount?: number;
system?: boolean;
platform_default?: boolean;
}
export interface GroupPagination {
results: Array<GroupOut>;
}
export const getRbacGroups = (): Promise<GroupPagination> =>
getAxiosInstance().get(`${RBAC_API_BASE}/groups/`) as Promise<
GroupPagination
>;
export const fetchFilterGroups = (filterValue = ''): Promise<SelectOptions> =>
getAxiosInstance()
.get(
`${RBAC_API_BASE}/groups/${
filterValue.length > 0 ? `?name=${filterValue}` : ''
}`
)
.then(({ results }: GroupPagination) => {
return results.map(({ id, name }) => ({ label: name, value: id }));
});
|
#!/bin/bash
source activate /gs/hs0/tgb-deepmt/bugliarello.e/envs/volta
cd ../../../../code/volta
python eval_task.py \
--bert_model bert-base-uncased --config_file config/ctrl_vl-bert_base.json --tasks_config_file config_tasks/ctrl_test_tasks.yml \
--from_pretrained /gs/hs0/tgb-deepmt/bugliarello.e/checkpoints/mpre-unmasked/refcoco+_unc_s54/volta/ctrl_vl-bert/refcoco+_ctrl_vl-bert_base/pytorch_model_15.bin \
--task 10 \
--output_dir /gs/hs0/tgb-deepmt/bugliarello.e/results/mpre-unmasked/refcoco+_unc_s54/volta/ctrl_vl-bert
conda deactivate
|
<reponame>bitrise-steplib/bitrise-step-run-eas-build
package step
import (
"github.com/bitrise-io/go-steputils/v2/stepconf"
"github.com/bitrise-io/go-utils/v2/command"
"github.com/bitrise-io/go-utils/v2/log"
"github.com/bitrise-steplib/bitrise-step-run-eas-build/eas"
)
type easClientBuilder struct {
commandFactory command.Factory
logger log.Logger
}
func NewEASClientBuilder(commandFactory command.Factory, logger log.Logger) EASClientBuilder {
return easClientBuilder{
commandFactory: commandFactory,
logger: logger,
}
}
func (b easClientBuilder) Build(token stepconf.Secret, workDir string) EASClient {
return eas.NewClient(b.commandFactory, b.logger, token, workDir)
}
|
public int stringLength(String str) {
return str.length();
} |
<filename>node_modules/@darwinia/types/interfaces/staking/definitions.d.ts
declare const _default: {
rpc: {
powerOf: {
alias: string[];
description: string;
params: {
name: string;
type: string;
}[];
type: string;
};
};
types: {
PowerOf: {
power: string;
};
};
};
export default _default;
|
#!/bin/bash
#
# Runs tests on all base URLs for a particular concurrency level.
#
# Enough requests to fill 10 minutes?
#REQUESTS=10000000
REQUESTS=100000
TIME_LIMIT=${1:-30}
CONCURRENCY=${2:-40}
REPORT_DIR=${3:-.}
SLEEP_TIME=${4:-5}
HOST=${5:-localhost}
HTTPDPORT=${6:-8089}
HTTPDSPORT=${7:-8099}
HTTPD_ONLY=true
HTTPSCHEME=https
REPORT_FILE="results_httpd.txt"
SCRIPT_DIR=`dirname "${0}"`
export REPORT_DIR
export REPORT_FILE
function quit {
echo
exit
}
trap "quit" INT TERM EXIT
# NOHTTPD if [ ! "${SKIP_HTTP_TESTS}" ] ; then
# NOHTTPD # httpd
# NOHTTPD REPORT_FILE=results_httpd
# NOHTTPD echo "Running test on http://${HOST}:${HTTPDPORT}/"
# NOHTTPD "${SCRIPT_DIR}/runfiletests.sh" 1 1 0 http://${HOST}:${HTTPDPORT}/ >/dev/null
# NOHTTPD sleep ${SLEEP_TIME}
# NOHTTPD "${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} http://${HOST}:${HTTPDPORT}/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# NOHTTPD fi
# NOHTTPD if [ ! "${SKIP_HTTPS_TESTS}" ] ; then
# httpd openssl mod_ssl
# REPORT_FILE=results_httpd_https
# echo "Running test on https://${HOST}:${HTTPDSPORT}/"
# "${SCRIPT_DIR}/runfiletests.sh" 1 1 0 https://${HOST}:${HTTPDSPORT}/ >/dev/null
# sleep ${SLEEP_TIME}
# "${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} https://${HOST}:${HTTPDSPORT}/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# NOHTTPD fi
# NOHTTPD if ${HTTPD_ONLY}; then
# NOHTTPD echo "Done httpd/httpds only proxy"
# NOHTTPD quit
# NOHTTPD exit
# NOHTTPD fi
# Test nio openssl
REPORT_FILE=results_coyote_apr_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8002/ true >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8002/ true | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# Test nio openssl
REPORT_FILE=results_coyote_nio_openssl$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8003/ true >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8003/ true | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# Test nio jsse
REPORT_FILE=results_coyote_nio_jsse$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8004/ true >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8004/ true | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# STOP the tests here for the moment.
quit
# Nio JSSE
REPORT_FILE=results_coyote_nio_jsse_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8001/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8001/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# Coyote APR
REPORT_FILE=results_coyote_apr_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8002/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8002/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# Next connector
REPORT_FILE=results_coyote_nio_openssl_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8003/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8003/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# Next connector
REPORT_FILE=results_coyote_nio2_openssl_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8004/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8004/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# STOP the tests here for the moment.
quit
# Coyote NIO2
REPORT_FILE=results_coyote_nio2_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8004/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8004/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# Coyote NIO w/o sendfile
REPORT_FILE=results_coyote_nio_openssl_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8006/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8006/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# Coyote NIO2
REPORT_FILE=results_coyote_nio_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8007/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8007/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
# STOP the tests here for the moment.
quit
# Coyote NIO2 w/o sendfile
REPORT_FILE=results_coyote_nio2_ns_$HTTPSCHEME
"${SCRIPT_DIR}/runfiletests.sh" 1 1 0 $HTTPSCHEME://${HOST}:8008/ >/dev/null
sleep ${SLEEP_TIME}
"${SCRIPT_DIR}/runfiletests.sh" ${REQUESTS} ${CONCURRENCY} ${TIME_LIMIT} $HTTPSCHEME://${HOST}:8008/ | tee "${REPORT_DIR}/${REPORT_FILE}.txt" 2>&1
quit
|
#!/bin/bash
set -ev
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#
# Skip Install if Python 2.7 or PyPy and not a PR
#
if [ "${TRAVIS_PULL_REQUEST}" == "false" ] && [ "${TRAVIS_BRANCH}" != "master" ]; then
echo "Regular Push (not PR) on non-master branch:"
if [ "${TRAVIS_PYTHON_VERSION}" == "2.7" ]; then
echo "Skipping Python 2.7"
exit 0
fi
if [ "${TRAVIS_PYTHON_VERSION}" == "pypy" ]; then
echo "Skipping Python PyPy"
exit 0
fi
if [ "${PYSMT_SOLVER}" == "all" ]; then
echo "Skipping 'all' configuration"
exit 0
fi
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
echo "Skipping MacOSX build"
exit 0
fi
fi
function brew_install_or_upgrade {
brew install "$1" || (brew upgrade "$1" && brew cleanup "$1")
}
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
brew update
brew_install_or_upgrade openssl
brew_install_or_upgrade readline
brew_install_or_upgrade swig
brew_install_or_upgrade gperf
brew_install_or_upgrade mpfr
brew_install_or_upgrade libmpc
brew_install_or_upgrade gmp
brew_install_or_upgrade pyenv
brew_install_or_upgrade pyenv-virtualenv
brew_install_or_upgrade readline
brew_install_or_upgrade xz
brew_install_or_upgrade zlib
brew_install_or_upgrade libffi
brew_install_or_upgrade ncurses
pyenv install ${TRAVIS_PYTHON_VERSION}
pyenv virtualenv ${TRAVIS_PYTHON_VERSION} venv
eval "$(pyenv init -)"
pyenv activate venv
fi
# Check that the correct version of Python is running.
python ${DIR}/check_python_version.py "${TRAVIS_PYTHON_VERSION}"
|
import { Sse } from '@nestjs/common';
import { Controller, Get } from '@nestjs/common';
import { interval } from 'rxjs';
import { map } from 'rxjs/operators';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
return this.appService.getHello();
}
@Sse('sse')
testSee() {
return interval(3000).pipe(map((_) => ({ data: { hello: 'world' } })));
}
}
|
<filename>modules/network/src/main/java/org/apache/ignite/network/Network.java<gh_stars>0
/*
* 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.ignite.network;
import java.util.Arrays;
import java.util.Collections;
import org.apache.ignite.network.message.MessageSerializerProvider;
/**
* Entry point for network module.
*/
public class Network {
/** Message mapper providers, messageMapperProviders[message type] -> message mapper provider for message with message type. */
private final MessageSerializerProvider<?>[] messageSerializerProviders = new MessageSerializerProvider<?>[Short.MAX_VALUE << 1];
/** Message handlers. */
private final MessageHandlerHolder messageHandlerHolder = new MessageHandlerHolder();
/** Cluster factory. */
private final NetworkClusterFactory clusterFactory;
/**
* Constructor.
* @param factory Cluster factory.
*/
public Network(NetworkClusterFactory factory) {
clusterFactory = factory;
}
/**
* Register message mapper by message type.
* @param type Message type.
* @param mapperProvider Message mapper provider.
*/
public void registerMessageMapper(short type, MessageSerializerProvider mapperProvider) throws NetworkConfigurationException {
if (this.messageSerializerProviders[type] != null)
throw new NetworkConfigurationException("Message mapper for type " + type + " is already defined");
this.messageSerializerProviders[type] = mapperProvider;
}
/**
* Start new cluster.
* @return Network cluster.
*/
public NetworkCluster start() {
//noinspection Java9CollectionFactory
NetworkClusterContext context = new NetworkClusterContext(messageHandlerHolder, Collections.unmodifiableList(Arrays.asList(messageSerializerProviders)));
return clusterFactory.startCluster(context);
}
}
|
#!/usr/bin/env bash
set -euo pipefail
DID_FAIL=0
IMAGE_TAG=$1
CURRENT_DIR=$(dirname $(readlink -f $0))
for TEST in $(ls -1 ${CURRENT_DIR}/common/*.sh 2> /dev/null || true); do
docker run -i -t --rm -u node -v ${TEST}:/home/docker/test.sh akeneo/node:${IMAGE_TAG} bash test.sh || DID_FAIL=1
done
for TEST in $(ls -1 ${CURRENT_DIR}/${IMAGE_TAG}/*.sh 2> /dev/null || true); do
docker run -i -t --rm -u node -v ${TEST}:/home/docker/test.sh akeneo/node:${IMAGE_TAG} bash test.sh || DID_FAIL=1
done
test "0" -ne "$DID_FAIL" && exit 1
exit 0
|
#!/bin/bash
rm -rf RUNNING_PID > /dev/null
sbt clean dist
rm -rf hello-impl-0.1.0-SNAPSHOT > /dev/null
unzip hello-impl/target/universal/hello-impl-0.1.0-SNAPSHOT.zip
./hello-impl-0.1.0-SNAPSHOT/bin/hello-impl
|
#!/bin/bash
dieharder -d 101 -g 44 -S 3145334834
|
<gh_stars>1-10
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.22.0
// protoc v3.5.1
// source: client.proto
package message
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
//登录
type C_G_LoginResquest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
Key int64 `protobuf:"varint,2,opt,name=Key,proto3" json:"Key,omitempty"`
}
func (x *C_G_LoginResquest) Reset() {
*x = C_G_LoginResquest{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *C_G_LoginResquest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*C_G_LoginResquest) ProtoMessage() {}
func (x *C_G_LoginResquest) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use C_G_LoginResquest.ProtoReflect.Descriptor instead.
func (*C_G_LoginResquest) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{0}
}
func (x *C_G_LoginResquest) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *C_G_LoginResquest) GetKey() int64 {
if x != nil {
return x.Key
}
return 0
}
//登录
type G_C_LoginResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
Key int64 `protobuf:"varint,2,opt,name=Key,proto3" json:"Key,omitempty"`
}
func (x *G_C_LoginResponse) Reset() {
*x = G_C_LoginResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *G_C_LoginResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*G_C_LoginResponse) ProtoMessage() {}
func (x *G_C_LoginResponse) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use G_C_LoginResponse.ProtoReflect.Descriptor instead.
func (*G_C_LoginResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{1}
}
func (x *G_C_LoginResponse) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *G_C_LoginResponse) GetKey() int64 {
if x != nil {
return x.Key
}
return 0
}
//登录
type C_A_LoginRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
AccountName string `protobuf:"bytes,2,opt,name=AccountName,proto3" json:"AccountName,omitempty"`
Password string `protobuf:"bytes,3,opt,name=Password,proto3" json:"Password,omitempty"`
BuildNo string `protobuf:"bytes,5,opt,name=BuildNo,proto3" json:"BuildNo,omitempty"`
Key int64 `protobuf:"varint,6,opt,name=Key,proto3" json:"Key,omitempty"` //uint32 Crc = 7;
}
func (x *C_A_LoginRequest) Reset() {
*x = C_A_LoginRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *C_A_LoginRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*C_A_LoginRequest) ProtoMessage() {}
func (x *C_A_LoginRequest) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use C_A_LoginRequest.ProtoReflect.Descriptor instead.
func (*C_A_LoginRequest) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{2}
}
func (x *C_A_LoginRequest) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *C_A_LoginRequest) GetAccountName() string {
if x != nil {
return x.AccountName
}
return ""
}
func (x *C_A_LoginRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *C_A_LoginRequest) GetBuildNo() string {
if x != nil {
return x.BuildNo
}
return ""
}
func (x *C_A_LoginRequest) GetKey() int64 {
if x != nil {
return x.Key
}
return 0
}
//登录反馈
type A_C_LoginResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
Error int32 `protobuf:"varint,2,opt,name=Error,proto3" json:"Error,omitempty"`
AccountName string `protobuf:"bytes,4,opt,name=AccountName,proto3" json:"AccountName,omitempty"`
}
func (x *A_C_LoginResponse) Reset() {
*x = A_C_LoginResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *A_C_LoginResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*A_C_LoginResponse) ProtoMessage() {}
func (x *A_C_LoginResponse) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use A_C_LoginResponse.ProtoReflect.Descriptor instead.
func (*A_C_LoginResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{3}
}
func (x *A_C_LoginResponse) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *A_C_LoginResponse) GetError() int32 {
if x != nil {
return x.Error
}
return 0
}
func (x *A_C_LoginResponse) GetAccountName() string {
if x != nil {
return x.AccountName
}
return ""
}
//注册
type C_A_RegisterRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
AccountName string `protobuf:"bytes,2,opt,name=AccountName,proto3" json:"AccountName,omitempty"`
Password string `protobuf:"bytes,3,opt,name=Password,proto3" json:"Password,omitempty"`
}
func (x *C_A_RegisterRequest) Reset() {
*x = C_A_RegisterRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *C_A_RegisterRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*C_A_RegisterRequest) ProtoMessage() {}
func (x *C_A_RegisterRequest) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use C_A_RegisterRequest.ProtoReflect.Descriptor instead.
func (*C_A_RegisterRequest) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{4}
}
func (x *C_A_RegisterRequest) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *C_A_RegisterRequest) GetAccountName() string {
if x != nil {
return x.AccountName
}
return ""
}
func (x *C_A_RegisterRequest) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
//注册反馈
type A_C_RegisterResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
Error int32 `protobuf:"varint,2,opt,name=Error,proto3" json:"Error,omitempty"`
}
func (x *A_C_RegisterResponse) Reset() {
*x = A_C_RegisterResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *A_C_RegisterResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*A_C_RegisterResponse) ProtoMessage() {}
func (x *A_C_RegisterResponse) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use A_C_RegisterResponse.ProtoReflect.Descriptor instead.
func (*A_C_RegisterResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{5}
}
func (x *A_C_RegisterResponse) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *A_C_RegisterResponse) GetError() int32 {
if x != nil {
return x.Error
}
return 0
}
//创角
type C_W_CreatePlayerRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
PlayerName string `protobuf:"bytes,2,opt,name=PlayerName,proto3" json:"PlayerName,omitempty"`
Sex int32 `protobuf:"varint,3,opt,name=Sex,proto3" json:"Sex,omitempty"`
}
func (x *C_W_CreatePlayerRequest) Reset() {
*x = C_W_CreatePlayerRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *C_W_CreatePlayerRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*C_W_CreatePlayerRequest) ProtoMessage() {}
func (x *C_W_CreatePlayerRequest) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use C_W_CreatePlayerRequest.ProtoReflect.Descriptor instead.
func (*C_W_CreatePlayerRequest) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{6}
}
func (x *C_W_CreatePlayerRequest) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *C_W_CreatePlayerRequest) GetPlayerName() string {
if x != nil {
return x.PlayerName
}
return ""
}
func (x *C_W_CreatePlayerRequest) GetSex() int32 {
if x != nil {
return x.Sex
}
return 0
}
//创角反馈
type W_C_CreatePlayerResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
Error int32 `protobuf:"varint,2,opt,name=Error,proto3" json:"Error,omitempty"`
PlayerId int64 `protobuf:"varint,3,opt,name=PlayerId,proto3" json:"PlayerId,omitempty"`
}
func (x *W_C_CreatePlayerResponse) Reset() {
*x = W_C_CreatePlayerResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *W_C_CreatePlayerResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*W_C_CreatePlayerResponse) ProtoMessage() {}
func (x *W_C_CreatePlayerResponse) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use W_C_CreatePlayerResponse.ProtoReflect.Descriptor instead.
func (*W_C_CreatePlayerResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{7}
}
func (x *W_C_CreatePlayerResponse) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *W_C_CreatePlayerResponse) GetError() int32 {
if x != nil {
return x.Error
}
return 0
}
func (x *W_C_CreatePlayerResponse) GetPlayerId() int64 {
if x != nil {
return x.PlayerId
}
return 0
}
//登录游戏
type C_W_Game_LoginRequset struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
PlayerId int64 `protobuf:"varint,2,opt,name=PlayerId,proto3" json:"PlayerId,omitempty"`
}
func (x *C_W_Game_LoginRequset) Reset() {
*x = C_W_Game_LoginRequset{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *C_W_Game_LoginRequset) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*C_W_Game_LoginRequset) ProtoMessage() {}
func (x *C_W_Game_LoginRequset) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use C_W_Game_LoginRequset.ProtoReflect.Descriptor instead.
func (*C_W_Game_LoginRequset) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{8}
}
func (x *C_W_Game_LoginRequset) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *C_W_Game_LoginRequset) GetPlayerId() int64 {
if x != nil {
return x.PlayerId
}
return 0
}
//选角反馈
type W_C_SelectPlayerResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
AccountId int64 `protobuf:"varint,2,opt,name=AccountId,proto3" json:"AccountId,omitempty"`
PlayerData []*PlayerData `protobuf:"bytes,3,rep,name=PlayerData,proto3" json:"PlayerData,omitempty"`
}
func (x *W_C_SelectPlayerResponse) Reset() {
*x = W_C_SelectPlayerResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *W_C_SelectPlayerResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*W_C_SelectPlayerResponse) ProtoMessage() {}
func (x *W_C_SelectPlayerResponse) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use W_C_SelectPlayerResponse.ProtoReflect.Descriptor instead.
func (*W_C_SelectPlayerResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{9}
}
func (x *W_C_SelectPlayerResponse) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *W_C_SelectPlayerResponse) GetAccountId() int64 {
if x != nil {
return x.AccountId
}
return 0
}
func (x *W_C_SelectPlayerResponse) GetPlayerData() []*PlayerData {
if x != nil {
return x.PlayerData
}
return nil
}
type C_G_LogoutResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
}
func (x *C_G_LogoutResponse) Reset() {
*x = C_G_LogoutResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *C_G_LogoutResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*C_G_LogoutResponse) ProtoMessage() {}
func (x *C_G_LogoutResponse) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use C_G_LogoutResponse.ProtoReflect.Descriptor instead.
func (*C_G_LogoutResponse) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{10}
}
func (x *C_G_LogoutResponse) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
//聊天
type C_W_ChatMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
Sender int64 `protobuf:"varint,2,opt,name=Sender,proto3" json:"Sender,omitempty"`
Recver int64 `protobuf:"varint,3,opt,name=Recver,proto3" json:"Recver,omitempty"`
MessageType int32 `protobuf:"varint,4,opt,name=MessageType,proto3" json:"MessageType,omitempty"`
Message string `protobuf:"bytes,5,opt,name=Message,proto3" json:"Message,omitempty"`
}
func (x *C_W_ChatMessage) Reset() {
*x = C_W_ChatMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *C_W_ChatMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*C_W_ChatMessage) ProtoMessage() {}
func (x *C_W_ChatMessage) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use C_W_ChatMessage.ProtoReflect.Descriptor instead.
func (*C_W_ChatMessage) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{11}
}
func (x *C_W_ChatMessage) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *C_W_ChatMessage) GetSender() int64 {
if x != nil {
return x.Sender
}
return 0
}
func (x *C_W_ChatMessage) GetRecver() int64 {
if x != nil {
return x.Recver
}
return 0
}
func (x *C_W_ChatMessage) GetMessageType() int32 {
if x != nil {
return x.MessageType
}
return 0
}
func (x *C_W_ChatMessage) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type W_C_ChatMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PacketHead *Ipacket `protobuf:"bytes,1,opt,name=PacketHead,proto3" json:"PacketHead,omitempty"`
Sender int64 `protobuf:"varint,2,opt,name=Sender,proto3" json:"Sender,omitempty"`
SenderName string `protobuf:"bytes,3,opt,name=SenderName,proto3" json:"SenderName,omitempty"`
Recver int64 `protobuf:"varint,4,opt,name=Recver,proto3" json:"Recver,omitempty"`
RecverName string `protobuf:"bytes,5,opt,name=RecverName,proto3" json:"RecverName,omitempty"`
MessageType int32 `protobuf:"varint,6,opt,name=MessageType,proto3" json:"MessageType,omitempty"`
Message string `protobuf:"bytes,7,opt,name=Message,proto3" json:"Message,omitempty"`
}
func (x *W_C_ChatMessage) Reset() {
*x = W_C_ChatMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *W_C_ChatMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*W_C_ChatMessage) ProtoMessage() {}
func (x *W_C_ChatMessage) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use W_C_ChatMessage.ProtoReflect.Descriptor instead.
func (*W_C_ChatMessage) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{12}
}
func (x *W_C_ChatMessage) GetPacketHead() *Ipacket {
if x != nil {
return x.PacketHead
}
return nil
}
func (x *W_C_ChatMessage) GetSender() int64 {
if x != nil {
return x.Sender
}
return 0
}
func (x *W_C_ChatMessage) GetSenderName() string {
if x != nil {
return x.SenderName
}
return ""
}
func (x *W_C_ChatMessage) GetRecver() int64 {
if x != nil {
return x.Recver
}
return 0
}
func (x *W_C_ChatMessage) GetRecverName() string {
if x != nil {
return x.RecverName
}
return ""
}
func (x *W_C_ChatMessage) GetMessageType() int32 {
if x != nil {
return x.MessageType
}
return 0
}
func (x *W_C_ChatMessage) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type W_C_Test struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Recv []int32 `protobuf:"varint,1,rep,packed,name=Recv,proto3" json:"Recv,omitempty"`
}
func (x *W_C_Test) Reset() {
*x = W_C_Test{}
if protoimpl.UnsafeEnabled {
mi := &file_client_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *W_C_Test) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*W_C_Test) ProtoMessage() {}
func (x *W_C_Test) ProtoReflect() protoreflect.Message {
mi := &file_client_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use W_C_Test.ProtoReflect.Descriptor instead.
func (*W_C_Test) Descriptor() ([]byte, []int) {
return file_client_proto_rawDescGZIP(), []int{13}
}
func (x *W_C_Test) GetRecv() []int32 {
if x != nil {
return x.Recv
}
return nil
}
var File_client_proto protoreflect.FileDescriptor
var file_client_proto_rawDesc = []byte{
0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x11, 0x43, 0x5f, 0x47, 0x5f, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x50,
0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x10, 0x0a,
0x03, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4b, 0x65, 0x79, 0x22,
0x57, 0x0a, 0x11, 0x47, 0x5f, 0x43, 0x5f, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65,
0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20,
0x01, 0x28, 0x03, 0x52, 0x03, 0x4b, 0x65, 0x79, 0x22, 0xae, 0x01, 0x0a, 0x10, 0x43, 0x5f, 0x41,
0x5f, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a,
0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63,
0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12,
0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x42, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x18, 0x06,
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4b, 0x65, 0x79, 0x22, 0x7d, 0x0a, 0x11, 0x41, 0x5f, 0x43,
0x5f, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30,
0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61,
0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64,
0x12, 0x14, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x13, 0x43, 0x5f, 0x41,
0x5f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x30, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49,
0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65,
0x61, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
0x22, 0x5e, 0x0a, 0x14, 0x41, 0x5f, 0x43, 0x5f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a,
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x72,
0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72,
0x22, 0x7d, 0x0a, 0x17, 0x43, 0x5f, 0x57, 0x5f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x50,
0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1e, 0x0a,
0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x53, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x53, 0x65, 0x78, 0x22,
0x7e, 0x0a, 0x18, 0x57, 0x5f, 0x43, 0x5f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6c, 0x61,
0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x50,
0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x14, 0x0a,
0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x45, 0x72,
0x72, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x22,
0x65, 0x0a, 0x15, 0x43, 0x5f, 0x57, 0x5f, 0x47, 0x61, 0x6d, 0x65, 0x5f, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x52, 0x65, 0x71, 0x75, 0x73, 0x65, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a,
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x22, 0x9f, 0x01, 0x0a, 0x18, 0x57, 0x5f, 0x43, 0x5f, 0x53,
0x65, 0x6c, 0x65, 0x63, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65,
0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74,
0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0a, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x22, 0x46, 0x0a, 0x12, 0x43, 0x5f, 0x47, 0x5f,
0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30,
0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61,
0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64,
0x22, 0xaf, 0x01, 0x0a, 0x0f, 0x43, 0x5f, 0x57, 0x5f, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x65,
0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61, 0x63, 0x6b,
0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x16,
0x0a, 0x06, 0x52, 0x65, 0x63, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
0x52, 0x65, 0x63, 0x76, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x22, 0xef, 0x01, 0x0a, 0x0f, 0x57, 0x5f, 0x43, 0x5f, 0x43, 0x68, 0x61, 0x74, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x30, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74,
0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x2e, 0x49, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x0a, 0x50, 0x61,
0x63, 0x6b, 0x65, 0x74, 0x48, 0x65, 0x61, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64,
0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72,
0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x63, 0x76, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x52, 0x65, 0x63, 0x76, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x76,
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x52, 0x65,
0x63, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x22, 0x1e, 0x0a, 0x08, 0x57, 0x5f, 0x43, 0x5f, 0x54, 0x65, 0x73, 0x74,
0x12, 0x12, 0x0a, 0x04, 0x52, 0x65, 0x63, 0x76, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x04,
0x52, 0x65, 0x63, 0x76, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_client_proto_rawDescOnce sync.Once
file_client_proto_rawDescData = file_client_proto_rawDesc
)
func file_client_proto_rawDescGZIP() []byte {
file_client_proto_rawDescOnce.Do(func() {
file_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_client_proto_rawDescData)
})
return file_client_proto_rawDescData
}
var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_client_proto_goTypes = []interface{}{
(*C_G_LoginResquest)(nil), // 0: message.C_G_LoginResquest
(*G_C_LoginResponse)(nil), // 1: message.G_C_LoginResponse
(*C_A_LoginRequest)(nil), // 2: message.C_A_LoginRequest
(*A_C_LoginResponse)(nil), // 3: message.A_C_LoginResponse
(*C_A_RegisterRequest)(nil), // 4: message.C_A_RegisterRequest
(*A_C_RegisterResponse)(nil), // 5: message.A_C_RegisterResponse
(*C_W_CreatePlayerRequest)(nil), // 6: message.C_W_CreatePlayerRequest
(*W_C_CreatePlayerResponse)(nil), // 7: message.W_C_CreatePlayerResponse
(*C_W_Game_LoginRequset)(nil), // 8: message.C_W_Game_LoginRequset
(*W_C_SelectPlayerResponse)(nil), // 9: message.W_C_SelectPlayerResponse
(*C_G_LogoutResponse)(nil), // 10: message.C_G_LogoutResponse
(*C_W_ChatMessage)(nil), // 11: message.C_W_ChatMessage
(*W_C_ChatMessage)(nil), // 12: message.W_C_ChatMessage
(*W_C_Test)(nil), // 13: message.W_C_Test
(*Ipacket)(nil), // 14: message.Ipacket
(*PlayerData)(nil), // 15: message.PlayerData
}
var file_client_proto_depIdxs = []int32{
14, // 0: message.C_G_LoginResquest.PacketHead:type_name -> message.Ipacket
14, // 1: message.G_C_LoginResponse.PacketHead:type_name -> message.Ipacket
14, // 2: message.C_A_LoginRequest.PacketHead:type_name -> message.Ipacket
14, // 3: message.A_C_LoginResponse.PacketHead:type_name -> message.Ipacket
14, // 4: message.C_A_RegisterRequest.PacketHead:type_name -> message.Ipacket
14, // 5: message.A_C_RegisterResponse.PacketHead:type_name -> message.Ipacket
14, // 6: message.C_W_CreatePlayerRequest.PacketHead:type_name -> message.Ipacket
14, // 7: message.W_C_CreatePlayerResponse.PacketHead:type_name -> message.Ipacket
14, // 8: message.C_W_Game_LoginRequset.PacketHead:type_name -> message.Ipacket
14, // 9: message.W_C_SelectPlayerResponse.PacketHead:type_name -> message.Ipacket
15, // 10: message.W_C_SelectPlayerResponse.PlayerData:type_name -> message.PlayerData
14, // 11: message.C_G_LogoutResponse.PacketHead:type_name -> message.Ipacket
14, // 12: message.C_W_ChatMessage.PacketHead:type_name -> message.Ipacket
14, // 13: message.W_C_ChatMessage.PacketHead:type_name -> message.Ipacket
14, // [14:14] is the sub-list for method output_type
14, // [14:14] is the sub-list for method input_type
14, // [14:14] is the sub-list for extension type_name
14, // [14:14] is the sub-list for extension extendee
0, // [0:14] is the sub-list for field type_name
}
func init() { file_client_proto_init() }
func file_client_proto_init() {
if File_client_proto != nil {
return
}
file_message_proto_init()
if !protoimpl.UnsafeEnabled {
file_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*C_G_LoginResquest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*G_C_LoginResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*C_A_LoginRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*A_C_LoginResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*C_A_RegisterRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*A_C_RegisterResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*C_W_CreatePlayerRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*W_C_CreatePlayerResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*C_W_Game_LoginRequset); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*W_C_SelectPlayerResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*C_G_LogoutResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*C_W_ChatMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*W_C_ChatMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_client_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*W_C_Test); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_client_proto_rawDesc,
NumEnums: 0,
NumMessages: 14,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_client_proto_goTypes,
DependencyIndexes: file_client_proto_depIdxs,
MessageInfos: file_client_proto_msgTypes,
}.Build()
File_client_proto = out.File
file_client_proto_rawDesc = nil
file_client_proto_goTypes = nil
file_client_proto_depIdxs = nil
}
|
#!/usr/bin/env bash
set -euo pipefail
shopt -s extglob
fail=0
PUBLISH="false"
REFRESH="false"
DOWNLOAD="false"
NO_GPG="false"
SET_GPG="false"
listPackage=""
deletePackage=""
usage() {
echo -e "usage: $0
--packages-list Specify the Debian packages list file
--codename Specify the codename for the repository (defaults to testing)
--repository Specify the repository (defaults to 'deb http://ftp.de.debian.org/debian testing main')
--download Download the packages from the debian repository
--publish Publish the changes to the repository
--refresh Refresh the repository if files have been added to the pool
--all Download the debian packages, publish them and the sap packages if there are any
--no-gpg Do not use a GPG key
--on-the-fly TODO : generate a repo on the fly
--remove Remove specific package from the repository
--describe Status of package/history
--list=<package> List the package information
--delete=<package> Remove the package from the repository
--gpg-key=<key> Use different GPG key that what is defined in the settings file. Make sure to use with --set-gpg option.
--set-gpg Force a new gpg key to be defined
-h Help usage\n" >&2
}
download_debian() {
local packagesList=$1
local repo=$2
local tmpdir=$(mktemp -d)
trap 'rm -rf ${tmpdir}' RETURN
echo "${repo}" > "${tmpdir}/list"
echo "${repo}" | sed 's/deb /deb-src /' >> "${tmpdir}/list"
mkdir "$tmpdir/lists"
mkdir -p "$tmpdir/cache/partial"
# fix permissions so it can download
chown _apt "$tmpdir"
chown _apt "$tmpdir/lists"
chown _apt "$thisDir/packages/${CODENAME}/main"
apt-get -o Dir::Etc::SourceList="$tmpdir/list" -o Dir::Etc::SourceParts= -o Dir::State::Lists="${tmpdir}/lists" -o Dir::Cache::Archives="${tmpdir}/cache" update
apt-cache -o Dir::Etc::SourceList="$tmpdir/list" -o Dir::Etc::SourceParts= -o Dir::State::Lists="${tmpdir}/lists" -o Dir::Cache::Archives="${tmpdir}/cache" depends $(grep . "${thisDir}/${packagesList}") | awk '$0 ~ /^ Depends: </ {depends=1; next}; /^ / { if (depends == 1) {print $1; next}}; $0 ~ /Depends: / { print $2 }; depends=0' >> "${tmpdir}/packagelistdeps"
cat "${thisDir}"/"${packagesList}" >> "${tmpdir}"/packagelistdeps
(cd "${thisDir}/packages/${CODENAME}/main"; apt-get -o Dir::Etc::SourceList="$tmpdir/list" -o Dir::Etc::SourceParts= -o Dir::State::Lists="${tmpdir}/lists" -o Dir::Cache::Archives="${tmpdir}/cache" download $(sort "${tmpdir}/packagelistdeps" | uniq ))
#ls -latr ${tmpdir}/cache
(cd "${thisDir}/packages/${CODENAME}/source"; apt-get -o Dir::Etc::SourceList="$tmpdir/list" -o Dir::Etc::SourceParts= -o Dir::State::Lists="${tmpdir}/lists" -o Dir::Cache::Archives="${tmpdir}/cache" source --download-only $(sort "${tmpdir}/packagelistdeps" | uniq ))
}
publish() {
for distro in "${thisDir}"/packages/*; do
for component in "${distro}"/*; do
if [[ $(shopt -s nullglob dotglob; f=("${component}"/*); echo ${#f[@]}) -eq 0 ]]; then
echo "nothing to do for $(basename "${distro}")/$(basename "${component}"), skipping"
continue
fi
if [[ $(basename "${component}") == "source" ]]; then
for dsc in "${component}"/*.dsc; do
reprepro -s -b "${thisDir}/reprepro" includedsc "$(basename "${distro}")" "${dsc}"
done
else
reprepro -s -C "$(basename "${component}")" -b "${thisDir}/reprepro" includedeb "$(basename "${distro}")" "${component}"/*.deb
fi
done
done
# sap packages
if [[ $(shopt -s nullglob dotglob; f=("${thisDir}/packages_gardenlinux"/*.deb); echo ${#f[@]}) -ne 0 ]]; then
reprepro -s -C "main" -b "${thisDir}/reprepro" includedeb "${CODENAME}" "${thisDir}/packages_gardenlinux"/!(*@(-dbg_|-dbgsym_)*).deb
reprepro -s -C "main" -b "${thisDir}/reprepro" includedeb "${CODENAME}-debug" "${thisDir}/packages_gardenlinux"/*@(-dbg_|-dbgsym_)*.deb
else
echo "no specific gardenlinux packags found, skipping"
fi
if [[ $(shopt -s nullglob dotglob; f=("${thisDir}/packages_gardenlinux"/*.dsc); echo ${#f[@]}) -ne 0 ]]; then
for dsc in "${thisDir}/packages_gardenlinux"/*.dsc; do
reprepro -s -b "${thisDir}/reprepro" includedsc "${CODENAME}" "${dsc}"
done
else
echo "no specific gardenlinux source packages found, skipping"
fi
reprepro -s -b "${thisDir}/reprepro" createsymlinks
}
refresh() {
echo "Refreshing the repository"
reprepro -b "${thisDir}/reprepro/" export
}
list() {
local package=$1
reprepro -b "${thisDir}/reprepro/" list "${CODENAME}" "$package"
}
delete() {
local package=$1
reprepro -b "${thisDir}/reprepro/" remove "${CODENAME}" "$package"
}
thisDir=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
# shellcheck source=./settings
source "${thisDir}/settings"
# reading commandline parameters
while getopts ":h-:" optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
packages-list=*)
PACKAGES_DEBIAN=${OPTARG#*=}
;;
codename=*)
CODENAME=${OPTARG#*=}
;;
gpg-key=*)
GPG_KEY=${OPTARG#*=}
;;
repository=*)
REPOSITORY=${OPTARG#*=}
;;
list=*)
listPackage=${OPTARG#*=}
;;
delete=*)
deletePackage=${OPTARG#*=}
;;
download)
DOWNLOAD=true
;;
publish)
PUBLISH=true
;;
no-gpg)
NO_GPG=true
;;
set-gpg)
SET_GPG=true
;;
refresh)
REFRESH=true
;;
all)
DOWNLOAD=true
PUBLISH=true
;;
*)
if [ "$OPTERR" = 1 ]; then
echo "Unknown option --${OPTARG}" >&2
fail=1
fi
;;
esac
;;
h)
usage
exit 0
;;
*)
echo "Non-option argument: '-${OPTARG}'" >&2
fail=1
;;
esac
done
[[ ${fail} -eq 1 ]] && usage && exit 1
# signing
if [[ "$NO_GPG" == "true" ]]; then
echo "Removing the signing key from the repository"
distributionsTemp="${thisDir}/reprepro/conf/distributions.tmp"
distributions="${thisDir}/reprepro/conf/distributions"
timestamp=$(date +%s)
cp "$distributions" "${distributions}.${timestamp}"
sed -i '/^SignWith: .*/d' "${thisDir}/reprepro/conf/distributions"
fi
if [[ "$GPG_KEY" != "no" && "$SET_GPG" == "true" ]]; then
echo "Adding signing key for the repository"
distributionsTemp="${thisDir}/reprepro/conf/distributions.tmp"
distributions="${thisDir}/reprepro/conf/distributions"
#if ! gpg --list-secret-keys --keyid-format LONG | grep -qw "$GPG_KEY"; then
# echo "GPG key not in your keyring, exiting"
# exit 1
#fi
# backing up, just in case
timestamp=$(date +%s)
cp "$distributions" "${distributions}.${timestamp}"
sed -i '/^SignWith: .*/d' "${distributions}"
awk -v RS="" -F'\n' -v OFS="\n" -v s="SignWith: ${GPG_KEY}" '{$1=$1;print $0;print s"\n"}' "$distributions" > "$distributionsTemp" | sed -i '${/^$/d;};' "${distributionsTemp}" && mv ${distributionsTemp} ${distributions}
fi
if [[ ${DOWNLOAD} == "true" ]]; then
echo "Downloading needed debian packages"
download_debian "${PACKAGES_DEBIAN}" "${REPOSITORY}"
fi
if [[ ${PUBLISH} == "true" ]]; then
echo "Publishing the needed packages"
publish
fi
if [[ ${REFRESH} == "true" ]]; then
refresh
fi
if [[ ! -z "${listPackage}" ]]; then
list "${listPackage}"
if log=$(grep "${listPackage}" "${thisDir}/reprepro/logs/gardenlinux.log" | tail); then
echo "Last 10 lines of logs relating to this package"
echo "$log"
fi
fi
if [[ ! -z "${deletePackage}" ]]; then
delete "${deletePackage}"
fi
|
<gh_stars>0
require('./bootstrap');
const app = new Vue({
el: '#app',
data: {
msg: 'Click on user from left side:',
content: '',
privsteMsgs: [],
singleMsgs: [],
msgFrom: '',
conID: '',
friend_id: '',
seen: false,
newMsgFrom: ''
},
ready: function(){
this.created();
},
created(){
axios.get('http://localhost/Social-Network/index.php/getMessages')
.then(response => {
console.log(response.data); // show if success
app.privsteMsgs = response.data; //we are putting data into our posts array
})
.catch(function (error) {
console.log(error); // run if we have error
});
},
methods:{
messages: function(id){
axios.get('http://localhost/Social-Network/index.php/getMessages/' + id)
.then(response => {
console.log(response.data); // show if success
app.singleMsgs = response.data; //we are putting data into our posts array
app.conID = response.data[0].conversation_id
})
.catch(function (error) {
console.log(error); // run if we have error
});
},
inputHandler(e){
if(e.keyCode ===13 && !e.shiftKey){
e.preventDefault();
this.sendMsg();
}
},
sendMsg(){
if(this.msgFrom){
axios.post('http://localhost/Social-Network/index.php/sendMessage', {
conID: this.conID,
msg: this.msgFrom
})
.then( (response) => {
console.log(response.data); // show if success
if(response.status===200){
app.singleMsgs = response.data;
}
})
.catch(function (error) {
console.log(error); // run if we have error
});
}
},
friendID: function(id){
app.friend_id = id;
},
sendNewMsg(){
axios.post('http://localhost/Social-Network/index.php/sendNewMessage', {
friend_id: this.friend_id,
msg: this.newMsgFrom,
})
.then(function (response) {
console.log(response.data); // show if success
if(response.status===200){
window.location.replace('http://localhost/Social-Network/index.php/messages');
app.msg = 'your message has been sent successfully';
}
})
.catch(function (error) {
console.log(error); // run if we have error
});
}
}
});
|
#!/usr/bin/env bash
set -x
echo "Deploying cassandra configs files"
sudo cp ~/provisioning/cassandra/conf/* /etc/cassandra/
export PRIVATE_IP="$(curl http://169.254.169.254/latest/meta-data/local-ipv4)"
echo "Fixing yaml to use private ip (${PRIVATE_IP}) for address settings instead of localhost"
CASSANDRA_YAML_SETTINGS="$( cat <<EOF
listen_address: $PRIVATE_IP
rpc_address:$PRIVATE_IP
broadcast_address:$PRIVATE_IP
EOF
)"
# replace anything _address with this ip
# messing with my regex will only bring you pain
sudo sed -i -e "s/^\([^#]*_address:\).*/\1 ${PRIVATE_IP} /g" /etc/cassandra/cassandra.yaml
sudo chown -R cassandra:cassandra /var/lib/cassandra |
#!/bin/sh
ctags \
core/*.cpp \
core/*.h \
core/*.hpp \
plugins/*.cpp \
plugins/*.h |
#!/bin/bash
# define variables
LOG_FILE="/var/log/apache2/access.log"
TO_EMAIL="admin@example.com"
# process the logfile
grep -q "error" $LOG_FILE
if [ $? -eq 0 ]
then
echo "An error was found in the logs." | mail -s "Error log alert" $TO_EMAIL
fi |
#!/usr/bin/env bash
function dump_pod_data {
workspace_pod_name=$1
dump_dest=$2
workspace_id=$(echo ${workspace_pod_name} | awk -F"." '{ print $1}')
cp_pod_data "${PRODUCT_NAMESPACE_PREFIX}codeready/${workspace_pod_name}:/projects" "${dump_dest}/${workspace_id}"
}
function component_dump_data {
local pods="$(oc get pods -n ${PRODUCT_NAMESPACE_PREFIX}codeready | grep workspace | awk '{print $1}')"
if [ "${#pods}" -eq "0" ]; then
echo "=>> No workspaces found to backup"
exit 0
fi
local archive_path="$1/archives"
local dump_dest="/tmp/codeready-data"
mkdir -p $dump_dest
for pod in $pods; do dump_pod_data $pod $dump_dest; done
local ts=$(date '+%H_%M_%S')
tar -zcvf "$archive_path/codeready-pv-data-${ts}.tar.gz" -C "${dump_dest}" .
} |
# Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1
module Rubinius
class Mirror
class Range < Mirror
# Rubinius's definition for the `excl` method relies on its internal object representation. We use a different
# representation, so we must override the method with a compatible implementation.
def excl
@object.exclude_end?
end
end
end
end
|
#!/usr/bin/env bash
start_time=`date +%Y%m%d%H%M%S`
echo "start ${start_time}--------------------------------------------------"
gpu_card=$1
shift
export CUDA_VISIBLE_DEVICES=${gpu_card}
#export LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH"
#export PATH="/usr/local/cuda-10.0/bin:$PATH"
python=python
export LANG="zh_CN.UTF-8"
CUR_DIR=`pwd`
ROOT=${CUR_DIR}
export PYTHONPATH=${ROOT}:${PYTHONPATH}
for i in `seq 0 4`
do
${python} $@ --current_run $i
done
end_time=`date +%Y%m%d%H%M%S`
echo ${end_time}
|
// @flow
import task from './task';
import yargs, { argv } from 'yargs';
import execa from 'execa';
import chalk from 'chalk';
import inquirerRobot from './tool/inquirer';
export async function run() {
if (Object.keys(argv).length > 2) {
console.log('\nUsage: serverless-express-starter <command>\n');
console.log('where <command> is one of:\n');
yargs.showHelp();
return;
}
if (!isRequiredToolHasInstalled()) {
return;
}
await initProject();
}
export async function initProject() {
await inquirerRobot.run();
if (inquirerRobot.name.trim().length === 0) {
console.log(chalk.red('Please enter the project name.'));
return;
}
await task.createFiles(inquirerRobot);
await task.installPackages(inquirerRobot);
await task.runExtraSettings(inquirerRobot);
task.showCompleteMessages();
}
function isRequiredToolHasInstalled(): boolean {
try {
execa.shellSync('which git');
} catch (error) {
console.log(chalk.red('serverless-express-started need to install git.'));
return false;
}
return true;
} |
<filename>torch2trt/handlers/constant.py<gh_stars>10-100
import tensorrt as trt
import torch
from torch2trt.core import (current_context, has_trt_tensor,
register_node_handler)
from torch2trt.utils import print_inputs
@register_node_handler("prim::Constant")
def prim_constant(inputs, attributes, scope):
if "value" not in attributes:
return [None]
return [attributes["value"]]
@register_node_handler("prim::ListConstruct")
def prim_list_construct(inputs, attributes, scope):
return [list(inputs)]
@register_node_handler("prim::TupleConstruct")
def prim_tuple_construct(inputs, attributes, scope):
return [tuple(inputs)]
@register_node_handler("prim::NumToTensor")
def prim_num_to_tensor(inputs, attributes, scope):
return [inputs[0]]
@register_node_handler("prim::Int")
def prim_int(inputs, attributes, scope):
return [int(inputs[0])]
@register_node_handler("aten::Int")
def aten_int(inputs, attributes, scope):
return [int(inputs[0])]
@register_node_handler("aten::to")
def aten_to(inputs, attributes, scope):
inp, dst = inputs[:2]
net = current_context().network
if net is not None and has_trt_tensor(inputs):
raise NotImplementedError
res = inp.to(dst)
if hasattr(inp, "__torch2trt_weight_name"):
res.__torch2trt_weight_name = inp.__torch2trt_weight_name
return [res]
@register_node_handler("aten::detach")
def aten_detach(inputs, attributes, scope):
inp = inputs[0]
net = current_context().network
if net is not None and has_trt_tensor(inputs):
raise NotImplementedError
return [inp.detach()]
@register_node_handler("aten::t")
def aten_t(inputs, attributes, scope):
inp = inputs[0]
# weights in nn.Linear use this.
assert isinstance(inp, torch.Tensor), "don't support this in tensorrt"
res = inputs[0].t()
if hasattr(inp, "__torch2trt_weight_name"):
res.__torch2trt_weight_name = inp.__torch2trt_weight_name
return [res]
@register_node_handler("prim::ListUnpack")
def prim_list_unpack(inputs, attributes, scope):
return [*inputs[0]]
@register_node_handler("prim::GetAttr")
def prim_get_attr(inputs, attributes, scope):
attr_name = attributes["name"]
attr = getattr(inputs[0], attr_name)
ctx = current_context()
if isinstance(attr, torch.Tensor):
attr.__torch2trt_weight_name = scope
ctx.torch_weight_nodes_dict[scope] = attr
return [attr]
|
<reponame>krishnakumar24/swiper
import classesToSelector from '../../shared/classes-to-selector.js';
import $ from '../../shared/dom.js';
export default function A11y({ swiper, extendParams, on }) {
extendParams({
a11y: {
enabled: true,
notificationClass: 'swiper-notification',
prevSlideMessage: 'Previous slide',
nextSlideMessage: 'Next slide',
firstSlideMessage: 'This is the first slide',
lastSlideMessage: 'This is the last slide',
paginationBulletMessage: 'Go to slide {{index}}',
slideLabelMessage: '{{index}} / {{slidesLength}}',
containerMessage: null,
containerRoleDescriptionMessage: null,
itemRoleDescriptionMessage: null,
slideRole: 'group',
id: null,
},
});
let liveRegion = null;
function notify(message) {
const notification = liveRegion;
if (notification.length === 0) return;
notification.html('');
notification.html(message);
}
function getRandomNumber(size = 16) {
const randomChar = () => Math.round(16 * Math.random()).toString(16);
return 'x'.repeat(size).replace(/x/g, randomChar);
}
function makeElFocusable($el) {
$el.attr('tabIndex', '0');
}
function makeElNotFocusable($el) {
$el.attr('tabIndex', '-1');
}
function addElRole($el, role) {
$el.attr('role', role);
}
function addElRoleDescription($el, description) {
$el.attr('aria-roledescription', description);
}
function addElControls($el, controls) {
$el.attr('aria-controls', controls);
}
function addElLabel($el, label) {
$el.attr('aria-label', label);
}
function addElId($el, id) {
$el.attr('id', id);
}
function addElLive($el, live) {
$el.attr('aria-live', live);
}
function disableEl($el) {
$el.attr('aria-disabled', true);
}
function enableEl($el) {
$el.attr('aria-disabled', false);
}
function onEnterOrSpaceKey(e) {
if (e.keyCode !== 13 && e.keyCode !== 32) return;
const params = swiper.params.a11y;
const $targetEl = $(e.target);
if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) {
if (!(swiper.isEnd && !swiper.params.loop)) {
swiper.slideNext();
}
if (swiper.isEnd) {
notify(params.lastSlideMessage);
} else {
notify(params.nextSlideMessage);
}
}
if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) {
if (!(swiper.isBeginning && !swiper.params.loop)) {
swiper.slidePrev();
}
if (swiper.isBeginning) {
notify(params.firstSlideMessage);
} else {
notify(params.prevSlideMessage);
}
}
if (
swiper.pagination &&
$targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))
) {
$targetEl[0].click();
}
}
function updateNavigation() {
if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;
const { $nextEl, $prevEl } = swiper.navigation;
if ($prevEl && $prevEl.length > 0) {
if (swiper.isBeginning) {
disableEl($prevEl);
makeElNotFocusable($prevEl);
} else {
enableEl($prevEl);
makeElFocusable($prevEl);
}
}
if ($nextEl && $nextEl.length > 0) {
if (swiper.isEnd) {
disableEl($nextEl);
makeElNotFocusable($nextEl);
} else {
enableEl($nextEl);
makeElFocusable($nextEl);
}
}
}
function hasPagination() {
return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;
}
function hasClickablePagination() {
return hasPagination() && swiper.params.pagination.clickable;
}
function updatePagination() {
const params = swiper.params.a11y;
if (!hasPagination()) return;
swiper.pagination.bullets.each((bulletEl) => {
const $bulletEl = $(bulletEl);
if (swiper.params.pagination.clickable) {
makeElFocusable($bulletEl);
if (!swiper.params.pagination.renderBullet) {
addElRole($bulletEl, 'button');
addElLabel(
$bulletEl,
params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1),
);
}
}
if ($bulletEl.is(`.${swiper.params.pagination.bulletActiveClass}`)) {
$bulletEl.attr('aria-current', 'true');
} else {
$bulletEl.removeAttr('aria-current');
}
});
}
const initNavEl = ($el, wrapperId, message) => {
makeElFocusable($el);
if ($el[0].tagName !== 'BUTTON') {
addElRole($el, 'button');
$el.on('keydown', onEnterOrSpaceKey);
}
addElLabel($el, message);
addElControls($el, wrapperId);
};
const handleFocus = (e) => {
const slideEl = e.target.closest(`.${swiper.params.slideClass}`);
if (!slideEl || !swiper.slides.includes(slideEl)) return;
const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
const isVisible =
swiper.params.watchSlidesProgress &&
swiper.visibleSlides &&
swiper.visibleSlides.includes(slideEl);
if (isActive || isVisible) return;
swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
};
const initSlides = () => {
const params = swiper.params.a11y;
if (params.itemRoleDescriptionMessage) {
addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage);
}
addElRole($(swiper.slides), params.slideRole);
const slidesLength = swiper.params.loop
? swiper.slides.filter((el) => !el.classList.contains(swiper.params.slideDuplicateClass))
.length
: swiper.slides.length;
if (params.slideLabelMessage) {
swiper.slides.each((slideEl, index) => {
const $slideEl = $(slideEl);
const slideIndex = swiper.params.loop
? parseInt($slideEl.attr('data-swiper-slide-index'), 10)
: index;
const ariaLabelMessage = params.slideLabelMessage
.replace(/\{\{index\}\}/, slideIndex + 1)
.replace(/\{\{slidesLength\}\}/, slidesLength);
addElLabel($slideEl, ariaLabelMessage);
});
}
};
const init = () => {
const params = swiper.params.a11y;
swiper.$el.append(liveRegion);
// Container
const $containerEl = swiper.$el;
if (params.containerRoleDescriptionMessage) {
addElRoleDescription($containerEl, params.containerRoleDescriptionMessage);
}
if (params.containerMessage) {
addElLabel($containerEl, params.containerMessage);
}
// Wrapper
const $wrapperEl = swiper.$wrapperEl;
const wrapperId = params.id || $wrapperEl.attr('id') || `swiper-wrapper-${getRandomNumber(16)}`;
const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';
addElId($wrapperEl, wrapperId);
addElLive($wrapperEl, live);
// Slide
initSlides();
// Navigation
let $nextEl;
let $prevEl;
if (swiper.navigation && swiper.navigation.$nextEl) {
$nextEl = swiper.navigation.$nextEl;
}
if (swiper.navigation && swiper.navigation.$prevEl) {
$prevEl = swiper.navigation.$prevEl;
}
if ($nextEl && $nextEl.length) {
initNavEl($nextEl, wrapperId, params.nextSlideMessage);
}
if ($prevEl && $prevEl.length) {
initNavEl($prevEl, wrapperId, params.prevSlideMessage);
}
// Pagination
if (hasClickablePagination()) {
swiper.pagination.$el.on(
'keydown',
classesToSelector(swiper.params.pagination.bulletClass),
onEnterOrSpaceKey,
);
}
// Tab focus
swiper.$el.on('focus', handleFocus, true);
};
function destroy() {
if (liveRegion && liveRegion.length > 0) liveRegion.remove();
let $nextEl;
let $prevEl;
if (swiper.navigation && swiper.navigation.$nextEl) {
$nextEl = swiper.navigation.$nextEl;
}
if (swiper.navigation && swiper.navigation.$prevEl) {
$prevEl = swiper.navigation.$prevEl;
}
if ($nextEl) {
$nextEl.off('keydown', onEnterOrSpaceKey);
}
if ($prevEl) {
$prevEl.off('keydown', onEnterOrSpaceKey);
}
// Pagination
if (hasClickablePagination()) {
swiper.pagination.$el.off(
'keydown',
classesToSelector(swiper.params.pagination.bulletClass),
onEnterOrSpaceKey,
);
}
// Tab focus
swiper.$el.off('focus', handleFocus, true);
}
on('beforeInit', () => {
liveRegion = $(
`<span class="${swiper.params.a11y.notificationClass}" aria-live="assertive" aria-atomic="true"></span>`,
);
});
on('afterInit', () => {
if (!swiper.params.a11y.enabled) return;
init();
});
on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => {
if (!swiper.params.a11y.enabled) return;
initSlides();
});
on('fromEdge toEdge afterInit lock unlock', () => {
if (!swiper.params.a11y.enabled) return;
updateNavigation();
});
on('paginationUpdate', () => {
if (!swiper.params.a11y.enabled) return;
updatePagination();
});
on('destroy', () => {
if (!swiper.params.a11y.enabled) return;
destroy();
});
}
|
from django.conf import settings
from django.test.runner import DiscoverRunner as BaseDiscoverRunner
class DiscoverRunner(BaseDiscoverRunner):
def setup_test_environment(self, **kwargs):
super().setup_test_environment(**kwargs)
# ManifestStaticFileStorage & friends are not well-suited for tests, as they would required
# collectstatic to be run before each test run
settings.STATICFILES_STORAGE = (
"django.contrib.staticfiles.storage.StaticFilesStorage"
)
|
module Fog
module Compute
class Linode
class Real
def linode_ip_list(linode_id, ip_id=nil)
options = {}
if ip_id
options.merge!(:ipaddressId => ip_id)
end
request(
:expects => 200,
:method => 'GET',
:query => { :api_action => 'linode.ip.list', :linodeId => linode_id }.merge!(options)
)
end
end
class Mock
def linode_ip_list(linode_id, ip_id=nil)
response = Excon::Response.new
response.status = 200
body = {
"ERRORARRAY" => [],
"ACTION" => "linode.ip.list"
}
if ip_id
# one IP
mock_ip = create_mock_ip(ip_id)
response.body = body.merge("DATA" => [mock_ip])
else
# all IPs
mock_ips = []
ip_id = rand(10000..99999)
mock_ips << create_mock_ip(linode_id, ip_id)
ip_id = rand(10000..99999)
mock_ips << create_mock_ip(linode_id, ip_id, false)
response.body = body.merge("DATA" => mock_ips)
end
response
end
private
def create_mock_ip(linode_id, ip_id, is_public=true)
{
"IPADDRESSID" => ip_id,
"RDNS_NAME" => "li-test.members.linode.com",
"LINODEID" => linode_id,
"ISPUBLIC" => is_public ? 1 : 0,
"IPADDRESS" => is_public ? "172.16.58.3" : "192.168.1.2"
}
end
end
end
end
end
|
import * as Crypto from 'crypto';
export default class Aes128 {
private config:any = {};
public key:string;
public iv:string;
init() {
this.key = this.config.key;
this.iv = this.config.iv;
if( !this.key ) throw new Error( '<Aes128.key> is not configured' );
if( undefined === this.iv ) throw new Error( '<Aes128.iv> is not configured' );
}
/**
*
*/
encrypt( input:string, encode:string ) {
if( !encode ) encode = 'base64';
const cipher = Crypto.createCipheriv( 'aes-128-ecb', this.key, this.iv );
let result = (<any>cipher).update( input, 'utf8', encode );
result += cipher.final(encode);
return result;
}
/**
*
*/
decrypt( encrypted:string, encode:string ) {
if( !encode ) encode = 'base64';
const decipher = Crypto.createDecipheriv('aes-128-ecb', this.key, this.iv);
let result:string = (<any>decipher).update(encrypted, encode, 'utf8');
result += decipher.final('utf8');
return result;
}
}
|
#!/bin/bash
# Original: https://gist.github.com/woowa-hsw0/caa3340e2a7b390dbde81894f73e379d
set -eu
umask 0022
TMPDIR=$(mktemp -d awsenv)
echo "TEMPDIR $TMPDIR"
if [[ $# -ge 1 ]]; then
AWS_PROFILE="$1"
else
read -p 'Enter AWS_PROFILE: ' AWS_PROFILE
fi
caller_identity=($(aws --profile "$AWS_PROFILE" sts get-caller-identity --output text))
AWS_ACCOUNT_NUMBER="${caller_identity[0]}"
AWS_IAM_USER_ARN="${caller_identity[1]}"
AWS_IAM_USERNAME="$(basename "$AWS_IAM_USER_ARN")"
MFA_SERIAL="arn:aws:iam::$AWS_ACCOUNT_NUMBER:mfa/$AWS_IAM_USERNAME"
echo "AWS Account number: $AWS_ACCOUNT_NUMBER"
echo "IAM Username: $AWS_IAM_USERNAME"
echo "MFA Serial: $MFA_SERIAL"
if ykman oath info > "$TMPDIR/yk-oath-info" 2>&1 ; then
echo "Trying to read MFA code from Yubikey."
cat "$TMPDIR/yk-oath-info"
rm -f "$TMPDIR/yk-oath-info"
ykman oath code "$AWS_PROFILE" 2>&1 | tee "$TMPDIR/yk-mfa-code"
# take the last field, the name of the MFA token can contain spaces (Amazon Web Services ...)
otp_token=$(grep -F "$AWS_PROFILE" "$TMPDIR/yk-mfa-code" | rev | cut -d' ' -f1 |rev)
echo "TOKEN $otp_token"
rm -f "$TMPDIR/yk-mfa-code"
[[ -z "$otp_token" ]] && exit 1
else
read -p 'Enter MFA code: ' otp_token
fi
session_token=($(aws --profile "$AWS_PROFILE" sts get-session-token --serial-number $MFA_SERIAL --token-code $otp_token --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' --output text))
export AWS_ACCESS_KEY_ID="${session_token[0]}" AWS_SECRET_ACCESS_KEY="${session_token[1]}" AWS_SESSION_TOKEN="${session_token[2]}"
aws sts get-caller-identity
rm -Rf "$TMPDIR"
echo "All set, aws configured"
|
<reponame>constmoon/constmoon.github.io
import React from "react"
import { Helmet } from "react-helmet"
import { graphql } from "gatsby"
import Layout from "@components/layout"
import SEO from "@components/seo"
import "@styles/project.scss"
export default function projectTemplate({ data }) {
const { markdownRemark: post } = data
const tags = post.frontmatter.tags || []
return (
<Layout>
<SEO
title={post.frontmatter.title}
description={post.excerpt}
/>
<div className="project-container">
<h1 className="project-title">{post.frontmatter.title}</h1>
<div
className="project-content"
dangerouslySetInnerHTML={{ __html: post.html }}
/>
</div>
</Layout>
)
}
export const pageQuery = graphql`
query ProjectPostByPath($path: String!) {
site {
siteMetadata {
title
author
}
}
markdownRemark(frontmatter: {path: {eq: $path}}) {
html
frontmatter {
date(formatString: "YYYY-MM-DD")
path
title
}
excerpt(pruneLength: 200)
}
}
` |
<reponame>arh-space/twitter_autobase
consumer_key = "uDrDG2SK8erM7uj0X9qfiKDTm"
consumer_secret = "<KEY>"
access_token = "<KEY>"
access_token_secret = "<KEY>"
trigger = "TDB"
timezone = 7 #change this into your timezone. for example if your timezone is GMT+7 you put 7
|
<reponame>rhnvrm/mini-projects
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hello;
import java.io.IOException;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* @author rhnvrm
*/
public class Midlet extends MIDlet implements CommandListener{
private Form f;
private Display display;
private Command send;
private Command exit;
private Client client;
public class Client implements Runnable {
private boolean quit = false;
public void run() {
while (!quit) {
try {
DatagramConnection dgc = (DatagramConnection) Connector.open("datagram://localhost:9001");
try {
byte[] payload = "Test Message".getBytes();
Datagram datagram =
dgc.newDatagram(payload, payload.length);
dgc.send(datagram);
int size = 100;
Datagram datagram_r = dgc.newDatagram(size);
dgc.receive(datagram_r);
f.append(
new String(datagram_r.getData()).trim());
} finally {
dgc.close();
}
} catch (IOException x) {
x.printStackTrace();
}
}
}
public void quit() {
quit = true;
}
}
public void startApp() {
f = new Form("Client");
display=Display.getDisplay(this);
send = new Command("Send", Command.OK, 0);
exit = new Command("Exit", Command.EXIT, 0);
f.addCommand(exit);
f.addCommand(send);
f.setCommandListener(this);
display.setCurrent(f);
}
public void pauseApp() {
}
public void commandAction(Command c, Displayable d){
if(c==send){
client = new Client();
Thread serverThread = new Thread(client);
serverThread.start();
}
if(c == exit){
client.quit();
destroyApp(true);
}
}
public void destroyApp(boolean unconditional){
notifyDestroyed();
}
} |
<gh_stars>0
package org.endeavourhealth.datasetmanager.api.json;
public class JsonDatasetFields {
private String header = null;
private int index;
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}
|
<filename>src/include/axi4_configs_extra.h
#ifndef __AXI_CONFIG_DUTH_H__
#define __AXI_CONFIG_DUTH_H__
namespace axi {
// Extension of Matchlib AXI configuration
namespace cfg {
/**
* \brief A standard AXI configuration with SIZE field.
*/
struct standard_duth {
enum {
useACE = 0,
dataWidth = 64,
useVariableBeatSize = 1,
useMisalignedAddresses = 0,
useLast = 1,
useWriteStrobes = 1,
useBurst = 1, useFixedBurst = 1, useWrapBurst = 0, maxBurstSize = 256,
useQoS = 0, useLock = 0, useProt = 0, useCache = 0, useRegion = 0,
aUserWidth = 0, wUserWidth = 0, bUserWidth = 0, rUserWidth = 0,
addrWidth = 32,
idWidth = 4,
useWriteResponses = 1,
};
};
struct standard_duth_128 {
enum {
useACE = 0,
dataWidth = 128,
useVariableBeatSize = 1,
useMisalignedAddresses = 0,
useLast = 1,
useWriteStrobes = 1,
useBurst = 1, useFixedBurst = 1, useWrapBurst = 0, maxBurstSize = 256,
useQoS = 0, useLock = 0, useProt = 0, useCache = 0, useRegion = 0,
aUserWidth = 0, wUserWidth = 0, bUserWidth = 0, rUserWidth = 0,
addrWidth = 32,
idWidth = 4,
useWriteResponses = 1,
};
};
/**
* \brief ACE enabled, AXI configuration.
*/
struct ace {
enum {
useACE = 1,
CacheLineWidth = 64, // bits
dataWidth = 64,
useVariableBeatSize = 1,
useMisalignedAddresses = 0,
useLast = 1,
useWriteStrobes = 1,
useBurst = 1, useFixedBurst = 1, useWrapBurst = 0, maxBurstSize = 256,
useQoS = 0, useLock = 0, useProt = 0, useCache = 0, useRegion = 0,
aUserWidth = 0, wUserWidth = 0, bUserWidth = 0, rUserWidth = 0,
addrWidth = 32,
idWidth = 4,
useWriteResponses = 1,
};
};
}; // namespace cfg
}; // namespace axi
#endif
|
import axios, { AxiosError } from 'axios';
const axiosInstance = axios.create({
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
});
// axiosInstance.interceptors.request.use(onSuccess, onError);
// axiosInstance.interceptors.response.use(onSuccess, onError);
export const getAxiosErrorMessage = (error: AxiosError): string => {
return (error as any).response?.data?.message || error.message;
};
export default axiosInstance;
|
<filename>src/main/java/models/Team.java
package models;
import java.util.Objects;
public class Team {
private String teamName;
private String teamDescription;
private int id;
public Team() {
this.teamName = teamName;
this.teamDescription = teamDescription;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) { this.teamName = teamName; }
public String getTeamDescription() { return teamDescription; }
public void setTeamDescription(String teamDescription) { this.teamDescription = teamDescription; }
public int getId() { return id; }
public void setId(int id) { this.id = id; }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Team team = (Team) o;
return id == team.id &&
Objects.equals(teamName, team.teamName) &&
Objects.equals(teamDescription, team.teamDescription);
}
@Override
public int hashCode() {
return Objects.hash(teamName, teamDescription, id);
}
}
|
<gh_stars>10-100
// vue-shim.d.ts
declare module '*.vue' {
import { ComponentPublicInstance } from '@vue/runtime-dom'
const app: new () => ComponentPublicInstance
export default app
}
|
import { ApiProperty, ApiPropertyOptional, PickType, IntersectionType } from '@nestjs/swagger'
import { IsNotEmpty, IsNumber } from 'class-validator'
import { IsOptional } from '@/decorator/common.decorator'
import { Type, Transform } from 'class-transformer'
import { toArrayNumber } from '@/utils/validate'
export class MenuResponse {
@ApiProperty({ description: '节点id', example: 1 })
id: number
@ApiProperty({ description: '节点类型: 1.目录 2.菜单 3.权限', enum: [1, 2], example: 1 })
type: number
@ApiProperty({ description: '节点名称', example: '工作台' })
name: string
@ApiPropertyOptional({ description: '上级节点' })
parent: MenuResponse
@ApiPropertyOptional({ description: '节点路由' })
router: string
@ApiPropertyOptional({ description: '路由缓存: 0.关闭 1.开启', enum: [0, 1], example: 1 })
keepAlive: number
@ApiPropertyOptional({ description: '是否可见: 0.隐藏 1.显示', enum: [0, 1], example: 1 })
visible: number
@ApiPropertyOptional({ description: '节点状态: 0.禁用 1.启用 2.删除', enum: [0, 1, 2], example: 1 })
status: number
@ApiPropertyOptional({ description: '文件路径' })
path: string
@ApiPropertyOptional({ description: '节点图标' })
icon: string
@ApiPropertyOptional({ description: '排序号', example: 0 })
order: number
@ApiPropertyOptional({ description: '节点权限', type: [], example: [] })
role: any[]
@ApiProperty({ description: '节点子集', type: [MenuResponse], example: [] })
children: MenuResponse[]
}
export class MenuParameter {
@ApiProperty({ description: '节点id', example: 1 })
@IsNotEmpty({ message: '节点id 必填' })
@Type(type => Number)
id: number
@ApiProperty({ description: '节点类型: 1.目录 2.菜单 3.权限', enum: [1, 2], example: 1 })
@IsNotEmpty({ message: '节点类型 必填' })
@Type(type => Number)
type: number
@ApiProperty({ description: '节点名称', example: '工作台' })
@IsNotEmpty({ message: '节点名称 必填' })
name: string
@ApiPropertyOptional({ description: '上级节点' })
@IsOptional({}, { string: true, number: true })
@Type(type => Number)
parent: number
@ApiPropertyOptional({ description: '节点路由' })
@IsOptional({}, { string: true, number: true })
router: string
@ApiPropertyOptional({ description: '路由缓存: 0.关闭 1.开启', enum: [0, 1] })
@IsOptional({}, { string: true, number: true })
@Type(type => Number)
keepAlive: number
@ApiPropertyOptional({ description: '是否可见: 0.隐藏 1.显示', enum: [0, 1], example: 1 })
@IsOptional({}, { string: true, number: true })
@Type(type => Number)
visible: number
@ApiPropertyOptional({ description: '节点状态: 0.隐藏 1.显示', enum: [0, 1] })
@IsOptional({}, { string: true, number: true })
@Type(type => Number)
status: number
@ApiPropertyOptional({ description: '文件路径' })
@IsOptional({}, { string: true, number: true })
path: string
@ApiPropertyOptional({ description: '节点图标' })
@IsOptional({}, { string: true, number: true })
icon: string
@ApiPropertyOptional({ description: '排序号' })
@IsOptional({}, { string: true })
@Type(type => Number)
order: number
@ApiProperty({ description: '节点权限' })
@Transform(type => toArrayNumber(type), { toClassOnly: true })
@IsNumber({}, { each: true, message: '权限id 必须为Array<number>' })
role: number[]
@ApiPropertyOptional({ description: '权限' })
@IsOptional({}, { string: true, number: true })
permission: string
}
/**
*
*
* 创建菜单-Parameter
*************************************************************************************************/
export class NodeCreateMenuParameter extends IntersectionType(
PickType(MenuParameter, ['type', 'name', 'parent', 'router', 'role']),
PickType(MenuParameter, ['keepAlive', 'visible', 'path', 'icon', 'order'])
) {}
/**创建菜单-Response**/
export class NodeCreateMenuResponse {
@ApiProperty({ description: 'message', example: '创建成功' })
message: string
}
/**
*
*
* 获取节点目录-Response
*************************************************************************************************/
export class NodeMenuConterResponse {
@ApiProperty({ description: '节点目录列表', type: [MenuResponse], example: [] })
list: MenuResponse[]
}
/**
*
*
* 动态路由节点-Response
*************************************************************************************************/
export class NodeRouterResponse {
@ApiProperty({ description: '动态路由节点列表', type: [MenuResponse], example: [] })
list: MenuResponse[]
}
/**
*
*
* 角色菜单-Response
*************************************************************************************************/
export class NodeRoleMenusResponse {
@ApiProperty({ description: '角色菜单列表', type: [MenuResponse], example: [] })
list: MenuResponse[]
}
/**
*
*
* 菜单列表-Response
*************************************************************************************************/
export class NodeMenusResponse {
@ApiProperty({ description: '菜单列表', type: [MenuResponse], example: [] })
list: MenuResponse[]
}
/**
*
*
* 菜单信息-Parameter
*************************************************************************************************/
export class NodeMenuParameter extends PickType(MenuParameter, ['id']) {}
export class NodeMenuResponse extends MenuResponse {}
/**
*
*
* 修改菜单-Parameter
*************************************************************************************************/
export class NodeUpdateParameter extends IntersectionType(
PickType(MenuParameter, ['id', 'type', 'name', 'parent', 'router', 'role']),
PickType(MenuParameter, ['keepAlive', 'visible', 'path', 'icon', 'order'])
) {}
/** 修改菜单-Response**/
export class NodeUpdateResponse {
@ApiProperty({ description: 'message', example: '修改成功' })
message: string
}
/**
*
*
* 切换菜单状态-Parameter
*************************************************************************************************/
export class NodeMenuCutoverParameter extends PickType(MenuParameter, ['id']) {}
/** 切换菜单状态-Response**/
export class NodeMenuCutoverResponse {
@ApiProperty({ description: 'message', example: '修改成功' })
message: string
}
/**
*
*
* 删除菜单-Parameter
*************************************************************************************************/
export class NodeDeleteMenuParameter extends PickType(MenuParameter, ['id']) {}
/** 修改菜单-Response**/
export class NodeDeleteMenuResponse {
@ApiProperty({ description: 'message', example: '删除成功' })
message: string
}
|
DELETE FROM records WHERE timestamp < DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 WEEK); |
<gh_stars>0
#include <iostream>
using namespace std;
class A
{
public:
void display()
{
cout<<"Base class content.\n";
}
};
class B : public A { };
class C : public B { };
int main (int argc, char**argv)
{
cout << "\n" << argv[0] << "\n" << "\n";
C c;
c.display();
return 0;
}
|
#!/usr/bin/env python
import vtk
# Create image 1
source1 = vtk.vtkImageMandelbrotSource()
source1.SetWholeExtent(0, 255, 0, 255, 0, 0)
source1.Update()
source1Double = vtk.vtkImageCast()
source1Double.SetInputConnection(0, source1.GetOutputPort())
source1Double.SetOutputScalarTypeToDouble()
# Create image 2
source2 = vtk.vtkImageSinusoidSource()
source2.SetWholeExtent(0, 255, 0, 255, 0, 0)
source2.Update()
# Do the sum
sumFilter = vtk.vtkImageWeightedSum()
sumFilter.SetWeight(0, 0.8)
sumFilter.SetWeight(1, 0.2)
sumFilter.AddInputConnection(source1Double.GetOutputPort())
sumFilter.AddInputConnection(source2.GetOutputPort())
sumFilter.Update()
# Display the images
source1CastFilter = vtk.vtkImageCast()
source1CastFilter.SetInputConnection(source1.GetOutputPort())
source1CastFilter.SetOutputScalarTypeToUnsignedChar()
source1CastFilter.Update()
source2CastFilter = vtk.vtkImageCast()
source2CastFilter.SetInputConnection(source2.GetOutputPort())
source2CastFilter.SetOutputScalarTypeToUnsignedChar()
source2CastFilter.Update()
summedCastFilter = vtk.vtkImageCast()
summedCastFilter.SetInputConnection(sumFilter.GetOutputPort())
summedCastFilter.SetOutputScalarTypeToUnsignedChar()
summedCastFilter.Update()
# Create actors
source1Actor = vtk.vtkImageActor()
if vtk.VTK_MAJOR_VERSION <= 5:
source1Actor.SetInput(source1CastFilter.GetOutput())
else:
source1Actor.GetMapper().SetInputConnection(source1CastFilter.GetOutputPort())
source2Actor = vtk.vtkImageActor()
if vtk.VTK_MAJOR_VERSION <= 5:
source2Actor.SetInput(source2CastFilter.GetOutput())
else:
source2Actor.GetMapper().SetInputConnection(source2CastFilter.GetOutputPort())
summedActor = vtk.vtkImageActor()
if vtk.VTK_MAJOR_VERSION <= 5:
summedActor.SetInput(summedCastFilter.GetOutput())
else:
summedActor.GetMapper().SetInputConnection(summedCastFilter.GetOutputPort())
# There will be one render window
renderWindow = vtk.vtkRenderWindow()
renderWindow.SetSize(600, 300)
# And one interactor
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(renderWindow)
# Define viewport ranges
# (xmin, ymin, xmax, ymax)
leftViewport = [0.0, 0.0, 0.33, 1.0]
centerViewport = [0.33, 0.0, .66, 1.0]
rightViewport = [0.66, 0.0, 1.0, 1.0]
# Setup renderers
leftRenderer = vtk.vtkRenderer()
renderWindow.AddRenderer(leftRenderer)
leftRenderer.SetViewport(leftViewport)
leftRenderer.SetBackground(.6, .5, .4)
centerRenderer = vtk.vtkRenderer()
renderWindow.AddRenderer(centerRenderer)
centerRenderer.SetViewport(centerViewport)
centerRenderer.SetBackground(0.1, 0.5, 0.4)
rightRenderer = vtk.vtkRenderer()
renderWindow.AddRenderer(rightRenderer)
rightRenderer.SetViewport(rightViewport)
rightRenderer.SetBackground(0.4, 0.5, 0.6)
leftRenderer.AddActor(source1Actor)
centerRenderer.AddActor(source2Actor)
rightRenderer.AddActor(summedActor)
leftRenderer.ResetCamera()
centerRenderer.ResetCamera()
rightRenderer.ResetCamera()
renderWindow.Render()
interactor.Start()
|
<reponame>rdc-lda/hydra-login-consent-node<gh_stars>0
var fetch = require('node-fetch')
var querystring = require('querystring');
var hydraUrl = process.env.HYDRA_ADMIN_URL
var mockTlsTermination = {}
if (process.env.MOCK_TLS_TERMINATION) {
mockTlsTermination = {
'X-Forwarded-Proto': 'https'
}
}
// A little helper that takes type (can be "login" or "consent") and a challenge and returns the response from ORY Hydra.
function get(flow, challenge) {
const url = new URL('/oauth2/auth/requests/' + flow, hydraUrl)
url.search = querystring.stringify({[flow + '_challenge']: challenge})
return fetch(url.toString())
.then(function (res) {
if (res.status < 200 || res.status > 302) {
// This will handle any errors that aren't network related (network related errors are handled automatically)
return res.json().then(function (body) {
console.error('An error occurred while making a HTTP request: ', body)
return Promise.reject(new Error(body.error.message))
})
}
return res.json();
});
}
// A little helper that takes type (can be "login" or "consent"), the action (can be "accept" or "reject") and a challenge and returns the response from ORY Hydra.
function put(flow, action, challenge, body) {
const url = new URL('/oauth2/auth/requests/' + flow + '/' + action, hydraUrl)
url.search = querystring.stringify({[flow + '_challenge']: challenge})
return fetch(
// Joins process.env.HYDRA_ADMIN_URL with the request path
url.toString(),
{
method: 'PUT',
body: JSON.stringify(body),
headers: {
'Content-Type': 'application/json',
...mockTlsTermination
}
}
)
.then(function (res) {
if (res.status < 200 || res.status > 302) {
// This will handle any errors that aren't network related (network related errors are handled automatically)
return res.json().then(function (body) {
console.error('An error occurred while making a HTTP request: ', body)
return Promise.reject(new Error(body.error.message))
})
}
return res.json();
});
}
var hydra = {
// Fetches information on a login request.
getLoginRequest: function (challenge) {
return get('login', challenge);
},
// Accepts a login request.
acceptLoginRequest: function (challenge, body) {
return put('login', 'accept', challenge, body);
},
// Rejects a login request.
rejectLoginRequest: function (challenge, body) {
return put('login', 'reject', challenge, body);
},
// Fetches information on a consent request.
getConsentRequest: function (challenge) {
return get('consent', challenge);
},
// Accepts a consent request.
acceptConsentRequest: function (challenge, body) {
return put('consent', 'accept', challenge, body);
},
// Rejects a consent request.
rejectConsentRequest: function (challenge, body) {
return put('consent', 'reject', challenge, body);
},
// Fetches information on a logout request.
getLogoutRequest: function (challenge) {
return get('logout', challenge);
},
// Accepts a logout request.
acceptLogoutRequest: function (challenge) {
return put('logout', 'accept', challenge, {});
},
// Reject a logout request.
rejectLogoutRequest: function (challenge) {
return put('logout', 'reject', challenge, {});
},
};
module.exports = hydra;
|
<reponame>team-GIFT/gift<gh_stars>10-100
const { merge } = require('webpack-merge');
const devConfig = require('./config.dev');
const serverConfig = merge(devConfig, {
devServer: {
port: 3000,
static: ['public', 'src'],
historyApiFallback: true,
},
});
module.exports = serverConfig;
|
import React,{Component} from 'react';
import MenuLink from './MenuLink';
import {HashRouter as Router,Route,Link} from '../react-router-dom';
export default class App extends Component{
render(){
return (
<Router>
<div className="container">
<nav className="navbar navbar-default">
<div className="container-fluid">
<div className="navbar-header">
<div className="navbar-brand">管理系统</div>
</div>
<ul className="nav navbar-nav">
<MenuLink to="/home">首页</MenuLink>
<MenuLink to="/user">用户管理</MenuLink>
<MenuLink to="/profile">个人设置</MenuLink>
</ul>
</div>
</nav>
<div className="row">
<div className="col-md-12">
{this.props.children}
</div>
</div>
</div>
</Router>
)
}
} |
import json
from asyncio import sleep
from aiohttp.web import Application
import matrufsc_crawler as crawler
from .utils import log
async def update_database(app: Application):
log.info("Starting database update...")
data = await crawler.start(num_semesters=2)
log.info("Finished database update.")
if data:
app["database"] = data
with open(app["database_path"], "w") as f:
json.dump(data, f)
else:
log.warning("Empty crawler response")
async def start_database_updater(app: Application):
app.loop.create_task(_repeat_database_update(app))
async def _repeat_database_update(app: Application):
delay = float(app["update_interval"]) * 60
while True:
await sleep(delay)
await update_database(app)
|
package com.mh.controltool2.scan.annotation.handler.control;
import com.mh.controltool2.annotation.Bean;
import com.mh.controltool2.method.type.InvokeBeanObject;
import com.mh.controltool2.method.type.InvokeObjectInfo;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
public class TypeBean implements AnnotationTypeHandler {
@Override
public Class<? extends Annotation> getMatchAnnotation() {
return Bean.class;
}
@Override
public InvokeObjectInfo annotationType(String url, Method method, Parameter parameter) {
Bean bean = parameter.getAnnotation(Bean.class);
if (bean == null) return null;
InvokeBeanObject invokeBeanObject = new InvokeBeanObject();
if("".equals(bean.value())) {
invokeBeanObject.setBeanName(bean.value());
}
invokeBeanObject.setArgToClass(parameter.getType());
return invokeBeanObject;
}
}
|
<gh_stars>1-10
const HttpMpCloud = require('./src/HttpMpCloud')
module.exports = HttpMpCloud |
# --------------------------------------------------
# OSX SETTINGS
# --------------------------------------------------
#!/bin/bash
# ~/.osx — https://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
# --------------------------------------------------
# General
# --------------------------------------------------
# Disable the sound effects on boot
sudo nvram SystemAudioVolume=" "
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# --------------------------------------------------
# UI
# --------------------------------------------------
# Increase window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# Disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Use dark menu bar and dock
defaults write NSGlobalDomain AppleInterfaceStyle Dark
# Disable font smoothing (on Non-Retina displays)
# defaults -currentHost write -g AppleFontSmoothing -int 0
# --------------------------------------------------
# Menu Bar
# --------------------------------------------------
# Show Date
defaults write com.apple.menuextra.clock DateFormat -string "EEE d. MMM HH:mm"
# Show Battery Percent
defaults write com.apple.menuextra.battery ShowPercent -bool true
# --------------------------------------------------
# Bluetooth
# --------------------------------------------------
# Increase sound quality for Bluetooth headphones/headsets
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# --------------------------------------------------
# Trackpad Settings
# --------------------------------------------------
# Trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# --------------------------------------------------
# Mouse Settings
# --------------------------------------------------
# Disable mouse acceleration
defaults write -g com.apple.mouse.scaling -1
# --------------------------------------------------
# Keyboard
# --------------------------------------------------
# Set keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 2
# Set keyboard repeat delay
defaults write NSGlobalDomain InitialKeyRepeat -int 25
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# --------------------------------------------------
# Lang Stuff
# --------------------------------------------------
# Set global language
sudo languagesetup -langspec en
# Set language and text formats
defaults write NSGlobalDomain AppleLanguages -array "en" "de"
defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=EUR"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
# --------------------------------------------------
# Screen Stuff
# --------------------------------------------------
# Require password after sleep after 5 seconds or screen saver begins after 1 second
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 5
# Save screenshots to pictures
defaults write com.apple.screencapture location -string "${HOME}/Pictures"
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# --------------------------------------------------
# Finder
# --------------------------------------------------
# Show hidden files
defaults write com.apple.finder AppleShowAllFiles -bool true
# Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Show the ~/Library folder
chflags nohidden ~/Library
# Expand the following File Info panes:
# “General”, “Open with”, and “Sharing & Permissions”
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true
# --------------------------------------------------
# Dock & Mission Control
# --------------------------------------------------
# Wipe all (default) app icons from the Dock
# This is only really useful when setting up a new Mac, or if you don’t use
# the Dock to launch apps.
defaults write com.apple.dock persistent-apps -array
# Speed up Mission Control animations
defaults write com.apple.dock expose-animation-duration -float 0.1
# Disable Dashboard
defaults write com.apple.dashboard mcx-disabled -bool true
# Don’t show Dashboard as a Space
defaults write com.apple.dock dashboard-in-overlay -bool true
# Change minimize/maximize window effect
defaults write com.apple.dock mineffect -string "scale"
# Minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
# Don’t animate opening applications from the Dock
defaults write com.apple.dock launchanim -bool false
# Remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-delay -float 0
# Hot corners
# Possible values:
# 0: no-op
# 2: Mission Control
# 3: Show application windows
# 4: Desktop
# 5: Start screen saver
# 6: Disable screen saver
# 7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# Bottom left screen corner → Desktop
defaults write com.apple.dock wvous-bl-corner -int 4
defaults write com.apple.dock wvous-bl-modifier -int 0
# Bottom right screen corner → Mission Control
defaults write com.apple.dock wvous-br-corner -int 2
defaults write com.apple.dock wvous-br-modifier -int 0
# --------------------------------------------------
# Terminal Stuff
# --------------------------------------------------
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# --------------------------------------------------
# Activity Monitor
# --------------------------------------------------
# Show the main window when launching Activity Monitor
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# Visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5
# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
# Sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
# --------------------------------------------------
# TextEdit
# --------------------------------------------------
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
# --------------------------------------------------
# Kill affected Applications
# --------------------------------------------------
for app in "Activity Monitor" "cfprefsd" \
"Dock" "Finder" "Safari" "SystemUIServer"; do
killall "${app}" >/dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."
|
#!/bin/bash
#PBS -N 2d_flux_shima_etal_part1
#PBS -l select=1:node_type=clx-25
#PBS -l walltime=00:30:00
# Switch to submission directory
cd $PBS_O_WORKDIR
time julia --check-bounds=no --threads=1 -e 'include("run_benchmarks.jl"); run_benchmarks(3:13, 2, flux_shima_etal, flux_shima_etal)'
|
use Cryode\Annotaction\Tests\ExampleActions\GetFoo;
use Cryode\Annotaction\Tests\ExampleActions\PostFoo;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Routing\Router;
use Orchestra\Testbench\TestCase;
class LoadActionRoutesTest extends TestCase
{
public function testActionLoad(): void
{
// Create a mock instance of the Router
$router = $this->app->make(Router::class);
// Register the action routes
$router->get('/foo', GetFoo::class);
$router->post('/foo', PostFoo::class);
// Get the registered routes
$registeredRoutes = $router->getRoutes()->getRoutes();
// Assert that the action routes are registered
$this->assertTrue($this->routeExists($registeredRoutes, 'GET', '/foo', GetFoo::class));
$this->assertTrue($this->routeExists($registeredRoutes, 'POST', '/foo', PostFoo::class));
}
// Helper function to check if a route exists in the registered routes
private function routeExists($routes, $method, $uri, $action)
{
foreach ($routes as $route) {
if ($route->uri() === $uri && $route->getActionName() === $action && in_array($method, $route->methods())) {
return true;
}
}
return false;
}
} |
<filename>dspace-xoai/dspace-xoai-api/src/main/java/org/dspace/xoai/util/MetadataNamePredicate.java
package org.dspace.xoai.util;
import org.dspace.content.Item;
import com.google.common.base.Predicate;
import com.lyncode.xoai.dataprovider.xml.xoai.Element;
public class MetadataNamePredicate implements Predicate<Element> {
private String name;
public MetadataNamePredicate (String n) {
name = n;
}
@Override
public boolean apply(Element arg0) {
if (name == null) return false;
else if (name.equals(Item.ANY)) return true;
else return (name.toLowerCase().equals(arg0.getName().toLowerCase()));
}
}
|
import React from "react"
import { motion } from "framer-motion"
const Submit = ({ children, style }) => (
<motion.button
type="submit"
whileHover={{
scale: 1.1,
}}
whileTap={{
scale: 0.9,
}}
style={{
borderWidth: 0,
padding: ".5em",
color: "rebeccapurple",
fontWeight: "900",
backgroundColor: "white",
...style,
}}
>
{children}
</motion.button>
)
export default Submit
|
<reponame>lordjoe/LocBlastJava<gh_stars>0
package com.lordjoe.blast;
import com.lordjoe.ssh.BlastLaunchDTO;
import com.lordjoe.ssh.JobState;
import org.json.JSONObject;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
public class JSonClusterRunner {
static Map<String,JSonClusterRunner> byID = new HashMap<>();
public static void registerRunner(JSonClusterRunner runner) {
byID.put(runner.getId(),runner);
}
public static JSonClusterRunner fromID(String id) {
return byID.get(id);
}
private final Map<String, String> mapx = new HashMap<>();
private BlastLaunchDTO job;
private final AtomicReference<JobState> lastState = new AtomicReference<JobState>(JobState.NullState);
public JSonClusterRunner(Map<String, ? extends Object> inMap) {
for(String key : inMap.keySet()) {
Object value = inMap.get(key);
mapx.put(key, value.toString());
}
String id = mapx.get("JobId");
this.job = buildJob(id );
registerRunner(this);
}
public void startJob(String server) {
JSONObject json = new JSONObject(mapx);
boolean response = NetClientGet.guaranteeServer();
response = NetClientGet.callClientWithJSon(server, json);
}
private BlastLaunchDTO buildJob(String id) {
String program = mapx.get("program");
job = new BlastLaunchDTO(program,id);
job.database = mapx.get("database");
String fileName = mapx.get("query");
if(fileName != null)
job.query = new File(fileName);
mapx.put("JobId",job.id);
return job;
}
public String getId() {
// TODO Auto-generated method stub
return job.id;
}
public BlastLaunchDTO getJob() {
// TODO Auto-generated method stub
return job;
}
public JobState getLastState() {
// TODO Auto-generated method stub
return lastState.get();
}
public JobState getState() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Fix This"); // ToDo return null;
}
public void setLastState(JobState newValue) {
lastState.set(newValue);
}
}
|
<gh_stars>100-1000
// libraries
import Vue from 'vue';
import {clone, dump} from './utils'
export default function ()
{
// vue
Vue.config.debug = true;
window.Vue = Vue;
// token
const csrf = $('meta[name="csrf-token"]').attr('content');
const root = $('meta[name="route"]').attr('content');
// resource
Vue.use(require('vue-resource'));
Vue.http.options.root = root;
Vue.http.headers.common['X-CSRF-TOKEN'] = csrf;
// jquery
jQuery.ajaxSetup(
{
headers:
{
'X-CSRF-Token': csrf
}
});
// utilities
window.clone = clone;
window.dump = dump;
}
|
#!/bin/sh
set -e
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# Use filter instead of exclude so missing patterns don't throw errors.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'"
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
code_sign_cmd="$code_sign_cmd &"
fi
echo "$code_sign_cmd"
eval "$code_sign_cmd"
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/HCExtentionSwift/HCExtentionSwift.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/HCExtentionSwift/HCExtentionSwift.framework"
fi
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
wait
fi
|
package org.kestell.photoboothbrowser;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
import com.squareup.picasso.Picasso;
public class PhotoActivity extends AppCompatActivity implements OnPrintPhotoListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photo);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
String filename = getIntent().getStringExtra("filename");
String photoPath = Api.BASE_URL + "/photos/" + filename;
ImageView imageView = (ImageView)findViewById(R.id.photo);
Picasso.with(this)
.load(photoPath)
.tag(this)
.into(imageView);
FloatingActionButton fab = (FloatingActionButton)findViewById(R.id.fab);
fab.setOnClickListener(v -> {
Api api = new Api();
api.printPhoto(filename, this);
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void OnPrintPhotoSuccess() {
Toast.makeText(this, "Your photo will print shortly.", Toast.LENGTH_SHORT).show();
NavUtils.navigateUpFromSameTask(this);
}
@Override
public void OnPrintPhotoError() {
Toast.makeText(this, "Couldn't print photo!", Toast.LENGTH_SHORT).show();
}
}
|
<gh_stars>1-10
import { Component, OnInit } from "@angular/core";
import { NavController, MenuController, ToastController, AlertController, LoadingController, Events } from '@ionic/angular';
import { SynchronisationService } from '../../service/synchronisation/synchronisation';
import { MapDataService } from '../../service/map.data.service';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: "app-settings",
templateUrl: "./settings.page.html",
styleUrls: ["./settings.page.scss"]
})
export class SettingsPage implements OnInit {
lang: any;
enableNotifications: any;
paymentMethod: any;
currency: any;
enablePromo: any;
enableHistory: any;
languages: any = [{nom:'English',code:'en'},{nom:'Français',code:'fr'}];
synchronisation: any = [{nom:"Journalier",temps:24*60*60*1000},{nom:"Hebdomadaire",temps:7*24*60*60*1000},{nom:"Mensuel",temps:30*24*60*60*1000}];
user: any;
societe;
parametre;
allTourners;
constructor(public navCtrl: NavController,
public menuCtrl: MenuController,
public toastCtrl: ToastController,
public alertCtrl: AlertController,
public loadingCtrl: LoadingController,
private synchro: SynchronisationService,
private mapper: MapDataService,
private _translate: TranslateService,
public events: Events) {}
ngOnInit() {
if (localStorage.getItem("user")) {
this.user = JSON.parse(localStorage.getItem("user"));
}
if (localStorage.getItem("societe")) {
this.societe = JSON.parse(localStorage.getItem("societe"));
if (localStorage.getItem("tourners")) {
this.allTourners = JSON.parse(localStorage.getItem("tourners"));
}
}
if(localStorage.getItem("parametre")) {
this.parametre=JSON.parse(localStorage.getItem("parametre"));
this.lang=this.parametre.langue;
this._translate.use(this.parametre.langue.code);
}else {
this._translate.use('fr');
}
}
editProfile() {
this.navCtrl.navigateForward("edit-profile");
}
logout() {
localStorage.clear();
this.navCtrl.navigateRoot("/");
}
changeLanguage(langue) {
this._translate.use(langue.code);
this.parametre.langue=langue;
localStorage.setItem("parametre",JSON.stringify(this.parametre));
this.events.publish('parametre:update',this.parametre,Date.now());
}
async ChargerClients() {
let tourners = [];
if (this.allTourners.length !== 0) {
tourners = this.allTourners.map(element => {
return {
name: "tourner",
type: "radio",
label: element.tourner.numc,
value: element.tourner.id
};
});
} else {
}
let that = this;
const alert = await this.alertCtrl.create({
header: "Mes Tournées",
inputs: tourners,
buttons: [
{
text: "Cancel",
role: "cancel",
cssClass: "secondary",
handler: () => {}
},
{
text: "Ok",
handler: data => {
// that.Load('Chargement des clients');
let clients;
console.log(that.allTourners);
that.allTourners.forEach(element => {
if (element.tourner.id === parseInt(data)) {
clients = element.tourner.tclientsList;
localStorage.setItem("tourner", JSON.stringify( element.tourner));
}
});
that.events.publish(
"clients:chargement",
clients,
Date.now()
);
}
}
]
});
await alert.present();
}
async Synchronisation () {
let loading = await this.loadingCtrl.create({
message: 'Synchronisation encours ...'
});
loading.present();
this.synchro.updateSociete(this.societe).subscribe(
resp => {
if(resp instanceof Array && resp.length === 0) {
loading.dismiss();
this.sendTaoster('Echec Synchronisation');
} else {
if(resp.Societe) {
localStorage.setItem('societe',JSON.stringify(resp.Societe));
if(resp.Societe.tcategorieList) {
let mapUser = this.mapper.mapCategorie(resp.Societe.tcategorieList);
localStorage.setItem('article',JSON.stringify(mapUser));
}
if(resp.Societe.tclientsList) {
localStorage.setItem('clients',JSON.stringify(resp.Societe.tclientsList));
}
}
loading.dismiss();
this.sendTaoster('Synchronisation effectuée avec succès');
}
}
);
}
async sendTaoster(msg) {
const toast = await this.toastCtrl.create({
message: msg,
duration: 3000,
position: "top",
closeButtonText: "OK",
showCloseButton: true
});
return toast.present();
}
}
|
package com.amn.tictactoe;
import com.amn.tictactoe.Board;
import com.amn.tictactoe.AI;
import com.amn.tictactoe.Human;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Applet_Main extends Applet implements ActionListener
{
private static final long serialVersionUID = 1L;
public static final boolean DEBUG = false;
public static final int ROWS = 3;
public static final int COLS = 3;
// Window stuff
private Timer timer;
public Dimension screenSize, appletSize;
public Window window;
public Board board;
public AI ai = new AI();
public Human human = new Human();
public int currentPlayer = Player.HUMAN;
public Button squares[][] = new Button[ROWS][COLS];
public Button clickedSquare;
public void init()
{
board = new Board(ai, human);
this.setLayout(new GridLayout(3,3));
for (int i = 0; i < ROWS; ++i)
{
for (int j = 0; j < COLS; j++)
{
squares[i][j] = new Button("");
squares[i][j].addActionListener(this);
this.add(squares[i][j]);
}
}
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
appletSize = this.getSize();
ActionListener listener = new ActionListener(){
public void actionPerformed(ActionEvent event){
centerAppletViewer();
}
};
timer = new Timer(0, listener);
timer.start();
}
public void start()
{
Container container = squares[0][0].getParent();
while (container.getParent() != null)
{
container = container.getParent();
}
if (container instanceof Window)
{
window = (Window)container;
}
else
{
System.out.println(container);
}
}
public void centerAppletViewer()
{
if (this.window != null)
{
int x = (int) (screenSize.getWidth() / 2 - appletSize.getWidth() / 2);
int y = (int) (screenSize.getHeight() / 2 - appletSize.getHeight() / 2 - 50);
this.window.setLocation(x,y);
timer.stop();
}
}
@Override
public void actionPerformed(ActionEvent event)
{
clickedSquare = (Button)event.getSource();
for (int i = 0; i < ROWS; ++i)
{
for (int j = 0; j < COLS; j++)
{
if (clickedSquare == squares[i][j])
{
Player player = (currentPlayer == Player.HUMAN) ? human : ai;
if (currentPlayer == Player.HUMAN)
{
if (!((Human)player).makeMove(board, i, j))
{
this.showMessage("That move is invalid.");
}
else
{
clickedSquare.setLabel(String.valueOf(player.getSymbol()));
this.switchPlayer();
AIMove move = ai.makeMove(board);
squares[move.i][move.j].setLabel(String.valueOf(ai.getSymbol()));
if (DEBUG)
{
board.printBoardState();
}
this.switchPlayer();
}
}
}
}
}
int winner = board.gameOver();
if (winner == Board.DRAW)
{
this.showMessage("Draw!");
}
else if (winner != Board.EMPTY_VAL)
{
Player player = (winner == Player.AI) ? ai : human;
this.showMessage(player + " has won the game!");
}
}
public void switchPlayer()
{
currentPlayer = (currentPlayer + 1) % 2;
}
public void showMessage(String message)
{
JOptionPane.showConfirmDialog(null, message, "TicTacToe", JOptionPane.OK_CANCEL_OPTION);
}
}
|
<reponame>nullbyte91/dsa-cpp<gh_stars>0
/*
Header file - unordered_map
unordered_map is an associated container that stores elements formed by combination of key value and a mapped value.
The key value is used to uniquely identify the element and mapped value is the content associated with the key.
Both key and value can be of any type predefined or user-defined.
Internally unordered_map is implemented using Hash Table, the key provided to map are hashed into indices of hash
table that is why performance of data structure depends on hash function a lot but on an average the cost of search,
insert and delete from hash table is O(1).
Declaration:
unordered_map<string, int> umap;
Member function:
at(): This function in C++ unordered_map returns the reference to the value with the element as key k.
begin(): Returns an iterator pointing to the first element in the container in the unordered_map container
end(): Returns an iterator pointing to the position past the last element in the container in the unordered_map container
bucket(): Returns the bucket number where the element with the key k is located in the map.
bucket_count: bucket_count is used to count the total no. of buckets in the unordered_map. No parameter is required to pass into this function.
bucket_size: Returns number of elements in each bucket of the unordered_map.
count(): Count the number of elements present in an unordered_map with a given key.
equal_range: Return the bounds of a range that includes all the elements in the container with a key that compares equal to k.
*/
#include <iostream>
#include <cstdio>
#include <unordered_map>
using namespace std;
int
main(int argc, char** argcv)
{
unordered_map <string, int> mp;
// Insert value by [] operator
mp["a"] = 1;
mp["b"]= 2;
// Insert value by insert function
mp.insert(make_pair("c", 3));
// create a iterator
unordered_map <string, int>::iterator it;
// Search the Key
if (mp.find("b") == mp.end()){
cout << "Key not found " << endl;
} else {
it = mp.find("b");
cout << "key found and the value" << it->second;
}
for (it=mp.begin(); it != mp.end(); it++){
cout << it->first << " " << it->second << endl;
}
putchar('\n');
return 0;
}
|
cleanup_cache() {
if [ $clean_cache = true ]; then
info "clean_cache option set to true."
info "Cleaning out cache contents"
rm -rf $cache_dir/npm-version
rm -rf $cache_dir/node-version
rm -rf $cache_dir/phoenix-static
rm -rf $cache_dir/yarn-cache
cleanup_old_node
fi
}
load_previous_npm_node_versions() {
if [ -f $cache_dir/npm-version ]; then
old_node=$(<$cache_dir/node-version)
fi
}
download_node() {
local platform=linux-x64
if [ ! -f ${cached_node} ]; then
echo "Resolving node version $node_version..."
if ! read number url < <(curl --silent --get --retry 5 --retry-max-time 15 --data-urlencode "range=$node_version" "https://nodebin.herokai.com/v1/node/$platform/latest.txt"); then
fail_bin_install node $node_version;
fi
echo "Downloading and installing node $number..."
local code=$(curl "$url" -L --silent --fail --retry 5 --retry-max-time 15 -o ${cached_node} --write-out "%{http_code}")
if [ "$code" != "200" ]; then
echo "Unable to download node: $code" && false
fi
else
info "Using cached node ${node_version}..."
fi
}
cleanup_old_node() {
local old_node_dir=$cache_dir/node-$old_node-linux-x64.tar.gz
# Note that $old_node will have a format of "v5.5.0" while $node_version
# has the format "5.6.0"
if [ $clean_cache = true ] || [ $old_node != v$node_version ] && [ -f $old_node_dir ]; then
info "Cleaning up old Node $old_node and old dependencies in cache"
rm $old_node_dir
rm -rf $cache_dir/node_modules
fi
}
install_node() {
info "Installing Node $node_version..."
tar xzf ${cached_node} -C /tmp
local node_dir=$heroku_dir/node
if [ -d $node_dir ]; then
echo " ! Error while installing Node $node_version."
echo " Please remove any prior buildpack that installs Node."
exit 1
else
mkdir -p $node_dir
# Move node (and npm) into .heroku/node and make them executable
mv /tmp/node-v$node_version-linux-x64/* $node_dir
chmod +x $node_dir/bin/*
PATH=$node_dir/bin:$PATH
fi
}
install_yarn() {
local dir="$1"
echo "Downloading and installing yarn..."
local download_url="https://yarnpkg.com/latest.tar.gz"
local code=$(curl "$download_url" -L --silent --fail --retry 5 --retry-max-time 15 -o /tmp/yarn.tar.gz --write-out "%{http_code}")
if [ "$code" != "200" ]; then
echo "Unable to download yarn: $code" && false
fi
rm -rf $dir
mkdir -p "$dir"
# https://github.com/yarnpkg/yarn/issues/770
if tar --version | grep -q 'gnu'; then
tar xzf /tmp/yarn.tar.gz -C "$dir" --strip 1 --warning=no-unknown-keyword
else
tar xzf /tmp/yarn.tar.gz -C "$dir" --strip 1
fi
chmod +x $dir/bin/*
PATH=$dir/bin:$PATH
echo "Installed yarn $(yarn --version)"
}
install_and_cache_deps() {
info "Installing and caching node modules"
cd $assets_dir
if [ -d $cache_dir/node_modules ]; then
mkdir -p node_modules
cp -r $cache_dir/node_modules/* node_modules/
fi
install_yarn_deps
cp -r node_modules $cache_dir
PATH=$assets_dir/node_modules/.bin:$PATH
}
install_yarn_deps() {
yarn install --cache-folder $cache_dir/yarn-cache --pure-lockfile 2>&1
}
cache_versions() {
info "Caching versions for future builds"
echo `node --version` > $cache_dir/node-version
echo `yarn --version` > $cache_dir/yarn-version
}
finalize_node() {
if [ $remove_node = true ]; then
remove_node
else
write_profile
fi
}
write_profile() {
info "Creating runtime environment"
mkdir -p $build_dir/.profile.d
local export_line="export PATH=\"\$HOME/.heroku/node/bin:\$HOME/.heroku/yarn/bin:\$HOME/bin:\$HOME/$phoenix_relative_path/node_modules/.bin:\$PATH\""
echo $export_line >> $build_dir/.profile.d/phoenix_static_buildpack_paths.sh
}
remove_node() {
info "Removing node and node_modules"
rm -rf $assets_dir/node_modules
rm -rf $heroku_dir/node
}
|
<filename>open-sphere-base/core/src/main/java/io/opensphere/core/preferences/PreferenceChangeEvent.java
package io.opensphere.core.preferences;
import javax.xml.bind.JAXBException;
import io.opensphere.core.util.ref.WeakReference;
/**
* An event for a preference change.
*/
public class PreferenceChangeEvent
{
/**
* Weak reference to the originator of the message.
*/
private final WeakReference<Object> mySourceRef;
/** The preference topic. */
private final String myTopic;
/** The preference change event value. */
private final Preference<?> myValue;
/**
* Constructor with key and value.
*
* @param topic The preference topic.
* @param newValue The new preference.
* @param source The originator of the change that produced the event.
*/
public PreferenceChangeEvent(String topic, Preference<?> newValue, Object source)
{
myTopic = topic;
myValue = newValue;
mySourceRef = new WeakReference<>(source);
}
/**
* Gets the key for the change event.
*
* @return the key
*/
public String getKey()
{
return myValue.getKey();
}
/**
* Gets the source of the preference change.
*
* @return the source object
*/
public Object getSource()
{
return mySourceRef.get();
}
/**
* Returns the topic for the preferences change event.
*
* @return the topic
*/
public String getTopic()
{
return myTopic;
}
/**
* Gets the value as a boolean, or default if could not be converted to a
* boolean.
*
* @param def the default value to return if the value could not be
* converted
* @return the value as a boolean
*/
public boolean getValueAsBoolean(boolean def)
{
return myValue.isNull() ? def : myValue.getBooleanValue(def);
}
/**
* Gets the value as a boolean, or default if could not be converted to a
* boolean.
*
* @param def the default value to return if the value could not be
* converted
* @return the value as a boolean
*/
public Boolean getValueAsBoolean(Boolean def)
{
return myValue.isNull() ? def : myValue.getBooleanValue(def);
}
/**
* Gets the value as a double or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
* @return the value as a double or default if it could not be converted
*/
public double getValueAsDouble(double def)
{
return myValue.isNull() ? def : myValue.getDoubleValue(def);
}
/**
* Gets the value as a double or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
* @return the value as a double or default if it could not be converted
*/
public Double getValueAsDouble(Double def)
{
return myValue.isNull() ? def : myValue.getDoubleValue(def);
}
/**
* Gets the value as a float or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
* @return the value as a float or default if it could not be converted
*/
public float getValueAsFloat(float def)
{
return myValue.isNull() ? def : myValue.getFloatValue(def);
}
/**
* Gets the value as a float or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
* @return the value as a float or default if it could not be converted
*/
public Float getValueAsFloat(Float def)
{
return myValue.isNull() ? def : myValue.getFloatValue(def);
}
/**
* Gets the value as a int or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
* @return the value or default if it could not be converted
*/
public int getValueAsInt(int def)
{
return myValue.isNull() ? def : myValue.getIntValue(def);
}
/**
* Gets the value as a int or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
* @return the value or default if it could not be converted
*/
public Integer getValueAsInteger(Integer def)
{
return myValue.isNull() ? def : myValue.getIntegerValue(def);
}
/**
* Gets the value as a long or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
*
* @return value or default if it could not be converted
*/
public long getValueAsLong(long def)
{
return myValue.isNull() ? def : myValue.getLongValue(def);
}
/**
* Gets the value as a long or default if it could not be converted.
*
* @param def the default value to return if the value could not be
* converted
*
* @return value or default if it could not be converted
*/
public Long getValueAsLong(Long def)
{
return myValue.isNull() ? def : myValue.getLongValue(def);
}
/**
* Gets the value as an {@link Object} or default if it is null.
*
* @param <T> The type of the object.
* @param def The default object to return.
* @return The object value of the preference or def if null.
* @throws JAXBException Thrown if the object could not be unmarshalled from
* its JAXB form.
*/
@SuppressWarnings("unchecked")
public <T> T getValueAsObject(T def) throws JAXBException
{
return myValue.isNull() ? def : (T)myValue.getValue();
}
/**
* Gets the value as a {@link String}, or default if could not be converted
* to a {@link String}.
*
* @param def the default value to return if the value could not be
* converted
* @return The value as a {@link String}.
*/
public String getValueAsString(String def)
{
return myValue.isNull() ? def : myValue.getStringValue(def);
}
@Override
public String toString()
{
return "PreferenceChangeEvent: Topic[" + myTopic + "] Key[" + getKey() + "] Value[" + myValue + "]";
}
}
|
/*
* 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.livy.thriftserver.session;
import java.util.Iterator;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.types.StructType;
import org.apache.livy.Job;
import org.apache.livy.JobContext;
/**
* A Job implementation for executing SQL queries in a Livy session.
*/
public class SqlJob implements Job<Void> {
private final String sessionId;
private final String statementId;
private final String statement;
private final String defaultIncrementalCollect;
private final String incrementalCollectEnabledProp;
public SqlJob() {
this(null, null, null, null, null);
}
public SqlJob(
String sessionId,
String statementId,
String statement,
String defaultIncrementalCollect,
String incrementalCollectEnabledProp) {
this.sessionId = sessionId;
this.statementId = statementId;
this.statement = statement;
this.defaultIncrementalCollect = defaultIncrementalCollect;
this.incrementalCollectEnabledProp = incrementalCollectEnabledProp;
}
@Override
public Void call(JobContext ctx) throws Exception {
ctx.sc().setJobGroup(statementId, statement);
try {
executeSql(ctx);
} finally {
ctx.sc().clearJobGroup();
}
return null;
}
private void executeSql(JobContext ctx) throws Exception {
ThriftSessionState session = ThriftSessionState.get(ctx, sessionId);
SparkSession spark = session.spark();
Dataset<Row> df = spark.sql(statement);
StructType schema = df.schema();
boolean incremental = Boolean.parseBoolean(
spark.conf().get(incrementalCollectEnabledProp, defaultIncrementalCollect));
Iterator<Row> iter;
if (incremental) {
iter = new ScalaIterator<>(df.rdd().toLocalIterator());
} else {
iter = df.collectAsList().iterator();
}
// Register both the schema and the iterator with the session state after the statement
// has been executed.
session.registerStatement(statementId, schema, iter);
}
}
|
#!/usr/bin/env bash
node server.js 3000 |
# Import the configuration settings from config.py
from config import FILEUPLOAD_ALLOWED_EXTENSIONS
def is_allowed_file(filename):
# Extract the file extension from the filename
file_extension = filename.rsplit('.', 1)[1].lower()
# Check if the file extension is in the allowed extensions list
if file_extension in FILEUPLOAD_ALLOWED_EXTENSIONS:
return True
else:
return False |
<filename>dac/ui/src/pages/AdminPage/subpages/UsersV2.js
/*
* Copyright (C) 2017-2019 Dremio Corporation
*
* 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.
*/
import { Component } from 'react';
import Radium from 'radium';
import pureRender from 'pure-render-decorator';
import Immutable from 'immutable';
@Radium
@pureRender
export default class UsersV2 extends Component {
constructor(props) {
super(props);
this.state = {
activeBtn: 'internal'
};
}
showRadioBtns() {
const radioBtns = Immutable.fromJS([
{
id: 'internal',
text: la('Internal (Authenticate users through email invilations)')
}, {
id: 'os',
text: la('OS')
},
{
id: 'LDAP',
text: la('LDAP')
}, {
id: 'Authentication',
text: la('Google Authentication')
}
]);
return radioBtns.map((radio) => {
return (
<div className='item-block' key={radio.get('id')}>
<input
id={radio.get('id')}
defaultChecked={radio.get('id') === this.state.activeBtn}
name='credentials'
onChange={this.toggleRadioBtns.bind(this, radio.get('id'))}
className='item-input'
type='radio' />
<label htmlFor={radio.get('id')} className='item-label'>
{radio.get('text')}
</label>
</div>
);
});
}
toggleRadioBtns(id) {
this.setState({
activeBtn: id
});
}
render() {
return (
<div>
<div className='admin-header' style={style.adminHeader}>
<h3>{la('Authentication')}</h3>
</div>
<div style={style.wrapper}>
<span style={style.title}>Authentication Type</span>
{this.showRadioBtns()}
</div>
</div>
);
}
}
const style = {
title: {
fontWeight: 'bold'
},
wrapper: {
width: '100%',
marginTop: 10,
paddingTop: 20
},
adminHeader: {
display: 'flex',
alignItems: 'center',
borderBottom: '1px solid rgba(0,0,0,.1)',
padding: '10px 0'
}
};
|
package mvgk.moviesearch
import org.jsoup.Jsoup
import org.openqa.selenium.firefox.FirefoxDriver
/**
* @author <NAME>
*/
case class AfishaQuery(title: String, titleRus: Option[String], year: Int) extends MovieQuery {
def doQuery(firefoxDriver: Option[FirefoxDriver] = None): MovieQueryResult = {
val searchUrl = "http://www.afisha.ru/Search/?Search_str=%s"
val query = searchUrl.format(titleRus.getOrElse(title))
val html = Jsoup.connect(query).get()
val list = html.body().getElementsByClass("b-search-page").get(0)
val href = list.getElementsByClass("places-list-item").get(0).getElementsByTag("a").get(0).attr("href")
val sourceHtml = html.html()
MovieQueryResult(Some(href), "md5")
}
}
object AfishaQuery {
def main(args: Array[String]) = {
val result = AfishaQuery("leviathan", Some("Левиафан"), 2014).doQuery()
println(result)
}
}
|
#Aqueduct - Compliance Remediation Content
#Copyright (C) 2011,2012 Vincent C. Passaro (vincent.passaro@gmail.com)
#
#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.
#
#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., 51 Franklin Street, Fifth Floor,
#Boston, MA 02110-1301, USA.
#!/bin/bash
######################################################################
#By Tummy a.k.a Vincent C. Passaro #
#Vincent[.]Passaro[@]gmail[.]com #
#www.vincentpassaro.com #
######################################################################
#_____________________________________________________________________
#| Version | Change Information | Author | Date |
#|__________|_______________________|____________________|____________|
#| 1.0 | Initial Script | Vincent C. Passaro | 20-oct-2011|
#| | Creation | | |
#|__________|_______________________|____________________|____________|
#
#
# - updated by Shannon Mitchell(shannon.mitchell@fusiontechnology-llc.com)
# on 16-jan-2012 to have it remove netgroup entries from the access control
# files and not ACLs.
#
# Updated by Lee Kinser (lkinser@redhat.com) on 1 May 2012 to squash
# find errors
#######################DISA INFORMATION###############################
#Group ID (Vulid): V-11987
#Group Title: Plus (+) in Access Control Files
#Rule ID: SV-12488r5_rule
#Severity: CAT II
#Rule Version (STIG-ID): GEN001980
#Rule Title: The .rhosts, .shosts, hosts.equiv, shosts.equiv, /etc/passwd,
#/etc/shadow, and/or /etc/group files must not contain a plus (+) without
#defining entries for NIS+ netgroups.
#
#Vulnerability Discussion: The Berkeley r-commands are legacy services which
#allow cleartext remote access and have an insecure trust model and should
#never be used. However, if there has been a documented exception made for
#their use a plus (+) in system accounts files causes the system to lookup
#the specified entry using NIS. The /etc/passwd, /etc/shadow or /etc/group
#should also be checked for plus (+) entries. If the system is not using
#NIS, no such entries should exist.
#
#Responsibility: System Administrator
#IAControls: ECCD-1, ECCD-2
#
#Check Content:
#Check system configuration files for plus (+) entries.
#
#Procedure:
# find / -name .rhosts
# grep + /<directorylocation>/.rhosts
#
# find / -name .shosts
# grep + /<directorylocation>/.shosts
#
# find / -name hosts.equiv
# grep + /<directorylocation>/hosts.equiv
#
# find / -name shosts.equiv
# grep + /<directorylocation>/shosts.equiv
#
# grep + /etc/passwd
# grep + /etc/shadow
# grep + /etc/group
#
#If the .rhosts, .shosts, hosts.equiv, shosts.equiv, /etc/passwd, /etc/shadow, and/or /etc/group files contain a plus (+) and do not define entries for NIS+ netgroups, this is a finding.
#
#Fix Text: Edit the .rhosts, .shosts, hosts.equiv, shosts.equiv, /etc/passwd, /etc/shadow, and/or /etc/group files and remove entries containing a plus (+).
#######################DISA INFORMATION###############################
#Global Variables#
PDI=GEN001980
#Start-Lockdown
for ACF in `find / -fstype nfs -prune -o -name .rhosts -o -name .shosts -o -name hosts.equiv -o -name shosts.equiv 2> /dev/null` /etc/passwd /etc/shadow /etc/group
do
grep '^+' $ACF > /dev/null
if [ $? -eq 0 ]
then
sed -i -e '/^\+/d' $ACF
fi
done
|
<reponame>bobjan/xmlsplitter
package com.logotet.xmlsplitter;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.nio.file.FileSystems;
/**
*
* @author :<NAME>
* @since :2016
*
*
* @todo To write proper instructions how to use this class and how to write other implementation classes
*
*
* */
public class ChunkBufferedImpl implements ChunkReceiver {
private static final int BUFFER_SIZE;
static String fileName;
static String fileType;
static String folder;
static String separator;
static boolean built = false;
static {
BUFFER_SIZE = 8192;
separator = FileSystems.getDefault().getSeparator();
}
private static int increment = 0;
XMLOutputFactory outputFactory;
XMLEventWriter xmlWriter;
public static class Builder {
String fileName;
String folder;
String fileType = "xml";
public Builder inFolder(String folder) {
this.folder = folder;
return this;
}
public Builder withType(String folder) {
this.fileType = fileType;
return this;
}
public Builder withName(String fileName) {
this.fileName = fileName;
return this;
}
ChunkBufferedImpl build() {
ChunkBufferedImpl chunk = new ChunkBufferedImpl();
ChunkBufferedImpl.folder = this.folder;
ChunkBufferedImpl.fileName = this.fileName;
ChunkBufferedImpl.fileType = this.fileType;
ChunkBufferedImpl.built = true;
return chunk;
}
}
/**
*
*
* */
public ChunkBufferedImpl() {
if (built) { // If not created via Builder, it must not work at all
outputFactory = XMLOutputFactory.newInstance();
File outputFile = new File(String.format("%s%s%s_%06d.%s", folder,separator, fileName, ++increment, fileType));
try {
xmlWriter = outputFactory.createXMLEventWriter(new BufferedOutputStream(new FileOutputStream(outputFile), BUFFER_SIZE));
} catch (XMLStreamException | FileNotFoundException e) {
e.printStackTrace();
}
}
}
@Override
public void close() {
if (xmlWriter != null) {
try {
xmlWriter.close();
} catch (XMLStreamException ignored) {
}
}
}
@Override
public void add(XMLEvent event) {
try {
if (xmlWriter != null) xmlWriter.add(event);
} catch (XMLStreamException e) {
e.printStackTrace();
}
}
@Override
public void endAll() {
}
}
|
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
readonly _dir="$(cd "$(dirname "${0}")" && pwd)"
readonly __config_file="${1:-"${_dir}/config.sh"}"
source "${_dir}"/functions.sh "${__config_file}"
main() {
process_previous_ping_events || true
monitor_streamed_events
}
main "$@"
|
import React from 'react'
import { globalCss } from '../stitches.js'
const globalStyles = globalCss({
body: {
backgroundColor: '#F3F4F6',
fontSize: '16px',
fontFamily: 'sans-serif'
}
})
export default function AppPage ({ Component, pageProps }) {
globalStyles()
return <Component {...pageProps} />
}
|
#!/bin/bash
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk && ./emsdk install latest
|
<gh_stars>1-10
/*
* MIT License
*
* Copyright (c) 2018 <NAME> (@smallcreep) <<EMAIL>>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.smallcreep.cucumber.seeds.fake;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;
/**
* Fake ResultSet, throws of all methods {@link UnsupportedOperationException}.
* @since 0.2.0
* @checkstyle DesignForExtensionCheck (2000 lines)
* @checkstyle ParameterNameCheck (2000 lines)
* @checkstyle ParameterNameCheck (2000 lines)
* @checkstyle MissingDeprecatedCheck (2000 lines)
* @checkstyle MethodCountCheck (2000 lines)
* @checkstyle MissingDeprecatedCheck (2000 lines)
*/
@SuppressWarnings(
{
"PMD.AvoidDuplicateLiterals",
"PMD.ExcessivePublicCount",
"PMD.ExcessiveClassLength",
"PMD.TooManyMethods"
}
)
public abstract class ResultSetFake implements ResultSet {
@Override
public boolean next() {
throw new UnsupportedOperationException(
"unsupported method #next()"
);
}
@Override
public void close() {
throw new UnsupportedOperationException(
"unsupported method #close()"
);
}
@Override
public boolean wasNull() {
throw new UnsupportedOperationException(
"unsupported method #wasNull()"
);
}
@Override
public String getString(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getString()"
);
}
@Override
public boolean getBoolean(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getBoolean()"
);
}
@Override
public byte getByte(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getByte()"
);
}
@Override
public short getShort(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getShort()"
);
}
@Override
public int getInt(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getInt()"
);
}
@Override
public long getLong(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getLong()"
);
}
@Override
public float getFloat(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getFloat()"
);
}
@Override
public double getDouble(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getDouble()"
);
}
@Deprecated
@Override
public BigDecimal getBigDecimal(final int columnIndex, final int scale) {
throw new UnsupportedOperationException(
"unsupported method #getBigDecimal()"
);
}
@Override
public byte[] getBytes(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getBytes()"
);
}
@Override
public Date getDate(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getDate()"
);
}
@Override
public Time getTime(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getTime()"
);
}
@Override
public Timestamp getTimestamp(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getTimestamp()"
);
}
@Override
public InputStream getAsciiStream(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getAsciiStream()"
);
}
@Deprecated
@Override
public InputStream getUnicodeStream(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getUnicodeStream()"
);
}
@Override
public InputStream getBinaryStream(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getBinaryStream()"
);
}
@Override
public String getString(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getString()"
);
}
@Override
public boolean getBoolean(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getBoolean()"
);
}
@Override
public byte getByte(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getByte()"
);
}
@Override
public short getShort(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getShort()"
);
}
@Override
public int getInt(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getInt()"
);
}
@Override
public long getLong(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getLong()"
);
}
@Override
public float getFloat(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getFloat()"
);
}
@Override
public double getDouble(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getDouble()"
);
}
@Deprecated
@Override
public BigDecimal getBigDecimal(final String columnLabel, final int scale) {
throw new UnsupportedOperationException(
"unsupported method #getBigDecimal()"
);
}
@Override
public byte[] getBytes(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getBytes()"
);
}
@Override
public Date getDate(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getDate()"
);
}
@Override
public Time getTime(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getTime()"
);
}
@Override
public Timestamp getTimestamp(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getTimestamp()"
);
}
@Override
public InputStream getAsciiStream(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getAsciiStream()"
);
}
@Deprecated
@Override
public InputStream getUnicodeStream(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getUnicodeStream()"
);
}
@Override
public InputStream getBinaryStream(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getBinaryStream()"
);
}
@Override
public SQLWarning getWarnings() {
throw new UnsupportedOperationException(
"unsupported method #getWarnings()"
);
}
@Override
public void clearWarnings() {
throw new UnsupportedOperationException(
"unsupported method #clearWarnings()"
);
}
@Override
public String getCursorName() {
throw new UnsupportedOperationException(
"unsupported method #getCursorName()"
);
}
@Override
public ResultSetMetaData getMetaData() {
throw new UnsupportedOperationException(
"unsupported method #getMetaData()"
);
}
@Override
public Object getObject(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getObject()"
);
}
@Override
public Object getObject(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getObject()"
);
}
@Override
public int findColumn(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #findColumn()"
);
}
@Override
public Reader getCharacterStream(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getCharacterStream()"
);
}
@Override
public Reader getCharacterStream(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getCharacterStream()"
);
}
@Override
public BigDecimal getBigDecimal(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getBigDecimal()"
);
}
@Override
public BigDecimal getBigDecimal(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getBigDecimal()"
);
}
@Override
public boolean isBeforeFirst() {
throw new UnsupportedOperationException(
"unsupported method #isBeforeFirst()"
);
}
@Override
public boolean isAfterLast() {
throw new UnsupportedOperationException(
"unsupported method #isAfterLast()"
);
}
@Override
public boolean isFirst() {
throw new UnsupportedOperationException(
"unsupported method #isFirst()"
);
}
@Override
public boolean isLast() {
throw new UnsupportedOperationException(
"unsupported method #isLast()"
);
}
@Override
public void beforeFirst() {
throw new UnsupportedOperationException(
"unsupported method #beforeFirst()"
);
}
@Override
public void afterLast() {
throw new UnsupportedOperationException(
"unsupported method #afterLast()"
);
}
@Override
public boolean first() {
throw new UnsupportedOperationException(
"unsupported method #first()"
);
}
@Override
public boolean last() {
throw new UnsupportedOperationException(
"unsupported method #last()"
);
}
@Override
public int getRow() {
throw new UnsupportedOperationException(
"unsupported method #getRow()"
);
}
@Override
public boolean absolute(final int row) {
throw new UnsupportedOperationException(
"unsupported method #absolute()"
);
}
@Override
public boolean relative(final int rows) {
throw new UnsupportedOperationException(
"unsupported method #relative()"
);
}
@Override
public boolean previous() {
throw new UnsupportedOperationException(
"unsupported method #previous()"
);
}
@Override
public void setFetchDirection(final int direction) {
throw new UnsupportedOperationException(
"unsupported method #setFetchDirection()"
);
}
@Override
public int getFetchDirection() {
throw new UnsupportedOperationException(
"unsupported method #getFetchDirection()"
);
}
@Override
public void setFetchSize(final int rows) {
throw new UnsupportedOperationException(
"unsupported method #setFetchSize()"
);
}
@Override
public int getFetchSize() {
throw new UnsupportedOperationException(
"unsupported method #getFetchSize()"
);
}
@Override
public int getType() {
throw new UnsupportedOperationException(
"unsupported method #getType()"
);
}
@Override
public int getConcurrency() {
throw new UnsupportedOperationException(
"unsupported method #getConcurrency()"
);
}
@Override
public boolean rowUpdated() {
throw new UnsupportedOperationException(
"unsupported method #rowUpdated()"
);
}
@Override
public boolean rowInserted() {
throw new UnsupportedOperationException(
"unsupported method #rowInserted()"
);
}
@Override
public boolean rowDeleted() {
throw new UnsupportedOperationException(
"unsupported method #rowDeleted()"
);
}
@Override
public void updateNull(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #updateNull()"
);
}
@Override
public void updateBoolean(final int columnIndex, final boolean x) {
throw new UnsupportedOperationException(
"unsupported method #updateBoolean()"
);
}
@Override
public void updateByte(final int columnIndex, final byte x) {
throw new UnsupportedOperationException(
"unsupported method #updateByte()"
);
}
@Override
public void updateShort(final int columnIndex, final short x) {
throw new UnsupportedOperationException(
"unsupported method #updateShort()"
);
}
@Override
public void updateInt(final int columnIndex, final int x) {
throw new UnsupportedOperationException(
"unsupported method #updateInt()"
);
}
@Override
public void updateLong(final int columnIndex, final long x) {
throw new UnsupportedOperationException(
"unsupported method #updateLong()"
);
}
@Override
public void updateFloat(final int columnIndex, final float x) {
throw new UnsupportedOperationException(
"unsupported method #updateFloat()"
);
}
@Override
public void updateDouble(final int columnIndex, final double x) {
throw new UnsupportedOperationException(
"unsupported method #updateDouble()"
);
}
@Override
public void updateBigDecimal(final int columnIndex, final BigDecimal x) {
throw new UnsupportedOperationException(
"unsupported method #updateBigDecimal()"
);
}
@Override
public void updateString(final int columnIndex, final String x) {
throw new UnsupportedOperationException(
"unsupported method #updateString()"
);
}
@Override
public void updateBytes(final int columnIndex, final byte[] x) {
throw new UnsupportedOperationException(
"unsupported method #updateBytes()"
);
}
@Override
public void updateDate(final int columnIndex, final Date x) {
throw new UnsupportedOperationException(
"unsupported method #updateDate()"
);
}
@Override
public void updateTime(final int columnIndex, final Time x) {
throw new UnsupportedOperationException(
"unsupported method #updateTime()"
);
}
@Override
public void updateTimestamp(final int columnIndex, final Timestamp x) {
throw new UnsupportedOperationException(
"unsupported method #updateTimestamp()"
);
}
@Override
public void updateAsciiStream(
final int columnIndex, final InputStream x, final int length
) {
throw new UnsupportedOperationException(
"unsupported method #updateAsciiStream()"
);
}
@Override
public void updateBinaryStream(
final int columnIndex, final InputStream x, final int length
) {
throw new UnsupportedOperationException(
"unsupported method #updateBinaryStream()"
);
}
@Override
public void updateCharacterStream(
final int columnIndex, final Reader x, final int length
) {
throw new UnsupportedOperationException(
"unsupported method #updateCharacterStream()"
);
}
@Override
public void updateObject(
final int columnIndex, final Object x, final int scaleOrLength
) {
throw new UnsupportedOperationException(
"unsupported method #updateObject()"
);
}
@Override
public void updateObject(final int columnIndex, final Object x) {
throw new UnsupportedOperationException(
"unsupported method #updateObject()"
);
}
@Override
public void updateNull(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #updateNull()"
);
}
@Override
public void updateBoolean(final String columnLabel, final boolean x) {
throw new UnsupportedOperationException(
"unsupported method #updateBoolean()"
);
}
@Override
public void updateByte(final String columnLabel, final byte x) {
throw new UnsupportedOperationException(
"unsupported method #updateByte()"
);
}
@Override
public void updateShort(final String columnLabel, final short x) {
throw new UnsupportedOperationException(
"unsupported method #updateShort()"
);
}
@Override
public void updateInt(final String columnLabel, final int x) {
throw new UnsupportedOperationException(
"unsupported method #updateInt()"
);
}
@Override
public void updateLong(final String columnLabel, final long x) {
throw new UnsupportedOperationException(
"unsupported method #updateLong()"
);
}
@Override
public void updateFloat(final String columnLabel, final float x) {
throw new UnsupportedOperationException(
"unsupported method #updateFloat()"
);
}
@Override
public void updateDouble(final String columnLabel, final double x) {
throw new UnsupportedOperationException(
"unsupported method #updateDouble()"
);
}
@Override
public void updateBigDecimal(final String columnLabel, final BigDecimal x) {
throw new UnsupportedOperationException(
"unsupported method #updateBigDecimal()"
);
}
@Override
public void updateString(final String columnLabel, final String x) {
throw new UnsupportedOperationException(
"unsupported method #updateString()"
);
}
@Override
public void updateBytes(final String columnLabel, final byte[] x) {
throw new UnsupportedOperationException(
"unsupported method #updateBytes()"
);
}
@Override
public void updateDate(final String columnLabel, final Date x) {
throw new UnsupportedOperationException(
"unsupported method #updateDate()"
);
}
@Override
public void updateTime(final String columnLabel, final Time x) {
throw new UnsupportedOperationException(
"unsupported method #updateTime()"
);
}
@Override
public void updateTimestamp(final String columnLabel, final Timestamp x) {
throw new UnsupportedOperationException(
"unsupported method #updateTimestamp()"
);
}
@Override
public void updateAsciiStream(
final String columnLabel, final InputStream x, final int length
) {
throw new UnsupportedOperationException(
"unsupported method #updateAsciiStream()"
);
}
@Override
public void updateBinaryStream(
final String columnLabel, final InputStream x, final int length
) {
throw new UnsupportedOperationException(
"unsupported method #updateBinaryStream()"
);
}
@Override
public void updateCharacterStream(
final String columnLabel, final Reader reader, final int length
) {
throw new UnsupportedOperationException(
"unsupported method #updateCharacterStream()"
);
}
@Override
public void updateObject(
final String columnLabel, final Object x, final int scaleOrLength
) {
throw new UnsupportedOperationException(
"unsupported method #updateObject()"
);
}
@Override
public void updateObject(final String columnLabel, final Object x) {
throw new UnsupportedOperationException(
"unsupported method #updateObject()"
);
}
@Override
public void insertRow() {
throw new UnsupportedOperationException(
"unsupported method #insertRow()"
);
}
@Override
public void updateRow() {
throw new UnsupportedOperationException(
"unsupported method #updateRow()"
);
}
@Override
public void deleteRow() {
throw new UnsupportedOperationException(
"unsupported method #deleteRow()"
);
}
@Override
public void refreshRow() {
throw new UnsupportedOperationException(
"unsupported method #refreshRow()"
);
}
@Override
public void cancelRowUpdates() {
throw new UnsupportedOperationException(
"unsupported method #cancelRowUpdates()"
);
}
@Override
public void moveToInsertRow() {
throw new UnsupportedOperationException(
"unsupported method #moveToInsertRow()"
);
}
@Override
public void moveToCurrentRow() {
throw new UnsupportedOperationException(
"unsupported method #moveToCurrentRow()"
);
}
@Override
public Statement getStatement() {
throw new UnsupportedOperationException(
"unsupported method #getStatement()"
);
}
@Override
public Object getObject(
final int columnIndex, final Map<String, Class<?>> map
) {
throw new UnsupportedOperationException(
"unsupported method #getObject()"
);
}
@Override
public Ref getRef(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getRef()"
);
}
@Override
public Blob getBlob(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getBlob()"
);
}
@Override
public Clob getClob(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getClob()"
);
}
@Override
public Array getArray(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getArray()"
);
}
@Override
public Object getObject(
final String columnLabel, final Map<String, Class<?>> map
) {
throw new UnsupportedOperationException(
"unsupported method #getObject()"
);
}
@Override
public Ref getRef(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getRef()"
);
}
@Override
public Blob getBlob(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getBlob()"
);
}
@Override
public Clob getClob(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getClob()"
);
}
@Override
public Array getArray(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getArray()"
);
}
@Override
public Date getDate(final int columnIndex, final Calendar cal) {
throw new UnsupportedOperationException(
"unsupported method #getDate()"
);
}
@Override
public Date getDate(final String columnLabel, final Calendar cal) {
throw new UnsupportedOperationException(
"unsupported method #getDate()"
);
}
@Override
public Time getTime(final int columnIndex, final Calendar cal) {
throw new UnsupportedOperationException(
"unsupported method #getTime()"
);
}
@Override
public Time getTime(final String columnLabel, final Calendar cal) {
throw new UnsupportedOperationException(
"unsupported method #getTime()"
);
}
@Override
public Timestamp getTimestamp(final int columnIndex, final Calendar cal) {
throw new UnsupportedOperationException(
"unsupported method #getTimestamp()"
);
}
@Override
public Timestamp getTimestamp(
final String columnLabel, final Calendar cal
) {
throw new UnsupportedOperationException(
"unsupported method #getTimestamp()"
);
}
@Override
public URL getURL(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getURL()"
);
}
@Override
public URL getURL(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getURL()"
);
}
@Override
public void updateRef(final int columnIndex, final Ref x) {
throw new UnsupportedOperationException(
"unsupported method #updateRef()"
);
}
@Override
public void updateRef(final String columnLabel, final Ref x) {
throw new UnsupportedOperationException(
"unsupported method #updateRef()"
);
}
@Override
public void updateBlob(final int columnIndex, final Blob x) {
throw new UnsupportedOperationException(
"unsupported method #updateBlob()"
);
}
@Override
public void updateBlob(final String columnLabel, final Blob x) {
throw new UnsupportedOperationException(
"unsupported method #updateBlob()"
);
}
@Override
public void updateClob(final int columnIndex, final Clob x) {
throw new UnsupportedOperationException(
"unsupported method #updateClob()"
);
}
@Override
public void updateClob(final String columnLabel, final Clob x) {
throw new UnsupportedOperationException(
"unsupported method #updateClob()"
);
}
@Override
public void updateArray(final int columnIndex, final Array x) {
throw new UnsupportedOperationException(
"unsupported method #updateArray()"
);
}
@Override
public void updateArray(final String columnLabel, final Array x) {
throw new UnsupportedOperationException(
"unsupported method #updateArray()"
);
}
@Override
public RowId getRowId(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getRowId()"
);
}
@Override
public RowId getRowId(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getRowId()"
);
}
@Override
public void updateRowId(final int columnIndex, final RowId x) {
throw new UnsupportedOperationException(
"unsupported method #updateRowId()"
);
}
@Override
public void updateRowId(final String columnLabel, final RowId x) {
throw new UnsupportedOperationException(
"unsupported method #updateRowId()"
);
}
@Override
public int getHoldability() {
throw new UnsupportedOperationException(
"unsupported method #getHoldability()"
);
}
@Override
public boolean isClosed() {
throw new UnsupportedOperationException(
"unsupported method #isClosed()"
);
}
@Override
public void updateNString(final int columnIndex, final String nString) {
throw new UnsupportedOperationException(
"unsupported method #updateNString()"
);
}
@Override
public void updateNString(final String columnLabel, final String nString) {
throw new UnsupportedOperationException(
"unsupported method #updateNString()"
);
}
@Override
public void updateNClob(final int columnIndex, final NClob nClob) {
throw new UnsupportedOperationException(
"unsupported method #updateNClob()"
);
}
@Override
public void updateNClob(final String columnLabel, final NClob nClob) {
throw new UnsupportedOperationException(
"unsupported method #updateNClob()"
);
}
@Override
public NClob getNClob(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getNClob()"
);
}
@Override
public NClob getNClob(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getNClob()"
);
}
@Override
public SQLXML getSQLXML(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getSQLXML()"
);
}
@Override
public SQLXML getSQLXML(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getSQLXML()"
);
}
@Override
public void updateSQLXML(final int columnIndex, final SQLXML xmlObject) {
throw new UnsupportedOperationException(
"unsupported method #updateSQLXML()"
);
}
@Override
public void updateSQLXML(final String columnLabel, final SQLXML xmlObject) {
throw new UnsupportedOperationException(
"unsupported method #updateSQLXML()"
);
}
@Override
public String getNString(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getNString()"
);
}
@Override
public String getNString(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getNString()"
);
}
@Override
public Reader getNCharacterStream(final int columnIndex) {
throw new UnsupportedOperationException(
"unsupported method #getNCharacterStream()"
);
}
@Override
public Reader getNCharacterStream(final String columnLabel) {
throw new UnsupportedOperationException(
"unsupported method #getNCharacterStream()"
);
}
@Override
public void updateNCharacterStream(
final int columnIndex, final Reader x, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateNCharacterStream()"
);
}
@Override
public void updateNCharacterStream(
final String columnLabel, final Reader reader, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateNCharacterStream()"
);
}
@Override
public void updateAsciiStream(
final int columnIndex, final InputStream x, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateAsciiStream()"
);
}
@Override
public void updateBinaryStream(
final int columnIndex, final InputStream x, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateBinaryStream()"
);
}
@Override
public void updateCharacterStream(
final int columnIndex, final Reader x, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateCharacterStream()"
);
}
@Override
public void updateAsciiStream(
final String columnLabel, final InputStream x, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateAsciiStream()"
);
}
@Override
public void updateBinaryStream(
final String columnLabel, final InputStream x, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateBinaryStream()"
);
}
@Override
public void updateCharacterStream(
final String columnLabel, final Reader reader, final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateCharacterStream()"
);
}
@Override
public void updateBlob(
final int columnIndex,
final InputStream inputStream,
final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateBlob()"
);
}
@Override
public void updateBlob(
final String columnLabel,
final InputStream inputStream,
final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateBlob()"
);
}
@Override
public void updateClob(
final int columnIndex,
final Reader reader,
final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateClob()"
);
}
@Override
public void updateClob(
final String columnLabel,
final Reader reader,
final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateClob()"
);
}
@Override
public void updateNClob(
final int columnIndex,
final Reader reader,
final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateNClob()"
);
}
@Override
public void updateNClob(
final String columnLabel,
final Reader reader,
final long length
) {
throw new UnsupportedOperationException(
"unsupported method #updateNClob()"
);
}
@Override
public void updateNCharacterStream(final int columnIndex, final Reader x) {
throw new UnsupportedOperationException(
"unsupported method #updateNCharacterStream()"
);
}
@Override
public void updateNCharacterStream(
final String columnLabel,
final Reader reader
) {
throw new UnsupportedOperationException(
"unsupported method #updateNCharacterStream()"
);
}
@Override
public void updateAsciiStream(final int columnIndex, final InputStream x) {
throw new UnsupportedOperationException(
"unsupported method #updateAsciiStream()"
);
}
@Override
public void updateBinaryStream(final int columnIndex, final InputStream x) {
throw new UnsupportedOperationException(
"unsupported method #updateBinaryStream()"
);
}
@Override
public void updateCharacterStream(final int columnIndex, final Reader x) {
throw new UnsupportedOperationException(
"unsupported method #updateCharacterStream()"
);
}
@Override
public void updateAsciiStream(
final String columnLabel,
final InputStream x
) {
throw new UnsupportedOperationException(
"unsupported method #updateAsciiStream()"
);
}
@Override
public void updateBinaryStream(
final String columnLabel,
final InputStream x
) {
throw new UnsupportedOperationException(
"unsupported method #updateBinaryStream()"
);
}
@Override
public void updateCharacterStream(
final String columnLabel,
final Reader reader
) {
throw new UnsupportedOperationException(
"unsupported method #updateCharacterStream()"
);
}
@Override
public void updateBlob(
final int columnIndex,
final InputStream inputStream
) {
throw new UnsupportedOperationException(
"unsupported method #updateBlob()"
);
}
@Override
public void updateBlob(
final String columnLabel,
final InputStream inputStream
) {
throw new UnsupportedOperationException(
"unsupported method #updateBlob()"
);
}
@Override
public void updateClob(final int columnIndex, final Reader reader) {
throw new UnsupportedOperationException(
"unsupported method #updateClob()"
);
}
@Override
public void updateClob(final String columnLabel, final Reader reader) {
throw new UnsupportedOperationException(
"unsupported method #updateClob()"
);
}
@Override
public void updateNClob(final int columnIndex, final Reader reader) {
throw new UnsupportedOperationException(
"unsupported method #updateNClob()"
);
}
@Override
public void updateNClob(final String columnLabel, final Reader reader) {
throw new UnsupportedOperationException(
"unsupported method #updateNClob()"
);
}
@Override
public <T> T getObject(final int columnIndex, final Class<T> type) {
throw new UnsupportedOperationException(
"unsupported method #getObject()"
);
}
@Override
public <T> T getObject(final String columnLabel, final Class<T> type) {
throw new UnsupportedOperationException(
"unsupported method #getObject()"
);
}
@Override
public <T> T unwrap(final Class<T> iface) {
throw new UnsupportedOperationException(
"unsupported method #unwrap()"
);
}
@Override
public boolean isWrapperFor(final Class<?> iface) {
throw new UnsupportedOperationException(
"unsupported method #isWrapperFor()"
);
}
}
|
<filename>shared/directives/open-close.directive.spec.ts
import { OpenCloseDirective } from './open-close.directive';
describe('OpenCloseDirective', () => {
it('should create an instance', () => {
const directive = new OpenCloseDirective();
expect(directive).toBeTruthy();
});
});
|
<filename>test/integration/08.publish-landing.test.js
'use strict';
const fs = require('fs');
const path = require('path');
const chai = require('chai');
const chaiHttp = require('chai-http');
const chaiValidateResponse = require('chai-validate-response');
chai.use(chaiHttp);
chai.use(chaiValidateResponse.default);
const should = chai.should();
const server = require('../server');
const config = require('../../config/config');
const fakes = require('../fakes/fakes');
const routesPrefix = config.routesPrefix + config.landingsRoutesNamespace;
const openapiSchemaPath = path.resolve("./spec/openapi.yaml");
let landingId = '';
let landingDomain = '';
let landingIsPublished = false;
let landingHasUnpublishedChanges = false;
let landingDestinationDir = '';
let nginxConfigFile = '';
const fakeProjectFile = fs.readFileSync(fakes.fakeProjectZipPath);
describe(`POST ${routesPrefix}/{landingId}/publishing`, () => {
before(() => {
return new Promise((resolve) => {
chai.request(server)
.get(`${routesPrefix}`)
.set('authorization', `Bearer ${fakes.fakeUserAuthToken}`)
.end((err, res) => {
const landing = res.body.landings.pop();
landingId = landing._id;
landingDomain = landing.domain;
landingIsPublished = landing.isPublished;
landingHasUnpublishedChanges = landing.hasUnpublishedChanges;
landingDestinationDir = path.resolve(config.landingsHtmlDir, landingId);
nginxConfigFile = path.resolve(config.nginxConfigsDir, `${landingId}.conf`);
resolve();
});
});
});
it("selected landing should not be published", (done) => {
landingIsPublished.should.be.false;
done();
});
it("should return auth error for request without bearer token", (done) => {
chai.request(server)
.post(`${routesPrefix}/${landingId}/publishing`)
.end((err, res) => {
should.not.exist(err);
res.status.should.eql(401);
res.type.should.eql('application/json');
res.should.to.be.a.validResponse(openapiSchemaPath, `${routesPrefix}/{landingId}/publishing`, "post")
.andNotifyWhen(done);
});
});
it("should return bad request error when none file is attached", (done) => {
chai.request(server)
.post(`${routesPrefix}/blah-blah-blah/publishing`)
.set('authorization', `Bearer ${fakes.fakeUserAuthToken}`)
.end((err, res) => {
should.not.exist(err);
res.status.should.eql(400);
res.should.to.be.a.validResponse(openapiSchemaPath, `${routesPrefix}/{landingId}/publishing`, "post")
.andNotifyWhen(done);
});
});
it("should return bad request error when landing id is invalid", (done) => {
chai.request(server)
.post(`${routesPrefix}/blah-blah-blah/publishing`)
.set('authorization', `Bearer ${fakes.fakeUserAuthToken}`)
.attach('file', fakeProjectFile, 'project.zip')
.end((err, res) => {
should.not.exist(err);
res.status.should.eql(400);
res.should.to.be.a.validResponse(openapiSchemaPath, `${routesPrefix}/{landingId}/publishing`, "post")
.andNotifyWhen(done);
});
});
it("should return not found error when publish landing for another user", (done) => {
chai.request(server)
.post(`${routesPrefix}/${landingId}/publishing`)
.set('authorization', `Bearer ${fakes.fakeAnotherUserAuthToken}`)
.attach('file', fakeProjectFile, 'project.zip')
.end((err, res) => {
should.not.exist(err);
res.status.should.eql(404);
res.should.to.be.a.validResponse(openapiSchemaPath, `${routesPrefix}/{landingId}/publishing`, "post")
.andNotifyWhen(done);
});
});
it("should return bad request error when attached file have wrong content-type", (done) => {
chai.request(server)
.post(`${routesPrefix}/${landingId}/publishing`)
.set('authorization', `Bearer ${fakes.fakeUserAuthToken}`)
.attach('file', fakeProjectFile, 'project.jpg')
.end((err, res) => {
should.not.exist(err);
res.status.should.eql(400);
res.should.to.be.a.validResponse(openapiSchemaPath, `${routesPrefix}/{landingId}/publishing`, "post")
.andNotifyWhen(done);
});
});
it("should return valid response on success publishing and updated flags in body", (done) => {
chai.request(server)
.post(`${routesPrefix}/${landingId}/publishing`)
.set('authorization', `Bearer ${fakes.fakeUserAuthToken}`)
.attach('file', fakeProjectFile, 'project.zip')
.end((err, res) => {
should.not.exist(err);
res.status.should.eql(200);
res.body.isPublished.should.be.true;
res.body.hasUnpublishedChanges.should.be.false;
res.should.to.be.a.validResponse(openapiSchemaPath, `${routesPrefix}/{landingId}/publishing`, "post")
.andNotifyWhen(done);
});
});
it("should place files for published landing", (done) => {
fs.existsSync(landingDestinationDir).should.be.true;
if (landingDomain) {
fs.existsSync(nginxConfigFile).should.be.true;
} else {
fs.existsSync(nginxConfigFile).should.be.false;
}
done();
});
it("should success re-publish already published landing", (done) => {
chai.request(server)
.post(`${routesPrefix}/${landingId}/publishing`)
.set('authorization', `Bearer ${fakes.fakeUserAuthToken}`)
.attach('file', fakeProjectFile, 'project.zip')
.end((err, res) => {
should.not.exist(err);
res.status.should.eql(200);
res.body.isPublished.should.be.true;
res.body.hasUnpublishedChanges.should.be.false;
res.should.to.be.a.validResponse(openapiSchemaPath, `${routesPrefix}/{landingId}/publishing`, "post")
.andNotifyWhen(done);
});
});
});
|
Advanced Bash-Scripting Guide:
Prev Chapter 16. External Filters, Programs and Commands Next
16.7. Terminal Control Commands
Command affecting the console or terminal
tput
Initialize terminal and/or fetch information about it from terminfo data. Various options permit certain terminal operations: tput clear is the equivalent of clear; tput reset is the equivalent of reset.
bash$ tput longname
xterm terminal emulator (X Window System)
Issuing a tput cup X Y moves the cursor to the (X,Y) coordinates in the current terminal. A clear to erase the terminal screen would normally precede this.
Some interesting options to tput are:
bold, for high-intensity text
smul, to underline text in the terminal
smso, to render text in reverse
sgr0, to reset the terminal parameters (to normal), without clearing the screen
Example scripts using tput:
Example 36-15
Example 36-13
Example A-44
Example A-42
Example 27-2
Note that stty offers a more powerful command set for controlling a terminal.
infocmp
This command prints out extensive information about the current terminal. It references the terminfo database.
bash$ infocmp
# Reconstructed via infocmp from file:
/usr/share/terminfo/r/rxvt
rxvt|rxvt terminal emulator (X Window System),
am, bce, eo, km, mir, msgr, xenl, xon,
colors#8, cols#80, it#8, lines#24, pairs#64,
acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m,
civis=\E[?25l,
clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M,
...
reset
Reset terminal parameters and clear text screen. As with clear, the cursor and prompt reappear in the upper lefthand corner of the terminal.
clear
The clear command simply clears the text screen at the console or in an xterm. The prompt and cursor reappear at the upper lefthand corner of the screen or xterm window. This command may be used either at the command line or in a script. See Example 11-26.
resize
Echoes commands necessary to set $TERM and $TERMCAP to duplicate the size (dimensions) of the current terminal.
bash$ resize
set noglob;
setenv COLUMNS '80';
setenv LINES '24';
unset noglob;
script
This utility records (saves to a file) all the user keystrokes at the command-line in a console or an xterm window. This, in effect, creates a record of a session.
Prev Home Next
Communications Commands Up Math Commands |
<filename>src/containers/SearchAndFilter/HorseSearchBar/index.js
import React, { Component } from 'react'
import { connect } from 'react-redux'
/**
* @module SearchAndFilterBar
*/
import SearchAndFilterBar from 'components/searchandfilter/SearchAndFilterBar'
import {
updateHorseSeachQuery,
updateHorseSort,
toggleHorseFilterPanel
} from 'actions/browsehorses'
class HorseSearchFilterBar extends Component {
constructor (props) {
super(props)
}
render () {
const {
updateSearchQuery,
updateSort,
query,
sort,
attributes,
toggleFilter,
resultsAmount,
filterOpen,
placeholder
} = this.props
return (
<SearchAndFilterBar
resultsAmount={resultsAmount}
onFilterClick={toggleFilter}
filterActive={filterOpen}
placeholder={placeholder}
selectOptions={attributes.sort}
defaultSortValue={sort.displayName || 'relevance'}
sortValue={sort.displayName}
onSearchUpdate={updateSearchQuery}
onSelectUpdate={updateSort}
searchValue={query}
/>
)
}
}
const mapStateToProps = ({browseHorses}, ownProps) => {
const {
query,
sort,
attributes,
resultsAmount,
filterOpen
} = browseHorses
return {
query,
sort,
attributes,
resultsAmount,
filterOpen
}
}
const mapDispatchToProps = (dispatch, ownProps) => {
return {
updateSearchQuery: (query) => {
dispatch(updateHorseSeachQuery(query))
ownProps.onUpdate()
},
updateSort: (name) => {
dispatch(updateHorseSort(name))
ownProps.onUpdate()
},
toggleFilter: () => {
dispatch(toggleHorseFilterPanel())
ownProps.onUpdate()
}
}
}
export default connect(
mapStateToProps,
mapDispatchToProps)(HorseSearchFilterBar)
|
import React, { ReactElement } from "react";
import { Box } from "@chakra-ui/react";
import Table from "../Table";
const OperatingSystemTable = ({
systems,
loading,
title,
}: {
title: string;
systems: OS[] | Browser[];
loading: boolean;
}): ReactElement => {
let totalCounter = 0;
systems.forEach(({ counter }) => (totalCounter += counter));
return (
<Box rounded="md" borderWidth="1px" p="5" mt="8">
<Table
loading={loading}
title={title}
rows={systems.map(({ name, counter }) => {
const percent = Math.round((counter / totalCounter) * 100);
return {
label: name,
tooltipLabel: `${percent}%`,
percent,
};
})}
/>
</Box>
);
};
export default OperatingSystemTable;
|
#!/bin/bash
docker build -t stss-eval . |
<gh_stars>0
/*
* Generated by @medplum/generator
* Do not edit manually.
*/
import { Age } from './Age';
import { Annotation } from './Annotation';
import { CodeableConcept } from './CodeableConcept';
import { Extension } from './Extension';
import { Identifier } from './Identifier';
import { Meta } from './Meta';
import { Narrative } from './Narrative';
import { Period } from './Period';
import { Range } from './Range';
import { Reference } from './Reference';
import { Resource } from './Resource';
/**
* An action that is or was performed on or for a patient. This can be a
* physical intervention like an operation, or less invasive like long
* term services, counseling, or hypnotherapy.
*/
export interface Procedure {
/**
* This is a Procedure resource
*/
readonly resourceType: 'Procedure';
/**
* The logical id of the resource, as used in the URL for the resource.
* Once assigned, this value never changes.
*/
readonly id?: string;
/**
* The metadata about the resource. This is content that is maintained by
* the infrastructure. Changes to the content might not always be
* associated with version changes to the resource.
*/
readonly meta?: Meta;
/**
* A reference to a set of rules that were followed when the resource was
* constructed, and which must be understood when processing the content.
* Often, this is a reference to an implementation guide that defines the
* special rules along with other profiles etc.
*/
readonly implicitRules?: string;
/**
* The base language in which the resource is written.
*/
readonly language?: string;
/**
* A human-readable narrative that contains a summary of the resource and
* can be used to represent the content of the resource to a human. The
* narrative need not encode all the structured data, but is required to
* contain sufficient detail to make it "clinically safe" for a human to
* just read the narrative. Resource definitions may define what content
* should be represented in the narrative to ensure clinical safety.
*/
readonly text?: Narrative;
/**
* These resources do not have an independent existence apart from the
* resource that contains them - they cannot be identified independently,
* and nor can they have their own independent transaction scope.
*/
readonly contained?: Resource[];
/**
* May be used to represent additional information that is not part of
* the basic definition of the resource. To make the use of extensions
* safe and manageable, there is a strict set of governance applied to
* the definition and use of extensions. Though any implementer can
* define an extension, there is a set of requirements that SHALL be met
* as part of the definition of the extension.
*/
readonly extension?: Extension[];
/**
* May be used to represent additional information that is not part of
* the basic definition of the resource and that modifies the
* understanding of the element that contains it and/or the understanding
* of the containing element's descendants. Usually modifier elements
* provide negation or qualification. To make the use of extensions safe
* and manageable, there is a strict set of governance applied to the
* definition and use of extensions. Though any implementer is allowed to
* define an extension, there is a set of requirements that SHALL be met
* as part of the definition of the extension. Applications processing a
* resource are required to check for modifier extensions.
*
* Modifier extensions SHALL NOT change the meaning of any elements on
* Resource or DomainResource (including cannot change the meaning of
* modifierExtension itself).
*/
readonly modifierExtension?: Extension[];
/**
* Business identifiers assigned to this procedure by the performer or
* other systems which remain constant as the resource is updated and is
* propagated from server to server.
*/
readonly identifier?: Identifier[];
/**
* The URL pointing to a FHIR-defined protocol, guideline, order set or
* other definition that is adhered to in whole or in part by this
* Procedure.
*/
readonly instantiatesCanonical?: string[];
/**
* The URL pointing to an externally maintained protocol, guideline,
* order set or other definition that is adhered to in whole or in part
* by this Procedure.
*/
readonly instantiatesUri?: string[];
/**
* A reference to a resource that contains details of the request for
* this procedure.
*/
readonly basedOn?: Reference[];
/**
* A larger event of which this particular procedure is a component or
* step.
*/
readonly partOf?: Reference[];
/**
* A code specifying the state of the procedure. Generally, this will be
* the in-progress or completed state.
*/
readonly status?: string;
/**
* Captures the reason for the current state of the procedure.
*/
readonly statusReason?: CodeableConcept;
/**
* A code that classifies the procedure for searching, sorting and
* display purposes (e.g. "Surgical Procedure").
*/
readonly category?: CodeableConcept;
/**
* The specific procedure that is performed. Use text if the exact nature
* of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").
*/
readonly code?: CodeableConcept;
/**
* The person, animal or group on which the procedure was performed.
*/
readonly subject?: Reference;
/**
* The Encounter during which this Procedure was created or performed or
* to which the creation of this record is tightly associated.
*/
readonly encounter?: Reference;
/**
* Estimated or actual date, date-time, period, or age when the procedure
* was performed. Allows a period to support complex procedures that
* span more than one date, and also allows for the length of the
* procedure to be captured.
*/
readonly performedDateTime?: string;
/**
* Estimated or actual date, date-time, period, or age when the procedure
* was performed. Allows a period to support complex procedures that
* span more than one date, and also allows for the length of the
* procedure to be captured.
*/
readonly performedPeriod?: Period;
/**
* Estimated or actual date, date-time, period, or age when the procedure
* was performed. Allows a period to support complex procedures that
* span more than one date, and also allows for the length of the
* procedure to be captured.
*/
readonly performedString?: string;
/**
* Estimated or actual date, date-time, period, or age when the procedure
* was performed. Allows a period to support complex procedures that
* span more than one date, and also allows for the length of the
* procedure to be captured.
*/
readonly performedAge?: Age;
/**
* Estimated or actual date, date-time, period, or age when the procedure
* was performed. Allows a period to support complex procedures that
* span more than one date, and also allows for the length of the
* procedure to be captured.
*/
readonly performedRange?: Range;
/**
* Individual who recorded the record and takes responsibility for its
* content.
*/
readonly recorder?: Reference;
/**
* Individual who is making the procedure statement.
*/
readonly asserter?: Reference;
/**
* Limited to "real" people rather than equipment.
*/
readonly performer?: ProcedurePerformer[];
/**
* The location where the procedure actually happened. E.g. a newborn at
* home, a tracheostomy at a restaurant.
*/
readonly location?: Reference;
/**
* The coded reason why the procedure was performed. This may be a coded
* entity of some type, or may simply be present as text.
*/
readonly reasonCode?: CodeableConcept[];
/**
* The justification of why the procedure was performed.
*/
readonly reasonReference?: Reference[];
/**
* Detailed and structured anatomical location information. Multiple
* locations are allowed - e.g. multiple punch biopsies of a lesion.
*/
readonly bodySite?: CodeableConcept[];
/**
* The outcome of the procedure - did it resolve the reasons for the
* procedure being performed?
*/
readonly outcome?: CodeableConcept;
/**
* This could be a histology result, pathology report, surgical report,
* etc.
*/
readonly report?: Reference[];
/**
* Any complications that occurred during the procedure, or in the
* immediate post-performance period. These are generally tracked
* separately from the notes, which will typically describe the procedure
* itself rather than any 'post procedure' issues.
*/
readonly complication?: CodeableConcept[];
/**
* Any complications that occurred during the procedure, or in the
* immediate post-performance period.
*/
readonly complicationDetail?: Reference[];
/**
* If the procedure required specific follow up - e.g. removal of
* sutures. The follow up may be represented as a simple note or could
* potentially be more complex, in which case the CarePlan resource can
* be used.
*/
readonly followUp?: CodeableConcept[];
/**
* Any other notes and comments about the procedure.
*/
readonly note?: Annotation[];
/**
* A device that is implanted, removed or otherwise manipulated
* (calibration, battery replacement, fitting a prosthesis, attaching a
* wound-vac, etc.) as a focal portion of the Procedure.
*/
readonly focalDevice?: ProcedureFocalDevice[];
/**
* Identifies medications, devices and any other substance used as part
* of the procedure.
*/
readonly usedReference?: Reference[];
/**
* Identifies coded items that were used as part of the procedure.
*/
readonly usedCode?: CodeableConcept[];
}
/**
* An action that is or was performed on or for a patient. This can be a
* physical intervention like an operation, or less invasive like long
* term services, counseling, or hypnotherapy.
*/
export interface ProcedureFocalDevice {
/**
* Unique id for the element within a resource (for internal references).
* This may be any string value that does not contain spaces.
*/
readonly id?: string;
/**
* May be used to represent additional information that is not part of
* the basic definition of the element. To make the use of extensions
* safe and manageable, there is a strict set of governance applied to
* the definition and use of extensions. Though any implementer can
* define an extension, there is a set of requirements that SHALL be met
* as part of the definition of the extension.
*/
readonly extension?: Extension[];
/**
* May be used to represent additional information that is not part of
* the basic definition of the element and that modifies the
* understanding of the element in which it is contained and/or the
* understanding of the containing element's descendants. Usually
* modifier elements provide negation or qualification. To make the use
* of extensions safe and manageable, there is a strict set of governance
* applied to the definition and use of extensions. Though any
* implementer can define an extension, there is a set of requirements
* that SHALL be met as part of the definition of the extension.
* Applications processing a resource are required to check for modifier
* extensions.
*
* Modifier extensions SHALL NOT change the meaning of any elements on
* Resource or DomainResource (including cannot change the meaning of
* modifierExtension itself).
*/
readonly modifierExtension?: Extension[];
/**
* The kind of change that happened to the device during the procedure.
*/
readonly action?: CodeableConcept;
/**
* The device that was manipulated (changed) during the procedure.
*/
readonly manipulated?: Reference;
}
/**
* An action that is or was performed on or for a patient. This can be a
* physical intervention like an operation, or less invasive like long
* term services, counseling, or hypnotherapy.
*/
export interface ProcedurePerformer {
/**
* Unique id for the element within a resource (for internal references).
* This may be any string value that does not contain spaces.
*/
readonly id?: string;
/**
* May be used to represent additional information that is not part of
* the basic definition of the element. To make the use of extensions
* safe and manageable, there is a strict set of governance applied to
* the definition and use of extensions. Though any implementer can
* define an extension, there is a set of requirements that SHALL be met
* as part of the definition of the extension.
*/
readonly extension?: Extension[];
/**
* May be used to represent additional information that is not part of
* the basic definition of the element and that modifies the
* understanding of the element in which it is contained and/or the
* understanding of the containing element's descendants. Usually
* modifier elements provide negation or qualification. To make the use
* of extensions safe and manageable, there is a strict set of governance
* applied to the definition and use of extensions. Though any
* implementer can define an extension, there is a set of requirements
* that SHALL be met as part of the definition of the extension.
* Applications processing a resource are required to check for modifier
* extensions.
*
* Modifier extensions SHALL NOT change the meaning of any elements on
* Resource or DomainResource (including cannot change the meaning of
* modifierExtension itself).
*/
readonly modifierExtension?: Extension[];
/**
* Distinguishes the type of involvement of the performer in the
* procedure. For example, surgeon, anaesthetist, endoscopist.
*/
readonly function?: CodeableConcept;
/**
* The practitioner who was involved in the procedure.
*/
readonly actor?: Reference;
/**
* The organization the device or practitioner was acting on behalf of.
*/
readonly onBehalfOf?: Reference;
}
|
import aiohttp
from aiohttp import web
from servicelib.session import get_session
async def login_handler(request):
data = await request.post()
username = data.get('username')
password = data.get('password')
# Perform authentication logic here
# Assuming successful authentication
session_id = create_session(username) # Create a session for the user
return web.json_response({'session_id': session_id})
async def user_data_handler(request):
session_id = request.headers.get('session_id')
if not session_id:
return web.json_response({'error': 'Session ID is required'}, status=401)
session_data = get_session(session_id) # Retrieve session data using servicelib
if not session_data:
return web.json_response({'error': 'Invalid session ID'}, status=401)
# Fetch user-specific data using the session data
user_data = fetch_user_data(session_data['user_id'])
return web.json_response(user_data)
app = web.Application()
app.router.add_post('/login', login_handler)
app.router.add_get('/user-data', user_data_handler)
if __name__ == '__main__':
web.run_app(app) |
#!/bin/bash
WORKSPACE=$1
PORT=$2
play debug "run ${PORT}"
|
<reponame>brotherlogic/pictureframe
package com.github.brotherlogic.pictureframe;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;
public class ImagePanel extends JPanel {
Image img;
public ImagePanel(Image image) {
super();
img = image;
setBackground(Color.BLACK);
}
@Override
public void paint(Graphics g) {
super.paint(g);
g.drawImage(img, (800 - img.getWidth(null)) / 2, 0, null);
}
@Override
public Dimension getPreferredSize() {
return getParent().getSize();
}
}
|
echo YourPassword | sudo -S /Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh stop apache
echo YourPassword | sudo -S /Applications/XAMPP/xamppfiles/mysql/scripts/ctl.sh stop mysql
|
/*
Copyright (c) 2016-2017 Bitnami
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.kubeless;
/**
* Event includes information about the event source
*/
public class Event {
String Data;
String EventID;
String EventType;
String EventTime;
String EventNamespace;
public Event(String data, String eventId, String eventType, String eventTime, String eventNamespace) {
this.Data = data;
this.EventID = eventId;
this.EventType = eventType;
this.EventTime = eventTime;
this.EventNamespace = eventNamespace;
}
}
|
/*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is "Simplenlg".
*
* The Initial Developer of the Original Code is <NAME>, <NAME> and <NAME>.
* Portions created by <NAME>, <NAME> and <NAME> are Copyright (C) 2010-11 The University of Aberdeen. All Rights Reserved.
*
* Contributor(s): <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>.
*/
package simplenlg.lexicon;
import java.io.File;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import simplenlg.features.LexicalFeature;
import simplenlg.framework.Language;
import simplenlg.framework.LexicalCategory;
import simplenlg.framework.WordElement;
/**
* This class loads words from an XML lexicon. All features specified in the
* lexicon are loaded
*
* @author ereiter
*
*/
public class XMLLexicon extends Lexicon {
// node names in lexicon XML files
private static final String XML_BASE = "base"; // base form of Word
private static final String XML_CATEGORY = "category"; // base form of Word
private static final String XML_ID = "id"; // base form of Word
private static final String XML_WORD = "word"; // node defining a word
// inflectional codes which need to be set as part of INFLECTION feature
private static final List<String> INFL_CODES = Arrays.asList(new String[] {
"reg", "irreg", "uncount", "inv", "metareg", "glreg", "nonCount", "sing", "groupuncount" });
// lexicon
private Set<WordElement> words; // set of words
private Map<String, WordElement> indexByID; // map from ID to word
private Map<String, List<WordElement>> indexByBase; // map from base to set
// of words with this
// baseform
protected /*private*/ Map<String, List<WordElement>> indexByVariant; // map from variants
// to set of words
// with this variant
// added by vaudrypl
protected Map<LexicalCategory, List<WordElement>> indexByCategory; // map from variants
/**********************************************************************/
// constructors
/**********************************************************************/
/**
* Load an XML Lexicon from a named file
*
* @param filename
*/
public XMLLexicon(String filename) {
super();
File file = new File(filename);
createLexicon(file.toURI());
}
/**
* Load an XML Lexicon from a File
*
* @param file
*/
public XMLLexicon(File file) {
super();
createLexicon(file.toURI());
}
/**
* Load an XML Lexicon from a URI
*
* @param lexiconURI
*/
public XMLLexicon(URI lexiconURI) {
super();
createLexicon(lexiconURI);
}
public XMLLexicon() {
this(Language.DEFAULT_LANGUAGE);
}
/**
* Loads the default XML lexicon corresponding to a particular language
*
* @param language
*/
public XMLLexicon(Language language) {
super(language);
if (language == null) language = Language.DEFAULT_LANGUAGE;
String xmlLexiconFilePath;
switch (language) {
case FRENCH :
xmlLexiconFilePath = "/lexicon/default-french-lexicon.xml";
break;
default :
xmlLexiconFilePath = "/lexicon/default-lexicon.xml";
}
try {
createLexicon(XMLLexicon.class.getResourceAsStream(xmlLexiconFilePath));
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
/**
* Load an XML Lexicon from a named file
* with the associated language
*
* @param language
* the associated language
* @param filename
* @author vaudrypl
*/
public XMLLexicon(Language language, String filename) {
super(language);
File file = new File(filename);
createLexicon(file.toURI());
}
/**
* Load an XML Lexicon from a named file
* with the ISO 639-1 two letter code of the associated language
*
* @param language
* the associated language ISO 639-1 two letter code
* @param filename
* @author vaudrypl
*/
public XMLLexicon(String languageCode, String filename) {
super(languageCode);
File file = new File(filename);
createLexicon(file.toURI());
}
/**
* Load an XML Lexicon from a file
* with the associated language
*
* @param language
* the associated language
* @param file
* @author vaudrypl
*/
public XMLLexicon(Language language, File file) {
super(language);
createLexicon(file.toURI());
}
/**
* Load an XML Lexicon from a file
* with the ISO 639-1 two letter code of the associated language
*
* @param language
* the associated language ISO 639-1 two letter code
* @param file
* @author vaudrypl
*/
public XMLLexicon(String languageCode, File file) {
super(languageCode);
createLexicon(file.toURI());
}
/**
* Load an XML Lexicon from a URI
* with the associated language
*
* @param language
* the associated language
* @param lexiconURI
* @author vaudrypl
*/
public XMLLexicon(Language language, URI lexiconURI) {
super(language);
createLexicon(lexiconURI);
}
/**
* Load an XML Lexicon from a URI
* with the ISO 639-1 two letter code of the associated language
*
* @param language
* the associated language ISO 639-1 two letter code
* @param lexiconURI
* @author vaudrypl
*/
public XMLLexicon(String languageCode, URI lexiconURI) {
super(languageCode);
createLexicon(lexiconURI);
}
/**
* method to actually load and index the lexicon from a URI
*
* vaudrypl removed call to addSpecialCases() and moved this
* method to simplenlg.lexicon.english.XMLLexicon
*
* @param uri
*/
private void createLexicon(URI lexiconURI) {
// initialise objects
words = new HashSet<WordElement>();
indexByID = new HashMap<String, WordElement>();
indexByBase = new HashMap<String, List<WordElement>>();
indexByVariant = new HashMap<String, List<WordElement>>();
// added by vaudrypl
indexByCategory = new EnumMap<LexicalCategory, List<WordElement>>(LexicalCategory.class);
try {
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(lexiconURI.toString());
if (doc != null) {
Element lexRoot = doc.getDocumentElement();
NodeList wordNodes = lexRoot.getChildNodes();
for (int i = 0; i < wordNodes.getLength(); i++) {
Node wordNode = wordNodes.item(i);
// ignore things that aren't elements
if (wordNode.getNodeType() == Node.ELEMENT_NODE) {
WordElement word = convertNodeToWord(wordNode);
if (word != null) {
words.add(word);
IndexWord(word);
}
}
}
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
/**
* method to actually load and index the lexicon from a URI.
* This method uses InputStram so the file can be read from inside the jar file
*
* @author <NAME>
* @param is
*/
private void createLexicon(InputStream is) {
// initialise objects
words = new HashSet<WordElement>();
indexByID = new HashMap<String, WordElement>();
indexByBase = new HashMap<String, List<WordElement>>();
indexByVariant = new HashMap<String, List<WordElement>>();
// added by vaudrypl
indexByCategory = new EnumMap<LexicalCategory, List<WordElement>>(LexicalCategory.class);
try {
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(is);
if (doc != null) {
Element lexRoot = doc.getDocumentElement();
NodeList wordNodes = lexRoot.getChildNodes();
for (int i = 0; i < wordNodes.getLength(); i++) {
Node wordNode = wordNodes.item(i);
// ignore things that aren't elements
if (wordNode.getNodeType() == Node.ELEMENT_NODE) {
WordElement word = convertNodeToWord(wordNode);
if (word != null) {
words.add(word);
IndexWord(word);
}
}
}
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
/**
* create a simplenlg WordElement from a Word node in a lexicon XML file
*
* @param wordNode
* @return
* @throws XPathUtilException
*
* access level modifier changed by <NAME> from private
* to protected to allow overriding in subclass
*/
/*private*/ protected WordElement convertNodeToWord(Node wordNode) {
// if this isn't a Word node, ignore it
if (!wordNode.getNodeName().equalsIgnoreCase(XML_WORD))
return null;
// // if there is no base, flag an error and return null
// String base = XPathUtil.extractValue(wordNode, Constants.XML_BASE);
// if (base == null) {
// System.out.println("Error in loading XML lexicon: Word with no base");
// return null;
// }
// create word
WordElement word = new WordElement(this);
List<String> inflections = new ArrayList<String>();
// now copy features
NodeList nodes = wordNode.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node featureNode = nodes.item(i);
if (featureNode.getNodeType() == Node.ELEMENT_NODE) {
String feature = featureNode.getNodeName().trim();
String value = featureNode.getTextContent();
if (value != null)
value = value.trim();
if (feature == null) {
System.out.println("Error in XML lexicon node for "
+ word.toString());
break;
}
if (feature.equalsIgnoreCase(XML_BASE)) {
word.setBaseForm(value);
} else if (feature.equalsIgnoreCase(XML_CATEGORY))
word.setCategory(LexicalCategory.valueOf(value
.toUpperCase()));
else if (feature.equalsIgnoreCase(XML_ID))
word.setId(value);
else if (value == null || value.equals("")) {
if (INFL_CODES.contains(feature)) {
// if this is an infl code, add it to inflections
inflections.add(feature);
} else {
//otherwise assume it's a boolean feature
word.setFeature(feature, true);
}
} else
word.setFeature(feature, value);
}
}
//if no infl specified, assume regular
if(inflections.isEmpty()) {
inflections.add("reg");
}
//default inflection code is "reg" if we have it, else random pick form infl codes available
String defaultInfl = inflections.contains("reg") ? "reg" : inflections.get(0);
word.setFeature(LexicalFeature.INFLECTIONS, inflections);
word.setFeature(LexicalFeature.DEFAULT_INFL, defaultInfl);
// done, return word
return word;
}
/**
* add word to internal indices
*
* @param word
*/
private void IndexWord(WordElement word) {
// first index by base form
String base = word.getBaseForm();
// shouldn't really need is, as all words have base forms
if (base != null) {
updateIndex(word, base, indexByBase);
}
// now index by ID, which should be unique (if present)
String id = word.getId();
if (id != null) {
if (indexByID.containsKey(id))
System.out.println("Lexicon error: ID " + id
+ " occurs more than once");
indexByID.put(id, word);
}
// now index by variant
for (String variant : getVariants(word)) {
updateIndex(word, variant, indexByVariant);
}
// added by vaudrypl
// now index by category
LexicalCategory category = (LexicalCategory) word.getCategory();
// shouldn't really need is, as all words have category
if (category != null) {
if (!indexByCategory.containsKey(category)) {
indexByCategory.put(category, new ArrayList<WordElement>());
}
indexByCategory.get(category).add(word);
}
// done
}
/**
* routine for getting morph variants, should be overridden by subclass
* for specific language
* @param word
* @return set of variants of the word
* @author vaudrypl
*/
protected Set<String> getVariants(WordElement word) {
Set<String> variants = new HashSet<String>();
variants.add(word.getBaseForm());
return variants;
}
/**
* convenience method to update an index
*
* @param word
* @param base
* @param index
*/
protected /*private*/ void updateIndex(WordElement word, String base,
Map<String, List<WordElement>> index) {
if (!index.containsKey(base))
index.put(base, new ArrayList<WordElement>());
index.get(base).add(word);
}
/**
* creates a default WordElement and adds it to the lexicon
*
* @param baseForm
* - base form of word
* @param category
* - category of word
* @return WordElement entry for specified info
* @author vaudrypl
*/
@Override
protected WordElement createWord(String baseForm, LexicalCategory category) {
WordElement newWord = super.createWord(baseForm, category);
words.add(newWord);
IndexWord(newWord);
return newWord; // return default
// WordElement of this
// baseForm, category
}
/**
* creates a default WordElement and adds it to the lexicon
*
* @param baseForm
* - base form of word
* @return WordElement entry for specified info
* @author vaudrypl
*/
@Override
protected WordElement createWord(String baseForm) {
WordElement newWord = super.createWord(baseForm);
words.add(newWord);
IndexWord(newWord);
return newWord; // return default WordElement of this
// baseForm
}
/******************************************************************************************/
// main methods to get data from lexicon
/******************************************************************************************/
/*
* (non-Javadoc)
*
* @see simplenlg.lexicon.Lexicon#getWords(java.lang.String,
* simplenlg.features.LexicalCategory)
*/
@Override
public List<WordElement> getWords(String baseForm, LexicalCategory category) {
return getWordsFromIndex(baseForm, category, indexByBase);
}
/**
* get matching keys from an index map
*
* @param indexKey
* @param category
* @param indexMap
* @return
*/
private List<WordElement> getWordsFromIndex(String indexKey,
LexicalCategory category, Map<String, List<WordElement>> indexMap) {
List<WordElement> result = new ArrayList<WordElement>();
// case 1: unknown, return empty list
if (!indexMap.containsKey(indexKey))
return result;
// case 2: category is ANY, return everything
if (category == LexicalCategory.ANY)
return indexMap.get(indexKey);
// case 3: other category, search for match
else
for (WordElement word : indexMap.get(indexKey))
if (word.getCategory() == category)
result.add(word);
return result;
}
/*
* (non-Javadoc)
*
* @see simplenlg.lexicon.Lexicon#getWordsByID(java.lang.String)
*/
@Override
public List<WordElement> getWordsByID(String id) {
List<WordElement> result = new ArrayList<WordElement>();
if (indexByID.containsKey(id))
result.add(indexByID.get(id));
return result;
}
/*
* (non-Javadoc)
*
* @see simplenlg.lexicon.Lexicon#getWordsFromVariant(java.lang.String,
* simplenlg.features.LexicalCategory)
*/
@Override
public List<WordElement> getWordsFromVariant(String variant,
LexicalCategory category) {
return getWordsFromIndex(variant, category, indexByVariant);
}
/**
* Looks for all words in the lexicon matching the category and features
* provided. If some of the features provided have a value of null or Boolean.FALSE,
* This method will also include words who don't have those features at all.
* This allows default values for features not determined by the word.
*
* @param category category of the returned WordElement
* @param features features and their corrsponding values that
* the WordElement returned must have (it can have others)
* @return list of all WordElements found that matches the argument
*
* @author vaudrypl
*/
@Override
public List<WordElement> getWords(LexicalCategory category,
Map<String, Object> features) {
List<WordElement> result = new ArrayList<WordElement>();
Collection<WordElement> collection = null;
Iterator<WordElement> iterator = null;
if (category == LexicalCategory.ANY) {
// use the whole lexicon
collection = words;
} else if (indexByCategory.containsKey(category)) {
collection = indexByCategory.get(category);
}
if (collection != null) iterator = collection.iterator();
// if the index by category doesn't contain the category wanted,
// skip this part and return an empty list
if (iterator != null) {
if (features == null) {
result.addAll(collection);
}else {
// must convert map to set to use contains()
Set<Map.Entry<String, Object>> featuresToCheck = features.entrySet();
while (iterator.hasNext()) {
WordElement currentWord = iterator.next();
Map<String, Object> currentFeaturesMap = currentWord.getAllFeatures();
Set<Map.Entry<String, Object>> currentFeaturesSet = currentFeaturesMap.entrySet();
/* Doesn't add a word to the list if the following is not true for
at least one feature received as argument :
The word has this feature and its corresponding value OR
The value of this feature is null or Boolean.FALSE and the word
doesn't have this feature at all.
*/ boolean addWord = true;
for (Map.Entry<String, Object> entry : featuresToCheck) {
if ( !( currentFeaturesSet.contains( entry ) ||
((entry.getValue() == null || entry.getValue() == Boolean.FALSE)
&& !currentFeaturesMap.containsKey(entry.getKey())) ) ) {
addWord = false;
break;
}
}
if (addWord) result.add(currentWord);
}
}
}
return result;
}
} |
<reponame>SoundShell/cli<filename>packages/cli-plugin-fc/postinstall.js
try {
const {
postInstall,
postInstallModule,
formatModuleVersion,
} = require('@midwayjs/command-core');
(async () => {
const info = await postInstall();
const version = formatModuleVersion(
info && info.deps['@midwayjs/faas']
).major;
if (!version) {
return;
}
await postInstallModule([
{ name: '@midwayjs/serverless-app', version },
{ name: '@midwayjs/serverless-fc-starter', version },
{ name: '@midwayjs/serverless-fc-trigger', version },
]);
})();
} catch (e) {
//
}
|
<filename>hedera-mirror-importer/src/test/java/com/hedera/mirror/importer/reader/balance/BalanceFileReaderImplV2Test.java
package com.hedera.mirror.importer.reader.balance;
/*-
*
* Hedera Mirror Node
*
* Copyright (C) 2019 - 2022 Hedera Hashgraph, LLC
*
* 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.
*
*/
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
import com.hedera.mirror.importer.domain.StreamFileData;
import com.hedera.mirror.importer.reader.balance.line.AccountBalanceLineParserV2;
class BalanceFileReaderImplV2Test extends CsvBalanceFileReaderTest {
static final String FILE_PATH = getTestFilename("v2", "2020-09-22T04_25_00.083212003Z_Balances.csv");
BalanceFileReaderImplV2Test() {
super(BalanceFileReaderImplV2.class, AccountBalanceLineParserV2.class, FILE_PATH, 106L);
}
@Test
void supportsInvalidWhenWrongVersion() {
StreamFileData streamFileData = StreamFileData
.from(balanceFile.getName(), BalanceFileReaderImplV1.TIMESTAMP_HEADER_PREFIX);
assertThat(balanceFileReader.supports(streamFileData)).isFalse();
}
}
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.flickr4 = void 0;
var flickr4 = {
"viewBox": "0 0 16 16",
"children": [{
"name": "path",
"attribs": {
"fill": "#000000",
"d": "M8 0c-4.418 0-8 3.606-8 8.055s3.582 8.055 8 8.055 8-3.606 8-8.055-3.582-8.055-8-8.055zM4.5 10.5c-1.381 0-2.5-1.119-2.5-2.5s1.119-2.5 2.5-2.5 2.5 1.119 2.5 2.5c0 1.381-1.119 2.5-2.5 2.5zM11.5 10.5c-1.381 0-2.5-1.119-2.5-2.5s1.119-2.5 2.5-2.5 2.5 1.119 2.5 2.5c0 1.381-1.119 2.5-2.5 2.5z"
}
}]
};
exports.flickr4 = flickr4; |
const generateHexColor = () => {
let hexCode = '#';
const possibleValues = '0123456789ABCDEF';
for (let i = 0; i < 6; i++) {
hexCode += possibleValues[Math.floor(Math.random() * 16)];
}
return hexCode;
};
console.log(generateHexColor()); |
package bd.edu.daffodilvarsity.classmanager.adapters.recyclerViewAdapters;
import android.content.res.Resources;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import bd.edu.daffodilvarsity.classmanager.DiffUtilCallbacks.EachDayRoutineDiffCallback;
import bd.edu.daffodilvarsity.classmanager.R;
import bd.edu.daffodilvarsity.classmanager.routine.RoutineClassDetails;
import timber.log.Timber;
public class EachDayRoutineRecyclerViewAdapter extends RecyclerView.Adapter<EachDayRoutineRecyclerViewAdapter.ViewHolder> {
private NotificationChangeListener notificationChangeListener;
private ArrayList<RoutineClassDetails> mClasses = new ArrayList<>();
public EachDayRoutineRecyclerViewAdapter() {
notificationChangeListener = null;
}
public void addNotificationChangeListener(NotificationChangeListener listener) {
notificationChangeListener = listener;
}
public void updateRecyclerViewAdapter(List<RoutineClassDetails> updatedList) {
EachDayRoutineDiffCallback diffCallback = new EachDayRoutineDiffCallback(mClasses, updatedList);
DiffUtil.DiffResult result = DiffUtil.calculateDiff(diffCallback);
result.dispatchUpdatesTo(this);
mClasses.clear();
mClasses.addAll(updatedList);
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_classes, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) {
try {
holder.courseName.setText(mClasses.get(position).getCourseName());
holder.courseCode.setText(mClasses.get(position).getCourseCode());
holder.classTime.setText(mClasses.get(position).getTime());
holder.teacherInitial.setText(mClasses.get(position).getTeacherInitial());
holder.section.setText(mClasses.get(position).getSection());
holder.roomNo.setText(mClasses.get(position).getRoom());
if (mClasses.get(position).isNotificationEnabled()) {
holder.notification.setBackgroundColor(getRandomColor(position));
holder.notification.setImageResource(R.drawable.ic_alarm_on_white);
holder.divider.setVisibility(View.INVISIBLE);
} else {
holder.notification.setBackgroundColor(Color.parseColor("#00000000"));
holder.notification.setImageResource(R.drawable.ic_alarm_off_black);
holder.divider.setVisibility(View.VISIBLE);
}
holder.notification.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (notificationChangeListener != null) {
notificationChangeListener.onNotificationChanges(mClasses.get(position));
Animation pulse = AnimationUtils.loadAnimation(holder.notification.getContext(), R.anim.pulse_anim);
holder.notification.startAnimation(pulse);
}
}
});
} catch (NullPointerException | Resources.NotFoundException e) {
Timber.e(e);
}
}
@Override
public int getItemCount() {
return mClasses.size();
}
private int getRandomColor(int position) {
switch (position) {
case 0:
case 5:
return Color.parseColor("#00BCD4");
case 1:
case 6:
return Color.parseColor("#FF9800");
case 2:
case 7:
return Color.parseColor("#AB47BC");
case 3:
case 8:
return Color.parseColor("#7E57C2");
case 4:
case 9:
return Color.parseColor("#29B6F6");
default:
return Color.parseColor("#7E57C2");
}
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView courseName;
TextView courseCode;
TextView classTime;
TextView teacherInitial;
TextView section;
TextView roomNo;
ImageView notification;
View divider;
private ViewHolder(@NonNull View itemView) {
super(itemView);
courseName = itemView.findViewById(R.id.course_name);
courseCode = itemView.findViewById(R.id.course_code);
classTime = itemView.findViewById(R.id.class_time);
teacherInitial = itemView.findViewById(R.id.teacher_initial);
section = itemView.findViewById(R.id.section);
roomNo = itemView.findViewById(R.id.room_no);
notification = itemView.findViewById(R.id.notification);
divider = itemView.findViewById(R.id.divider);
}
}
public interface NotificationChangeListener {
void onNotificationChanges(RoutineClassDetails routineClassDetails);
}
}
|
package com.studiohartman.jamepad;
/**
* This is an enumerated type for controller buttons.
*
* Things are a bit gross here because it needs to correspond with the
* enum SDL_GameControllerButton in SDL_gamecontroller.h.
*
* We skip the invalid button one and the max one (Who would ever want to check those anyway?).
* This means that we start with an index 0 instead of -1, so that's nice at least.
*
* Make sure that the indices of the included buttons matches with the values in the
* enum in native code. (i.e. that A is 0 in both, B is 1 in both, etc.).
*
* @author <NAME>
*/
public enum ControllerButton {
A,
B,
X,
Y,
BACK,
GUIDE,
START,
LEFTSTICK,
RIGHTSTICK,
LEFTBUMPER,
RIGHTBUMPER,
DPAD_UP,
DPAD_DOWN,
DPAD_LEFT,
DPAD_RIGHT,
}
|
import fmt
func main() {
fmt.printf("Hello world.\n")
}
|
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// �nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2016.12.13 um 03:20:53 PM CET
//
package de.dfki.nlp.domain.pubmed;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"chemical"
})
@XmlRootElement(name = "ChemicalList")
public class ChemicalList {
@XmlElement(name = "Chemical", required = true)
protected List<Chemical> chemical;
/**
* Gets the value of the chemical property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the chemical property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getChemical().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Chemical }
*
*
*/
public List<Chemical> getChemical() {
if (chemical == null) {
chemical = new ArrayList<Chemical>();
}
return this.chemical;
}
}
|
#!/bin/bash
# Trained weights: resnet34_scnn-aug_tusimple_20210723.pt
# Training
python -m torch.distributed.launch --nproc_per_node=2 --use_env main_landet.py --train --config=configs/lane_detection/scnn/resnet34_tusimple_aug.py --mixed-precision
# Predicting lane points for testing
python main_landet.py --test --config=configs/lane_detection/scnn/resnet34_tusimple_aug.py --mixed-precision
# Testing with official scripts
./autotest_tusimple-aug.sh resnet34_scnn_tusimple-aug test checkpoints
|
/*
* Copyright 2014-2020 The Ideal Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file or at
* https://developers.google.com/open-source/licenses/bsd
*/
package ideal.development.actions;
import ideal.library.elements.*;
import ideal.library.reflections.*;
import javax.annotation.Nullable;
import ideal.runtime.elements.*;
import ideal.runtime.logs.*;
import ideal.runtime.reflections.*;
import ideal.development.elements.*;
import ideal.development.names.*;
import ideal.development.kinds.*;
import static ideal.development.kinds.type_kinds.*;
import ideal.development.types.*;
import ideal.development.flavors.*;
import ideal.development.notifications.*;
import ideal.development.modifiers.*;
import ideal.development.declarations.*;
import ideal.development.values.*;
public class action_utilities {
private action_utilities() { }
static final position no_position = new special_position(new base_string("no-position"));
public static readonly_list<type> lookup_types(analysis_context context, type from,
action_name name) {
// TODO: use map.
list<type> result = new base_list<type>();
readonly_list<action> types = context.lookup(from, name);
for (int i = 0; i < types.size(); ++i) {
action a = types.get(i);
if (a instanceof type_action) {
result.append(((type_action) a).get_type());
} else {
// This is unexpected; but we should be able just to ignore it.
// For now, panic to get attention.
utilities.panic("Type expected " + a);
}
}
return result;
}
// TODO: use declaration_utils.get_declared_supertypes()
public static readonly_list<type> get_supertypes(principal_type the_type) {
declaration the_declaration = the_type.get_declaration();
assert the_declaration instanceof type_declaration;
readonly_list<declaration> signature = ((type_declaration) the_declaration).get_signature();
list<type> result = new base_list<type>();
for (int i = 0; i < signature.size(); ++i) {
declaration d = signature.get(i);
if (d instanceof supertype_declaration) {
supertype_declaration the_supertype_declaration = (supertype_declaration) d;
if (!the_supertype_declaration.has_errors()) {
result.append(the_supertype_declaration.get_supertype());
}
}
}
return result;
}
public static void add_promotion(analysis_context context, type from, type to, position pos) {
if (to instanceof principal_type) {
context.add(from, special_name.PROMOTION, to.to_action(pos));
} else {
context.add(from, special_name.PROMOTION, new promotion_action(to, pos));
}
}
public static master_type make_type(analysis_context context, kind kind,
@Nullable flavor_profile the_flavor_profile, action_name name, principal_type parent,
@Nullable declaration the_declaration, position pos) {
master_type result = new master_type(kind, the_flavor_profile, name, parent, context,
the_declaration);
context.add(parent, name, result.to_action(pos));
return result;
}
public static action to_value(action expression, position source) {
type the_type = expression.result().type_bound();
if (common_library.get_instance().is_reference_type(the_type)) {
// TODO: check that flavor is readonly or mutable.
type value_type = common_library.get_instance().get_reference_parameter(the_type);
// TODO: replace this with a promotion lookup.
return new dereference_action(value_type, null, source).bind_from(expression, source);
} else {
return expression;
}
}
public static boolean is_procedure_type(type the_type) {
return the_type.principal().get_kind() == type_kinds.procedure_kind;
}
public static boolean is_valid_procedure_arity(type procedure_type, int arity) {
assert is_procedure_type(procedure_type);
return ((parametrized_type) procedure_type.principal()).get_parameters().
is_valid_arity(arity + 1);
}
public static abstract_value get_procedure_argument(type procedure_type, int index) {
assert is_procedure_type(procedure_type);
return ((parametrized_type) procedure_type.principal()).get_parameters().get(index + 1);
}
public static abstract_value get_procedure_return(type procedure_type) {
principal_type the_principal = procedure_type.principal();
assert the_principal.get_kind() == type_kinds.procedure_kind;
return ((parametrized_type) the_principal).get_parameters().first();
}
public static base_execution_context get_context(execution_context the_context) {
return (base_execution_context) the_context;
}
public static entity_wrapper execute_procedure(procedure_declaration the_procedure,
@Nullable value_wrapper this_argument, readonly_list<entity_wrapper> arguments,
execution_context the_context) {
base_execution_context new_context = action_utilities.get_context(the_context).
make_child(the_procedure.original_name());
if (the_procedure.get_category() == procedure_category.STATIC) {
assert this_argument == null;
} else {
assert this_argument != null;
new_context.put_var(the_procedure.get_this_declaration(), this_argument);
}
assert the_procedure.get_argument_types().size() == arguments.size();
for (int i = 0; i < arguments.size(); ++i) {
variable_declaration var_decl = the_procedure.get_parameter_variables().get(i);
entity_wrapper wrapped_argument = arguments.get(i);
assert wrapped_argument instanceof value_wrapper;
new_context.put_var(var_decl, (value_wrapper) wrapped_argument);
}
action body_action = the_procedure.get_body_action();
assert body_action != null;
entity_wrapper result = body_action.execute(new_context);
// TODO: uniformly hanlde jump_wrappers; do stack trace.
if (result instanceof panic_value) {
utilities.panic(((panic_value) result).message);
}
if (the_procedure.get_category() == procedure_category.CONSTRUCTOR) {
result = this_argument;
} else {
if (result instanceof returned_value) {
result = ((returned_value) result).result;
}
}
return result;
}
public static boolean is_result(action the_action, abstract_value the_result) {
// TODO: For now assume this -- but it doesn't *have* to be true.
assert the_result instanceof type;
return the_action.result().type_bound().is_subtype_of(the_result.type_bound());
}
// Make it easy to detect where type_id needs to be cast to type.
public static type to_type(type_id the_type_id) {
return (type) the_type_id;
}
public static boolean is_of(entity_wrapper the_entity, type the_type) {
return to_type(the_entity.type_bound()).is_subtype_of(the_type);
}
public static error_signal cant_promote(abstract_value from, type target,
analysis_context the_context, position pos) {
return new error_signal(new base_string("Can't promote " + the_context.print_value(from) +
" to " + the_context.print_value(target)), pos);
}
public static flavor_profile get_profile(supertype_declaration the_supertype) {
type the_type = the_supertype.get_supertype();
type_utilities.prepare(the_type, declaration_pass.TYPES_AND_PROMOTIONS);
flavor_profile the_profile = the_type.principal().get_flavor_profile();
if (the_type.get_flavor() != flavors.nameonly_flavor) {
the_profile = flavor_profiles.combine(the_profile, the_type.get_flavor().get_profile());
}
return the_profile;
}
public static boolean supports_constructors(principal_type the_type) {
kind the_kind = the_type.get_kind();
return the_kind == class_kind || the_kind == datatype_kind || the_kind == enum_kind;
}
}
|
from rest_framework.views import APIView
from rest_framework.response import Response
from .schemas import InventoryByStatusSchema # Assuming the schema is imported from a separate file
class InventoryAPI(APIView):
summary = "Returns toy inventories by status"
response_schema = InventoryByStatusSchema
def get(self, request):
# Assume toy inventories are retrieved from a database or an external source
toy_inventories = [
{"name": "Toy1", "status": "available"},
{"name": "Toy2", "status": "out of stock"},
{"name": "Toy3", "status": "available"},
{"name": "Toy4", "status": "out of stock"},
]
# Filter toy inventories by status
requested_status = request.query_params.get('status', None)
if requested_status:
filtered_inventories = [inventory for inventory in toy_inventories if inventory['status'] == requested_status]
else:
filtered_inventories = toy_inventories # If no status is specified, return all inventories
# Return the filtered toy inventories as a response adhering to the InventoryByStatusSchema
serialized_inventories = InventoryByStatusSchema(filtered_inventories, many=True)
return Response(serialized_inventories.data) |
<gh_stars>0
import React from 'react';
import { Link } from 'react-router';
import moment from 'moment';
export default class InvalidBookPeriod extends React.Component {
render() {
const { date, isDateBookable, range, changeDateUrl, changeRangeUrl } = this.props;
const formattedDate = moment(date, 'YYYY-MM-DD').format('dddd D MMMM YYYY');
if (isDateBookable) {
const formattedRange = {
start: moment(range.start, moment.ISO_8601).format('HH:mm'),
end: moment(range.end, moment.ISO_8601).format('HH:mm')
};
return (
<div className="no-books">
<div className="no-books-text">
<div>{formattedDate}</div>
<div>L'orario {formattedRange.start} - {formattedRange.end} non è disponibile.</div>
</div>
<Link className="btn btn-primary" to={changeRangeUrl}>Cambia Orario</Link>
<Link className="btn btn-primary" to={changeDateUrl} style={{marginLeft:'10px'}}>Cambia Giorno</Link>
</div>
);
} else {
return (
<div className="no-books">
<div className="no-books-text">
<div>{formattedDate}</div>
<div>Data non disponibile.</div>
</div>
<Link className="btn btn-primary" to={changeDateUrl}>Cambia Giorno</Link>
</div>
);
}
}
}
|
#!/bin/bash
ORNG='\033[0;33m'
NC='\033[0m'
W='\033[1;37m'
LP='\033[1;35m'
YLW='\033[1;33m'
LBBLUE='\e[104m'
RED='\033[0;31m'
echo -e "${ORNG}"
figlet -f mini "ReconSpider"
echo -e "${NC}"
cd /opt/reconspider
sudo python3 reconspider.py
sleep 2
cd /opt/shufti
shufti -m
|
#pragma once
#include <vector>
using namespace std;
class block
{
public:
block(int idnum, int givenOwner);
void putOn(int location);
void displayBlock();
int getOwner();
vector<int> getBlock();
int getX();
int getY();
int getNum();
int getID();
void rotate(bool rotateToLeft);
void reverse();
void replace(int lefttop_x,int lefttop_y);
/*void placedAt(square* loc);
vector<square*> getSquaresLoc();*/
bool hasBeenPlaced();
bool getSymmetry();
private:
int id, numOfSquares, x, y, owner;
bool symmetry, isPlaced;
bool shape[5][5] = { {0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0} };
//vector<square*> squareLocationRecords;
};
|
import express, { Request, Response } from "express";
import bodyParser from "body-parser";
import cookieSession from "cookie-session"
import { AppRouter } from './AppRouter'
import './controllers/LoginController'
import './controllers/RootController'
const app = express();
app.use(bodyParser.urlencoded({extended:true}));
app.use(cookieSession({keys:['asdfasd']}));
app.use(AppRouter.getInstance())
app.listen(3000,()=>{
console.log('Listening on port 3000');
}) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.