text
stringlengths
2
14k
meta
dict
Vue.component('dropdown', { template: '#tmpl-dropdown', props: { id: { type: String, }, visible: { type: Boolean, default: false, }, items: { type: Array, default: [], }, classes: { type: Array, default: () => [], }, }, methods: { clicked: function(item) { if (item.click && !item.disabled) { item.click(); } if (!item.preventClose) { closeDropdown(); } }, }, }); let openedDropdown; let clickHndl = function(event) { if (!openedDropdown) { return; } var element = event.target; while (element) { if (element === openedDropdown) { return; } element = element.parentElement; } // Click outside the dropdown, close it closeDropdown(); }; function closeDropdown() { if (!openedDropdown) { return; } document.removeEventListener('click', clickHndl); if (openedDropdown.className.indexOf('hidden') < 0) { openedDropdown.className = (openedDropdown.className + ' hidden').trim(); } openedDropdown = undefined; } function openDropdown(element) { element = parseElement(element); if (!element) { console.error('Invalid dropdown element'); return; } event.stopPropagation(); closeDropdown(); if (getComputedStyle(element.parentElement).position === 'relative') { // Position the dropdown relatively to the parent element.style.left = (window.event.clientX - element.parentElement.offsetLeft + element.parentElement.scrollLeft) + 'px'; element.style.top = (window.event.clientY - element.parentElement.offsetTop + element.parentElement.scrollTop) + 'px'; } else { // Position the dropdown absolutely on the window element.style.left = (window.event.clientX + window.scrollX) + 'px'; element.style.top = (window.event.clientY + window.scrollY) + 'px'; } document.addEventListener('click', clickHndl); element.className = element.className.split(' ').filter(c => c !== 'hidden').join(' '); openedDropdown = element; const maxLeft = Math.min(window.innerWidth, element.parentElement.clientWidth) + element.parentElement.scrollLeft; const maxTop = Math.min(window.innerHeight, element.parentElement.clientHeight) + element.parentElement.scrollTop; if (element.parentElement.offsetLeft + element.offsetLeft + parseFloat(getComputedStyle(element).width) >= maxLeft) { if (parseFloat(element.style.left) - parseFloat(getComputedStyle(element).width) >= 0) { element.style.left = (parseFloat(element.style.left) - parseFloat(getComputedStyle(element).width)) + 'px'; } } if (element.parentElement.offsetTop + element.offsetTop + parseFloat(getComputedStyle(element).height) >= maxTop) { if (parseFloat(element.style.top) - parseFloat(getComputedStyle(element).height) >= 0) { element.style.top = (parseFloat(element.style.top) - parseFloat(getComputedStyle(element).height)) + 'px'; } } if (parseFloat(element.style.left) < 0) { element.style.left = 0; } if (parseFloat(element.style.top) < 0) { element.style.top = 0; } }
{ "pile_set_name": "Github" }
const express = require('express') const router = express() const { createWebAPIRequest } = require('../util/util') router.get('/', (req, res) => { const cookie = req.get('Cookie') ? req.get('Cookie') : '' const data = { mvid: req.query.mvid } createWebAPIRequest( 'music.163.com', '/weapi/discovery/simiMV', 'POST', data, cookie, music_req => res.send(music_req), err => res.status(502).send('fetch error') ) }) module.exports = router
{ "pile_set_name": "Github" }
/////////////////////////////////////////////////////////////////////////////////// /// OpenGL Mathematics (glm.g-truc.net) /// /// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) /// 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. /// /// Restrictions: /// By making use of the Software for military purposes, you choose to make /// a Bunny unhappy. /// /// 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. /// /// @ref core /// @file glm/mat2x3.hpp /// @date 2013-12-24 / 2013-12-24 /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// #pragma once #include "detail/type_mat2x3.hpp" namespace glm { /// 2 columns of 3 components matrix of low precision floating-point numbers. /// There is no guarantee on the actual precision. /// /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a> typedef tmat2x3<float, lowp> lowp_mat2x3; /// 2 columns of 3 components matrix of medium precision floating-point numbers. /// There is no guarantee on the actual precision. /// /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a> typedef tmat2x3<float, mediump> mediump_mat2x3; /// 2 columns of 3 components matrix of high precision floating-point numbers. /// There is no guarantee on the actual precision. /// /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a> typedef tmat2x3<float, highp> highp_mat2x3; }//namespace glm
{ "pile_set_name": "Github" }
/** * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. * * Please refer to the NVIDIA end user license agreement (EULA) associated * with this source code for terms and conditions that govern your use of * this software. Any use, reproduction, disclosure, or distribution of * this software and related documentation outside the terms of the EULA * is strictly prohibited. * */ // Helper functions for CUDA Driver API error handling (make sure that CUDA_H is included in your projects) #ifndef HELPER_CUDA_DRVAPI_H #define HELPER_CUDA_DRVAPI_H #include <stdlib.h> #include <stdio.h> #include <string.h> #include <helper_string.h> #include <drvapi_error_string.h> #ifndef MAX #define MAX(a,b) (a > b ? a : b) #endif #ifndef EXIT_WAIVED #define EXIT_WAIVED 2 #endif //////////////////////////////////////////////////////////////////////////////// // These are CUDA Helper functions // add a level of protection to the CUDA SDK samples, let's force samples to explicitly include CUDA.H #ifdef __cuda_cuda_h__ // This will output the proper CUDA error strings in the event that a CUDA host call returns an error #ifndef checkCudaErrors #define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__) // These are the inline versions for all of the SDK helper functions inline void __checkCudaErrors(CUresult err, const char *file, const int line) { if (CUDA_SUCCESS != err) { fprintf(stderr, "checkCudaErrors() Driver API error = %04d \"%s\" from file <%s>, line %i.\n", err, getCudaDrvErrorString(err), file, line); exit(EXIT_FAILURE); } } #endif #ifdef getLastCudaDrvErrorMsg #undef getLastCudaDrvErrorMsg #endif #define getLastCudaDrvErrorMsg(msg) __getLastCudaDrvErrorMsg (msg, __FILE__, __LINE__) inline void __getLastCudaDrvErrorMsg(const char *msg, const char *file, const int line) { CUresult err = cuCtxSynchronize(); if (CUDA_SUCCESS != err) { fprintf(stderr, "getLastCudaDrvErrorMsg -> %s", msg); fprintf(stderr, "getLastCudaDrvErrorMsg -> cuCtxSynchronize API error = %04d \"%s\" in file <%s>, line %i.\n", err, getCudaDrvErrorString(err), file, line); exit(EXIT_FAILURE); } } // This function wraps the CUDA Driver API into a template function template <class T> inline void getCudaAttribute(T *attribute, CUdevice_attribute device_attribute, int device) { CUresult error_result = cuDeviceGetAttribute(attribute, device_attribute, device); if (error_result != CUDA_SUCCESS) { printf("cuDeviceGetAttribute returned %d\n-> %s\n", (int)error_result, getCudaDrvErrorString(error_result)); exit(EXIT_SUCCESS); } } #endif // Beginning of GPU Architecture definitions inline int _ConvertSMVer2CoresDRV(int major, int minor) { // Defines for GPU Architecture types (using the SM version to determine the # of cores per SM typedef struct { int SM; // 0xMm (hexidecimal notation), M = SM Major version, and m = SM minor version int Cores; } sSMtoCores; sSMtoCores nGpuArchCoresPerSM[] = { { 0x10, 8 }, // Tesla Generation (SM 1.0) G80 class { 0x11, 8 }, // Tesla Generation (SM 1.1) G8x class { 0x12, 8 }, // Tesla Generation (SM 1.2) G9x class { 0x13, 8 }, // Tesla Generation (SM 1.3) GT200 class { 0x20, 32 }, // Fermi Generation (SM 2.0) GF100 class { 0x21, 48 }, // Fermi Generation (SM 2.1) GF10x class { 0x30, 192}, // Kepler Generation (SM 3.0) GK10x class { 0x35, 192}, // Kepler Generation (SM 3.5) GK11x class { -1, -1 } }; int index = 0; while (nGpuArchCoresPerSM[index].SM != -1) { if (nGpuArchCoresPerSM[index].SM == ((major << 4) + minor)) { return nGpuArchCoresPerSM[index].Cores; } index++; } // If we don't find the values, we default use the previous one to run properly printf("MapSMtoCores for SM %d.%d is undefined. Default to use %d Cores/SM\n", major, minor, nGpuArchCoresPerSM[7].Cores); return nGpuArchCoresPerSM[7].Cores; } // end of GPU Architecture definitions #ifdef __cuda_cuda_h__ // General GPU Device CUDA Initialization inline int gpuDeviceInitDRV(int ARGC, const char **ARGV) { int cuDevice = 0; int deviceCount = 0; CUresult err = cuInit(0); if (CUDA_SUCCESS == err) { checkCudaErrors(cuDeviceGetCount(&deviceCount)); } if (deviceCount == 0) { fprintf(stderr, "cudaDeviceInit error: no devices supporting CUDA\n"); exit(EXIT_FAILURE); } int dev = 0; dev = getCmdLineArgumentInt(ARGC, (const char **) ARGV, "device="); if (dev < 0) { dev = 0; } if (dev > deviceCount-1) { fprintf(stderr, "\n"); fprintf(stderr, ">> %d CUDA capable GPU device(s) detected. <<\n", deviceCount); fprintf(stderr, ">> cudaDeviceInit (-device=%d) is not a valid GPU device. <<\n", dev); fprintf(stderr, "\n"); return -dev; } checkCudaErrors(cuDeviceGet(&cuDevice, dev)); char name[100]; cuDeviceGetName(name, 100, cuDevice); int computeMode; getCudaAttribute<int>(&computeMode, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE, dev); if (computeMode == CU_COMPUTEMODE_PROHIBITED) { fprintf(stderr, "Error: device is running in <CU_COMPUTEMODE_PROHIBITED>, no threads can use this CUDA Device.\n"); return -1; } if (checkCmdLineFlag(ARGC, (const char **) ARGV, "quiet") == false) { printf("gpuDeviceInitDRV() Using CUDA Device [%d]: %s\n", dev, name); } return dev; } // This function returns the best GPU based on performance inline int gpuGetMaxGflopsDeviceIdDRV() { CUdevice current_device = 0, max_perf_device = 0; int device_count = 0, sm_per_multiproc = 0; int max_compute_perf = 0, best_SM_arch = 0; int major = 0, minor = 0 , multiProcessorCount, clockRate; cuInit(0); checkCudaErrors(cuDeviceGetCount(&device_count)); if (device_count == 0) { fprintf(stderr, "gpuGetMaxGflopsDeviceIdDRV error: no devices supporting CUDA\n"); exit(EXIT_FAILURE); } // Find the best major SM Architecture GPU device while (current_device < device_count) { checkCuda
{ "pile_set_name": "Github" }
defmodule Absinthe.Execution.SubscriptionTest do use Absinthe.Case import ExUnit.CaptureLog defmodule PubSub do @behaviour Absinthe.Subscription.Pubsub def start_link() do Registry.start_link(keys: :unique, name: __MODULE__) end def node_name() do node() end def subscribe(topic) do Registry.register(__MODULE__, topic, []) :ok end def publish_subscription(topic, data) do message = %{ topic: topic, event: "subscription:data", result: data } Registry.dispatch(__MODULE__, topic, fn entries -> for {pid, _} <- entries, do: send(pid, {:broadcast, message}) end) end def publish_mutation(_proxy_topic, _mutation_result, _subscribed_fields) do # this pubsub is local and doesn't support clusters :ok end end defmodule Schema do use Absinthe.Schema query do # Query type must exist end object :user do field :id, :id field :name, :string field :group, :group do resolve fn user, _, %{context: %{test_pid: pid}} -> batch({__MODULE__, :batch_get_group, pid}, nil, fn _results -> {:ok, user.group} end) end end end object :group do field :name, :string end def batch_get_group(test_pid, _) do # send a message to the test process every time we access this function. # if batching is working properly, it should only happen once. send(test_pid, :batch_get_group) %{} end subscription do field :raises, :string do config fn _, _ -> {:ok, topic: "*"} end resolve fn _, _, _ -> raise "boom" end end field :user, :user do arg :id, :id config fn args, _ -> {:ok, topic: args[:id] || "*"} end trigger :update_user, topic: fn user -> [user.id, "*"] end end field :thing, :string do arg :client_id, non_null(:id) config fn _args, %{context: %{authorized: false}} -> {:error, "unauthorized"} args, _ -> { :ok, topic: args.client_id } end end field :multiple_topics, :string do config fn _, _ -> {:ok, topic: ["topic_1", "topic_2", "topic_3"]} end end field :other_user, :user do arg :id, :id config fn args, %{context: %{context_id: context_id, document_id: document_id}} -> {:ok, topic: args[:id] || "*", context_id: context_id, document_id: document_id} args, %{context: %{context_id: context_id}} -> {:ok, topic: args[:id] || "*", context_id: context_id} end end field :relies_on_document, :string do config fn _, %{document: %Absinthe.Blueprint{} = document} -> %{type: :subscription, name: op_name} = Absinthe.Blueprint.current_operation(document) {:ok, topic: "*", context_id: "*", document_id: op_name} end end end mutation do field :update_user, :user do arg :id, non_null(:id) resolve fn _, %{id: id}, _ -> {:ok, %{id: id, name: "foo"}} end end end end setup_all do {:ok, _} = PubSub.start_link() {:ok, _} = Absinthe.Subscription.start_link(PubSub) :ok end @query """ subscription ($clientId: ID!) { thing(clientId: $clientId) } """ test "can subscribe the current process" do client_id = "abc" assert {:ok, %{"subscribed" => topic}} = run_subscription( @query, Schema, variables: %{"clientId" => client_id}, context: %{pubsub: PubSub} ) Absinthe.Subscription.publish(PubSub, "foo", thing: client_id) assert_receive({:broadcast, msg}) assert %{ event: "subscription:data", result: %{data: %{"thing" => "foo"}}, topic: topic } == msg end @query """ subscription ($clientId: ID!) { thing(clientId: $clientId) } """ test "can unsubscribe the current process" do client_id = "abc" assert {:ok, %{"subscribed" => topic}} = run_subscription( @query, Schema, variables: %{"clientId" => client_id}, context: %{pubsub: PubSub} ) Absinthe.Subscription.unsubscribe(PubSub, topic) Absinthe.Subscription.publish(PubSub, "foo", thing: client_id) refute_receive({:broadcast, _}) end @query """ subscription { multipleTopics } """ test "schema can provide multiple topics to subscribe to" do assert {:ok, %{"subscribed" => topic}} = run_subscription( @query, Schema, variables: %{}, context: %{pubsub: PubSub} ) msg = %{ event: "subscription:data", result: %{data: %{"multipleTopics" => "foo"}}, topic: topic } Absinthe.Subscription.publish(PubSub, "foo", multiple_topics: "topic_1") assert_receive({:broadcast, ^msg}) Absinthe.Subscription.publish(PubSub, "foo", multiple_topics: "topic_2") assert_receive({:broadcast, ^msg}) Absinthe.Subscription.publish(PubSub, "foo", multiple_topics: "topic_3") assert_receive({:broadcast, ^msg}) end @query """ subscription { multipleTopics } """ test "unsubscription works when multiple topics are provided" do assert {:ok, %{"subscribed" => topic}} = run_subscription( @query, Schema, variables: %{}, context: %{pubsub: PubSub} ) Absinthe.Subscription.unsubscribe(PubSub, topic) Absinthe.Subscription.publish(PubSub, "foo", multiple_topics: "topic_1") refute_receive({:broadcast, _}) Absinthe.Subscription.publish(PubSub, "foo", multiple_topics: "topic_2") refute_receive({:broadcast, _}) Absinthe.Subscription.publish(PubSub, "foo", multiple_topics: "topic_3") refute_receive({:broadcast, _}) end @query """ subscription ($clientId: ID!) { thing(clientId: $clientId, extra: 1) } """ test "can return errors properly" do assert { :ok, %{ errors: [ %{ locations: [%{column: 30, line: 2}], message: "Unknown argument \"extra\" on field \"thing\" of type \"RootSubscriptionType\"." } ] } } == run_subscription(@query, Schema, variables: %{"clientId" =>
{ "pile_set_name": "Github" }
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'test_aslr_default', 'type': 'executable', 'msvs_settings': { }, 'sources': ['hello.cc'], }, { 'target_name': 'test_aslr_no', 'type': 'executable', 'msvs_settings': { 'VCLinkerTool': { 'RandomizedBaseAddress': '1', }, }, 'sources': ['hello.cc'], }, { 'target_name': 'test_aslr_yes', 'type': 'executable', 'msvs_settings': { 'VCLinkerTool': { 'RandomizedBaseAddress': '2', } }, 'sources': ['hello.cc'], }, ] }
{ "pile_set_name": "Github" }
--- src/client.c.org Tue Nov 30 13:49:23 2004 +++ src/client.c Wed Dec 1 12:42:01 2004 @@ -144,6 +144,7 @@ static size_t try_read_from_server PROTO ((char *, size_t)); +static void proxy_connect PROTO ((cvsroot_t *, int)); static void auth_server PROTO ((cvsroot_t *, struct buffer *, struct buffer *, int, int, struct hostent *)); @@ -3762,7 +3763,7 @@ int port_number; struct sockaddr_in client_sai; struct hostent *hostinfo; - struct buffer *to_server, *from_server; + struct buffer *local_to_server, *local_from_server; sock = socket (AF_INET, SOCK_STREAM, 0); if (sock == -1) @@ -3770,7 +3771,17 @@ error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); } port_number = get_cvs_port_number (root); + + /* if we have a proxy connect to that instead */ + if(root->proxy) + { + hostinfo = init_sockaddr (&client_sai, root->proxy, root->proxy_port); + } + else + { hostinfo = init_sockaddr (&client_sai, root->hostname, port_number); + } + if (trace) { fprintf (stderr, " -> Connecting to %s(%s):%d\n", @@ -3780,29 +3791,41 @@ if (connect (sock, (struct sockaddr *) &client_sai, sizeof (client_sai)) < 0) error (1, 0, "connect to %s(%s):%d failed: %s", - root->hostname, + root->proxy ? root->proxy : root->hostname, inet_ntoa (client_sai.sin_addr), - port_number, SOCK_STRERROR (SOCK_ERRNO)); + root->proxy ? root->proxy_port : port_number, + SOCK_STRERROR (SOCK_ERRNO)); - make_bufs_from_fds (sock, sock, 0, &to_server, &from_server, 1); + make_bufs_from_fds (sock, sock, 0, &local_to_server, &local_from_server, 1); - auth_server (root, to_server, from_server, verify_only, do_gssapi, hostinfo); + if(root->proxy) + { + // REALLY ugly hack to allow proxy_connect() to use send_to_server(). + // The proper fix would be to remove the global to_server & from_server + // variables, and instead let send_to_server() etc. take the target + // server struct as a paramter. + to_server = local_to_server; + from_server = local_from_server; + proxy_connect (root, port_number); + } + + auth_server (root, local_to_server, local_from_server, verify_only, do_gssapi, hostinfo); if (verify_only) { int status; - status = buf_shutdown (to_server); + status = buf_shutdown (local_to_server); if (status != 0) error (0, status, "shutting down buffer to server"); - buf_free (to_server); - to_server = NULL; + buf_free (local_to_server); + local_to_server = NULL; - status = buf_shutdown (from_server); + status = buf_shutdown (local_from_server); if (status != 0) error (0, status, "shutting down buffer from server"); - buf_free (from_server); - from_server = NULL; + buf_free (local_from_server); + local_from_server = NULL; /* Don't need to set server_started = 0 since we don't set it to 1 * until returning from this call. @@ -3810,11 +3833,53 @@ } else { - *to_server_p = to_server; - *from_server_p = from_server; + *to_server_p = local_to_server; + *from_server_p = local_from_server; } return; +} + + + +static void +proxy_connect (root, port_number) + cvsroot_t *root; + int port_number; +{ +#define CONNECT_STRING "CONNECT %s:%d HTTP/1.0\r\n\r\n" + /* Send a "CONNECT" command to proxy: */ + char* read_buf; + int codenum, count; + + /* 4 characters for port covered by the length of %s & %d */ + char* write_buf = xmalloc (strlen (CONNECT_STRING) + strlen (root->hostname +) + 20 + 1); + int len = sprintf (write_buf, CONNECT_STRING, root->hostname, port_number); + + send_to_server (write_buf, len); + + /* Wait for HTTP status code, bail out if you don't get back a 2xx code.*/ + count = read_line (&read_buf); + sscanf (read_buf, "%s %d", write_buf, &codenum); + + if ((codenum / 100) != 2) + error (1, 0, "proxy server %s:%d does not support http tunnelling", + root->proxy, root->proxy_port); + free (read_buf); + free (write_buf); + + /* Skip through remaining part of MIME header, recv_line + consumes the trailing \n */ + while(read_line (&read_buf) > 0) + { + if (read_buf[0] == '\r' || read_buf[0] == 0) + { + free (read_buf); + break; + } + free (read_buf); + } } --- src/client.h.org Wed Dec 1 07:36:43 2004 +++ src/client.h Wed Dec 1 07:38:06 2004 @@ -69,6 +69,9 @@ # ifndef CVS_AUTH_PORT # define CVS_AUTH_PORT 2401 # endif /* CVS_AUTH_PORT */ +# ifndef CVS_PROXY_PORT +# define CVS_PROXY_PORT 80 +# endif /* CVS_PROXY_PORT */ # endif /* (AUTH_CLIENT_SUPPORT) || defined (HAVE_GSSAPI) */ # if HAVE_KERBEROS --- src/root.c.org Wed Dec 1 07:38:19 2004 +++ src/root.c Wed Dec 1 07:48:43 2004 @@ -303,6 +303,8 @@ newroot->proxy_port = 0; newroot->isremote = 0; #endif /* CLIENT_SUPPORT */ + newroot->proxy = NULL; + newroot->proxy_port = CVS_PROXY_PORT; return newroot; } @@ -332,6 +334,8 @@ if (root->proxy_hostname != NULL) free (root->proxy_hostname); #endif /* CLIENT_SUPPORT */ + if (root->proxy != NULL) + free (root->proxy); free (root); } @@ -375,6 +379,7 @@ #ifdef CLIENT_SUPPORT int check_hostname, no_port, no_password; #endif /* CLIENT_SUPPORT */ + const char *env_var; /* allocate some space */ newroot = new_cvsroot_t();
{ "pile_set_name": "Github" }
/* Presentation mode for SF HTML * * This file implements simple slide functionality for the SF HTML * files. When loaded in a page, it will tag some of the page elements * as slide boundaries, giving each an id of the form * "#slide-XX". Pressing left or right should trigger "slide mode", * focusing the screen on the current slide, and then navigate between * slides. Pressing escape brings the page back to normal. */ /* Which DOM elements to mark as slide boundaries */ var slideSelector = 'h1.libtitle, h1.section, h2.section, h3.section, .quiz'; /* Whether or not we are in slide mode */ var slideMode = false; /* Navigates between slides, using the current location hash to find * the next slide to go to */ function slideNavigate(direction) { function slideNumber(s) { if (!s) return null; var match = s.match(/slide-(.*)/); if (match && match.length != 0) { return parseInt(match[1]); } return null; } var curSlide = slideNumber(location.hash); var lastSlide = slideNumber($('.slide').last().attr('id')); var nextSlide; /* We change the id of each slide element when the page loads, and * then switch between slides based on the current hash. This is * not entirely optimal, and can probably be made better. * http://www.appelsiini.net/projects/viewport seems to be a nice choice. */ if (direction == 'left') { if (curSlide != null) { if (curSlide > 0) { nextSlide = curSlide - 1; } else { nextSlide = lastSlide; } } else { nextSlide = 0; } } else if (direction == 'right') { if (curSlide != null && curSlide < lastSlide) { nextSlide = curSlide + 1; } else { nextSlide = 0; } } location.hash = '#slide-' + nextSlide; return false; }; /* Force the browser to scroll back to the hash location */ function refreshHash() { var t = location.hash; location.hash = ''; location.hash = t; } /* Activate slide mode. Inserts the right amount of spacing between * slide boundaries, ensuring that only one slide appears on the * screen at a time */ function slideActivate() { $('.slide').each(function (i, elt) { if (i > 0) $(elt).css('margin-top', $(window).height()); $(elt).css('height', '20px'); }); $('#main').css('padding-bottom', $(window).height()); slideMode = true; if (location.hash) { refreshHash(); } else { location.hash = '#slide-0'; } } /* Deactivate slide mode. Removes the extra spacing between slides */ function slideDeactivate() { $('.slide').each(function (i, elt) { $(elt).css('margin-top', 0); $(elt).css('height', 0); }); $('#main').css('padding-bottom', 0); refreshHash(); slideMode = false; } /* Set up appropriate input handlers */ $(document).keydown(function (event) { if (slideMode) { if (event.keyCode == 37) { slideNavigate('left'); } else if (event.keyCode == 39) { slideNavigate('right'); } else if (event.keyCode == 27) { // escape slideDeactivate(); } else return true; } else { if (event.keyCode == 37 || event.keyCode == 39) { slideActivate(); return false; } else { return true; } } }); /* Find slide boundaries and tag them */ $(document).ready(function () { $(slideSelector).each(function (i, elt) { var mark = '<div class="slide" id="slide-' + i + '" />'; $(mark).insertBefore($(elt)); }); if (location.hash) { slideActivate(); } });
{ "pile_set_name": "Github" }
# The MIT License # # Copyright (c) 2004-2010, Sun Microsystems, Inc. # # 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. Description=Opis
{ "pile_set_name": "Github" }
rem ----------------------------------------------------------------------- rem URL: http://www.orafaq.com/scripts/plsql/hex2dec.txt rem Filename: hex2dec.sql rem Purpose: Functions to convert Hex to Decimal and vice versa rem Author: Mark Malakanov, Feb-1999 + Anonymous rem ----------------------------------------------------------------------- CREATE OR REPLACE FUNCTION hex2dec (hexnum in char) RETURN number IS i number; digits number; result number := 0; current_digit char(1); current_digit_dec number; BEGIN digits := length(hexnum); for i in 1..digits loop current_digit := SUBSTR(hexnum, i, 1); if current_digit in ('A','B','C','D','E','F') then current_digit_dec := ascii(current_digit) - ascii('A') + 10; else current_digit_dec := to_number(current_digit); end if; result := (result * 16) + current_digit_dec; end loop; return result; END hex2dec; / show errors CREATE OR REPLACE FUNCTION num2hex (N in number) RETURN varchar2 IS H varchar2(64) :=''; N2 integer := N; BEGIN loop select rawtohex(chr(N2))||H into H from dual; N2 := trunc(N2 / 256); exit when N2=0; end loop; return H; END num2hex; / show errors -- Examples: select hex2dec('FF') from dual; select num2hex(10) from dual;
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0) on Thu Jan 05 01:03:22 EST 2017 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>StaxServerConfiguration (appsensor-parent 2.3.1 API)</title> <meta name="date" content="2017-01-05"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="StaxServerConfiguration (appsensor-parent 2.3.1 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.owasp.appsensor.configuration.stax.server</div> <h2 title="Class StaxServerConfiguration" class="title">Class StaxServerConfiguration</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> <li> <ul class="inheritance"> <li><a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html" title="class in org.owasp.appsensor.core.configuration.server">org.owasp.appsensor.core.configuration.server.ServerConfiguration</a></li> <li> <ul class="inheritance"> <li>org.owasp.appsensor.configuration.stax.server.StaxServerConfiguration</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>@Named public class <span class="typeNameLabel">StaxServerConfiguration</span> extends <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html" title="class in org.owasp.appsensor.core.configuration.server">ServerConfiguration</a></pre> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../org/owasp/appsensor/configuration/stax/server/StaxServerConfiguration.html#StaxServerConfiguration--">StaxServerConfiguration</a></span>()</code></td> </tr> <tr class="rowColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../org/owasp/appsensor/configuration/stax/server/StaxServerConfiguration.html#StaxServerConfiguration-boolean-">StaxServerConfiguration</a></span>(boolean&nbsp;loadConfiguration)</code></td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.org.owasp.appsensor.core.configuration.server.ServerConfiguration"> <!-- --> </a> <h3>Methods inherited from class&nbsp;org.owasp.appsensor.core.configuration.server.<a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html" title="class in org.owasp.appsensor.core.configuration.server">ServerConfiguration</a></h3> <code><a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#equals-java.lang.Object-">equals</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#findClientApplication-java.lang.String-">findClientApplication</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#findDetectionPoints-org.owasp.appsensor.core.DetectionPoint-">findDetectionPoints</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#findDetectionPoints-org.owasp.appsensor.core.DetectionPoint-java.lang.String-">findDetectionPoints</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getClientApplicationIdentificationHeaderName--">getClientApplicationIdentificationHeaderName</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getClientApplications--">getClientApplications</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getConfigurationFile--">getConfigurationFile</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getCorrelationSets--">getCorrelationSets</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getCustomDetectionPoints--">getCustomDetectionPoints</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getDetectionPoints--">getDetectionPoints</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getGeolocationDatabasePath--">getGeolocationDatabasePath</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getRelatedDetectionSystems-org.owasp.appsensor.core.DetectionSystem-">getRelatedDetectionSystems</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getServerHostName--">getServerHostName</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getServerPort--">getServerPort</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#getServerSocketTimeout--">getServerSocketTimeout</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#hashCode--">hashCode</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#isGeolocateIpAddresses--">isGeolocateIpAddresses</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#setClientApplicationIdentificationHeaderName-java.lang.String-">setClientApplicationIdentificationHeaderName</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#setClientApplications-java.util.Collection-">setClientApplications</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#setConfigurationFile-java.io.File-">setConfigurationFile</a>, <a href="../../../../../../org/owasp/appsensor/core/configuration/server/ServerConfiguration.html#setCorrelationSets-java.util.Collection-">setCorrelationSets</a>, <a href="../../../../../../org/owasp/
{ "pile_set_name": "Github" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.Runtime.InteropServices.Tests { public class TypeLibVarAttributeTests { [Theory] [InlineData((TypeLibVarFlags)(-1))] [InlineData((TypeLibVarFlags)0)] [InlineData(TypeLibVarFlags.FBindable)] public void Ctor_TypeLibVarFlags(TypeLibVarFlags flags) { var attribute = new TypeLibVarAttribute(flags); Assert.Equal(flags, attribute.Value); } [Theory] [InlineData(-1)] [InlineData(0)] [InlineData(4)] public void Ctor_ShortFlags(short flags) { var attribute = new TypeLibVarAttribute(flags); Assert.Equal((TypeLibVarFlags)flags, attribute.Value); } } }
{ "pile_set_name": "Github" }
/* * Broadcom UniMAC MDIO bus controller driver * * Copyright (C) 2014-2017 Broadcom * * 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. */ #include <linux/kernel.h> #include <linux/phy.h> #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/module.h> #include <linux/io.h> #include <linux/delay.h> #include <linux/of.h> #include <linux/of_platform.h> #include <linux/of_mdio.h> #include <linux/platform_data/mdio-bcm-unimac.h> #define MDIO_CMD 0x00 #define MDIO_START_BUSY (1 << 29) #define MDIO_READ_FAIL (1 << 28) #define MDIO_RD (2 << 26) #define MDIO_WR (1 << 26) #define MDIO_PMD_SHIFT 21 #define MDIO_PMD_MASK 0x1F #define MDIO_REG_SHIFT 16 #define MDIO_REG_MASK 0x1F #define MDIO_CFG 0x04 #define MDIO_C22 (1 << 0) #define MDIO_C45 0 #define MDIO_CLK_DIV_SHIFT 4 #define MDIO_CLK_DIV_MASK 0x3F #define MDIO_SUPP_PREAMBLE (1 << 12) struct unimac_mdio_priv { struct mii_bus *mii_bus; void __iomem *base; int (*wait_func) (void *wait_func_data); void *wait_func_data; }; static inline u32 unimac_mdio_readl(struct unimac_mdio_priv *priv, u32 offset) { /* MIPS chips strapped for BE will automagically configure the * peripheral registers for CPU-native byte order. */ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) return __raw_readl(priv->base + offset); else return readl_relaxed(priv->base + offset); } static inline void unimac_mdio_writel(struct unimac_mdio_priv *priv, u32 val, u32 offset) { if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) __raw_writel(val, priv->base + offset); else writel_relaxed(val, priv->base + offset); } static inline void unimac_mdio_start(struct unimac_mdio_priv *priv) { u32 reg; reg = unimac_mdio_readl(priv, MDIO_CMD); reg |= MDIO_START_BUSY; unimac_mdio_writel(priv, reg, MDIO_CMD); } static inline unsigned int unimac_mdio_busy(struct unimac_mdio_priv *priv) { return unimac_mdio_readl(priv, MDIO_CMD) & MDIO_START_BUSY; } static int unimac_mdio_poll(void *wait_func_data) { struct unimac_mdio_priv *priv = wait_func_data; unsigned int timeout = 1000; do { if (!unimac_mdio_busy(priv)) return 0; usleep_range(1000, 2000); } while (--timeout); if (!timeout) return -ETIMEDOUT; return 0; } static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg) { struct unimac_mdio_priv *priv = bus->priv; int ret; u32 cmd; /* Prepare the read operation */ cmd = MDIO_RD | (phy_id << MDIO_PMD_SHIFT) | (reg << MDIO_REG_SHIFT); unimac_mdio_writel(priv, cmd, MDIO_CMD); /* Start MDIO transaction */ unimac_mdio_start(priv); ret = priv->wait_func(priv->wait_func_data); if (ret) return ret; cmd = unimac_mdio_readl(priv, MDIO_CMD); /* Some broken devices are known not to release the line during * turn-around, e.g: Broadcom BCM53125 external switches, so check for * that condition here and ignore the MDIO controller read failure * indication. */ if (!(bus->phy_ignore_ta_mask & 1 << phy_id) && (cmd & MDIO_READ_FAIL)) return -EIO; return cmd & 0xffff; } static int unimac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val) { struct unimac_mdio_priv *priv = bus->priv; u32 cmd; /* Prepare the write operation */ cmd = MDIO_WR | (phy_id << MDIO_PMD_SHIFT) | (reg << MDIO_REG_SHIFT) | (0xffff & val); unimac_mdio_writel(priv, cmd, MDIO_CMD); unimac_mdio_start(priv); return priv->wait_func(priv->wait_func_data); } /* Workaround for integrated BCM7xxx Gigabit PHYs which have a problem with * their internal MDIO management controller making them fail to successfully * be read from or written to for the first transaction. We insert a dummy * BMSR read here to make sure that phy_get_device() and get_phy_id() can * correctly read the PHY MII_PHYSID1/2 registers and successfully register a * PHY device for this peripheral. * * Once the PHY driver is registered, we can workaround subsequent reads from * there (e.g: during system-wide power management). * * bus->reset is invoked before mdiobus_scan during mdiobus_register and is * therefore the right location to stick that workaround. Since we do not want * to read from non-existing PHYs, we either use bus->phy_mask or do a manual * Device Tree scan to limit the search area. */ static int unimac_mdio_reset(struct mii_bus *bus) { struct device_node *np = bus->dev.of_node; struct device_node *child; u32 read_mask = 0; int addr; if (!np) { read_mask = ~bus->phy_mask; } else { for_each_available_child_of_node(np, child) { addr = of_mdio_parse_addr(&bus->dev, child); if (addr < 0) continue; read_mask |= 1 << addr; } } for (addr = 0; addr < PHY_MAX_ADDR; addr++) { if (read_mask & 1 << addr) { dev_dbg(&bus->dev, "Workaround for PHY @ %d\n", addr); mdiobus_read(bus, addr, MII_BMSR); } } return 0; } static int unimac_mdio_probe(struct platform_device *pdev) { struct unimac_mdio_pdata *pdata = pdev->dev.platform_data; struct unimac_mdio_priv *priv; struct device_node *np; struct mii_bus *bus; struct resource *r; int ret; np = pdev->dev.of_node; priv = devm_kzalloc(&pdev->dev, sizeof(*priv),
{ "pile_set_name": "Github" }
%YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: serializedVersion: 6 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: Floor m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} m_ShaderKeywords: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: 2050 stringTagMap: RenderType: Opaque disabledShaderPasses: [] m_SavedProperties: serializedVersion: 3 m_TexEnvs: - _BaseMap: m_Texture: {fileID: 2800000, guid: 7583d2822d7d74246ba5be4bfb4bfb77, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _BumpMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _DetailAlbedoMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _DetailMask: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _DetailNormalMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _EmissionMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: m_Texture: {fileID: 2800000, guid: 7583d2822d7d74246ba5be4bfb4bfb77, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MetallicGlossMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _OcclusionMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _ParallaxMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _SpecGlossMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} m_Floats: - _AlphaClip: 0 - _Blend: 0 - _BumpScale: 1 - _Cull: 2 - _Cutoff: 0.5 - _DetailNormalMapScale: 1 - _DstBlend: 0 - _EnvironmentReflections: 1 - _GlossMapScale: 1 - _Glossiness: 0.15 - _GlossyReflections: 1 - _Metallic: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 - _QueueOffset: 0 - _ReceiveShadows: 1 - _Smoothness: 0.15 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 - _Surface: 0 - _UVSec: 0 - _WorkflowMode: 1 - _ZWrite: 1 m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} --- !u!114 &3801298144813794507 MonoBehaviour: m_ObjectHideFlags: 11 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} m_Name: m_EditorClassIdentifier: version: 1
{ "pile_set_name": "Github" }
/* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) */ #include "evolution-config.h" #include "e-composer-spell-header.h" G_DEFINE_TYPE ( EComposerSpellHeader, e_composer_spell_header, E_TYPE_COMPOSER_TEXT_HEADER) static void e_composer_spell_header_class_init (EComposerSpellHeaderClass *class) { EComposerTextHeaderClass *composer_text_header_class; composer_text_header_class = E_COMPOSER_TEXT_HEADER_CLASS (class); composer_text_header_class->entry_type = E_TYPE_SPELL_ENTRY; } static void e_composer_spell_header_init (EComposerSpellHeader *header) { } EComposerHeader * e_composer_spell_header_new_label (ESourceRegistry *registry, const gchar *label) { g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL); return g_object_new ( E_TYPE_COMPOSER_SPELL_HEADER, "label", label, "button", FALSE, "registry", registry, NULL); } EComposerHeader * e_composer_spell_header_new_button (ESourceRegistry *registry, const gchar *label) { g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL); return g_object_new ( E_TYPE_COMPOSER_SPELL_HEADER, "label", label, "button", TRUE, "registry", registry, NULL); }
{ "pile_set_name": "Github" }
def euclideanDistance(p: List[Int], q: List[Int]): Int = math.sqrt(p.zip(q).map { case (u, v) => math.pow(u-v, 2) }.sum)
{ "pile_set_name": "Github" }
--- a/sockd/sockd_io.c.old 2017-05-10 19:57:20.672000000 +0000 +++ b/sockd/sockd_io.c 2017-05-10 20:00:34.548000000 +0000 @@ -2912,7 +2912,7 @@ siginfo(sig, si, sc) int src_so_rcvbuf, dst_so_rcvbuf; #endif /* HAVE_RECVBUF_IOCTL */ -#if HAVE_SENDBUF_IOCTL +#ifdef HAVE_SENDBUF_IOCTL int src_so_sndbuf, dst_so_sndbuf; #endif /* HAVE_SENDBUF_IOCTL */ @@ -2960,7 +2960,7 @@ siginfo(sig, si, sc) *src_bufferinfo = NUL; *dst_bufferinfo = NUL; -#if HAVE_RECVBUF_IOCTL || HAVE_SENDBUF_IOCTL +#if defined(HAVE_RECVBUF_IOCTL) || defined(HAVE_SENDBUF_IOCTL) havesocketinfo = 1; @@ -2987,7 +2987,7 @@ siginfo(sig, si, sc) } #endif /* HAVE_RECVBUF_IOCTL */ -#if HAVE_SENDBUF_IOCTL +#ifdef HAVE_SENDBUF_IOCTL if (havesocketinfo) { if (ioctl(src->s, SENDBUF_IOCTLVAL, &src_so_sndbuf) != 0) { swarn("%s: sendbuf size ioctl() on src-fd %d failed", @@ -3005,7 +3005,7 @@ siginfo(sig, si, sc) } #endif /* HAVE_SENDBUF_IOCTL */ -#if HAVE_SENDBUF_IOCTL && HAVE_RECVBUF_IOCTL +#ifdef HAVE_SENDBUF_IOCTL && HAVE_RECVBUF_IOCTL if (havesocketinfo) { snprintf(src_bufferinfo, sizeof(src_bufferinfo), "%lu buffered (%lu + %lu + %lu)",
{ "pile_set_name": "Github" }
/* Copyright 2006-2015 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * * See http://www.boost.org/libs/flyweight for library home page. */ #ifndef BOOST_FLYWEIGHT_SERIALIZE_HPP #define BOOST_FLYWEIGHT_SERIALIZE_HPP #if defined(_MSC_VER)&&(_MSC_VER>=1200) #pragma once #endif #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/flyweight/flyweight_fwd.hpp> #include <boost/flyweight/detail/archive_constructed.hpp> #include <boost/flyweight/detail/serialization_helper.hpp> #include <boost/serialization/nvp.hpp> #include <boost/serialization/split_free.hpp> #include <boost/throw_exception.hpp> #include <memory> /* Serialization routines for flyweight<T>. */ namespace boost{ namespace serialization{ template< class Archive, typename T,typename Arg1,typename Arg2,typename Arg3 > inline void serialize( Archive& ar,::boost::flyweights::flyweight<T,Arg1,Arg2,Arg3>& f, const unsigned int version) { split_free(ar,f,version); } template< class Archive, typename T,typename Arg1,typename Arg2,typename Arg3 > void save( Archive& ar,const ::boost::flyweights::flyweight<T,Arg1,Arg2,Arg3>& f, const unsigned int /*version*/) { typedef ::boost::flyweights::flyweight<T,Arg1,Arg2,Arg3> flyweight; typedef ::boost::flyweights::detail::save_helper<flyweight> helper; typedef typename helper::size_type size_type; helper& hlp=ar.template get_helper<helper>(); size_type n=hlp.find(f); ar<<make_nvp("item",n); if(n==hlp.size()){ ar<<make_nvp("key",f.get_key()); hlp.push_back(f); } } template< class Archive, typename T,typename Arg1,typename Arg2,typename Arg3 > void load( Archive& ar,::boost::flyweights::flyweight<T,Arg1,Arg2,Arg3>& f, const unsigned int version) { typedef ::boost::flyweights::flyweight<T,Arg1,Arg2,Arg3> flyweight; typedef typename flyweight::key_type key_type; typedef ::boost::flyweights::detail::load_helper<flyweight> helper; typedef typename helper::size_type size_type; helper& hlp=ar.template get_helper<helper>(); size_type n=0; ar>>make_nvp("item",n); if(n>hlp.size()){ throw_exception( archive::archive_exception(archive::archive_exception::other_exception)); } else if(n==hlp.size()){ ::boost::flyweights::detail::archive_constructed<key_type> k( "key",ar,version); hlp.push_back(flyweight(k.get())); } f=hlp[n]; } } /* namespace serialization */ } /* namespace boost */ #endif
{ "pile_set_name": "Github" }
/***** * Tencent is pleased to support the open source community by making QMUI_iOS available. * Copyright (C) 2016-2019 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT * 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. *****/ // // QMUITableView.m // qmui // // Created by QMUI Team on 14-7-2. // #import "QMUITableView.h" #import "UITableView+QMUI.h" #import "UIView+QMUI.h" @implementation QMUITableView @dynamic delegate; @dynamic dataSource; - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style { if (self = [super initWithFrame:frame style:style]) { [self didInitialize]; } return self; } - (instancetype)initWithCoder:(NSCoder *)aDecoder { if (self = [super initWithCoder:aDecoder]) { [self didInitialize]; } return self; } - (void)didInitialize { [self qmui_styledAsQMUITableView]; } - (void)dealloc { self.delegate = nil; self.dataSource = nil; } // 保证一直存在tableFooterView,以去掉列表内容不满一屏时尾部的空白分割线 - (void)setTableFooterView:(UIView *)tableFooterView { if (!tableFooterView) { tableFooterView = [[UIView alloc] init]; } [super setTableFooterView:tableFooterView]; } - (BOOL)touchesShouldCancelInContentView:(UIView *)view { if ([self.delegate respondsToSelector:@selector(tableView:touchesShouldCancelInContentView:)]) { return [self.delegate tableView:self touchesShouldCancelInContentView:view]; } // 默认情况下只有当view是非UIControl的时候才会返回yes,这里统一对UIButton也返回yes // 原因是UITableView上面把事件延迟去掉了,但是这样如果拖动的时候手指是在UIControl上面的话,就拖动不了了 if ([view isKindOfClass:[UIControl class]]) { if ([view isKindOfClass:[UIButton class]]) { return YES; } else { return NO; } } return YES; } @end
{ "pile_set_name": "Github" }
import { db } from "../../lib/mongo" import parse from "../../lib/parse" class EmailSettingsService { constructor() { this.defaultSettings = { host: "", port: "", user: "", pass: 0, from_name: "", from_address: "", } } getEmailSettings() { return db .collection("emailSettings") .findOne() .then(settings => this.changeProperties(settings)) } updateEmailSettings(data) { const settings = this.getValidDocumentForUpdate(data) return this.insertDefaultSettingsIfEmpty().then(() => db .collection("emailSettings") .updateOne( {}, { $set: settings, }, { upsert: true } ) .then(res => this.getEmailSettings()) ) } insertDefaultSettingsIfEmpty() { return db .collection("emailSettings") .countDocuments({}) .then(count => { if (count === 0) { return db.collection("emailSettings").insertOne(this.defaultSettings) } }) } getValidDocumentForUpdate(data) { if (Object.keys(data).length === 0) { return new Error("Required fields are missing") } const settings = {} if (data.host !== undefined) { settings.host = parse.getString(data.host).toLowerCase() } if (data.port !== undefined) { settings.port = parse.getNumberIfPositive(data.port) } if (data.user !== undefined) { settings.user = parse.getString(data.user) } if (data.pass !== undefined) { settings.pass = parse.getString(data.pass) } if (data.from_name !== undefined) { settings.from_name = parse.getString(data.from_name) } if (data.from_address !== undefined) { settings.from_address = parse.getString(data.from_address) } return settings } changeProperties(settings) { if (settings) { delete settings._id } else { return this.defaultSettings } return settings } } export default new EmailSettingsService()
{ "pile_set_name": "Github" }
package raft import ( "log" "os" ) //------------------------------------------------------------------------------ // // Variables // //------------------------------------------------------------------------------ const ( Debug = 1 Trace = 2 ) var logLevel int = 0 var logger *log.Logger func init() { logger = log.New(os.Stdout, "[raft]", log.Lmicroseconds) } //------------------------------------------------------------------------------ // // Functions // //------------------------------------------------------------------------------ func LogLevel() int { return logLevel } func SetLogLevel(level int) { logLevel = level } //-------------------------------------- // Warnings //-------------------------------------- // Prints to the standard logger. Arguments are handled in the manner of // fmt.Print. func warn(v ...interface{}) { logger.Print(v...) } // Prints to the standard logger. Arguments are handled in the manner of // fmt.Printf. func warnf(format string, v ...interface{}) { logger.Printf(format, v...) } // Prints to the standard logger. Arguments are handled in the manner of // fmt.Println. func warnln(v ...interface{}) { logger.Println(v...) } //-------------------------------------- // Basic debugging //-------------------------------------- // Prints to the standard logger if debug mode is enabled. Arguments // are handled in the manner of fmt.Print. func debug(v ...interface{}) { if logLevel >= Debug { logger.Print(v...) } } // Prints to the standard logger if debug mode is enabled. Arguments // are handled in the manner of fmt.Printf. func debugf(format string, v ...interface{}) { if logLevel >= Debug { logger.Printf(format, v...) } } // Prints to the standard logger if debug mode is enabled. Arguments // are handled in the manner of fmt.Println. func debugln(v ...interface{}) { if logLevel >= Debug { logger.Println(v...) } } //-------------------------------------- // Trace-level debugging //-------------------------------------- // Prints to the standard logger if trace debugging is enabled. Arguments // are handled in the manner of fmt.Print. func trace(v ...interface{}) { if logLevel >= Trace { logger.Print(v...) } } // Prints to the standard logger if trace debugging is enabled. Arguments // are handled in the manner of fmt.Printf. func tracef(format string, v ...interface{}) { if logLevel >= Trace { logger.Printf(format, v...) } } // Prints to the standard logger if trace debugging is enabled. Arguments // are handled in the manner of debugln. func traceln(v ...interface{}) { if logLevel >= Trace { logger.Println(v...) } }
{ "pile_set_name": "Github" }
/* ___DISCLAIMER___ */ /* clock.c: PLL, CCLK, PCLK controls */ #include <arm/NXP/LPC17xx/LPC17xx.h> #include "config.h" #include "clock.h" #include "bits.h" #include "uart.h" void clock_disconnect() { disconnectPLL0(); disablePLL0(); } void clock_init() { /* set flash access time to 5 clks (80<f<=100MHz) */ setFlashAccessTime(5); /* setup PLL0 for 96MHz First, disable and disconnect PLL0. */ clock_disconnect(); /* PLL is disabled and disconnected. setup PCLK NOW as it cannot be changed reliably with PLL0 connected. see: http://ics.nxp.com/support/documents/microcontrollers/pdf/errata.lpc1754.pdf */ /* continue with PLL0 setup: enable the xtal oscillator and wait for it to become stable set the oscillator as clk source for PLL0 set PLL0 multiplier+predivider enable PLL0 set CCLK divider wait for PLL0 to lock connect PLL0 done */ enableMainOsc(); setClkSrc(CLKSRC_MAINOSC); setPLL0MultPrediv(CONFIG_CLK_MULT, CONFIG_CLK_PREDIV); enablePLL0(); setCCLKDiv(CONFIG_CLK_CCLKDIV); connectPLL0(); /* configure PLL1 for USB operation */ disconnectPLL1(); disablePLL1(); LPC_SC->PLL1CFG = 0x23; enablePLL1(); connectPLL1(); } void setFlashAccessTime(uint8_t clocks) { LPC_SC->FLASHCFG=FLASHTIM(clocks); } void setPLL0MultPrediv(uint16_t mult, uint8_t prediv) { LPC_SC->PLL0CFG=PLL_MULT(mult) | PLL_PREDIV(prediv); PLL0feed(); } void enablePLL0() { LPC_SC->PLL0CON |= PLLE0; PLL0feed(); } void disablePLL0() { LPC_SC->PLL0CON &= ~PLLE0; PLL0feed(); } void connectPLL0() { while(!(LPC_SC->PLL0STAT & PLOCK0)); LPC_SC->PLL0CON |= PLLC0; PLL0feed(); } void disconnectPLL0() { LPC_SC->PLL0CON &= ~PLLC0; PLL0feed(); } void setPLL1MultPrediv(uint16_t mult, uint8_t prediv) { LPC_SC->PLL1CFG=PLL_MULT(mult) | PLL_PREDIV(prediv); PLL1feed(); } void enablePLL1() { LPC_SC->PLL1CON |= PLLE1; PLL1feed(); } void disablePLL1() { LPC_SC->PLL1CON &= ~PLLE1; PLL1feed(); } void connectPLL1() { while(!(LPC_SC->PLL1STAT & PLOCK1)); LPC_SC->PLL1CON |= PLLC1; PLL1feed(); } void disconnectPLL1() { LPC_SC->PLL1CON &= ~PLLC1; PLL1feed(); } void setCCLKDiv(uint8_t div) { LPC_SC->CCLKCFG=CCLK_DIV(div); } void enableMainOsc() { LPC_SC->SCS=OSCEN; while(!(LPC_SC->SCS&OSCSTAT)); } void disableMainOsc() { LPC_SC->SCS=0; } void PLL0feed() { LPC_SC->PLL0FEED=0xaa; LPC_SC->PLL0FEED=0x55; } void PLL1feed() { LPC_SC->PLL1FEED=0xaa; LPC_SC->PLL1FEED=0x55; } void setClkSrc(uint8_t src) { LPC_SC->CLKSRCSEL=src; }
{ "pile_set_name": "Github" }
// This module implements the QsciLexerVerilog class. // // Copyright (c) 2017 Riverbank Computing Limited <info@riverbankcomputing.com> // // This file is part of QScintilla. // // This file may be used under the terms of the GNU General Public License // version 3.0 as published by the Free Software Foundation and appearing in // the file LICENSE included in the packaging of this file. Please review the // following information to ensure the GNU General Public License version 3.0 // requirements will be met: http://www.gnu.org/copyleft/gpl.html. // // If you do not wish to use this file under the terms of the GPL version 3.0 // then you may purchase a commercial license. For more information contact // info@riverbankcomputing.com. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. #include "Qsci/qscilexerverilog.h" #include <qcolor.h> #include <qfont.h> #include <qsettings.h> // The ctor. QsciLexerVerilog::QsciLexerVerilog(QObject *parent) : QsciLexer(parent), fold_atelse(false), fold_comments(false), fold_compact(true), fold_preproc(false), fold_atmodule(false) { } // The dtor. QsciLexerVerilog::~QsciLexerVerilog() { } // Returns the language name. const char *QsciLexerVerilog::language() const { return "Verilog"; } // Returns the lexer name. const char *QsciLexerVerilog::lexer() const { return "verilog"; } // Return the style used for braces. int QsciLexerVerilog::braceStyle() const { return Operator; } // Returns the set of keywords. const char *QsciLexerVerilog::keywords(int set) const { if (set == 1) return "always and assign automatic begin buf bufif0 bufif1 case casex " "casez cell cmos config deassign default defparam design disable " "edge else end endcase endconfig endfunction endgenerate " "endmodule endprimitiveendspecify endtable endtask event for " "force forever fork function generate genvar highz0 highz1 if " "ifnone incdir include initial inout input instance integer join " "large liblist library localparam macromodule medium module nand " "negedge nmos nor noshowcancelled not notif0 notif1 or output " "parameter pmos posedge primitive pull0 pull1 pulldown pullup " "pulsestyle_ondetect pulsestyle_onevent rcmos real realtime reg " "release repeat rnmos rpmos rtran rtranif0 rtranif1 scalared " "showcancelled signed small specify specparam strong0 strong1 " "supply0 supply1 table task time tran tranif0 tranif1 tri tri0 " "tri1 triand trior trireg unsigned use vectored wait wand weak0 " "weak1 while wire wor xnor xor"; if (set == 3) return "$async$and$array $async$and$plane $async$nand$array " "$async$nand$plane $async$nor$array $async$nor$plane " "$async$or$array $async$or$plane $bitstoreal $countdrivers " "$display $displayb $displayh $displayo $dist_chi_square " "$dist_erlang $dist_exponential $dist_normal $dist_poisson " "$dist_t $dist_uniform $dumpall $dumpfile $dumpflush $dumplimit " "$dumpoff $dumpon $dumpportsall $dumpportsflush $dumpportslimit " "$dumpportsoff $dumpportson $dumpvars $fclose $fdisplayh " "$fdisplay $fdisplayf $fdisplayb $ferror $fflush $fgetc $fgets " "$finish $fmonitorb $fmonitor $fmonitorf $fmonitorh $fopen " "$fread $fscanf $fseek $fsscanf $fstrobe $fstrobebb $fstrobef " "$fstrobeh $ftel $fullskew $fwriteb $fwritef $fwriteh $fwrite " "$getpattern $history $hold $incsave $input $itor $key $list " "$log $monitorb $monitorh $monitoroff $monitoron $monitor " "$monitoro $nochange $nokey $nolog $period $printtimescale " "$q_add $q_exam $q_full $q_initialize $q_remove $random " "$readmemb $readmemh $readmemh $realtime $realtobits $recovery " "$recrem $removal $reset_count $reset $reset_value $restart " "$rewind $rtoi $save $scale $scope $sdf_annotate $setup " "$setuphold $sformat $showscopes $showvariables $showvars " "$signed $skew $sreadmemb $sreadmemh $stime $stop $strobeb " "$strobe $strobeh $strobeo $swriteb $swriteh $swriteo $swrite " "$sync$and$array $sync$and$plane $sync$nand$array " "$sync$nand$plane $sync$nor$array $sync$nor$plane $sync$or$array " "$sync$or$plane $test$plusargs $time $timeformat $timeskew " "$ungetc $unsigned $value$plusargs $width $writeb $writeh $write " "$writeo"; return 0; } // Return the string of characters that comprise a word. const char *QsciLexerVerilog::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$"; } // Returns the foreground colour of the text for a style. QColor QsciLexerVerilog::defaultColor(int style) const { switch (style) { case Default: case InactiveComment: case InactiveCommentLine: case InactiveCommentBang: case InactiveNumber: case InactiveKeyword: case InactiveString: case InactiveKeywordSet2: case InactiveSystemTask: case InactivePreprocessor: case InactiveOperator: case InactiveIdentifier: case InactiveUnclosedString: case InactiveUserKeywordSet: case InactiveCommentKeyword: case InactiveDeclareInputPort: case InactiveDeclareOutputPort: case InactiveDeclareInputOutputPort: case InactivePortConnection: return QColor(0x80, 0x80, 0x80); case Comment: case CommentLine: return QColor(0x00, 0x7f, 0x00); case CommentBang: return QColor(0x3f, 0x7f, 0x3f); case Number: case KeywordSet2: return QColor(0x00, 0x7f, 0x7f); case Keyword: case DeclareOutputPort: return QColor(0x00, 0x00, 0x7f); case String: return QColor(0x7f, 0x00, 0x7f); case SystemTask: return QColor(0x80, 0x40, 0x20); case Preprocessor: return QColor(0x7f, 0x7f, 0x00); case Operator: return QColor(0x00, 0x70, 0x70); case UnclosedString: return QColor(0x00, 0x00, 0x00); case UserKeywordSet: case CommentKeyword: return QColor
{ "pile_set_name": "Github" }
/* Package logrus is a structured logger for Go, completely API compatible with the standard library logger. The simplest way to use Logrus is simply the package-level exported logger: package main import ( log "github.com/sirupsen/logrus" ) func main() { log.WithFields(log.Fields{ "animal": "walrus", "number": 1, "size": 10, }).Info("A walrus appears") } Output: time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10 For a full guide visit https://github.com/sirupsen/logrus */ package logrus
{ "pile_set_name": "Github" }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var chars = require("./chars"); var CssTokenType; (function (CssTokenType) { CssTokenType[CssTokenType["EOF"] = 0] = "EOF"; CssTokenType[CssTokenType["String"] = 1] = "String"; CssTokenType[CssTokenType["Comment"] = 2] = "Comment"; CssTokenType[CssTokenType["Identifier"] = 3] = "Identifier"; CssTokenType[CssTokenType["Number"] = 4] = "Number"; CssTokenType[CssTokenType["IdentifierOrNumber"] = 5] = "IdentifierOrNumber"; CssTokenType[CssTokenType["AtKeyword"] = 6] = "AtKeyword"; CssTokenType[CssTokenType["Character"] = 7] = "Character"; CssTokenType[CssTokenType["Whitespace"] = 8] = "Whitespace"; CssTokenType[CssTokenType["Invalid"] = 9] = "Invalid"; })(CssTokenType = exports.CssTokenType || (exports.CssTokenType = {})); var CssLexerMode; (function (CssLexerMode) { CssLexerMode[CssLexerMode["ALL"] = 0] = "ALL"; CssLexerMode[CssLexerMode["ALL_TRACK_WS"] = 1] = "ALL_TRACK_WS"; CssLexerMode[CssLexerMode["SELECTOR"] = 2] = "SELECTOR"; CssLexerMode[CssLexerMode["PSEUDO_SELECTOR"] = 3] = "PSEUDO_SELECTOR"; CssLexerMode[CssLexerMode["PSEUDO_SELECTOR_WITH_ARGUMENTS"] = 4] = "PSEUDO_SELECTOR_WITH_ARGUMENTS"; CssLexerMode[CssLexerMode["ATTRIBUTE_SELECTOR"] = 5] = "ATTRIBUTE_SELECTOR"; CssLexerMode[CssLexerMode["AT_RULE_QUERY"] = 6] = "AT_RULE_QUERY"; CssLexerMode[CssLexerMode["MEDIA_QUERY"] = 7] = "MEDIA_QUERY"; CssLexerMode[CssLexerMode["BLOCK"] = 8] = "BLOCK"; CssLexerMode[CssLexerMode["KEYFRAME_BLOCK"] = 9] = "KEYFRAME_BLOCK"; CssLexerMode[CssLexerMode["STYLE_BLOCK"] = 10] = "STYLE_BLOCK"; CssLexerMode[CssLexerMode["STYLE_VALUE"] = 11] = "STYLE_VALUE"; CssLexerMode[CssLexerMode["STYLE_VALUE_FUNCTION"] = 12] = "STYLE_VALUE_FUNCTION"; CssLexerMode[CssLexerMode["STYLE_CALC_FUNCTION"] = 13] = "STYLE_CALC_FUNCTION"; })(CssLexerMode = exports.CssLexerMode || (exports.CssLexerMode = {})); var LexedCssResult = (function () { function LexedCssResult(error, token) { this.error = error; this.token = token; } return LexedCssResult; }()); exports.LexedCssResult = LexedCssResult; function generateErrorMessage(input, message, errorValue, index, row, column) { return message + " at column " + row + ":" + column + " in expression [" + findProblemCode(input, errorValue, index, column) + ']'; } exports.generateErrorMessage = generateErrorMessage; function findProblemCode(input, errorValue, index, column) { var endOfProblemLine = index; var current = charCode(input, index); while (current > 0 && !isNewline(current)) { current = charCode(input, ++endOfProblemLine); } var choppedString = input.substring(0, endOfProblemLine); var pointerPadding = ''; for (var i = 0; i < column; i++) { pointerPadding += ' '; } var pointerString = ''; for (var i = 0; i < errorValue.length; i++) { pointerString += '^'; } return choppedString + '\n' + pointerPadding + pointerString + '\n'; } exports.findProblemCode = findProblemCode; var CssToken = (function () { function CssToken(index, column, line, type, strValue) { this.index = index; this.column = column; this.line = line; this.type = type; this.strValue = strValue; this.numValue = charCode(strValue, 0); } return CssToken; }()); exports.CssToken = CssToken; var CssLexer = (function () { function CssLexer() { } CssLexer.prototype.scan = function (text, trackComments) { if (trackComments === void 0) { trackComments = false; } return new CssScanner(text, trackComments); }; return CssLexer; }()); exports.CssLexer = CssLexer; var CssScannerError = (function () { function CssScannerError(token, message) { this.token = token; this.rawMessage = message; } CssScannerError.prototype.toString = function () { return this.message; }; return CssScannerError; }()); exports.CssScannerError = CssScannerError; function _trackWhitespace(mode) { switch (mode) { case CssLexerMode.SELECTOR: case CssLexerMode.PSEUDO_SELECTOR: case CssLexerMode.ALL_TRACK_WS: case CssLexerMode.STYLE_VALUE: return true; default: return false; } } var CssScanner = (function () { function CssScanner(input, _trackComments) { if (_trackComments === void 0) { _trackComments = false; } this.input = input; this._trackComments = _trackComments; this.length = 0; this.index = -1; this.column = -1; this.line = 0; this._currentMode = CssLexerMode.BLOCK; this._currentError = null; this.length = this.input.length; this.peekPeek = this.peekAt(0); this.advance(); } CssScanner.prototype.getMode = function () { return this._currentMode; }; CssScanner.prototype.setMode = function (mode) { if (this._currentMode != mode) { if (_trackWhitespace(this._currentMode) && !_trackWhitespace(mode)) { this.consumeWhitespace(); } this._currentMode = mode; } }; CssScanner.prototype.advance = function () { if (isNewline(this.peek)) { this.column = 0; this.line++; } else { this.column++; } this.index++; this.peek = this.peekPeek; this.peekPeek = this.peekAt(this.index + 1); }; CssScanner.prototype.peekAt = function (index) { return index >= this.length ? chars.$EOF : this.input.charCodeAt(index); }; CssScanner.prototype.consumeEmptyStatements = function () { this.consumeWhitespace(); while (this.peek == chars.$SEMICOLON) { this.advance(); this.consumeWhitespace(); } }; CssScanner.prototype.consumeWhitespace = function () { while (chars.isWhitespace(this.peek) || isNewline(this.peek)) { this.
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 8b83134143223104c9bc3865a565cab3 PrefabImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
<?php defined('BX_DOL') or die('hack attempt'); /** * Copyright (c) UNA, Inc - https://una.io * MIT License - https://opensource.org/licenses/MIT * * @defgroup UnaCore UNA Core * @{ */ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton { protected function __construct() { if (isset($GLOBALS['bxDolClasses'][get_class($this)])) trigger_error ('Multiple instances are not allowed for the class: ' . get_class($this), E_USER_ERROR); parent::__construct(); } /** * Prevent cloning the instance */ public function __clone() { if (isset($GLOBALS['bxDolClasses'][get_class($this)])) trigger_error('Clone is not allowed for the class: ' . get_class($this), E_USER_ERROR); } /** * Get singleton instance of the class */ public static function getInstance() { $sClass = __CLASS__; if(!isset($GLOBALS['bxDolClasses'][__CLASS__])) $GLOBALS['bxDolClasses'][__CLASS__] = new $sClass(); return $GLOBALS['bxDolClasses'][__CLASS__]; } function getModuleById($iId, $bFromCache = true) { $sSql = $this->prepare("SELECT * FROM `sys_modules` WHERE `id`=? LIMIT 1", $iId); return $bFromCache ? $this->fromMemory('sys_modules_' . $iId, 'getRow', $sSql) : $this->getRow($sSql); } function getModuleByName($sName, $bFromCache = true) { $sSql = $this->prepare("SELECT * FROM `sys_modules` WHERE `name`=? LIMIT 1", $sName); return $bFromCache ? $this->fromMemory('sys_modules_' . $sName, 'getRow', $sSql) : $this->getRow($sSql); } function getModuleByUri($sUri, $bFromCache = true) { $sSql = $this->prepare("SELECT * FROM `sys_modules` WHERE `uri`=? LIMIT 1", $sUri); return $bFromCache ? $this->fromMemory('sys_modules_' . $sUri, 'getRow', $sSql) : $this->getRow($sSql); } function enableModuleByUri($sUri) { $sSql = $this->prepare("UPDATE `sys_modules` SET `enabled`='1' WHERE `uri`=? LIMIT 1", $sUri); return (int)$this->query($sSql) > 0; } function disableModuleByUri($sUri) { $sSql = $this->prepare("UPDATE `sys_modules` SET `enabled`='0' WHERE `uri`=? LIMIT 1", $sUri); return (int)$this->query($sSql) > 0; } function setModulePendingUninstall($sUri, $bPendingUninstall) { $sSql = $this->prepare("UPDATE `sys_modules` SET `pending_uninstall` = ? WHERE `uri` = ? LIMIT 1", $bPendingUninstall ? 1 : 0, $sUri); return $this->query($sSql); } function isModule($sUri) { $sSql = $this->prepare("SELECT `id` FROM `sys_modules` WHERE `uri`=? LIMIT 1", $sUri); return (int)$this->getOne($sSql) > 0; } function isModuleByName($sName) { $sSql = $this->prepare("SELECT `id` FROM `sys_modules` WHERE `name`=? LIMIT 1", $sName); return (int)$this->getOne($sSql) > 0; } function isModuleParamsUsed($sUri, $sPath, $sPrefixDb, $sPrefixClass) { $sSql = "SELECT `id` FROM `sys_modules` WHERE `uri`='" . $sUri . "' || `path`='" . $sPath . "' || `db_prefix`='" . $sPrefixDb . "' || `class_prefix`='" . $sPrefixClass . "' LIMIT 1"; return (int)$this->getOne($sSql) > 0; } function isEnabled($sUri) { $sSql = $this->prepare("SELECT `id` FROM `sys_modules` WHERE `uri`=? AND `enabled`='1' LIMIT 1", $sUri); return (int)$this->getOne($sSql) > 0; } function isEnabledByName($sName) { $sSql = $this->prepare("SELECT `id` FROM `sys_modules` WHERE `name`=? AND `enabled`='1' LIMIT 1", $sName); return (int)$this->getOne($sSql) > 0; } function getModules() { $sSql = "SELECT * FROM `sys_modules` ORDER BY `title`"; return $this->fromMemory('sys_modules', 'getAll', $sSql); } function getModulesBy($aParams = array(), $bFromCache = true) { $aMethod = array('name' => 'getAll', 'params' => array(0 => 'query')); $sPostfix = $sWhereClause = $sOrderByClause = ""; $aBindings = array(); switch($aParams['type']) { case 'type': if(!is_array($aParams['value'])) $aParams['value'] = array($aParams['value']); $sPostfix .= '_type_' . implode('_', $aParams['value']); $sWhereClause .= " AND `type` IN (" . $this->implode_escape($aParams['value']) . ")"; break; case 'modules': $sPostfix .= '_modules'; $aBindings['type'] = BX_DOL_MODULE_TYPE_MODULE; $sWhereClause .= " AND `type`=:type"; break; case 'languages': $sPostfix .= '_languages'; $aBindings['type'] = BX_DOL_MODULE_TYPE_LANGUAGE; $sWhereClause .= " AND `type`=:type"; break; case 'templates': $sPostfix .= '_templates'; $aBindings['type'] = BX_DOL_MODULE_TYPE_TEMPLATE; $sWhereClause .= " AND `type`=:type"; break; case 'path_and_uri': $sPostfix .= '_path_and_uri_' . $aParams['path'] . '_' . $aParams['uri']; $aMethod['name'] = 'getRow'; $aBindings = array_merge($aBindings, array( 'path' => $aParams['path'], 'uri' => $aParams['uri'] )); $sWhereClause .= " AND `path`=:path AND `uri`=:uri"; break; case 'all_pairs_name_uri': $sPostfix .= 'all_pairs_name_uri'; $aMethod['name'] = 'getPairs'; $aMethod['params'][1] = 'name'; $aMethod['params'][2] = 'uri'; break; case 'all': break; } if(isset($aParams['active'])) { $sPostfix .= "_active"; $aBindings['enabled'] = (int)$aParams['active']; $sWhereClause .= " AND `enabled`=:enabled"; } $sOrderByClause = " ORDER BY " . (isset($aParams['order_by']) ? $aParams['order_by'] : '`title`'); $aMethod['params'][0] = "SELECT `id`, `type`, `name`,
{ "pile_set_name": "Github" }
<header class="header-wrapper"> <nav class="inner"> <div class="title"> <a href="/"> <img class="logo" src="<%- url_for(theme.profile.logo) %>" /> </a> </div> <ul class="menu"> <% for (var i in theme.menu){ %> <% if ( i == 'search' ){%> <li class="item"> <a class="link" id="menu-search"> <i class="iconfont icon-<%-i %>" /> </a> </l> <% } else {%> <li class="item"> <a class="link" id="menu-<%-i%>" href="<%- url_for(theme.menu[i]) %>"> <i class="iconfont icon-<%-i %>" /> </a> </li> <% } %> <% } %> </ul> </nav> </header> <header class="mobile-header-wrapper"> <i id="mobile-toggle" class="iconfont icon-menu mobile-toggle"></i> </header>
{ "pile_set_name": "Github" }
# 练习 1:文本编辑器,vim > 原文:[Exercise 1. Text Editor, The: vim](https://archive.fo/5vf0X) > 译者:[飞龙](https://github.com/wizardforcel) > 协议:[CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/) > 自豪地采用[谷歌翻译](https://translate.google.cn/) 在 Linux 中,就像任何类 Unix 操作系统,一切都只是文件。而 Unix 哲学指出,配置文件必须是人类可读和可编辑的。在几乎所有的情况下,它们只是纯文本。所以,首先,你必须学习如何编辑文本文件。 为此,我强烈建议你学习 vim 的基础知识,这是在 Linux 中处理文本的最强大的工具之一。Vim 是由 Bill Joy 于 1976 年编写的,[vi](http://en.wikipedia.org/wiki/Vi) 的重新实现。vi 实现了一个非常成功的概念,甚至 Microsoft Visual Studio 2012 有一个[插件](http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329/),它提供了一个模式,与这个超过 35 岁的编辑器兼容。你可以在这里玩转它([这是在浏览器中运行的真正的 Linux](https://bellard.org/jslinux/vm.html?url=https://bellard.org/jslinux/buildroot-x86.cfg))。完成之后,最后获取我的虚拟机。 如果我还没成功说服你,你可以了解 [nano](http://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/)来代替。但至少要试试。 现在,登入`vm1`,之后键入: ``` vim hello.txt ``` 你应该看到: ``` Hello, brave adventurer! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "hello.txt" [New File] 0,0-1 All ``` 有一个笑话说,vim有两种模式 - “反复哔哔”和“破坏一切”。那么,如果你不知道如何使用 vim,这是非常真实的,因为 vim 是模态的文本编辑器。模式是: + 普通模式:移动光标并执行删除,复制和粘贴等文本操作。 + 插入模式:输入文本。 > 译者注:还有一个命令模式,用于生成真 · 随机字符串(笑)。 这十分使新手头疼,因为他们试图尽可能地避免普通模式。那么这是错误的,所以现在我将给你正确的大纲来使用 vim : ``` start vim while editing is not finished, repeat navigate to desired position in NORMAL mode enter INSERT mode by pressing i type text exit INSERT mode by pressing <ESCAPE> when editing is finished, type :wq ``` 最重要的是,几乎任何时候都呆在普通模式,短时间内进入插入模式,然后立即退出。以这种方式,vim 只有一种模式,而这种模式是普通模式。 现在让我们试试吧。记住,按`i`进入插入模式,以及`<ESCAPE>` 返回到普通模式。键入以下内容(在每行末尾按`<ENTER>`): ``` iRoses are red Linux is scary <ESCAPE> ``` 这是你应该看到的: ``` Roses are red Linux is scary ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 4,17 All ``` 现在我给你命令列表,在普通模式下移动光标: + `h` - 向左移动 + `j` - 向下移动 + `k` - 向上移动 + `l` - 右移 + `i` - 进入插入模式 + `o` - 在光标下插入一行并进入插入模式 + `<ESCAPE>` - 退出插入模式 + `x` - 删除光标下的符号 + `dd` - 删除一行 + `:wq` - 将更改写入文件并退出。是的,没错,这是一个冒号,后面跟着`wq`和`<ENTER>`。 + `:q!` - 不要对文件进行更改并退出。 那就够了。现在,将光标放在第一行并输入: ``` oViolets are blue<ESCAPE> ``` 之后,将光标放在`Linux is scary`那一行,并输入: ``` oBut I'm scary too<ESCAPE> ``` 你应该看到: ``` Roses are red Violets are blue Linux is scary But I'm scary too ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 4,17 All ``` 现在键入`:wq`保存文件,并退出。你应该看到: ``` Violets are blue Linux is scary But I'm scary too ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "hello.txt" 4L, 64C written user1@vm1:~$ ``` 好的。你做到它了。你刚刚在 vim 中编辑了文本文件,很好很强大! ## 附加题 + 通过键入键入`vim hello.txt`再次启动 vim,并尝试我给你的一些命令。 + 玩这个游戏,它会让你更熟悉 vim:<http://vim-adventures.com/>
{ "pile_set_name": "Github" }
/* Copyright (C) 2011 Mark Chandler (Desura Net Pty Ltd) Copyright (C) 2014 Bad Juju Games, Inc. 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. Contact us at legal@badjuju.com. */ #ifndef DESURA_SCRIPTCOREINTERNAL_H #define DESURA_SCRIPTCOREINTERNAL_H #ifdef _WIN32 #pragma once #endif #include "v8.h" class ScriptCoreInternal { public: void init(); void del(); void runScript(const char* file, const char* buff, uint32 size); void runString(const char* string); protected: void doRunScript(v8::Handle<v8::Script> script); gcString reportException(v8::TryCatch* try_catch); private: friend bool IsV8Init(); static std::mutex s_InitLock; static bool s_IsInit; static bool s_Disabled; static void OnFatalError(const char* location, const char* message); v8::Persistent<v8::Context> m_v8Context; }; #endif //DESURA_SCRIPTCOREINTERNAL_H
{ "pile_set_name": "Github" }
#ifndef _NRF_DELAY_H #define _NRF_DELAY_H // #include "nrf.h" /*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */ #if defined ( __CC_ARM ) static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us) { loop SUBS R0, R0, #1 NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP BNE loop BX LR } #elif defined ( __ICCARM__ ) static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) { __ASM ( "loop:\n\t" " SUBS R0, R0, #1\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " NOP\n\t" " BNE loop\n\t"); } #elif defined ( __GNUC__ ) __INLINE static void nrf_delay_us(uint32_t volatile number_of_us) { do { __ASM volatile ( "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" "NOP\n\t" ); } while (--number_of_us); } #endif void nrf_delay_ms(uint32_t volatile number_of_ms); #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/tv_item" android:layout_width="wrap_content" android:layout_height="60px" android:layout_margin="18px" android:gravity="center" android:paddingLeft="20px" android:paddingRight="20px" android:text="热词" android:textColor="@color/text1" android:background="@drawable/shape_tag_nor" /> </LinearLayout>
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 4f6a32ae4320c1d489759d620e71be9b NativeFormatImporter: externalObjects: {} mainObjectFileID: 2100000 userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
--------------- Custom Commands --------------- ``xse trip`` show last Trip value ``xse recu up`` ``xse recu down`` set Rekuperation up or down. Works only if Rekuperation is enabled in car ``xse charge`` set charge and leave Time. Example: ``xse charge 7 15 off`` set Time at 7:15 clock with pre climate off ``xse charge 9 55 on`` set Time at 9:55 clock with pre climate on
{ "pile_set_name": "Github" }
/* * Copyright 2019 The Error Prone Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.errorprone.bugpatterns; import static com.google.errorprone.BugPattern.SeverityLevel.ERROR; import static com.google.errorprone.matchers.Description.NO_MATCH; import static com.google.errorprone.matchers.JUnitMatchers.hasJUnit4TestRunner; import static com.google.errorprone.util.ASTHelpers.getAnnotationWithSimpleName; import static com.google.errorprone.util.ASTHelpers.hasAnnotation; import com.google.errorprone.BugPattern; import com.google.errorprone.VisitorState; import com.google.errorprone.bugpatterns.BugChecker.ClassTreeMatcher; import com.google.errorprone.fixes.SuggestedFix; import com.google.errorprone.fixes.SuggestedFixes; import com.google.errorprone.matchers.Description; import com.sun.source.tree.AnnotationTree; import com.sun.source.tree.ClassTree; /** Flags uses of parameters in non-parameterized tests. */ @BugPattern( name = "ParametersButNotParameterized", summary = "This test has @Parameters but is using the default JUnit4 runner. The parameters will" + " have no effect.", severity = ERROR) public final class ParametersButNotParameterized extends BugChecker implements ClassTreeMatcher { private static final String PARAMETERIZED = "org.junit.runners.Parameterized"; private static final String PARAMETER = "org.junit.runners.Parameterized.Parameter"; private static final String PARAMETERS = "org.junit.runners.Parameterized.Parameters"; @Override public Description matchClass(ClassTree tree, VisitorState state) { if (!hasJUnit4TestRunner.matches(tree, state)) { return NO_MATCH; } if (tree.getMembers().stream() .noneMatch( m -> hasAnnotation(m, PARAMETER, state) || hasAnnotation(m, PARAMETERS, state))) { return NO_MATCH; } AnnotationTree annotation = getAnnotationWithSimpleName(tree.getModifiers().getAnnotations(), "RunWith"); SuggestedFix.Builder fix = SuggestedFix.builder(); fix.replace( annotation, String.format("@RunWith(%s.class)", SuggestedFixes.qualifyType(state, fix, PARAMETERIZED))); return describeMatch(tree, fix.build()); } }
{ "pile_set_name": "Github" }
import $ from 'jquery'; import env from '../core/env'; import lists from '../core/lists'; import dom from '../core/dom'; export default class TablePopover { constructor(context) { this.context = context; this.ui = $.summernote.ui; this.options = context.options; this.events = { 'summernote.mousedown': (we, e) => { this.update(e.target); }, 'summernote.keyup summernote.scroll summernote.change': () => { this.update(); }, 'summernote.disable': () => { this.hide(); } }; } shouldInitialize() { return !lists.isEmpty(this.options.popover.table); } initialize() { this.$popover = this.ui.popover({ className: 'note-table-popover' }).render().appendTo(this.options.container); const $content = this.$popover.find('.popover-content,.note-popover-content'); this.context.invoke('buttons.build', $content, this.options.popover.table); // [workaround] Disable Firefox's default table editor if (env.isFF) { document.execCommand('enableInlineTableEditing', false, false); } } destroy() { this.$popover.remove(); } update(target) { if (this.context.isDisabled()) { return false; } const isCell = dom.isCell(target); if (isCell) { const pos = dom.posFromPlaceholder(target); this.$popover.css({ display: 'block', left: pos.left, top: pos.top }); } else { this.hide(); } return isCell; } hide() { this.$popover.hide(); } }
{ "pile_set_name": "Github" }
// Copyright (C) 2017-2019 Jonathan Müller <jonathanmueller.dev@gmail.com> // This file is subject to the license terms in the LICENSE file // found in the top-level directory of this distribution. #include <cppast/cpp_template_parameter.hpp> #include <cppast/cpp_entity_kind.hpp> using namespace cppast; const char* cppast::to_string(cpp_template_keyword kw) noexcept { switch (kw) { case cpp_template_keyword::keyword_class: return "class"; case cpp_template_keyword::keyword_typename: return "typename"; } return "should not get here"; } std::unique_ptr<cpp_template_type_parameter> cpp_template_type_parameter::build( const cpp_entity_index& idx, cpp_entity_id id, std::string name, cpp_template_keyword kw, bool variadic, std::unique_ptr<cpp_type> default_type) { std::unique_ptr<cpp_template_type_parameter> result( new cpp_template_type_parameter(std::move(name), kw, variadic, std::move(default_type))); idx.register_definition(std::move(id), type_safe::cref(*result)); return result; } cpp_entity_kind cpp_template_type_parameter::kind() noexcept { return cpp_entity_kind::template_type_parameter_t; } cpp_entity_kind cpp_template_type_parameter::do_get_entity_kind() const noexcept { return kind(); } bool detail::cpp_template_parameter_ref_predicate::operator()(const cpp_entity& e) { return e.kind() == cpp_entity_kind::template_type_parameter_t; } std::unique_ptr<cpp_non_type_template_parameter> cpp_non_type_template_parameter::build( const cpp_entity_index& idx, cpp_entity_id id, std::string name, std::unique_ptr<cpp_type> type, bool is_variadic, std::unique_ptr<cpp_expression> default_value) { std::unique_ptr<cpp_non_type_template_parameter> result( new cpp_non_type_template_parameter(std::move(name), std::move(type), is_variadic, std::move(default_value))); idx.register_definition(std::move(id), type_safe::cref(*result)); return result; } cpp_entity_kind cpp_non_type_template_parameter::kind() noexcept { return cpp_entity_kind::non_type_template_parameter_t; } cpp_entity_kind cpp_non_type_template_parameter::do_get_entity_kind() const noexcept { return kind(); } bool detail::cpp_template_ref_predicate::operator()(const cpp_entity& e) { return is_template(e.kind()) || e.kind() == cpp_entity_kind::template_template_parameter_t; } cpp_entity_kind cpp_template_template_parameter::kind() noexcept { return cpp_entity_kind::template_template_parameter_t; } cpp_entity_kind cpp_template_template_parameter::do_get_entity_kind() const noexcept { return kind(); }
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <AddressBookCore/ABCNPropertyDescription.h> #import <AddressBookCore/ABCNAbstractPropertyDescription-Protocol.h> @class NSString; @interface ABCNIdentifierDescription : ABCNPropertyDescription <ABCNAbstractPropertyDescription> { } - (void)decodeUsingCoder:(id)arg1 contact:(id)arg2; - (void)encodeUsingCoder:(id)arg1 contact:(id)arg2; - (void)copyFromContact:(id)arg1 to:(id)arg2; - (BOOL)isEqualForContact:(id)arg1 other:(id)arg2; - (id)init; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
{ "pile_set_name": "Github" }
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * 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 part of dcm4che, an implementation of DICOM(TM) in * Java(TM), hosted at https://github.com/dcm4che. * * The Initial Developer of the Original Code is * Agfa Healthcare. * Portions created by the Initial Developer are Copyright (C) 2012 * the Initial Developer. All Rights Reserved. * * Contributor(s): * See @authors listed below * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ package org.dcm4che3.net; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; /** * @author Gunter Zeilinger <gunterze@gmail.com> * */ public class DeviceService implements DeviceServiceInterface { protected Device device; protected ExecutorService executor; protected ScheduledExecutorService scheduledExecutor; protected void init(Device device) { setDevice(device); } public void setDevice(Device device) { this.device = device; } public Device getDevice() { return device; } public boolean isRunning() { return executor != null; } public void start() throws Exception { if (device == null) throw new IllegalStateException("Not initialized"); if (executor != null) throw new IllegalStateException("Already started"); executor = executerService(); scheduledExecutor = scheduledExecuterService(); try { device.setExecutor(executor); device.setScheduledExecutor(scheduledExecutor); device.bindConnections(); } catch (Exception e) { stop(); throw e; } } public void stop() { if (device != null) device.unbindConnections(); if (scheduledExecutor != null) scheduledExecutor.shutdown(); if (executor != null) executor.shutdown(); executor = null; scheduledExecutor = null; } protected ExecutorService executerService() { return Executors.newCachedThreadPool(); } protected ScheduledExecutorService scheduledExecuterService() { return Executors.newSingleThreadScheduledExecutor(); } }
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Pdf * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Png.php 22655 2010-07-22 18:47:20Z mabe $ */ /** Internally used classes */ require_once 'Zend/Pdf/Element/Array.php'; require_once 'Zend/Pdf/Element/Dictionary.php'; require_once 'Zend/Pdf/Element/Name.php'; require_once 'Zend/Pdf/Element/Numeric.php'; require_once 'Zend/Pdf/Element/String/Binary.php'; /** Zend_Pdf_Resource_Image */ require_once 'Zend/Pdf/Resource/Image.php'; /** * PNG image * * @package Zend_Pdf * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Pdf_Resource_Image_Png extends Zend_Pdf_Resource_Image { const PNG_COMPRESSION_DEFAULT_STRATEGY = 0; const PNG_COMPRESSION_FILTERED = 1; const PNG_COMPRESSION_HUFFMAN_ONLY = 2; const PNG_COMPRESSION_RLE = 3; const PNG_FILTER_NONE = 0; const PNG_FILTER_SUB = 1; const PNG_FILTER_UP = 2; const PNG_FILTER_AVERAGE = 3; const PNG_FILTER_PAETH = 4; const PNG_INTERLACING_DISABLED = 0; const PNG_INTERLACING_ENABLED = 1; const PNG_CHANNEL_GRAY = 0; const PNG_CHANNEL_RGB = 2; const PNG_CHANNEL_INDEXED = 3; const PNG_CHANNEL_GRAY_ALPHA = 4; const PNG_CHANNEL_RGB_ALPHA = 6; protected $_width; protected $_height; protected $_imageProperties; /** * Object constructor * * @param string $imageFileName * @throws Zend_Pdf_Exception * @todo Add compression conversions to support compression strategys other than PNG_COMPRESSION_DEFAULT_STRATEGY. * @todo Add pre-compression filtering. * @todo Add interlaced image handling. * @todo Add support for 16-bit images. Requires PDF version bump to 1.5 at least. * @todo Add processing for all PNG chunks defined in the spec. gAMA etc. * @todo Fix tRNS chunk support for Indexed Images to a SMask. */ public function __construct($imageFileName) { if (($imageFile = @fopen($imageFileName, 'rb')) === false ) { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception( "Can not open '$imageFileName' file for reading." ); } parent::__construct(); //Check if the file is a PNG fseek($imageFile, 1, SEEK_CUR); //First signature byte (%) if ('PNG' != fread($imageFile, 3)) { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Image is not a PNG'); } fseek($imageFile, 12, SEEK_CUR); //Signature bytes (Includes the IHDR chunk) IHDR processed linerarly because it doesnt contain a variable chunk length $wtmp = unpack('Ni',fread($imageFile, 4)); //Unpack a 4-Byte Long $width = $wtmp['i']; $htmp = unpack('Ni',fread($imageFile, 4)); $height = $htmp['i']; $bits = ord(fread($imageFile, 1)); //Higher than 8 bit depths are only supported in later versions of PDF. $color = ord(fread($imageFile, 1)); $compression = ord(fread($imageFile, 1)); $prefilter = ord(fread($imageFile,1)); if (($interlacing = ord(fread($imageFile,1))) != Zend_Pdf_Resource_Image_Png::PNG_INTERLACING_DISABLED) { require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception( "Only non-interlaced images are currently supported." ); } $this->_width = $width; $this->_height = $height; $this->_imageProperties = array(); $this->_imageProperties['bitDepth'] = $bits; $this->_imageProperties['pngColorType'] = $color; $this->_imageProperties['pngFilterType'] = $prefilter; $this->_imageProperties['pngCompressionType'] = $compression; $this->_imageProperties['pngInterlacingType'] = $interlacing; fseek($imageFile, 4, SEEK_CUR); //4 Byte Ending Sequence $imageData = ''; /* * The following loop processes PNG chunks. 4 Byte Longs are packed first give the chunk length * followed by the chunk signature, a four byte code. IDAT and IEND are manditory in any PNG. */ while(($chunkLengthBytes = fread($imageFile, 4)) !== false) { $chunkLengthtmp = unpack('Ni', $chunkLengthBytes); $chunkLength = $chunkLengthtmp['i']; $chunkType = fread($imageFile, 4); switch($chunkType) { case 'IDAT': //Image Data /* * Reads the actual image data from the PNG file. Since we know at this point that the compression * strategy is the default strategy, we also know that this data is Zip compressed. We will either copy * the data directly to the PDF and provide the correct FlateDecode predictor, or decompress the data * decode the filters and output the data as a raw pixel map. */ $imageData .= fread($imageFile, $chunkLength); fseek($imageFile, 4, SEEK_CUR); break; case 'PLTE': //Palette $paletteData = fread($imageFile, $chunkLength); fseek($imageFile, 4, SEEK_CUR); break; case 'tRNS': //Basic (non-alpha channel) transparency. $trnsData = fread($imageFile, $chunkLength); switch ($color) { case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_GRAY: $baseColor = ord(substr($trnsData, 1, 1)); $transparencyData = array(new Zend_Pdf_Element_Numeric($baseColor), new Zend_Pdf_Element_Numeric($baseColor)); break; case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_RGB: $red = ord(substr($trnsData,1,1)); $green = ord(substr($trnsData,3,1)); $blue = ord(substr($trnsData,5,1)); $transparencyData = array(new Zend_Pdf_Element_Numeric($red), new Zend_Pdf_Element_Numeric($red), new Zend_Pdf_Element_Numeric($green), new Zend_Pdf_Element_Numeric($green), new Zend_Pdf_Element_Numeric($blue), new Zend_Pdf_Element_
{ "pile_set_name": "Github" }
#include <rose.h> class SgVarSubstCopy : public SgCopyHelp { SgVariableSymbol *sourceSymbol; SgExpression *replacementExpression; public: SgVarSubstCopy(SgVariableSymbol *sourceSymbol, SgExpression *replacementExpression) : sourceSymbol(sourceSymbol), replacementExpression(replacementExpression) {} SgNode *copyAst(const SgNode *n) { if (const SgVarRefExp *vr = isSgVarRefExp(const_cast<SgNode *>(n))) { if (vr->get_symbol() == sourceSymbol) { return replacementExpression->copy(*this); } } return n->copy(*this); } }; #define SgNULL_FILE Sg_File_Info::generateDefaultFileInfoForTransformationNode() int main(int argc, char **argv) { // Initialize and check compatibility. See Rose::initialize ROSE_INITIALIZE; // Build the AST used by ROSE SgProject *project = frontend(argc, argv); // Find the exampleFunction function SgGlobal *global = project->get_file(0).get_globalScope(); SgFunctionSymbol *exampleFunctionSym = global->lookup_function_symbol("exampleFunction"); ROSE_ASSERT(exampleFunctionSym != NULL); SgFunctionDeclaration *exampleFunctionDecl = exampleFunctionSym->get_declaration(); ROSE_ASSERT(exampleFunctionDecl != NULL); SgFunctionDefinition *exampleFunctionDef = exampleFunctionDecl->get_definition(); ROSE_ASSERT(exampleFunctionDef != NULL); // Find its first parameter SgInitializedName *firstParamName = exampleFunctionDecl->get_args().front(); ROSE_ASSERT(firstParamName != NULL); SgVariableSymbol *firstParamSym = exampleFunctionDef->lookup_var_symbol(firstParamName->get_name()); ROSE_ASSERT(firstParamSym != NULL); // Construct the expression to substitute for SgIntVal *twenty = new SgIntVal(SgNULL_FILE, 20); // Create our copy help mechanism with the required parameters SgVarSubstCopy ourCopyHelp(firstParamSym, twenty); // Do the copy SgNode *exampleFunctionDeclCopyNode = exampleFunctionDecl->copy(ourCopyHelp); ROSE_ASSERT(exampleFunctionDeclCopyNode != NULL); SgFunctionDeclaration *exampleFunctionDeclCopy = isSgFunctionDeclaration(exampleFunctionDeclCopyNode); ROSE_ASSERT(exampleFunctionDeclCopy != NULL); // Change the name of the new function exampleFunctionDeclCopy->set_name("exampleFunction20"); global->get_symbol_table()->insert(exampleFunctionDeclCopy->get_name(), new SgFunctionSymbol(exampleFunctionDeclCopy)); // Add function to global scope global->append_declaration(exampleFunctionDeclCopy); // Generate source code from AST and call the vendor's compiler return backend(project); }
{ "pile_set_name": "Github" }
/** * Converts an ASCII `string` to an array. * * @private * @param {string} string The string to convert. * @returns {Array} Returns the converted array. */ function asciiToArray(string) { return string.split(''); } module.exports = asciiToArray;
{ "pile_set_name": "Github" }
// This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // 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 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. //! Communication streams for the polite-grandpa networking protocol. //! //! GRANDPA nodes communicate over a gossip network, where messages are not sent to //! peers until they have reached a given round. //! //! Rather than expressing protocol rules, //! polite-grandpa just carries a notion of impoliteness. Nodes which pass some arbitrary //! threshold of impoliteness are removed. Messages are either costly, or beneficial. //! //! For instance, it is _impolite_ to send the same message more than once. //! In the future, there will be a fallback for allowing sending the same message //! under certain conditions that are used to un-stick the protocol. use futures::{prelude::*, channel::mpsc}; use log::{debug, trace}; use parking_lot::Mutex; use prometheus_endpoint::Registry; use std::{pin::Pin, sync::Arc, task::{Context, Poll}}; use sp_core::traits::BareCryptoStorePtr; use finality_grandpa::Message::{Prevote, Precommit, PrimaryPropose}; use finality_grandpa::{voter, voter_set::VoterSet}; use sc_network::{NetworkService, ReputationChange}; use sc_network_gossip::{GossipEngine, Network as GossipNetwork}; use parity_scale_codec::{Encode, Decode}; use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor}; use sc_telemetry::{telemetry, CONSENSUS_DEBUG, CONSENSUS_INFO}; use crate::{ CatchUp, Commit, CommunicationIn, CommunicationOutH, CompactCommit, Error, Message, SignedMessage, }; use crate::environment::HasVoted; use gossip::{ FullCatchUpMessage, FullCommitMessage, GossipMessage, GossipValidator, PeerReport, VoteMessage, }; use sp_finality_grandpa::{ AuthorityId, AuthoritySignature, SetId as SetIdNumber, RoundNumber, }; use sp_utils::mpsc::TracingUnboundedReceiver; pub mod gossip; mod periodic; #[cfg(test)] pub(crate) mod tests; pub use sp_finality_grandpa::GRANDPA_ENGINE_ID; pub const GRANDPA_PROTOCOL_NAME: &'static str = "/paritytech/grandpa/1"; // cost scalars for reporting peers. mod cost { use sc_network::ReputationChange as Rep; pub(super) const PAST_REJECTION: Rep = Rep::new(-50, "Grandpa: Past message"); pub(super) const BAD_SIGNATURE: Rep = Rep::new(-100, "Grandpa: Bad signature"); pub(super) const MALFORMED_CATCH_UP: Rep = Rep::new(-1000, "Grandpa: Malformed cath-up"); pub(super) const MALFORMED_COMMIT: Rep = Rep::new(-1000, "Grandpa: Malformed commit"); pub(super) const FUTURE_MESSAGE: Rep = Rep::new(-500, "Grandpa: Future message"); pub(super) const UNKNOWN_VOTER: Rep = Rep::new(-150, "Grandpa: Unknown voter"); pub(super) const INVALID_VIEW_CHANGE: Rep = Rep::new(-500, "Grandpa: Invalid view change"); pub(super) const PER_UNDECODABLE_BYTE: i32 = -5; pub(super) const PER_SIGNATURE_CHECKED: i32 = -25; pub(super) const PER_BLOCK_LOADED: i32 = -10; pub(super) const INVALID_CATCH_UP: Rep = Rep::new(-5000, "Grandpa: Invalid catch-up"); pub(super) const INVALID_COMMIT: Rep = Rep::new(-5000, "Grandpa: Invalid commit"); pub(super) const OUT_OF_SCOPE_MESSAGE: Rep = Rep::new(-500, "Grandpa: Out-of-scope message"); pub(super) const CATCH_UP_REQUEST_TIMEOUT: Rep = Rep::new(-200, "Grandpa: Catch-up request timeout"); // cost of answering a catch up request pub(super) const CATCH_UP_REPLY: Rep = Rep::new(-200, "Grandpa: Catch-up reply"); pub(super) const HONEST_OUT_OF_SCOPE_CATCH_UP: Rep = Rep::new(-200, "Grandpa: Out-of-scope catch-up"); } // benefit scalars for reporting peers. mod benefit { use sc_network::ReputationChange as Rep; pub(super) const NEIGHBOR_MESSAGE: Rep = Rep::new(100, "Grandpa: Neighbor message"); pub(super) const ROUND_MESSAGE: Rep = Rep::new(100, "Grandpa: Round message"); pub(super) const BASIC_VALIDATED_CATCH_UP: Rep = Rep::new(200, "Grandpa: Catch-up message"); pub(super) const BASIC_VALIDATED_COMMIT: Rep = Rep::new(100, "Grandpa: Commit"); pub(super) const PER_EQUIVOCATION: i32 = 10; } /// A type that ties together our local authority id and a keystore where it is /// available for signing. pub struct LocalIdKeystore((AuthorityId, BareCryptoStorePtr)); impl LocalIdKeystore { /// Returns a reference to our local authority id. fn local_id(&self) -> &AuthorityId { &(self.0).0 } /// Returns a reference to the keystore. fn keystore(&self) -> &BareCryptoStorePtr { &(self.0).1 } } impl AsRef<BareCryptoStorePtr> for LocalIdKeystore { fn as_ref(&self) -> &BareCryptoStorePtr { self.keystore() } } impl From<(AuthorityId, BareCryptoStorePtr)> for LocalIdKeystore { fn from(inner: (AuthorityId, BareCryptoStorePtr)) -> LocalIdKeystore { LocalIdKeystore(inner) } } /// If the voter set is larger than this value some telemetry events are not /// sent to avoid increasing usage resource on the node and flooding the /// telemetry server (e.g. received votes, received commits.) const TELEMETRY_VOTERS_LIMIT: usize = 10; /// A handle to the network. /// /// Something that provides both the capabilities needed for the `gossip_network::Network` trait as /// well as the ability to set a fork sync request for a particular block. pub trait Network<Block: BlockT>: GossipNetwork<Block> + Clone + Send + 'static { /// Notifies the sync service to try and sync the given block from the given /// peers. /// /// If the given vector of peers is empty then the underlying implementation /// should make a best effort to fetch the block from any peers it is /// connected to (NOTE: this assumption will change in the future #3629). fn set_sync_fork_request(&self, peers: Vec<sc_network::PeerId>, hash: Block::Hash, number: NumberFor<Block>); } impl<B, H> Network<B> for Arc<NetworkService<B, H>> where B: BlockT, H: sc_network::ExHashT, { fn set_sync_fork_request(&self, peers: Vec<
{ "pile_set_name": "Github" }
console.log (Object.prototype.toString.call([].__proto__)); console.log (Object.prototype.toString.call([].__proto__.__proto__)); console.log (Object.prototype.toString.call([].__proto__.__proto__.__proto__));
{ "pile_set_name": "Github" }
# Subscription ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **subscriptionId** | **String** | | [optional] **applicationId** | **String** | | **apiIdentifier** | **String** | | **tier** | **String** | | **status** | [**StatusEnum**](#StatusEnum) | | [optional] <a name="StatusEnum"></a> ## Enum: StatusEnum Name | Value ---- | ----- BLOCKED | &quot;BLOCKED&quot; PROD_ONLY_BLOCKED | &quot;PROD_ONLY_BLOCKED&quot; UNBLOCKED | &quot;UNBLOCKED&quot; ON_HOLD | &quot;ON_HOLD&quot; REJECTED | &quot;REJECTED&quot;
{ "pile_set_name": "Github" }
/* * Copyright (c) 2006-2011 Christian Plattner. All rights reserved. * Please refer to the LICENSE.txt for licensing details. */ package ch.ethz.ssh2.packets; import ch.ethz.ssh2.DHGexParameters; /** * PacketKexDhGexRequestOld. * * @author Christian Plattner * @version 2.50, 03/15/10 */ public class PacketKexDhGexRequestOld { byte[] payload; int n; public PacketKexDhGexRequestOld(DHGexParameters para) { this.n = para.getPref_group_len(); } public byte[] getPayload() { if (payload == null) { TypesWriter tw = new TypesWriter(); tw.writeByte(Packets.SSH_MSG_KEX_DH_GEX_REQUEST_OLD); tw.writeUINT32(n); payload = tw.getBytes(); } return payload; } }
{ "pile_set_name": "Github" }
true false
{ "pile_set_name": "Github" }
//=========================================== // The following is for 8812A 1ANT BT Co-exist definition //=========================================== #define BT_AUTO_REPORT_ONLY_8812A_1ANT 1 #define BT_INFO_8812A_1ANT_B_FTP BIT7 #define BT_INFO_8812A_1ANT_B_A2DP BIT6 #define BT_INFO_8812A_1ANT_B_HID BIT5 #define BT_INFO_8812A_1ANT_B_SCO_BUSY BIT4 #define BT_INFO_8812A_1ANT_B_ACL_BUSY BIT3 #define BT_INFO_8812A_1ANT_B_INQ_PAGE BIT2 #define BT_INFO_8812A_1ANT_B_SCO_ESCO BIT1 #define BT_INFO_8812A_1ANT_B_CONNECTION BIT0 #define BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \ (((_BT_INFO_EXT_&BIT0))? TRUE:FALSE) #define BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT 2 #define BT_8812A_1ANT_WIFI_NOISY_THRESH 30 //max: 255 typedef enum _BT_INFO_SRC_8812A_1ANT{ BT_INFO_SRC_8812A_1ANT_WIFI_FW = 0x0, BT_INFO_SRC_8812A_1ANT_BT_RSP = 0x1, BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND = 0x2, BT_INFO_SRC_8812A_1ANT_MAX }BT_INFO_SRC_8812A_1ANT,*PBT_INFO_SRC_8812A_1ANT; typedef enum _BT_8812A_1ANT_BT_STATUS{ BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1, BT_8812A_1ANT_BT_STATUS_INQ_PAGE = 0x2, BT_8812A_1ANT_BT_STATUS_ACL_BUSY = 0x3, BT_8812A_1ANT_BT_STATUS_SCO_BUSY = 0x4, BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, BT_8812A_1ANT_BT_STATUS_MAX }BT_8812A_1ANT_BT_STATUS,*PBT_8812A_1ANT_BT_STATUS; typedef enum _BT_8812A_1ANT_WIFI_STATUS{ BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0, BT_8812A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1, BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2, BT_8812A_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3, BT_8812A_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4, BT_8812A_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5, BT_8812A_1ANT_WIFI_STATUS_MAX }BT_8812A_1ANT_WIFI_STATUS,*PBT_8812A_1ANT_WIFI_STATUS; typedef enum _BT_8812A_1ANT_COEX_ALGO{ BT_8812A_1ANT_COEX_ALGO_UNDEFINED = 0x0, BT_8812A_1ANT_COEX_ALGO_SCO = 0x1, BT_8812A_1ANT_COEX_ALGO_HID = 0x2, BT_8812A_1ANT_COEX_ALGO_A2DP = 0x3, BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS = 0x4, BT_8812A_1ANT_COEX_ALGO_PANEDR = 0x5, BT_8812A_1ANT_COEX_ALGO_PANHS = 0x6, BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7, BT_8812A_1ANT_COEX_ALGO_PANEDR_HID = 0x8, BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, BT_8812A_1ANT_COEX_ALGO_HID_A2DP = 0xa, BT_8812A_1ANT_COEX_ALGO_MAX = 0xb, }BT_8812A_1ANT_COEX_ALGO,*PBT_8812A_1ANT_COEX_ALGO; typedef struct _COEX_DM_8812A_1ANT{ // hw setting u1Byte preAntPosType; u1Byte curAntPosType; // fw mechanism BOOLEAN bCurIgnoreWlanAct; BOOLEAN bPreIgnoreWlanAct; u1Byte prePsTdma; u1Byte curPsTdma; u1Byte psTdmaPara[5]; u1Byte psTdmaDuAdjType; BOOLEAN bAutoTdmaAdjust; BOOLEAN bPrePsTdmaOn; BOOLEAN bCurPsTdmaOn; BOOLEAN bPreBtAutoReport; BOOLEAN bCurBtAutoReport; u1Byte preLps; u1Byte curLps; u1Byte preRpwm; u1Byte curRpwm; // sw mechanism BOOLEAN bPreLowPenaltyRa; BOOLEAN bCurLowPenaltyRa; u4Byte preVal0x6c0; u4Byte curVal0x6c0; u4Byte preVal0x6c4; u4Byte curVal0x6c4; u4Byte preVal0x6c8; u4Byte curVal0x6c8; u1Byte preVal0x6cc; u1Byte curVal0x6cc; BOOLEAN bLimitedDig; u4Byte backupArfrCnt1; // Auto Rate Fallback Retry cnt u4Byte backupArfrCnt2; // Auto Rate Fallback Retry cnt u2Byte backupRetryLimit; u1Byte backupAmpduMaxTime; // algorithm related u1Byte preAlgorithm; u1Byte curAlgorithm; u1Byte btStatus; u1Byte wifiChnlInfo[3]; u4Byte preRaMask; u4Byte curRaMask; u1Byte preArfrType; u1Byte curArfrType; u1Byte preRetryLimitType; u1Byte curRetryLimitType; u1Byte preAmpduTimeType; u1Byte curAmpduTimeType; u4Byte nArpCnt
{ "pile_set_name": "Github" }
package crdapps import ( "testing" routefake "github.com/openshift/client-go/route/clientset/versioned/fake" v1alpha1 "github.com/stakater/Forecastle/pkg/apis/forecastle/v1alpha1" "github.com/stakater/Forecastle/pkg/kube" "github.com/stakater/Forecastle/pkg/testutil" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" kubefake "k8s.io/client-go/kubernetes/fake" ) func Test_getURL(t *testing.T) { clients := kube.Clients{ RoutesClient: routefake.NewSimpleClientset(), KubernetesClient: kubefake.NewSimpleClientset(), } type args struct { clients kube.Clients forecastleApp v1alpha1.ForecastleApp } tests := []struct { name string args args want string err error }{ { name: "TestGetURLWithDefaultURLValue", args: args{ clients: clients, forecastleApp: *testutil.CreateForecastleApp("app-1", "https://google.com", "default", "https://icon"), }, want: "https://google.com", }, { name: "TestGetURLWithNoURL", args: args{ clients: clients, forecastleApp: *testutil.CreateForecastleApp("app-1", "", "default", "https://icon"), }, want: "", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got, err := getURL(tt.args.clients, tt.args.forecastleApp); got != tt.want && err != tt.err { t.Errorf("getURL() = %v, want %v, err = %v, wantErr = %v", got, tt.want, err, tt.err) } }) } } func Test_discoverURLFromRefs(t *testing.T) { clients := kube.Clients{ RoutesClient: routefake.NewSimpleClientset(), KubernetesClient: kubefake.NewSimpleClientset(), } clients.KubernetesClient.ExtensionsV1beta1().Ingresses("").Create(testutil.CreateIngressWithHost("my-app-ingress", "https://ingress-url.com")) clients.RoutesClient.RouteV1().Routes("").Create(testutil.CreateRouteWithHost("my-app-route", "ingress-url.com")) type args struct { clients kube.Clients forecastleApp v1alpha1.ForecastleApp } tests := []struct { name string args args want string err error }{ { name: "TestDiscoverURLFromRefsWithIngressName", args: args{ clients: clients, forecastleApp: *testutil.CreateForecastleAppWithURLFromIngress("app-1", "default", "https://icon", "my-app-ingress"), }, want: "http://https://ingress-url.com", }, { name: "TestDiscoverURLFromRefsWithRouteName", args: args{ clients: clients, forecastleApp: *testutil.CreateForecastleAppWithURLFromRoute("app-1", "default", "https://icon", "my-app-route"), }, want: "http://ingress-url.com", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got, err := discoverURLFromRefs(tt.args.clients, tt.args.forecastleApp); got != tt.want && err != tt.err { t.Errorf("discoverURLFromRefs() = %v, want %v, err = %v, wantErr = %v", got, tt.want, err, tt.err) } }) } clients.KubernetesClient.ExtensionsV1beta1().Ingresses("").Delete("my-app-ingress", &metav1.DeleteOptions{}) clients.RoutesClient.RouteV1().Routes("").Delete("my-app-route", &metav1.DeleteOptions{}) }
{ "pile_set_name": "Github" }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace ClearCanvas.ImageServer.Common { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] public sealed partial class ProductManifestServiceSettings : global::System.Configuration.ApplicationSettingsBase { private static ProductManifestServiceSettings defaultInstance = ((ProductManifestServiceSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new ProductManifestServiceSettings()))); public static ProductManifestServiceSettings Default { get { return defaultInstance; } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("http://localhost:9998/")] public string BaseUrl { get { return ((string)(this["BaseUrl"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] public string FailoverBaseUrl { get { return ((string)(this["FailoverBaseUrl"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("ClearCanvas.ImageServer.Common.ClientWsHttpConfiguration, ClearCanvas.ImageServer" + ".Common")] public string ConfigurationClass { get { return ((string)(this["ConfigurationClass"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2000000")] public int MaxReceivedMessageSize { get { return ((int)(this["MaxReceivedMessageSize"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("None")] public global::System.ServiceModel.Security.X509CertificateValidationMode CertificateValidationMode { get { return ((global::System.ServiceModel.Security.X509CertificateValidationMode)(this["CertificateValidationMode"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("NoCheck")] public global::System.Security.Cryptography.X509Certificates.X509RevocationMode RevocationMode { get { return ((global::System.Security.Cryptography.X509Certificates.X509RevocationMode)(this["RevocationMode"])); } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] public string UserCredentialsProviderClass { get { return ((string)(this["UserCredentialsProviderClass"])); } } } }
{ "pile_set_name": "Github" }
<?php /* * Copyright 2007-2017 Charles du Jeu - Abstrium SAS <team (at) pyd.io> * This file is part of Pydio. * * Pydio is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pydio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Pydio. If not, see <http://www.gnu.org/licenses/>. * * The latest code can be found at <https://pydio.com>. */ namespace Pydio\Access\Core\Filter; use Pydio\Access\Core\Model\AJXP_Node; use Pydio\Access\Core\Model\UserSelection; use Pydio\Core\Utils\Vars\PathUtils; defined('AJXP_EXEC') or die( 'Access not allowed'); /** * Class ContentFilter */ class ContentFilter { public $filters = array(); public $virtualPaths = array(); /** * @param AJXP_Node[] $nodes */ function __construct($nodes){ foreach($nodes as $n){ $virtualPath = $this->getVirtualPath($n->getPath()); $this->filters[$n->getPath()] = $virtualPath; } $this->virtualPaths = array_flip($this->filters); } /** * @param $path * @return string */ private function getVirtualPath($path){ return "/".substr(md5($path), 0, 10)."/".basename($path); } /** * @param UserSelection $userSelection */ function filterUserSelection( &$userSelection ){ if($userSelection->isEmpty()){ foreach($this->filters as $path => $virtual){ $userSelection->addFile($path); } }else{ $newFiles = array(); foreach($userSelection->getFiles() as $f){ if(isSet($this->virtualPaths[$f])){ $newFiles[] = $this->virtualPaths[$f]; }else{ $testB = base64_decode($f); if(isSet($this->virtualPaths[$testB])){ $newFiles[] = $this->virtualPaths[$testB]; } } } $userSelection->setFiles($newFiles); } } /** * @return mixed|string */ function getBaseDir(){ return PathUtils::forwardSlashDirname(array_keys($this->filters)[0]); } /** * Retrieves the path of the first object * @return mixed|string */ function getUniquePath(){ return PathUtils::forwardSlashBasename(array_keys($this->filters)[0]); } /** * @param AJXP_Node $node * @return String */ function externalPath(AJXP_Node $node){ return $this->getVirtualPath($node->getPath()); } /** * @param String $vPath * @return String mixed */ function filterExternalPath($vPath){ if(isSet($this->virtualPaths) && isSet($this->virtualPaths[$vPath])){ return $this->virtualPaths[$vPath]; } return $vPath; } /** * @param String $oldPath * @param String $newPath * @return bool Operation result */ public function movePath($oldPath, $newPath){ if(isSet($this->filters[$oldPath])){ $this->filters[$newPath] = $this->getVirtualPath($newPath); unset($this->filters[$oldPath]); $this->virtualPaths = array_flip($this->filters); return true; } return false; } /** * @return array public data as array, pre-utf8 encoded */ public function toArray(){ $data = array("filters" => array(), "virtualPaths" => array()); foreach($this->filters as $k => $v){ $data["filters"][$k] = $v; } foreach($this->virtualPaths as $k => $v){ $data["virtualPaths"][$k] = $v; } return $data; } /** * @param $filters */ public function fromFilterArray($filters){ $this->filters = $filters; $this->virtualPaths = array_flip($this->filters); } }
{ "pile_set_name": "Github" }
# coding=utf-8 """Python Arlo setup script.""" from setuptools import setup def readme(): with open('README.md') as desc: return desc.read() setup( name='arlo', py_modules=['arlo', 'request', 'eventstream'], version='1.2.35', description='Python Arlo is a library written in Python 2.7/3x ' + 'which exposes the Netgear Arlo cameras via the apis that are consumed by their website.', long_description=readme(), long_description_content_type='text/markdown', author='Jeffrey D. Walter', author_email='jeffreydwalter@gmail.com', url='https://github.com/jeffreydwalter/arlo', license='Apache Software License', include_package_data=True, install_requires=['monotonic', 'requests', 'sseclient==0.0.22', 'PySocks'], keywords=[ 'arlo', 'camera', 'home automation', 'netgear', 'python', ], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Other Environment', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Software Development :: Libraries :: Python Modules' ], )
{ "pile_set_name": "Github" }
// Copyright 2017 The Cockroach Authors. // // Use of this software is governed by the Business Source License // included in the file licenses/BSL.txt. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, Version 2.0, included in the file // licenses/APL.txt. package tree // Discard represents a DISCARD statement. type Discard struct { Mode DiscardMode } var _ Statement = &Discard{} // DiscardMode is an enum of the various discard modes. type DiscardMode int const ( // DiscardModeAll represents a DISCARD ALL statement. DiscardModeAll DiscardMode = iota ) // Format implements the NodeFormatter interface. func (node *Discard) Format(ctx *FmtCtx) { switch node.Mode { case DiscardModeAll: ctx.WriteString("DISCARD ALL") } } // String implements the Statement interface. func (node *Discard) String() string { return AsString(node) }
{ "pile_set_name": "Github" }
Description: Compute MD4 checksum. Files: lib/md4.h lib/md4.c m4/md4.m4 Depends-on: byteswap stdalign stdint configure.ac: AC_REQUIRE([AC_C_RESTRICT]) gl_MD4 Makefile.am: lib_SOURCES += md4.c Include: "md4.h" License: LGPLv2+ Maintainer: Simon Josefsson
{ "pile_set_name": "Github" }
import _plotly_utils.basevalidators class XaxisValidator(_plotly_utils.basevalidators.SubplotidValidator): def __init__(self, plotly_name="xaxis", parent_name="histogram2d", **kwargs): super(XaxisValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, dflt=kwargs.pop("dflt", "x"), edit_type=kwargs.pop("edit_type", "calc+clearAxisTypes"), role=kwargs.pop("role", "info"), **kwargs )
{ "pile_set_name": "Github" }
#[doc = "Reader of register CHINTENCLR"] pub type R = crate::R<u8, super::CHINTENCLR>; #[doc = "Writer for register CHINTENCLR"] pub type W = crate::W<u8, super::CHINTENCLR>; #[doc = "Register CHINTENCLR `reset()`'s with value 0"] impl crate::ResetValue for super::CHINTENCLR { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `OVR`"] pub type OVR_R = crate::R<bool, bool>; #[doc = "Write proxy for field `OVR`"] pub struct OVR_W<'a> { w: &'a mut W, } impl<'a> OVR_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u8) & 0x01); self.w } } #[doc = "Reader of field `EVD`"] pub type EVD_R = crate::R<bool, bool>; #[doc = "Write proxy for field `EVD`"] pub struct EVD_W<'a> { w: &'a mut W, } impl<'a> EVD_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u8) & 0x01) << 1); self.w } } impl R { #[doc = "Bit 0 - Channel Overrun Interrupt Disable"] #[inline(always)] pub fn ovr(&self) -> OVR_R { OVR_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Channel Event Detected Interrupt Disable"] #[inline(always)] pub fn evd(&self) -> EVD_R { EVD_R::new(((self.bits >> 1) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Channel Overrun Interrupt Disable"] #[inline(always)] pub fn ovr(&mut self) -> OVR_W { OVR_W { w: self } } #[doc = "Bit 1 - Channel Event Detected Interrupt Disable"] #[inline(always)] pub fn evd(&mut self) -> EVD_W { EVD_W { w: self } } }
{ "pile_set_name": "Github" }
export enum NotificationAnimationType { Fade = 'fade', FromTop = 'fromTop', FromRight = 'fromRight', FromBottom = 'fromBottom', FromLeft = 'fromLeft', Scale = 'scale', Rotate = 'rotate' }
{ "pile_set_name": "Github" }
/* * The Clear BSD License * Copyright (c) 2016, Freescale Semiconductor, Inc. * Copyright 2016-2017 NXP * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted (subject to the limitations in the disclaimer below) provided * that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, this * list of conditions and the following disclaimer in the documentation and/or * other materials provided with the distribution. * * o Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _PIN_MUX_H_ #define _PIN_MUX_H_ /******************************************************************************* * Definitions ******************************************************************************/ /*! @brief Direction type */ typedef enum _pin_mux_direction { kPIN_MUX_DirectionInput = 0U, /* Input direction */ kPIN_MUX_DirectionOutput = 1U, /* Output direction */ kPIN_MUX_DirectionInputOrOutput = 2U /* Input or output direction */ } pin_mux_direction_t; /*! * @addtogroup pin_mux * @{ */ /******************************************************************************* * API ******************************************************************************/ #if defined(__cplusplus) extern "C" { #endif /* FC0_RXD_SDA_MOSI (number 31), U18[4]/TO_MUX_P0_0-ISP_RX */ #define BOARD_INITPINS_DEBUG_UART_RX_PERIPHERAL FLEXCOMM0 /*!< Device name: FLEXCOMM0 */ #define BOARD_INITPINS_DEBUG_UART_RX_SIGNAL RXD_SDA_MOSI /*!< FLEXCOMM0 signal: RXD_SDA_MOSI */ #define BOARD_INITPINS_DEBUG_UART_RX_PIN_NAME FC0_RXD_SDA_MOSI /*!< Pin name */ #define BOARD_INITPINS_DEBUG_UART_RX_LABEL "U18[4]/TO_MUX_P0_0-ISP_RX" /*!< Label */ #define BOARD_INITPINS_DEBUG_UART_RX_NAME "DEBUG_UART_RX" /*!< Identifier name */ /* FC0_TXD_SCL_MISO (number 32), U6[4]/U22[3]/P0_1-ISP_TX */ #define BOARD_INITPINS_DEBUG_UART_TX_PERIPHERAL FLEXCOMM0 /*!< Device name: FLEXCOMM0 */ #define BOARD_INITPINS_DEBUG_UART_TX_SIGNAL TXD_SCL_MISO /*!< FLEXCOMM0 signal: TXD_SCL_MISO */ #define BOARD_INITPINS_DEBUG_UART_TX_PIN_NAME FC0_TXD_SCL_MISO /*!< Pin name */ #define BOARD_INITPINS_DEBUG_UART_TX_LABEL "U6[4]/U22[3]/P0_1-ISP_TX" /*!< Label */ #define BOARD_INITPINS_DEBUG_UART_TX_NAME "DEBUG_UART_TX" /*!< Identifier name */ /* SWO (number 50), J2[10]/JS30/U4[12]/TDO-SWO_TRGT-SPIFI_IO2 */ #define BOARD_INITPINS_DEBUG_SWD_SWO_PERIPHERAL SWD /*!< Device name: SWD */ #define BOARD_INITPINS_DEBUG_SWD_SWO_SIGNAL SWO /*!< SWD signal: SWO */ #define BOARD_INITPINS_DEBUG_SWD_SWO_PIN_NAME SWO /*!< Pin name */ #define BOARD_INITPINS_DEBUG_SWD_SWO_LABEL "J2[10]/JS30/U4[12]/TDO-SWO_TRGT-SPIFI_IO2" /*!< Label */ #define BOARD_INITPINS_DEBUG_SWD_SWO_NAME "DEBUG_SWD_SWO" /*!< Identifier name */ /*! * @brief Configures pin routing and optionally pin electrical features. * */ void BOARD_InitPins(void); /* Function assigned for the Cortex-M0P */ #if defined(__cplusplus) } #endif /*! * @} */ #endif /* _PIN_MUX_H_ */ /******************************************************************************* * EOF ******************************************************************************/
{ "pile_set_name": "Github" }
$TTL 1 ; KO $ORIGIN .. ; Missing label between dots
{ "pile_set_name": "Github" }
/* http://www.positioniseverything.net/easyclearing.html */ #djDebug .djdt-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } #djDebug .djdt-clearfix {display: inline-block;} /* Hides from IE-mac \*/ #djDebug .djdt-clearfix {display: block;} * html #djDebug .djdt-clearfix {height: 1%;} /* end hide from IE-mac */ /* Debug Toolbar CSS Reset, adapted from Eric Meyer's CSS Reset */ #djDebug {color:#000;background:#FFF;} #djDebug, #djDebug div, #djDebug span, #djDebug applet, #djDebug object, #djDebug iframe, #djDebug h1, #djDebug h2, #djDebug h3, #djDebug h4, #djDebug h5, #djDebug h6, #djDebug p, #djDebug blockquote, #djDebug pre, #djDebug a, #djDebug abbr, #djDebug acronym, #djDebug address, #djDebug big, #djDebug cite, #djDebug code, #djDebug del, #djDebug dfn, #djDebug em, #djDebug font, #djDebug img, #djDebug ins, #djDebug kbd, #djDebug q, #djDebug s, #djDebug samp, #djDebug small, #djDebug strike, #djDebug strong, #djDebug sub, #djDebug sup, #djDebug tt, #djDebug var, #djDebug b, #djDebug u, #djDebug i, #djDebug center, #djDebug dl, #djDebug dt, #djDebug dd, #djDebug ol, #djDebug ul, #djDebug li, #djDebug fieldset, #djDebug form, #djDebug label, #djDebug legend, #djDebug table, #djDebug caption, #djDebug tbody, #djDebug tfoot, #djDebug thead, #djDebug tr, #djDebug th, #djDebug td, #djDebug button { margin:0; padding:0; min-width:0; width:auto; border:0; outline:0; font-size:12px; line-height:1.5em; color:#000; vertical-align:baseline; background-color:transparent; font-family:sans-serif; text-align:left; text-shadow: none; white-space: normal; -webkit-transition: none; -moz-transition: none; -o-transition: none; transition: none; } #djDebug button, #djDebug a.button { background-color: #eee; background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #eee), color-stop(100%, #cccccc)); background-image: -webkit-linear-gradient(top, #eee, #cccccc); background-image: -moz-linear-gradient(top, #eee, #cccccc); background-image: -ms-linear-gradient(top, #eee, #cccccc); background-image: -o-linear-gradient(top, #eee, #cccccc); background-image: linear-gradient(top, #eee, #cccccc); border: 1px solid #ccc; border-bottom: 1px solid #bbb; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; color: #333; line-height: 1; padding: 0 8px; text-align: center; text-shadow: 0 1px 0 #eee; } #djDebug button:hover, #djDebug a.button:hover { background-color: #ddd; background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ddd), color-stop(100%, #bbb)); background-image: -webkit-linear-gradient(top, #ddd, #bbb); background-image: -moz-linear-gradient(top, #ddd, #bbb); background-image: -ms-linear-gradient(top, #ddd, #bbb); background-image: -o-linear-gradient(top, #ddd, #bbb); background-image: linear-gradient(top, #ddd, #bbb); border-color: #bbb; border-bottom-color: #999; cursor: pointer; text-shadow: 0 1px 0 #ddd; } #djDebug button:active, #djDebug a.button:active { border: 1px solid #aaa; border-bottom: 1px solid #888; -webkit-box-shadow: inset 0 0 5px 2px #aaa, 0 1px 0 0 #eee; -moz-box-shadow: inset 0 0 5px 2px #aaa, 0 1px 0 0 #eee; box-shadow: inset 0 0 5px 2px #aaa, 0 1px 0 0 #eee; } #djDebug #djDebugToolbar { background-color:#111; width:200px; z-index:100000000; position:fixed; top:0; bottom:0; right:0; opacity:0.9; overflow-y: auto; } #djDebug #djDebugToolbar small { color:#999; } #djDebug #djDebugToolbar ul { margin:0; padding:0; list-style:none; } #djDebug #djDebugToolbar li { border-bottom:1px solid #222; color:#fff; display:block; font-weight:bold; float:none; margin:0; padding:0; position:relative; width:auto; } #djDebug #djDebugToolbar input[type=checkbox] { float: right; margin: 10px; } #djDebug #djDebugToolbar li>a, #djDebug #djDebugToolbar li>div.djdt-contentless { font-weight:normal; font-style:normal; text-decoration:none; display:block; font-size:16px; padding:10px 10px 5px 25px; color:#fff; } #djDebug #djDebugToolbar li>div.djdt-disabled { font-style: italic; color: #999; } #djDebug #djDebugToolbar li a:hover { color:#111; background-color:#ffc; } #djDebug #djDebugToolbar li.djdt-active { background: #333 no-repeat left center; background-image: url(../img/indicator.png); padding-left:10px; } #djDebug #djDebugToolbar li.djdt-active a:hover { color:#b36a60; background-color:transparent; } #djDebug #djDebugToolbar li small { font-size:12px; color:#999; font-style:normal; text-decoration:none; font-variant:small-caps; } #djDebug #djDebugToolbarHandle { position:fixed; background-color:#fff; border:1px solid #111; top:30px; right:0; z-index:100000000; opacity:0.75; } #djDebug #djShowToolBarButton { display:block; height:75px; width:30px; border-right:none; border-bottom:4px solid #fff; border-top:4px solid #fff; border-left:4px solid #fff; color:#fff; font-size:10px; font-weight:bold; text-decoration:none; text-align:center; text-indent:-999999px; background: #000 no-repeat left center; background-image: url(../img/djdt_vertical
{ "pile_set_name": "Github" }
- content_for :page_title, @user.full_name .outer .container = render "/header", title: @user.full_name .charts = render @time_series.chart, time_series: @time_series .charts = render "/charts/pie_chart", title: t("charts.hours_spent_per_project"), data: EntryStats.new(@time_series.entries_for_time_span).hours_for_subject_collection(Project.all).to_json = render "/charts/pie_chart", title: t("charts.hours_spent_per_category"), data: EntryStats.new(@time_series.entries_for_time_span).hours_for_subject_collection(Category.all).to_json = link_to t("users.show.entries"), user_entries_path(@user)
{ "pile_set_name": "Github" }
package com.yarolegovich.mp.io; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.FragmentActivity; import com.kunzisoft.androidclearchroma.ChromaDialog; import com.kunzisoft.androidclearchroma.IndicatorMode; import com.kunzisoft.androidclearchroma.colormode.ColorMode; import com.kunzisoft.androidclearchroma.listener.OnColorSelectedListener; import com.yarolegovich.mp.R; import java.util.HashSet; import java.util.Set; /** * Created by yarolegovich on 06.05.2016. */ public class StandardUserInputModule implements UserInputModule { protected Context context; public StandardUserInputModule(Context context) { this.context = context; } @Override public void showEditTextInput( String key, CharSequence title, CharSequence defaultValue, final Listener<String> listener) { final View view = LayoutInflater.from(context).inflate(R.layout.dialog_edittext, null); final EditText inputField = (EditText) view.findViewById(R.id.mp_text_input); if (defaultValue != null) { inputField.setText(defaultValue); inputField.setSelection(defaultValue.length()); } final Dialog dialog = new AlertDialog.Builder(context) .setTitle(title) .setView(view) .show(); view.findViewById(R.id.mp_btn_confirm).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.onInput(inputField.getText().toString()); dialog.dismiss(); } }); } @Override public void showSingleChoiceInput( String key, CharSequence title, CharSequence[] displayItems, final CharSequence[] values, int selected, final Listener<String> listener) { new AlertDialog.Builder(context) .setTitle(title) .setSingleChoiceItems(displayItems, selected, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String selected = values[which].toString(); listener.onInput(selected); dialog.dismiss(); } }) /*.setItems(displayItems, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String selected = values[which].toString(); listener.onInput(selected); } })*/ .show(); } @Override public void showMultiChoiceInput( String key, CharSequence title, CharSequence[] displayItems, final CharSequence[] values, final boolean[] itemStates, final Listener<Set<String>> listener) { new AlertDialog.Builder(context) .setTitle(title) .setMultiChoiceItems(displayItems, itemStates, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { itemStates[which] = isChecked; } }) .setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Set<String> result = new HashSet<>(); for (int i = 0; i < values.length; i++) { if (itemStates[i]) { result.add(values[i].toString()); } } listener.onInput(result); } }) .show(); } @Override public void showColorSelectionInput( String key, CharSequence title, int defaultColor, final Listener<Integer> colorListener) { FragmentActivity activity; try { activity = (FragmentActivity) context; } catch (ClassCastException exc) { throw new AssertionError(context.getString(R.string.exc_not_frag_activity_subclass)); } final String tag = colorListener.getClass().getSimpleName(); ChromaDialog dialog = new ChromaDialog.Builder() .initialColor(defaultColor) .colorMode(ColorMode.ARGB) .indicatorMode(IndicatorMode.HEX) .create(); dialog.setOnColorSelectedListener(new OnColorSelectedListener() { @Override public void onPositiveButtonClick(int color) { colorListener.onInput(color); } @Override public void onNegativeButtonClick(int color) { } }); dialog.show(activity.getSupportFragmentManager(), tag); } }
{ "pile_set_name": "Github" }
# Copyright (c) Open Enclave SDK contributors. # Licensed under the MIT License. add_enclave_library(oehostfs STATIC hostfs.c) maybe_build_using_clangw(oehostfs) enclave_include_directories(oehostfs PRIVATE ${CMAKE_BINARY_DIR}/syscall ${PROJECT_SOURCE_DIR}/include/openenclave/corelibc) enclave_enable_code_coverage(oehostfs) enclave_link_libraries(oehostfs PRIVATE oesyscall) install_enclaves( TARGETS oehostfs EXPORT openenclave-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/openenclave/enclave)
{ "pile_set_name": "Github" }
package com.xixiciTest import com.xixici.P10 import org.scalatest.FunSuite /** * Created by xixici * Date: 2019/3/13 * Project Name: sword-offer-scala-sbt * Project URL: https://github.com/xixici/sword-offer-scala **/ class P10Test extends FunSuite { test("P10Test") { val Expected = 5 val Actual = P10.RectCover(4) assert(Expected === Actual) } }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="author" content="{{ Setting::get('author') }}"> <meta name="description" content="{{ Setting::get('desc') }}"> <meta name="keywords" content="{{ Setting::get('keywords') }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ asset('images/favicon.ico') }}"> <link rel="stylesheet" href="{{ asset(elixir('css/app.css')) }}"> </head> <body> <header> <navigation></navigation> </header> <main id="app"> <div class="container"> <router-view></router-view> </div> </main> <footer class="page-footer transparent"> <div class="footer-copyright"> <div class="container black-text text-lighten-5"> Copyright © 2015-2016 forehalo <span class="right black-text text-lighten-5" to="/">{{ Setting::get('title') }}</span> </div> </div> </footer> <script> window.Laravel = {!! json_encode([ 'csrfToken' => csrf_token(), 'config' => Setting::all(), 'currentViewType' => Request::segment(1) ?: 'default', 'isProduction' => env('APP_ENV') === 'prod' || env('APP_ENV') === 'production' ]) !!}; window.dictionary = {!! json_encode(trans('app')) !!}; </script> <script src="{{ asset(elixir('js/app.js')) }}"></script> <script> if ('serviceWorker' in navigator) { window.addEventListener('load', function() { navigator.serviceWorker .register('/service-worker.js') .then(function(reg) { reg.onupdatefound = function() { var installingWorker = reg.installing; installingWorker.onstatechange = function() { switch (installingWorker.state) { case 'installed': if (navigator.serviceWorker.controller) { console.log('New or updated content is available.'); } else { console.log('Content is now available offline!'); } break; case 'redundant': console.error('The installing service worker became redundant.'); break; } }; }; }).catch(function(e) { console.error('Error during service worker registration:', e); }); }); } </script> </body> </html>
{ "pile_set_name": "Github" }
ccc05a53f8c4a7f74b75a07b2cfba7b1
{ "pile_set_name": "Github" }
from pymesh.TestCase import TestCase from pymesh import compute_outer_hull from pymesh.meshio import form_mesh from pymesh.meshutils import generate_box_mesh from pymesh.meshutils import merge_meshes from pymesh.misc import Quaternion import numpy as np import math import unittest class OuterHullTest(TestCase): def assert_valid_attributes(self, mesh, outer_hull): self.assertTrue(outer_hull.has_attribute("flipped")) self.assertTrue(outer_hull.has_attribute("face_sources")) flipped = outer_hull.get_attribute("flipped") face_sources = outer_hull.get_attribute("face_sources") self.assertEqual(outer_hull.num_faces, len(flipped)) self.assertEqual(outer_hull.num_faces, len(face_sources)) self.assertTrue(np.all(face_sources >= 0)) self.assertTrue(np.all(face_sources < mesh.num_faces)) def test_simple_cube(self): mesh = generate_box_mesh( np.array([0, 0, 0]), np.array([1, 1, 1])) outer_hulls = compute_outer_hull(mesh, all_layers=True) self.assertEqual(1, len(outer_hulls)) outer_hull = outer_hulls[0] self.assertTrue(outer_hull.is_closed()) self.assertEqual(mesh.num_vertices, outer_hull.num_vertices) self.assertEqual(mesh.num_faces, outer_hull.num_faces) self.assert_valid_attributes(mesh, outer_hull) def test_intersecting_cubes(self): mesh_1 = generate_box_mesh( np.array([0, 0, 0]), np.array([2, 2, 2])) mesh_2 = generate_box_mesh( np.array([1, 1, 1]), np.array([3, 3, 3])) mesh = merge_meshes((mesh_1, mesh_2)) outer_hull = compute_outer_hull(mesh) self.assertTrue(outer_hull.is_closed()) self.assert_valid_attributes(mesh, outer_hull) def test_nested_cubes(self): mesh_1 = generate_box_mesh( np.array([0, 0, 0]), np.array([3, 3, 3])) mesh_2 = generate_box_mesh( np.array([1, 1, 1]), np.array([2, 2, 2])) mesh = merge_meshes((mesh_1, mesh_2)) outer_hulls = compute_outer_hull(mesh, all_layers=True) self.assertEqual(2, len(outer_hulls)) outer_hull = outer_hulls[0] interior_mesh = outer_hulls[1] self.assertTrue(outer_hull.is_closed()) self.assertEqual(1, outer_hull.num_components) self.assert_valid_attributes(mesh, outer_hull) self.assertEqual(8, interior_mesh.num_vertices) self.assert_array_equal(([1, 1, 1], [2, 2, 2]), interior_mesh.bbox) def test_multiple_components(self): mesh_1 = generate_box_mesh( np.array([0, 0, 0]), np.array([1, 1, 1])) mesh_2 = generate_box_mesh( np.array([2, 2, 2]), np.array([3, 3, 3])) mesh = merge_meshes((mesh_1, mesh_2)) outer_hulls = compute_outer_hull(mesh, all_layers=True) self.assertEqual(1, len(outer_hulls)) outer_hull = outer_hulls[0] self.assertTrue(outer_hull.is_closed()) self.assertEqual(2, outer_hull.num_components) self.assert_valid_attributes(mesh, outer_hull) def test_face_face_touch(self): mesh_1 = generate_box_mesh( np.array([0, 0, 0]), np.array([1, 1, 1])) mesh_2 = generate_box_mesh( np.array([0, 0, 1]), np.array([1, 1, 2])) mesh = merge_meshes((mesh_1, mesh_2)) outer_hulls = compute_outer_hull(mesh, all_layers=True) self.assertEqual(2, len(outer_hulls)) outer_hull = outer_hulls[0] interior_mesh = outer_hulls[1] self.assertTrue(outer_hull.is_closed()) self.assertEqual(1, outer_hull.num_components) self.assert_valid_attributes(mesh, outer_hull) self.assert_array_equal(([0, 0, 0], [1, 1, 2]), outer_hull.bbox) self.assertTrue(interior_mesh.is_closed()) self.assertEqual(1, interior_mesh.num_components) self.assert_array_equal(([0, 0, 1], [1, 1, 1]), interior_mesh.bbox)
{ "pile_set_name": "Github" }
#!/bin/bash # # This is a git extension that merges a pull request or topic branch via # rebasing so as to avoid a merge commit. # # Copyright 2015 Bazaarvoice, Inc., RetailMeNot, Inc., and git-land contributors # Licensed under Apache 2.0 # http://www.apache.org/licenses/LICENSE-2.0 project_root=`echo $(git rev-parse --show-toplevel)` # This lockfile exists primarily so that other automation, such as file change # monitoring, can react to the fact that this process is running. lockfile=$project_root/.git-land-in-progress touch $lockfile function exit_and_cleanup() { rm -f $lockfile if [[ $# == 2 ]]; then printf "$2" fi exit $1 } function usage() { echo "$1" echo "" echo "Usage: git land [options] [<remote>] <pull request number>[:<target branch>]" echo " git land [options] [<remote>] <branch>[:<target branch>]" echo "" echo " <remote>: the remote repo (default: origin)" echo " <pull request number>: a pull request to merge and close" echo " <branch>: a branch to merge and close" echo " <target branch>: the branch to merge to (default: master)" echo "" echo "Options:" echo " -f, --force-push-topic: force push <branch> to <remote> after rebasing" echo " -F, --no-force-push-topic: do not force push <branch> to <remote> after rebasing" echo "" echo "Examples:" echo " git land origin 23:master" echo " git land my-feature" echo " git land my-feature:target-branch" echo "" exit_and_cleanup 1 } # set upstream remote, defaulting to origin remote=$(git config git-land.remote) if [ -z "$remote" ]; then remote='origin' fi # set target branch, defaulting to master target_branch=$(git config git-land.target) if [ -z "$target_branch" ]; then target_branch='master' fi # are we configured to force push after rebasing? force_push_topic=$(git config --bool git-land.force-push-topic) [[ "$force_push_topic" = 'true' ]] \ && force_push_topic=true || force_push_topic=false args=() # Parse args while [[ $# > 0 ]]; do arg="$1" case $arg in -f|--force-push-topic) force_push_topic=true shift ;; -F|--no-force-push-topic) force_push_topic=false shift ;; *) args[${#args[@]}]=$arg shift ;; esac done merge_branch="" case ${#args[@]} in 0) usage "specified no args" ;; 1) merge_branch=${args[0]} ;; 2) remote=${args[0]} merge_branch=${args[1]} ;; *) usage "too many args" ;; esac # the branch specifier is source:target, but you can also just say source for short, # in which case, target defaults to "master" if [[ $merge_branch =~ ^[^:]+:[^:]+$ ]]; then branches=($(echo $arg | tr ':' '\n')) # split on ':' into an array merge_branch=${branches[0]} target_branch=${branches[1]} fi # set merge branch if merging a PR if [[ $merge_branch =~ ^[0-9]+$ ]]; then if [ "$force_push_topic" = true ]; then exit_and_cleanup 1 "Cannot force push a PR (https://help.github.com/articles/checking-out-pull-requests-locally/#tips)" fi pr=$merge_branch merge_branch="$remote/pr/$pr" fi read -r -p "Are you sure you want to merge $merge_branch into $remote/$target_branch? [Y/n] " response if [[ ! ($response = '' || $response =~ ^([yY][eE][sS]|[yY])$) ]]; then exit_and_cleanup 1 fi if [ -x "$project_root/.git/hooks/pre-land" ]; then $project_root/.git/hooks/pre-land $merge_branch $target_branch $remote || \ exit_and_cleanup $? "pre-land hook returned a non-zero error code" fi # sync local $target_branch with latest on github (git checkout $target_branch && \ git fetch $remote && \ git reset --hard $remote/$target_branch) || \ exit_and_cleanup $? "Could not sync local $target_branch with main repo" # rebase and squash (git checkout $merge_branch && \ git rebase -i $target_branch) || \ exit_and_cleanup $? "Could not checkout or rebase $merge_branch on $target_branch" # append github tag to close PR if we can and the last commit message omits it if [ -n "$pr" ]; then commit_message=$(git log -1 --pretty=%B) if [[ ! $commit_message =~ \[closes?\ \#"$pr"\] ]]; then if ! (git commit -n --amend -m "$commit_message"$'\n\n'"[close #$pr]"); then echo "Could not append commit message tag to close #$pr" fi fi fi # optionally force push source branch to origin if [ "$force_push_topic" = true ]; then git push -f $remote $merge_branch fi # merge the PR and push head=$(git rev-parse HEAD) (git checkout $target_branch && \ git merge --ff-only $head) || \ exit_and_cleanup $? "Could not fast-forward merge $merge_branch into $target_branch" git push $remote $target_branch || \ exit_and_cleanup $? "Could not push $target_branch to $remote" if [ -x "$project_root/.git/hooks/post-land" ]; then $project_root/.git/hooks/post-land $merge_branch $target_branch $remote || \ exit_and_cleanup $? "post-land hook returned a non-zero error code" fi exit_and_cleanup $?
{ "pile_set_name": "Github" }
// // KCSIBeaconTests.m // KCSIBeaconTests // // Copyright 2015 Kinvey, Inc // // 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 <XCTest/XCTest.h> #import "KCSBeaconManager.h" @interface KCSIBeaconTests : XCTestCase <KCSBeaconManagerDelegate> @property (nonatomic, strong) NSError* rangingError; @end @implementation KCSIBeaconTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { KCSBeaconManager* manager = [[KCSBeaconManager alloc] init]; manager.delegate = self; [manager startMonitoringForRegion:[[NSUUID UUID] UUIDString] identifier:@"com.kinvey.foo"]; while (1) { [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2]]; } } - (void) rangingFailedForRegion:(CLBeaconRegion *)region withError:(NSError *)error { self.rangingError = error; } @end
{ "pile_set_name": "Github" }
class PassthroughFormatter { format(value) { return value; } parse(text) { return text; } } export default PassthroughFormatter;
{ "pile_set_name": "Github" }
{ global: {}, components: { // Component-level parameters, defined initially from 'ks prototype use ...' // Each object below should correspond to a component in the components/ directory workflows: { bucket: "kubeflow-ci_temp", mode: "minikube", name: "jlewi-kubeflow-gke-deploy-test-4-3a8b", namespace: "kubeflow-test-infra", platform: "minikube", prow: "JOB_NAME=kubeflow-presubmit-test,JOB_TYPE=presubmit,PULL_NUMBER=209,REPO_NAME=kubeflow,REPO_OWNER=kubeflow,BUILD_NUMBER=997a", prow_env: "JOB_NAME=kubeflow-gke-deploy-test,JOB_TYPE=presubmit,PULL_NUMBER=4,REPO_NAME=kubeflow,REPO_OWNER=jlewi,BUILD_NUMBER=3a8b", gkeApiVersion: "", workflowName: "", }, gke_deploy: { bucket: "kubeflow-ci_temp", name: "jlewi-kubeflow-gke-deploy-test-4-3a8b", namespace: "kubeflow-test-infra", prow: "JOB_NAME=kubeflow-presubmit-test,JOB_TYPE=presubmit,PULL_NUMBER=209,REPO_NAME=kubeflow,REPO_OWNER=kubeflow,BUILD_NUMBER=997a", prow_env: "JOB_NAME=kubeflow-gke-deploy-test,JOB_TYPE=presubmit,PULL_NUMBER=4,REPO_NAME=kubeflow,REPO_OWNER=jlewi,BUILD_NUMBER=3a8b", gkeApiVersion: "", }, kfctl_test: { bucket: "kubeflow-ci_temp", name: "somefakename", namespace: "kubeflow-test-infra", prow_env: "", deleteKubeflow: true, gkeApiVersion: "v1", workflowName: "kfctl", }, kfctl_go_test: { bucket: "kubeflow-ci_temp", name: "somefakename", namespace: "kubeflow-test-infra", prow_env: "", deleteKubeflow: true, gkeApiVersion: "v1", workflowName: "kfctl-go", useBasicAuth: "false", useIstio: "true", testEndpoint: "false", configPath: "bootstrap/config/kfctl_gcp_iap_master.yaml", }, click_deploy_test: { bucket: "kubeflow-ci_temp", name: "somefakename", namespace: "kubeflow-test-infra", prow_env: "REPO_NAME=kubeflow,REPO_OWNER=kubeflow", gkeApiVersion: "v1", installIstio: false, workflowName: "deployapp", }, unit_tests: { bucket: "kubeflow-ci_temp", name: "somefakename", namespace: "kubeflow-test-infra", prow_env: "", gkeApiVersion: "", workflowName: "unittest", }, tfserving: { commit: "master", name: "somefakename", namespace: "kubeflow-test-infra", prow_env: "REPO_OWNER=kubeflow,REPO_NAME=kubeflow,PULL_BASE_SHA=master", gkeApiVersion: "", workflowName: "tfserving", }, }, }
{ "pile_set_name": "Github" }
# 如何查看一个文件的 inode number ::: tip Issue 欢迎在 Issue 中交流与讨论: [Issue 115](https://github.com/shfshanyue/Daily-Question/issues/115) ::: ::: tip Author 回答者: [shfshanyue](https://github.com/shfshanyue) ::: 可以使用 `ls` 或者 `stat` ``` bash $ stat hello.txt File: ‘hello.txt’ Size: 30 Blocks: 8 IO Block: 4096 regular file Device: fd01h/64769d Inode: 917526 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2019-12-10 16:15:55.253325208 +0800 Modify: 2019-12-10 16:15:52.740653330 +0800 Change: 2019-12-10 16:15:52.742653069 +0800 $ ls -i hello.txt 917526 hello.txt ```
{ "pile_set_name": "Github" }
/* Author: aeroson Description: Sets the text on the dialog Parameters: None Returns: Nothing */ #define AGM_CrewInfo_TextIDC 11123 private["_text", "_ctrl"]; disableSerialization; _text = _this select 0; _ctrl = (uiNamespace getVariable "AGM_CrewInfo_dialog") displayCtrl AGM_CrewInfo_TextIDC; _ctrl ctrlSetStructuredText parseText _text; _ctrl ctrlCommit 0;
{ "pile_set_name": "Github" }
{% if scid %} SELECT cl.oid as oid, relname as name, nsp.nspname as schema, pg_get_userbyid(relowner) AS seqowner, description as comment, array_to_string(relacl::text[], ', ') as acl, (SELECT array_agg(provider || '=' || label) FROM pg_seclabels sl1 WHERE sl1.objoid=cl.oid) AS securities FROM pg_class cl LEFT OUTER JOIN pg_namespace nsp ON cl.relnamespace = nsp.oid LEFT OUTER JOIN pg_description des ON (des.objoid=cl.oid AND des.classoid='pg_class'::regclass) WHERE relkind = 'S' AND relnamespace = {{scid}}::oid {% if seid %}AND cl.oid = {{seid}}::oid {% endif %} ORDER BY relname {% endif %}
{ "pile_set_name": "Github" }
package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", ) go_library( name = "go_default_library", srcs = [ "controllerrevision.go", "deployment.go", "expansion_generated.go", "scale.go", "statefulset.go", "statefulset_expansion.go", ], importpath = "k8s.io/client-go/listers/apps/v1beta1", deps = [ "//vendor/k8s.io/api/apps/v1beta1:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", "//vendor/k8s.io/client-go/tools/cache:go_default_library", ], ) filegroup( name = "package-srcs", srcs = glob(["**"]), tags = ["automanaged"], visibility = ["//visibility:private"], ) filegroup( name = "all-srcs", srcs = [":package-srcs"], tags = ["automanaged"], )
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <configuration status="OFF"> <appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d [%t] %-5p %M(%F:%L) - %m%n"/> </Console> </appenders> <loggers> <root level="info"> <appender-ref ref="Console"/> <appender-ref ref="Console" level="error"/> </root> </loggers> </configuration>
{ "pile_set_name": "Github" }
/* (C) COPYRIGHT 1994-2002 Xiph.Org Foundation */ /* Modified by Jean-Marc Valin */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* opus_types.h based on ogg_types.h from libogg */ /** @file opus_types.h @brief Opus reference implementation types */ #ifndef OPUS_TYPES_H #define OPUS_TYPES_H /* Use the real stdint.h if it's there (taken from Paul Hsieh's pstdint.h) */ #if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) || defined (HAVE_STDINT_H)) #include <stdint.h> typedef int16_t opus_int16; typedef uint16_t opus_uint16; typedef int32_t opus_int32; typedef uint32_t opus_uint32; #elif defined(_WIN32) # if defined(__CYGWIN__) # include <_G_config.h> typedef _G_int32_t opus_int32; typedef _G_uint32_t opus_uint32; typedef _G_int16 opus_int16; typedef _G_uint16 opus_uint16; # elif defined(__MINGW32__) typedef short opus_int16; typedef unsigned short opus_uint16; typedef int opus_int32; typedef unsigned int opus_uint32; # elif defined(__MWERKS__) typedef int opus_int32; typedef unsigned int opus_uint32; typedef short opus_int16; typedef unsigned short opus_uint16; # else /* MSVC/Borland */ typedef __int32 opus_int32; typedef unsigned __int32 opus_uint32; typedef __int16 opus_int16; typedef unsigned __int16 opus_uint16; # endif #elif defined(__MACOS__) # include <sys/types.h> typedef SInt16 opus_int16; typedef UInt16 opus_uint16; typedef SInt32 opus_int32; typedef UInt32 opus_uint32; #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ # include <sys/types.h> typedef int16_t opus_int16; typedef u_int16_t opus_uint16; typedef int32_t opus_int32; typedef u_int32_t opus_uint32; #elif defined(__BEOS__) /* Be */ # include <inttypes.h> typedef int16 opus_int16; typedef u_int16 opus_uint16; typedef int32_t opus_int32; typedef u_int32_t opus_uint32; #elif defined (__EMX__) /* OS/2 GCC */ typedef short opus_int16; typedef unsigned short opus_uint16; typedef int opus_int32; typedef unsigned int opus_uint32; #elif defined (DJGPP) /* DJGPP */ typedef short opus_int16; typedef unsigned short opus_uint16; typedef int opus_int32; typedef unsigned int opus_uint32; #elif defined(R5900) /* PS2 EE */ typedef int opus_int32; typedef unsigned opus_uint32; typedef short opus_int16; typedef unsigned short opus_uint16; #elif defined(__SYMBIAN32__) /* Symbian GCC */ typedef signed short opus_int16; typedef unsigned short opus_uint16; typedef signed int opus_int32; typedef unsigned int opus_uint32; #elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) typedef short opus_int16; typedef unsigned short opus_uint16; typedef long opus_int32; typedef unsigned long opus_uint32; #elif defined(CONFIG_TI_C6X) typedef short opus_int16; typedef unsigned short opus_uint16; typedef int opus_int32; typedef unsigned int opus_uint32; #else /* Give up, take a reasonable guess */ typedef short opus_int16; typedef unsigned short opus_uint16; typedef int opus_int32; typedef unsigned int opus_uint32; #endif #define opus_int int /* used for counters etc; at least 16 bits */ #define opus_int64 long long #define opus_int8 signed char #define opus_uint unsigned int /* used for counters etc; at least 16 bits */ #define opus_uint64 unsigned long long #define opus_uint8 unsigned char #endif /* OPUS_TYPES_H */
{ "pile_set_name": "Github" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace RssDataSerices { class RssDataScheduler { public string PostRssFeed(string ProfileType) { string str = ""; try { Api.RssFeeds.RssFeeds objRssFeed = new Api.RssFeeds.RssFeeds(); str = objRssFeed.PostRssfeed(ProfileType); } catch (Exception ex) { str = ex.Message; } return str; } } }
{ "pile_set_name": "Github" }
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package rangetable provides utilities for creating and inspecting // unicode.RangeTables. package rangetable import ( "sort" "unicode" ) // New creates a RangeTable from the given runes, which may contain duplicates. func New(r ...rune) *unicode.RangeTable { if len(r) == 0 { return &unicode.RangeTable{} } sort.Sort(byRune(r)) // Remove duplicates. k := 1 for i := 1; i < len(r); i++ { if r[k-1] != r[i] { r[k] = r[i] k++ } } var rt unicode.RangeTable for _, r := range r[:k] { if r <= 0xFFFF { rt.R16 = append(rt.R16, unicode.Range16{Lo: uint16(r), Hi: uint16(r), Stride: 1}) } else { rt.R32 = append(rt.R32, unicode.Range32{Lo: uint32(r), Hi: uint32(r), Stride: 1}) } } // Optimize RangeTable. return Merge(&rt) } type byRune []rune func (r byRune) Len() int { return len(r) } func (r byRune) Swap(i, j int) { r[i], r[j] = r[j], r[i] } func (r byRune) Less(i, j int) bool { return r[i] < r[j] } // Visit visits all runes in the given RangeTable in order, calling fn for each. func Visit(rt *unicode.RangeTable, fn func(rune)) { for _, r16 := range rt.R16 { for r := rune(r16.Lo); r <= rune(r16.Hi); r += rune(r16.Stride) { fn(r) } } for _, r32 := range rt.R32 { for r := rune(r32.Lo); r <= rune(r32.Hi); r += rune(r32.Stride) { fn(r) } } } // Assigned returns a RangeTable with all assigned code points for a given // Unicode version. This includes graphic, format, control, and private-use // characters. It returns nil if the data for the given version is not // available. func Assigned(version string) *unicode.RangeTable { return assigned[version] }
{ "pile_set_name": "Github" }
/* Whole cell */ div.container.cell { padding-left: 0; margin-bottom: 1em; } /* Removing all background formatting so we can control at the div level */ .cell_input div.highlight, .cell_input pre, .cell_output .output * { border: none; background: none; background-color: transparent; box-shadow: none; } .cell_output .output pre, .cell_input pre { margin: 0px; } /* Input cells */ div.cell div.cell_input { padding-left: 0em; padding-right: 0em; border: 1px #ccc solid; background-color: #f7f7f7; border-left-color: green; border-left-width: medium; } div.cell_input > div, div.cell_output div.output > div.highlight { margin: 0em !important; border: none !important; } /* All cell outputs */ .cell_output { padding-left: 1em; padding-right: 0em; margin-top: 1em; } /* Outputs from jupyter_sphinx overrides to remove extra CSS */ div.section div.jupyter_container { padding: .4em; margin: 0 0 .4em 0; background-color: none; border: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } /* Text outputs from cells */ .cell_output .output.text_plain, .cell_output .output.traceback, .cell_output .output.stream { background: #fcfcfc; margin-top: 1em; margin-bottom: 0em; box-shadow: none; } .cell_output .output.text_plain, .cell_output .output.stream { border: 1px solid #f7f7f7; } .cell_output .output.traceback { border: 1px solid #ffd6d6; } /* Math align to the left */ .cell_output .MathJax_Display { text-align: left !important; } /* Pandas tables. Pulled from the Jupyter / nbsphinx CSS */ div.cell_output table { border: none; border-collapse: collapse; border-spacing: 0; color: black; font-size: 1em; table-layout: fixed; } div.cell_output thead { border-bottom: 1px solid black; vertical-align: bottom; } div.cell_output tr, div.cell_output th, div.cell_output td { text-align: right; vertical-align: middle; padding: 0.5em 0.5em; line-height: normal; white-space: normal; max-width: none; border: none; } div.cell_output th { font-weight: bold; } div.cell_output tbody tr:nth-child(odd) { background: #f5f5f5; } div.cell_output tbody tr:hover { background: rgba(66, 165, 245, 0.2); } /* Inline text from `paste` operation */ span.pasted-text { font-weight: bold; } span.pasted-inline img { max-height: 2em; } tbody span.pasted-inline img { max-height: none; }
{ "pile_set_name": "Github" }
package org.nextrtc.signalingserver.api.dto; import org.nextrtc.signalingserver.api.NextRTCEvents; import org.nextrtc.signalingserver.exception.SignalingException; import java.time.ZonedDateTime; import java.util.Map; import java.util.Optional; public interface NextRTCEvent { NextRTCEvents type(); ZonedDateTime published(); Optional<NextRTCMember> from(); Optional<NextRTCMember> to(); Optional<NextRTCConversation> conversation(); Optional<SignalingException> exception(); Map<String, String> custom(); String content(); }
{ "pile_set_name": "Github" }
OPTION DOTNAME .text$ SEGMENT ALIGN(256) 'CODE' EXTERN OPENSSL_ia32cap_P:NEAR PUBLIC aesni_multi_cbc_encrypt ALIGN 32 aesni_multi_cbc_encrypt PROC PUBLIC mov QWORD PTR[8+rsp],rdi ;WIN64 prologue mov QWORD PTR[16+rsp],rsi mov rax,rsp $L$SEH_begin_aesni_multi_cbc_encrypt:: mov rdi,rcx mov rsi,rdx mov rdx,r8 mov rax,rsp push rbx push rbp push r12 push r13 push r14 push r15 lea rsp,QWORD PTR[((-168))+rsp] movaps XMMWORD PTR[rsp],xmm6 movaps XMMWORD PTR[16+rsp],xmm7 movaps XMMWORD PTR[32+rsp],xmm8 movaps XMMWORD PTR[48+rsp],xmm9 movaps XMMWORD PTR[64+rsp],xmm10 movaps XMMWORD PTR[80+rsp],xmm11 movaps XMMWORD PTR[96+rsp],xmm12 movaps XMMWORD PTR[(-104)+rax],xmm13 movaps XMMWORD PTR[(-88)+rax],xmm14 movaps XMMWORD PTR[(-72)+rax],xmm15 sub rsp,48 and rsp,-64 mov QWORD PTR[16+rsp],rax $L$enc4x_body:: movdqu xmm12,XMMWORD PTR[rsi] lea rsi,QWORD PTR[120+rsi] lea rdi,QWORD PTR[80+rdi] $L$enc4x_loop_grande:: mov DWORD PTR[24+rsp],edx xor edx,edx mov ecx,DWORD PTR[((-64))+rdi] mov r8,QWORD PTR[((-80))+rdi] cmp ecx,edx mov r12,QWORD PTR[((-72))+rdi] cmovg edx,ecx test ecx,ecx movdqu xmm2,XMMWORD PTR[((-56))+rdi] mov DWORD PTR[32+rsp],ecx cmovle r8,rsp mov ecx,DWORD PTR[((-24))+rdi] mov r9,QWORD PTR[((-40))+rdi] cmp ecx,edx mov r13,QWORD PTR[((-32))+rdi] cmovg edx,ecx test ecx,ecx movdqu xmm3,XMMWORD PTR[((-16))+rdi] mov DWORD PTR[36+rsp],ecx cmovle r9,rsp mov ecx,DWORD PTR[16+rdi] mov r10,QWORD PTR[rdi] cmp ecx,edx mov r14,QWORD PTR[8+rdi] cmovg edx,ecx test ecx,ecx movdqu xmm4,XMMWORD PTR[24+rdi] mov DWORD PTR[40+rsp],ecx cmovle r10,rsp mov ecx,DWORD PTR[56+rdi] mov r11,QWORD PTR[40+rdi] cmp ecx,edx mov r15,QWORD PTR[48+rdi] cmovg edx,ecx test ecx,ecx movdqu xmm5,XMMWORD PTR[64+rdi] mov DWORD PTR[44+rsp],ecx cmovle r11,rsp test edx,edx jz $L$enc4x_done movups xmm1,XMMWORD PTR[((16-120))+rsi] pxor xmm2,xmm12 movups xmm0,XMMWORD PTR[((32-120))+rsi] pxor xmm3,xmm12 mov eax,DWORD PTR[((240-120))+rsi] pxor xmm4,xmm12 movdqu xmm6,XMMWORD PTR[r8] pxor xmm5,xmm12 movdqu xmm7,XMMWORD PTR[r9] pxor xmm2,xmm6 movdqu xmm8,XMMWORD PTR[r10] pxor xmm3,xmm7 movdqu xmm9,XMMWORD PTR[r11] pxor xmm4,xmm8 pxor xmm5,xmm9 movdqa xmm10,XMMWORD PTR[32+rsp] xor rbx,rbx jmp $L$oop_enc4x ALIGN 32 $L$oop_enc4x:: add rbx,16 lea rbp,QWORD PTR[16+rsp] mov ecx,1 sub rbp,rbx DB 102,15,56,220,209 prefetcht0 [31+rbx*1+r8] prefetcht0 [31+rbx*1+r9] DB 102,15,56,220,217 prefetcht0 [31+rbx*1+r10] prefetcht0 [31+rbx*1+r10] DB 102,15,56,220,225 DB 102,15,56,220,233 movups xmm1,XMMWORD PTR[((48-120))+rsi] cmp ecx,DWORD PTR[32+rsp] DB 102,15,56,220,208 DB 102,15,56,220,216 DB 102,15,56,220,224 cmovge r8,rbp cmovg r12,rbp DB 102,15,56,220,232 movups xmm0,XMMWORD PTR[((-56))+rsi] cmp ecx,DWORD PTR[36+rsp] DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 cmovge r9,rbp cmovg r13,rbp DB 102,15,56,220,233 movups xmm1,XMMWORD PTR[((-40))+rsi] cmp ecx,DWORD PTR[40+rsp] DB 102,15,56,220,208 DB 102,15,56,220,216 DB 102,15,56,220,224 cmovge r10,rbp cmovg r14,rbp DB 102,15,56,220,232 movups xmm0,XMMWORD PTR[((-24))+rsi] cmp ecx,DWORD PTR[44+rsp] DB 102,15,56,220,209 DB 102,15,56,220,217 DB 102,15,56,220,225 cmovge r11,rbp cmovg r15,rbp DB 102,15,56,220,233 movups xmm1,XMMWORD PTR[((-8))+rsi] movdqa xmm11,xmm10 DB 102,15,56,220,208 prefetcht0 [15+rbx*1+r12] prefetcht0 [15+rbx*1+r13] DB 102,15
{ "pile_set_name": "Github" }
visiting accept: aVisitor aVisitor visitTask: self
{ "pile_set_name": "Github" }
<?php /** * This file is part of the Nette Framework (https://nette.org) * Copyright (c) 2004 David Grudl (https://davidgrudl.com) */ declare(strict_types=1); namespace Nette; if (false) { /** @deprecated use Nette\Bootstrap\Configurator */ class Configurator { } } elseif (!class_exists(Configurator::class)) { class_alias(Bootstrap\Configurator::class, Configurator::class); }
{ "pile_set_name": "Github" }
/****************************************************************************** * most_balanced_minimum_cuts.h * * * Source of KaHIP -- Karlsruhe High Quality Partitioning. * Christian Schulz <christian.schulz.phone@gmail.com> *****************************************************************************/ #ifndef MOST_BALANCED_MINIMUM_CUTS_SBD5CS #define MOST_BALANCED_MINIMUM_CUTS_SBD5CS #include "data_structure/graph_access.h" #include "partition_config.h" class most_balanced_minimum_cuts { public: most_balanced_minimum_cuts(); virtual ~most_balanced_minimum_cuts(); void compute_good_balanced_min_cut( graph_access & residualGraph, const PartitionConfig & config, NodeWeight & perfect_rhs_weight, std::vector< NodeID > & new_rhs_node ); private: void build_internal_scc_graph( graph_access & residualGraph, std::vector<int> & components, int comp_count, graph_access & scc_graph); void compute_new_rhs( graph_access & scc_graph, const PartitionConfig & config, std::vector< NodeWeight > & comp_weights, int comp_of_s, int comp_of_t, NodeWeight optimal_rhs_weight, std::vector<int> & comp_for_rhs); }; #endif /* end of include guard: MOST_BALANCED_MINIMUM_CUTS_SBD5CS */
{ "pile_set_name": "Github" }
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Crashlytics FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Crashlytics/iOS" "${PODS_ROOT}/Fabric/iOS" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 OTHER_LDFLAGS = $(inherited) -l"c++" -l"z" -framework "Security" -framework "SystemConfiguration" -framework "UIKit" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT} PODS_TARGET_SRCROOT = ${PODS_ROOT}/Crashlytics PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} SKIP_INSTALL = YES USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="@color/b4" android:state_checked="false" android:state_focused="false" android:state_pressed="false" /> <item android:color="@color/c1" android:state_checked="true" android:state_focused="false" android:state_pressed="false" /> <item android:color="@color/c1" android:state_checked="false" android:state_focused="true" android:state_pressed="false" /> <item android:color="@color/b4" android:state_checked="true" android:state_focused="true" android:state_pressed="false" /> </selector>
{ "pile_set_name": "Github" }
/// Copyright (c) 2012 Ecma International. All rights reserved. /** * @path ch15/15.4/15.4.4/15.4.4.19/15.4.4.19-1-10.js * @description Array.prototype.map - applied to the Math object */ function testcase() { function callbackfn(val, idx, obj) { return ('[object Math]' === Object.prototype.toString.call(obj)); } try { Math.length = 1; Math[0] = 1; var testResult = Array.prototype.map.call(Math, callbackfn); return testResult[0] === true; } finally { delete Math[0]; delete Math.length; } } runTestCase(testcase);
{ "pile_set_name": "Github" }
// // MMTrainWorkModel.m // MicroMannage // // Created by 倪望龙 on 2017/3/17. // Copyright © 2017年 xunyijia. All rights reserved. // #import "MMTrainWorkModel.h" @implementation MMTrainWorkModel @end
{ "pile_set_name": "Github" }
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # # http://www.apache.org/licenses/LICENSE-2.0 # # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from aliyunsdkcore.request import RpcRequest from aliyunsdkdrds.endpoint import endpoint_data class DescribeDrdsComponentsRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'Drds', '2019-01-23', 'DescribeDrdsComponents','Drds') self.set_method('POST') if hasattr(self, "endpoint_map"): setattr(self, "endpoint_map", endpoint_data.getEndpointMap()) if hasattr(self, "endpoint_regional"): setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional()) def get_CommodityCode(self): return self.get_query_params().get('CommodityCode') def set_CommodityCode(self,CommodityCode): self.add_query_param('CommodityCode',CommodityCode)
{ "pile_set_name": "Github" }
function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } var csrftoken = getCookie('csrftoken'); function upload(event) { event.preventDefault(); var data = new FormData(this); $("#importbutton").button("loading") $.ajax({ url: $(this).attr('action'), type: $(this).attr('method'), data: data, cache: false, processData: false, contentType: false, success: function(data, status) { if (data == "Ok"){ $('.modal').modal('hide'); $(".dynamic").load($(".dynamic").data("form")); $(".selected").load($(".selected").data("form")); $("#importbutton").button("complete") } else { $('.modal').empty(); $('.modal').append(data); $(".modal").modal('show'); } } }); return false; } function csrfSafeMethod(method) { return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); } $.ajaxSetup({ beforeSend: function(xhr, settings) { if (!csrfSafeMethod(settings.type) && !this.crossDomain) { xhr.setRequestHeader("X-CSRFToken", csrftoken); } } }); function popupwindow(url, title, w, h) { w = typeof w !== 'undefined' ? w : 800; h = typeof h !== 'undefined' ? h : 400; var left = 200; var top = -100; return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); } function PopupCenter(url, title, w, h) { var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; var left = ((width / 2) - (w / 2)) + dualScreenLeft; var top = ((height / 2) - (h / 2)) + dualScreenTop; var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); if (window.focus) { newWindow.focus(); } } $(function() { $('[data-toggle="tooltip"]').tooltip(); $('body').tooltip({ selector: '[data-toggle="tooltip"]' }); $(".dynamic").on("click", ".download", function(ev) { ev.preventDefault(); var url = $(this).data("form"); window.location.href = url; return false; }); $(".dynamic").on("click", ".silent", function(ev) { ev.preventDefault(); var url = $(this).data("form"); $.get(url) $(".dynamic").empty(); $(".dynamic").load($(".dynamic").data("form")); $(".selected").load($(".selected").data("form")); return false; }); $(".dynamic").on("click", ".paging", function(ev) { ev.preventDefault(); var url = $(this).data("form"); $(".dynamic").empty(); $(".dynamic").load(url); return false; }); $(".modal").on("click", ".paging", function(ev) { ev.preventDefault(); var url = $(this).data("form"); $(".modal").load(url); return false; }); $(".dynamic").on("click", ".edit", function(ev) { ev.preventDefault(); var url = $(this).data("form"); $(".modal").load(url, function() { $(this).modal('show'); }); return false; }); $(".dynamic").on("click", ".popup", function(ev) { ev.preventDefault(); var url = $(this).data("form"); PopupCenter(url, "preview", 800, 600); return false; }); $(".modal").on("click", ".edit", function(ev) { ev.preventDefault(); var url = $(this).data("form"); $(".modal").empty(); $(".modal").load(url, function() { $(this).modal('show'); }); return false; }); $(".selected").on("click", ".add", function(ev) { ev.preventDefault(); var url = $(this).data("form"); $(".modal").load(url, function() { $(this).modal('show'); }); return false; }); $(".selected").on("click", ".edit", function(ev) { ev.preventDefault(); var url = $(this).data("form"); $(".modal").load(url, function() { $(this).modal('show'); }); return false; }); $(".new").click(function(ev) { ev.preventDefault(); var url = $(this).data("form"); $(".modal").load(url, function() { $(this).modal('show'); }); return false; }); $(".new-selected").click(function(ev) { ev.preventDefault(); var url = $("#button-url").find(":selected").val(); $(".modal").load(url, function() { $(this).modal('show'); }); return false; }); $('.modal').on('hidden.bs.modal', function () { $(this).empty(); }) $(".dynamic").load($(".dynamic").data("form")); var delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); $(".filter-input").on("keyup", function(ev) { delay(function(){ if ($(".filter-input").val() != ""){ $(".dynamic").load($(".dynamic").data("form") + '/' + $(".filter-input").val()); } else { $(".dynamic").load($(".dynamic").data("form")); } }, 200); }) $('.modal').on("submit", ".modal-form", function() { $.ajax({ type: this.method, url: this.action, data: $(this).serialize(), context: this, success: function(data, status) { if (data == "Ok"){ $('.modal').modal('hide'); $(".dynamic").load($(".dynamic").data("form")); $(".selected").load($(".selected").data("form")); } else { $('.modal').empty(); $('.modal').append(data); $(".modal").modal('show'); } } }); return false; }); $('.modal').on("click", ".refresh", function() { $('.modal').load($(".refresh").data("url")); return false; }); $('.modal').on("click", ".browse", function(){ $('input[id=
{ "pile_set_name": "Github" }
#ifndef BOOST_BIND_STORAGE_HPP_INCLUDED #define BOOST_BIND_STORAGE_HPP_INCLUDED // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif // // bind/storage.hpp // // boost/bind.hpp support header, optimized storage // // Copyright (c) 2006 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt // // See http://www.boost.org/libs/bind/bind.html for documentation. // #include <boost/config.hpp> #include <boost/bind/arg.hpp> #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4512) // assignment operator could not be generated #endif namespace boost { namespace _bi { // 1 template<class A1> struct storage1 { explicit storage1( A1 a1 ): a1_( a1 ) {} template<class V> void accept(V & v) const { BOOST_BIND_VISIT_EACH(v, a1_, 0); } A1 a1_; }; #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( __BORLANDC__ ) template<int I> struct storage1< boost::arg<I> > { explicit storage1( boost::arg<I> ) {} template<class V> void accept(V &) const { } static boost::arg<I> a1_() { return boost::arg<I>(); } }; template<int I> struct storage1< boost::arg<I> (*) () > { explicit storage1( boost::arg<I> (*) () ) {} template<class V> void accept(V &) const { } static boost::arg<I> a1_() { return boost::arg<I>(); } }; #endif // 2 template<class A1, class A2> struct storage2: public storage1<A1> { typedef storage1<A1> inherited; storage2( A1 a1, A2 a2 ): storage1<A1>( a1 ), a2_( a2 ) {} template<class V> void accept(V & v) const { inherited::accept(v); BOOST_BIND_VISIT_EACH(v, a2_, 0); } A2 a2_; }; #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) template<class A1, int I> struct storage2< A1, boost::arg<I> >: public storage1<A1> { typedef storage1<A1> inherited; storage2( A1 a1, boost::arg<I> ): storage1<A1>( a1 ) {} template<class V> void accept(V & v) const { inherited::accept(v); } static boost::arg<I> a2_() { return boost::arg<I>(); } }; template<class A1, int I> struct storage2< A1, boost::arg<I> (*) () >: public storage1<A1> { typedef storage1<A1> inherited; storage2( A1 a1, boost::arg<I> (*) () ): storage1<A1>( a1 ) {} template<class V> void accept(V & v) const { inherited::accept(v); } static boost::arg<I> a2_() { return boost::arg<I>(); } }; #endif // 3 template<class A1, class A2, class A3> struct storage3: public storage2< A1, A2 > { typedef storage2<A1, A2> inherited; storage3( A1 a1, A2 a2, A3 a3 ): storage2<A1, A2>( a1, a2 ), a3_( a3 ) {} template<class V> void accept(V & v) const { inherited::accept(v); BOOST_BIND_VISIT_EACH(v, a3_, 0); } A3 a3_; }; #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) template<class A1, class A2, int I> struct storage3< A1, A2, boost::arg<I> >: public storage2< A1, A2 > { typedef storage2<A1, A2> inherited; storage3( A1 a1, A2 a2, boost::arg<I> ): storage2<A1, A2>( a1, a2 ) {} template<class V> void accept(V & v) const { inherited::accept(v); } static boost::arg<I> a3_() { return boost::arg<I>(); } }; template<class A1, class A2, int I> struct storage3< A1, A2, boost::arg<I> (*) () >: public storage2< A1, A2 > { typedef storage2<A1, A2> inherited; storage3( A1 a1, A2 a2, boost::arg<I> (*) () ): storage2<A1, A2>( a1, a2 ) {} template<class V> void accept(V & v) const { inherited::accept(v); } static boost::arg<I> a3_() { return boost::arg<I>(); } }; #endif // 4 template<class A1, class A2, class A3, class A4> struct storage4: public storage3< A1, A2, A3 > { typedef storage3<A1, A2, A3> inherited; storage4( A1 a1, A2 a2, A3 a3, A4 a4 ): storage3<A1, A2, A3>( a1, a2, a3 ), a4_( a4 ) {} template<class V> void accept(V & v) const { inherited::accept(v); BOOST_BIND_VISIT_EACH(v, a4_, 0); } A4 a4_; }; #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) template<class A1, class A2, class A3, int I> struct storage4< A1, A2, A3, boost::arg<I> >: public storage3< A1, A2, A3 > { typedef storage3<A1, A2, A3> inherited; storage4( A1 a1, A2 a2, A3 a3, boost::arg<I> ): storage3<A1, A2, A3>( a1, a2, a3 ) {} template<class V> void accept(V & v) const { inherited::accept(v); } static boost::arg<I> a4_() { return boost::arg<I>(); } }; template<class A1, class A2, class A3, int I> struct storage4< A1, A2, A3, boost::arg<I> (*) () >: public storage3< A1, A2, A3 > { typedef storage3<A1, A2, A3> inherited; storage4( A1 a1, A2 a2, A3 a3, boost::arg<I> (*) () ): storage3<A1, A2, A3>( a1, a2, a3 ) {} template<class V> void accept(V & v) const { inherited::accept(v); } static boost::arg<I> a4_() { return boost::arg<I>(); } }; #endif // 5 template<class A1, class A2, class A3, class A4, class A5> struct storage5: public storage4< A1, A2, A3, A4 >
{ "pile_set_name": "Github" }
/* * Copyright (c) 2010-2011, NVIDIA Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of NVIDIA Corporation nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <cugar/basic/cuda/arch.h> #include <cugar/basic/cuda/pointers.h> #include <cugar/basic/functors.h> #include <cugar/basic/algorithms.h> #include <cugar/basic/cuda/scan.h> #include <cugar/basic/utils.h> namespace cugar { namespace cuda { namespace bintree { typedef Radixtree_context::Split_task Split_task; // find the most significant bit smaller than start by which code0 and code1 differ template <typename Integer> CUGAR_FORCEINLINE CUGAR_HOST_DEVICE int32 find_leading_bit_difference( const int32 start_level, const Integer code0, const Integer code1) { int32 level = start_level; while (level >= 0) { const Integer mask = Integer(1u) << level; if ((code0 & mask) != (code1 & mask)) break; --level; } return level; } #define RADIX_TREE_USE_VOLATILE 1 #define RADIX_TREE_USE_FENCE 1 #define RADIX_TREE_USE_ATOMIC_RELEASE 1 #if defined(RADIX_TREE_USE_VOLATILE) #define RADIX_TREE_UNCACHED_LOAD(x) load<LOAD_VOLATILE>(x) #define RADIX_TREE_UNCACHED_STORE(x,v) store<STORE_VOLATILE>(x,v) #else #define RADIX_TREE_UNCACHED_LOAD(x) load<LOAD_CG>(x) #define RADIX_TREE_UNCACHED_STORE(x,v) store<STORE_CG>(x,v) #endif #if defined(RADIX_TREE_USE_FENCE) #define RADIX_TREE_RELEASE_FENCE() __threadfence() #else #define RADIX_TREE_RELEASE_FENCE() #endif #if defined(RADIX_TREE_USE_ATOMIC_RELEASE) #define RADIX_TREE_RELEASE(x,v) atomicExch(x,v) #else #define RADIX_TREE_RELEASE(x,v) RADIX_TREE_UNCACHED_STORE(x,v) #endif // do a single kd-split for all nodes in the input task queue, and generate // a corresponding list of output tasks template <uint32 BLOCK_SIZE, typename Tree, typename Integer> __global__ void split_kernel( const uint32 grid_size, Tree tree, const uint32 max_leaf_size, const uint32 n_nodes, const uint32 n_codes, const Integer* codes, int32* flags, Split_task* tasks, uint32* skip_nodes, uint32* out_node_count, uint32* out_leaf_count, uint32* work_counter) { const uint32 LOG_WARP_SIZE = 5; const uint32 WARP_SIZE = 1u << LOG_WARP_SIZE; volatile __shared__ uint32 warp_offset[ BLOCK_SIZE >> LOG_WARP_SIZE ]; const uint32 warp_tid = threadIdx.x & (WARP_SIZE-1); const uint32 warp_id = threadIdx.x >> LOG_WARP_SIZE; uint32 node = 0; uint32 begin = 0; uint32 end = 0; uint32 level = uint32(-1); uint32 parent = uint32(-1); uint32 skip_node = uint32(-1); uint32 split_index = 0; int32 node_flag = -1; bool proper_split = false; bool terminated = false; // keep the entire warp looping until there's some work to do while (__any(!terminated)) { // fetch new tasks for inactive lanes which are done processing their node (i.e. node_flag != 0) const uint32 new_node = cuda::alloc<1>( node_flag != 0, work_counter, warp_tid, warp_offset + warp_id ); if (node_flag != 0) // check if we are done processing the current node { // check whether we are done processing all nodes if (new_node >= n_nodes) terminated = true; // reset the node node = new_node; begin = 0; end = 0; level = uint32(-1); parent = uint32(-1); skip_node = uint32(-1); split_index = 0; node_flag = 0; proper_split = false; } //node_flag = terminated ? 0 : *(volatile int32*)(flags + node); node_flag = terminated ? 0 : RADIX_TREE_UNCACHED_LOAD(flags + node); if (node_flag != 0) { // fetch this node's description const Split_task in_task = RADIX_TREE_UNCACHED_LOAD( (uint4*)tasks + node ); parent = in_task.m_parent; begin = in_task.m_begin; end = in_task.m_end; level = in_task.m_level; split_index = (begin + end)/2; skip_node = RADIX_TREE_UNCACHED_LOAD( skip_nodes + node ); // check whether this is a valid node, needing a proper split if (node_flag == 1) { // check whether the input node really needs to be split if (end - begin > max_leaf_size) { if (level != uint32(-1)) { // adjust the splitting level so as to make sure the split will produce either 2 or 0 children level = find_leading_bit_difference( level, codes[begin], codes[end-1] ); } // check again if there is any chance to make a split, after the level has been adjusted if (level != uint32(-1)) { // find the "partitioning pivot" using a binary search split_index = find_pivot( codes + begin, end - begin, mask_and<Integer>( Integer(1u) << level ) ) - codes; // this shouldn't be needed, but... force a good split if (split_index == begin || split_index == end) split_index = (begin + end)/2; } // mark this as a proper split proper_split =
{ "pile_set_name": "Github" }
Sample code for Chapter 5 - "First-class functions" From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015) http://shop.oreilly.com/product/0636920032519.do
{ "pile_set_name": "Github" }
// StringUtils.cpp #include "StdAfx.h" #include "StringUtils.h" void SplitStringToTwoStrings(const UString &src, UString &dest1, UString &dest2) { dest1.Empty(); dest2.Empty(); bool quoteMode = false; int i; for (i = 0; i < src.Length(); i++) { wchar_t c = src[i]; if (c == L'\"') quoteMode = !quoteMode; else if (c == L' ' && !quoteMode) { if (!quoteMode) { i++; break; } } else dest1 += c; } dest2 = src.Mid(i); } void SplitString(const UString &srcString, UStringVector &destStrings) { destStrings.Clear(); UString string; int len = srcString.Length(); if (len == 0) return; for (int i = 0; i < len; i++) { wchar_t c = srcString[i]; if (c == L' ') { if (!string.IsEmpty()) { destStrings.Add(string); string.Empty(); } } else string += c; } if (!string.IsEmpty()) destStrings.Add(string); } UString JoinStrings(const UStringVector &srcStrings) { UString destString; for (int i = 0; i < srcStrings.Size(); i++) { if (i != 0) destString += L' '; destString += srcStrings[i]; } return destString; }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <model ref="5ef691b5-60ce-4ece-a04e-25e642dfa128/r:59b6a434-36b8-4735-ae34-3acf97303510(com.mbeddr.mpsutil.lantest/com.mbeddr.mpsutil.lantest.structure)"> <persistence version="9" /> <languages> <use id="982eb8df-2c96-4bd7-9963-11712ea622e5" name="jetbrains.mps.lang.resources" version="2" /> <devkit ref="78434eb8-b0e5-444b-850d-e7c4ad2da9ab(jetbrains.mps.devkit.aspect.structure)" /> </languages> <imports> <import index="tp25" ref="r:00000000-0000-4000-0000-011c89590301(jetbrains.mps.lang.smodel.structure)" /> <import index="tpck" ref="r:00000000-0000-4000-0000-011c89590288(jetbrains.mps.lang.core.structure)" implicit="true" /> <import index="tpce" ref="r:00000000-0000-4000-0000-011c89590292(jetbrains.mps.lang.structure.structure)" implicit="true" /> </imports> <registry> <language id="c72da2b9-7cce-4447-8389-f407dc1158b7" name="jetbrains.mps.lang.structure"> <concept id="6054523464627964745" name="jetbrains.mps.lang.structure.structure.AttributeInfo_AttributedConcept" flags="ng" index="trNpa"> <reference id="6054523464627965081" name="concept" index="trN6q" /> </concept> <concept id="2992811758677295509" name="jetbrains.mps.lang.structure.structure.AttributeInfo" flags="ng" index="M6xJ_"> <property id="7588428831955550663" name="role" index="Hh88m" /> <child id="7588428831947959310" name="attributed" index="EQaZv" /> </concept> <concept id="1169125787135" name="jetbrains.mps.lang.structure.structure.AbstractConceptDeclaration" flags="ig" index="PkWjJ"> <property id="6714410169261853888" name="conceptId" index="EcuMT" /> <property id="4628067390765907488" name="conceptShortDescription" index="R4oN_" /> <property id="4628067390765956807" name="final" index="R5$K2" /> <property id="4628067390765956802" name="abstract" index="R5$K7" /> <property id="5092175715804935370" name="conceptAlias" index="34LRSv" /> <child id="1071489727083" name="linkDeclaration" index="1TKVEi" /> <child id="1071489727084" name="propertyDeclaration" index="1TKVEl" /> </concept> <concept id="1169125989551" name="jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration" flags="ig" index="PlHQZ" /> <concept id="1169127622168" name="jetbrains.mps.lang.structure.structure.InterfaceConceptReference" flags="ig" index="PrWs8"> <reference id="1169127628841" name="intfc" index="PrY4T" /> </concept> <concept id="1071489090640" name="jetbrains.mps.lang.structure.structure.ConceptDeclaration" flags="ig" index="1TIwiD"> <property id="1096454100552" name="rootable" index="19KtqR" /> <reference id="1071489389519" name="extends" index="1TJDcQ" /> <child id="1169129564478" name="implements" index="PzmwI" /> </concept> <concept id="1071489288299" name="jetbrains.mps.lang.structure.structure.PropertyDeclaration" flags="ig" index="1TJgyi"> <property id="241647608299431129" name="propertyId" index="IQ2nx" /> <reference id="1082985295845" name="dataType" index="AX2Wp" /> </concept> <concept id="1071489288298" name="jetbrains.mps.lang.structure.structure.LinkDeclaration" flags="ig" index="1TJgyj"> <property id="1071599776563" name="role" index="20kJfa" /> <property id="1071599893252" name="sourceCardinality" index="20lbJX" /> <property id="1071599937831" name="metaClass" index="20lmBu" /> <property id="241647608299431140" name="linkId" index="IQ2ns" /> <reference id="1071599976176" name="target" index="20lvS9" /> </concept> </language> <language id="ceab5195-25ea-4f22-9b92-103b95ca8c0c" name="jetbrains.mps.lang.core"> <concept id="1133920641626" name="jetbrains.mps.lang.core.structure.BaseConcept" flags="ng" index="2VYdi"> <property id="1193676396447" name="virtualPackage" index="3GE5qa" /> <child id="5169995583184591170" name="smodelAttribute" index="lGtFl" /> </concept> <concept id="1169194658468" name="jetbrains.mps.lang.core.structure.INamedConcept" flags="ng" index="TrEIO"> <property id="1169194664001" name="name" index="TrG5h" /> </concept> </language> </registry> <node concept="1TIwiD" id="4XCJ8CcQ6Nj"> <property role="TrG5h" value="LantestConfig" /> <property role="34LRSv" value="lantest_config" /> <property role="19KtqR" value="true" /> <property role="R4oN_" value="configuration for language testing" /> <property role="EcuMT" value="5722030627681234131" /> <ref role="1TJDcQ" to="tpck:gw2VY9q" resolve="BaseConcept" /> <node concept="1TJgyj" id="2A9nHKANPH8" role="1TKVEi"> <property role="20lmBu" value="fLJjDmT/aggregation" /> <property role="20kJfa" value="seedModel" /> <property role="IQ2ns" value="2993027727001344840" /> <ref role="20lvS9" node="2A9nHKANPGu" resolve="AbstractSeedModel" /> </node> <node concept="1TJgyj" id="2P6psD9B1UY" role="1TKVEi"> <property role="20lmBu" value="fLJjDmT/aggregation" /> <property role="20kJfa" value="seedChooser" /> <property role="20lbJX" value="fLJekj4/_1" /> <property role="IQ2ns" value="3262406899569270462" /> <ref role="20lvS9" node="2P6psD9B1UX" resolve="ISeedChooser" /> </node> <node concept="1TJgyj" id="33cGTVo60G$" role="1TKVEi"> <property role="20
{ "pile_set_name": "Github" }
package cobra import ( "bytes" "strings" "testing" ) func TestZshCompletion(t *testing.T) { tcs := []struct { name string root *Command expectedExpressions []string }{ { name: "trivial", root: &Command{Use: "trivialapp"}, expectedExpressions: []string{"#compdef trivial"}, }, { name: "linear", root: func() *Command { r := &Command{Use: "linear"} sub1 := &Command{Use: "sub1"} r.AddCommand(sub1) sub2 := &Command{Use: "sub2"} sub1.AddCommand(sub2) sub3 := &Command{Use: "sub3"} sub2.AddCommand(sub3) return r }(), expectedExpressions: []string{"sub1", "sub2", "sub3"}, }, { name: "flat", root: func() *Command { r := &Command{Use: "flat"} r.AddCommand(&Command{Use: "c1"}) r.AddCommand(&Command{Use: "c2"}) return r }(), expectedExpressions: []string{"(c1 c2)"}, }, { name: "tree", root: func() *Command { r := &Command{Use: "tree"} sub1 := &Command{Use: "sub1"} r.AddCommand(sub1) sub11 := &Command{Use: "sub11"} sub12 := &Command{Use: "sub12"} sub1.AddCommand(sub11) sub1.AddCommand(sub12) sub2 := &Command{Use: "sub2"} r.AddCommand(sub2) sub21 := &Command{Use: "sub21"} sub22 := &Command{Use: "sub22"} sub2.AddCommand(sub21) sub2.AddCommand(sub22) return r }(), expectedExpressions: []string{"(sub11 sub12)", "(sub21 sub22)"}, }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { buf := new(bytes.Buffer) tc.root.GenZshCompletion(buf) output := buf.String() for _, expectedExpression := range tc.expectedExpressions { if !strings.Contains(output, expectedExpression) { t.Errorf("Expected completion to contain %q somewhere; got %q", expectedExpression, output) } } }) } }
{ "pile_set_name": "Github" }
/* Copyright (c) 2011, Daniel Guerrero All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Daniel Guerrero nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DANIEL GUERRERO BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var Base64Binary = { _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", /* will return a Uint8Array type */ decodeArrayBuffer: function(input) { var bytes = Math.ceil( (3*input.length) / 4.0); var ab = new ArrayBuffer(bytes); this.decode(input, ab); return ab; }, decode: function(input, arrayBuffer) { //get last chars to see if are valid var lkey1 = this._keyStr.indexOf(input.charAt(input.length-1)); var lkey2 = this._keyStr.indexOf(input.charAt(input.length-1)); var bytes = Math.ceil( (3*input.length) / 4.0); if (lkey1 == 64) bytes--; //padding chars, so skip if (lkey2 == 64) bytes--; //padding chars, so skip var uarray; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; var j = 0; if (arrayBuffer) uarray = new Uint8Array(arrayBuffer); else uarray = new Uint8Array(bytes); input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); for (i=0; i<bytes; i+=3) { //get the 3 octects in 4 ascii chars enc1 = this._keyStr.indexOf(input.charAt(j++)); enc2 = this._keyStr.indexOf(input.charAt(j++)); enc3 = this._keyStr.indexOf(input.charAt(j++)); enc4 = this._keyStr.indexOf(input.charAt(j++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; uarray[i] = chr1; if (enc3 != 64) uarray[i+1] = chr2; if (enc4 != 64) uarray[i+2] = chr3; } return uarray; } };
{ "pile_set_name": "Github" }
--- method: POST headers: Authorization: AWS4-HMAC-SHA256 Credential=access/20091028/us-east-1/mturk-requester/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=? Host: mturk-requester.us-east-1.amazonaws.com Content-Type: application/x-www-form-urlencoded; charset=utf-8 X-Amz-Content-SHA256: abcdef X-Amz-Date: 20091028T223200Z body: ''
{ "pile_set_name": "Github" }
$NetBSD: patch-ac,v 1.2 2006/08/02 19:24:55 kristerw Exp $ --- xroads.c.orig 1999-06-30 20:25:02.000000000 +0200 +++ xroads.c 2006-08-02 21:14:27.000000000 +0200 @@ -282,13 +282,13 @@ } /*************************************************************************************************/ -int trunc( float num ) { /* Truncate a float to an int */ +int mytrunc( float num ) { /* Truncate a float to an int */ if (num>0) return (int)num; else return (int)(num-0.5); } /*************************************************************************************************/ -int round( float num ) { /* Round a float to an int */ +int roundup( float num ) { /* Round a float to an int */ return (int)(num+0.5); } @@ -394,11 +394,11 @@ /* VacAttack */ /* if(data[amonst->type].attack1==VACCUUM && (amonst->x==monst[targ].x - || amonst->y==monst[targ].y) && (round(amonst->x) == - trunc(amonst->x) && round(amonst->y) == trunc(amonst->y))) { + || amonst->y==monst[targ].y) && (roundup(amonst->x) == + mytrunc(amonst->x) && roundup(amonst->y) == mytrunc(amonst->y))) { */ - if(data[amonst->type].attack1==VACCUUM && (round(amonst->x) == - trunc(amonst->x) && round(amonst->y) == trunc(amonst->y)) && + if(data[amonst->type].attack1==VACCUUM && (roundup(amonst->x) == + mytrunc(amonst->x) && roundup(amonst->y) == mytrunc(amonst->y)) && clearshot(amonst, &monst[targ])) { watchentity(amonst, &monst[targ]); vacattack(amonst, &monst[targ]); @@ -423,19 +423,19 @@ else amonst->frame++; if(data[amonst->type].etype!=EFFECT) { - maze[round(oldy)][round(oldx)]=-2; /* Blank out old space */ - maze[trunc(oldy)][trunc(oldx)]=-2; - maze[round(amonst->y)][round(amonst->x)]=number; - maze[trunc(amonst->y)][trunc(amonst->x)]=number; + maze[roundup(oldy)][roundup(oldx)]=-2; /* Blank out old space */ + maze[mytrunc(oldy)][mytrunc(oldx)]=-2; + maze[roundup(amonst->y)][roundup(amonst->x)]=number; + maze[mytrunc(amonst->y)][mytrunc(amonst->x)]=number; } /* If there was something underneath the effect, redraw it */ - if(maze[trunc(amonst->y)][trunc(amonst->x)]!=-2) { - bmonst=&monst[maze[trunc(amonst->y)][trunc(amonst->x)]]; + if(maze[mytrunc(amonst->y)][mytrunc(amonst->x)]!=-2) { + bmonst=&monst[maze[mytrunc(amonst->y)][mytrunc(amonst->x)]]; draw_tilex2(mainwindow, data[bmonst->type].tile[bmonst->frame], (bmonst->x)*GRIDSIZE, (bmonst->y)*GRIDSIZE, bmonst->color, bmonst->dir); } - if(maze[round(amonst->y)][round(amonst->x)]!=-2) { - bmonst=&monst[maze[round(amonst->y)][round(amonst->x)]]; + if(maze[roundup(amonst->y)][roundup(amonst->x)]!=-2) { + bmonst=&monst[maze[roundup(amonst->y)][roundup(amonst->x)]]; draw_tilex2(mainwindow, data[bmonst->type].tile[bmonst->frame], (bmonst->x)*GRIDSIZE, (bmonst->y)*GRIDSIZE, bmonst->color, bmonst->dir); } @@ -558,7 +558,7 @@ else if(player->attr & PULL_R) { newx+=1; player->attr &= ~PULL_R; } /* Only one half-step at a time */ - if(round(newx)!=trunc(newx) && round(newy)!=trunc(newy)) { + if(roundup(newx)!=mytrunc(newx) && roundup(newy)!=mytrunc(newy)) { #ifdef DEBUG printf("Damn, in two half-steps at a time...\n"); #endif @@ -574,30 +574,30 @@ /* If we're in a half-step, eqx and eqy are the space we're moving into */ - if(round(newx)!=trunc(newx)) { - eqy = trunc(newy); + if(roundup(newx)!=mytrunc(newx)) { + eqy = mytrunc(newy); if(newx > player->x) - eqx = round(newx); + eqx = roundup(newx); else if(newx < player->x) - eqx = trunc(newx); + eqx = mytrunc(newx); } - else if(round(newy)!=trunc(newy)) { - eqx = trunc(newx); + else if(roundup(newy)!=mytrunc(newy)) { + eqx = mytrunc(newx); if(newy > player->y) - eqy = round(newy); + eqy = roundup(newy); else if(newy < player->y) - eqy = trunc(newy); + eqy = mytrunc(newy); } else { - eqx = trunc(newx); - eqy = trunc(newy); + eqx = mytrunc(newx); + eqy = mytrunc(newy); } /* switch(player->dir) { - case LEFT: eqx = trunc(newx); break; - case RIGHT: eqx = round(newx); break; - case UP: eqy = trunc(newy); break; - case DOWN: eqy = round(newy); break; + case LEFT: eqx = mytrunc(newx); break; + case RIGHT: eqx = roundup(newx); break; + case UP: eqy = mytrunc(newy); break; + case DOWN: eqy = roundup(newy); break; default: } */ @@ -610,8 +610,8 @@ printf("Destination (%0.2f, %0.2f)...\n", newx, newy); printf("Equiv (%d, %d)\n", eqx, eqy); printf("@ %d, %d : %d\n", eqx, eqy, maze[eqy][eqx]); - printf("newx: %0.2f: round %d, trunc %d\n", newx, round(newx), trunc(newx)); - printf("newy: %0.2f: round %d, trunc %d\n", newy, round(newy), trunc(newy)); + printf("newx: %0.2f: round %d, trunc %d\n", newx, roundup(newx), mytrunc(newx)); + printf("newy: %0.2f: round %d, trunc %d\n", newy,
{ "pile_set_name": "Github" }