text
stringlengths 2
14k
| meta
dict |
|---|---|
/*=============================================================================
Copyright (c) 2018 Kohei Takahashi
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)
==============================================================================*/
#ifndef BOOST_FUSION_IS_NATIVE_FUSION_SEQUENCE
#define BOOST_FUSION_IS_NATIVE_FUSION_SEQUENCE
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/mpl/and.hpp>
#include <boost/type_traits/is_complete.hpp>
#include <boost/type_traits/is_convertible.hpp>
namespace boost { namespace fusion { namespace detail
{
template <typename Sequence>
struct is_native_fusion_sequence
: mpl::and_<
is_complete<Sequence>
, is_convertible<Sequence, detail::from_sequence_convertible_type>
>
{};
}}}
#endif
|
{
"pile_set_name": "Github"
}
|
// This source file is part of the Swift.org open source project
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
// RUN: not %target-swift-frontend %s -emit-ir
protocol 0{class TextOutputStream
|
{
"pile_set_name": "Github"
}
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M21,6h-2v9L6,15v2c0,0.55 0.45,1 1,1h11l4,4L22,7c0,-0.55 -0.45,-1 -1,-1zM17,12L17,3c0,-0.55 -0.45,-1 -1,-1L3,2c-0.55,0 -1,0.45 -1,1v14l4,-4h10c0.55,0 1,-0.45 1,-1z"/>
</vector>
|
{
"pile_set_name": "Github"
}
|
1634 1574848011319 httpcache-v1
Method: POST
URL: https://www.notion.so/api/v3/getRecordValues
Body:+110
{
"requests": [
{
"id": "f136e223-a6e8-4428-bbf4-676ef4725a68",
"table": "block"
}
]
}
Response:+1434
{
"results": [
{
"role": "comment_only",
"value": {
"alive": true,
"content": [
"e204cc5a-6d54-4c9a-aec7-ba7dda2738bd",
"3d6cf5ef-5339-4b1e-903d-0c9a5718d3e4",
"c931de19-15e4-42af-8b25-4b91c23aa69e",
"abd1ba9e-4450-481a-a596-e9a5883d0e23",
"99c91818-8d5c-43f2-8c50-9120f31b066b",
"7536037c-e9cb-4d60-bf6d-81db01f4ee20",
"7b6188a1-2316-47fa-91cc-b5e98a64f65f",
"37de4e0f-64d8-469d-ba64-1ed58bbab771"
],
"created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
"created_by_id": "bb760e2d-d679-4b64-b2a9-03005b21870a",
"created_by_table": "notion_user",
"created_time": 1551946003534,
"format": {
"page_full_width": true,
"page_small_text": true
},
"id": "f136e223-a6e8-4428-bbf4-676ef4725a68",
"ignore_block_count": true,
"last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
"last_edited_by_id": "bb760e2d-d679-4b64-b2a9-03005b21870a",
"last_edited_by_table": "notion_user",
"last_edited_time": 1551946003534,
"parent_id": "dc371b5c-6e7e-4e07-8e13-217dd1e6172f",
"parent_table": "block",
"properties": {
"title": [
[
"overflow scroll"
]
]
},
"type": "page",
"version": 7
}
}
]
}
15376 1574848011320 httpcache-v1
Method: POST
URL: https://www.notion.so/api/v3/loadPageChunk
Body:+152
{
"chunkNumber": 0,
"cursor": {
"stack": []
},
"limit": 50,
"pageId": "f136e223-a6e8-4428-bbf4-676ef4725a68",
"verticalColumns": false
}
Response:+15135
{
"cursor": {
"stack": []
},
"recordMap": {
"block": {
"18bfe038-1096-49f4-8904-e71ca18d76ed": {
"role": "comment_only",
"value": {
"alive": true,
"content": [
"de69ce46-4a84-4664-a79d-a8437cc023a2",
"6447d07e-7279-4ef8-ad31-221f6202a958",
"b5232adc-60a1-4030-aec3-ac8cfbc40c48",
"fd36e28b-d46e-4e85-8e33-850a518cc83b",
"98e6c7b5-3bf2-46c6-80d3-c5cbd31a66f9",
"7a254330-19a7-4078-9eb8-742c9947c27e",
"46bc5a5e-461b-4eea-ae50-1350e8c216f2",
"700875db-418d-425e-a5bc-4f233df26393",
"8d4886c1-0f85-4e70-8001-4f310f6668e5",
"a532af1c-38ff-4edb-a80f-44aaf3ccc3dc",
"5fee4d4d-52a7-4aa3-a0a2-aa7058cc0bf7",
"e012f912-2f98-4998-b135-e4e66d4b296a",
"8af638cc-537f-4b8f-a653-1a9437d3ac91",
"8ad0b607-0b54-4717-af1f-aaad85004d7a",
"c50f71ff-6d61-466c-bcd2-5bf31d7f79f2",
"07e243d7-106d-41a6-a70a-54841524dfcf",
"ee0aa8d5-16eb-4655-a3e4-1207a664ff8d",
"2f766cdc-785a-4190-bb87-fe34634ce93e",
"cfe69373-b211-484f-859d-994b14c21101",
"04974825-61b2-4800-ae16-c05860d63e8b",
"bb456a6b-e908-423a-9f01-4100ba169355",
"dbaba9a4-66d7-412d-b2c9-3da6f51a9e9a",
"2abad8a1-f82a-4e33-b817-7e35df65d648",
"6ef12527-82ae-43bf-9d83-10c7e4f6b679",
"325b6445-db10-4fc3-a31f-291360b669b7",
"b21963da-f818-4709-8a20-7a8c6cb88159",
"b4240597-9643-4c68-b3a4-8effe38559fd",
"c07e46a0-dbd4-4d9a-a7dd-7fa847bce4ff",
"ae18c98c-9032-491b-b984-171019e74029",
"0e939055-c399-4797-bc21-990b347dae23",
"f6444ef0-3c83-43a3-86be-f9a075d908f4",
"cf0362b8-6e4e-49e6-9095-491801d0527a",
"7178e7e9-93fe-4d60-84de-29271ca4ed9a",
"13d6e8c9-4b63-4f68-8735-21b9e3ecde18",
"67afe3a0-9215-4b71-a6ba-01022485f703",
"1fa750ee-637a-4507-a179-de35cff27ee6",
"96ef4707-530e-46e7-83ea-44b8e0942142",
"74c97777-0820-445d-a5e9-e83344297798",
"e7833d5c-379d-420f-ba51-ef44b8c4115e
|
{
"pile_set_name": "Github"
}
|
// -*- C++ -*-
// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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, or (at your option) any later
// version.
// This library 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.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file info_fn_imps.hpp
* Contains implementations of cc_ht_map_'s entire container info related
* functions.
*/
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
size() const
{ return m_num_used_e; }
PB_DS_CLASS_T_DEC
inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC::
max_size() const
{ return m_entry_allocator.max_size(); }
PB_DS_CLASS_T_DEC
inline bool
PB_DS_CLASS_C_DEC::
empty() const
{ return (size() == 0); }
PB_DS_CLASS_T_DEC
template<typename Other_HT_Map_Type>
bool
PB_DS_CLASS_C_DEC::
operator==(const Other_HT_Map_Type& other) const
{ return cmp_with_other(other); }
PB_DS_CLASS_T_DEC
template<typename Other_Map_Type>
bool
PB_DS_CLASS_C_DEC::
cmp_with_other(const Other_Map_Type& other) const
{
if (size() != other.size())
return false;
for (typename Other_Map_Type::const_iterator it = other.begin();
it != other.end(); ++it)
{
const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it);
const_mapped_pointer p_mapped_value =
const_cast<PB_DS_CLASS_C_DEC& >(*this).
find_key_pointer(r_key, traits_base::m_store_extra_indicator);
if (p_mapped_value == NULL)
return false;
#ifdef PB_DS_DATA_TRUE_INDICATOR
if (p_mapped_value->second != it->second)
return false;
#endif
}
return true;
}
PB_DS_CLASS_T_DEC
template<typename Other_HT_Map_Type>
bool
PB_DS_CLASS_C_DEC::
operator!=(const Other_HT_Map_Type& other) const
{ return !operator==(other); }
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <stdio.h>
#include <errno.h>
#include "bio_lcl.h"
#include "internal/cryptlib.h"
/*
* BIO_put and BIO_get both add to the digest, BIO_gets returns the digest
*/
static int nullf_write(BIO *h, const char *buf, int num);
static int nullf_read(BIO *h, char *buf, int size);
static int nullf_puts(BIO *h, const char *str);
static int nullf_gets(BIO *h, char *str, int size);
static long nullf_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static long nullf_callback_ctrl(BIO *h, int cmd, BIO_info_cb *fp);
static const BIO_METHOD methods_nullf = {
BIO_TYPE_NULL_FILTER,
"NULL filter",
/* TODO: Convert to new style write function */
bwrite_conv,
nullf_write,
/* TODO: Convert to new style read function */
bread_conv,
nullf_read,
nullf_puts,
nullf_gets,
nullf_ctrl,
NULL,
NULL,
nullf_callback_ctrl,
};
const BIO_METHOD *BIO_f_null(void)
{
return &methods_nullf;
}
static int nullf_read(BIO *b, char *out, int outl)
{
int ret = 0;
if (out == NULL)
return 0;
if (b->next_bio == NULL)
return 0;
ret = BIO_read(b->next_bio, out, outl);
BIO_clear_retry_flags(b);
BIO_copy_next_retry(b);
return ret;
}
static int nullf_write(BIO *b, const char *in, int inl)
{
int ret = 0;
if ((in == NULL) || (inl <= 0))
return 0;
if (b->next_bio == NULL)
return 0;
ret = BIO_write(b->next_bio, in, inl);
BIO_clear_retry_flags(b);
BIO_copy_next_retry(b);
return ret;
}
static long nullf_ctrl(BIO *b, int cmd, long num, void *ptr)
{
long ret;
if (b->next_bio == NULL)
return 0;
switch (cmd) {
case BIO_C_DO_STATE_MACHINE:
BIO_clear_retry_flags(b);
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
BIO_copy_next_retry(b);
break;
case BIO_CTRL_DUP:
ret = 0L;
break;
default:
ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
}
return ret;
}
static long nullf_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
{
long ret = 1;
if (b->next_bio == NULL)
return 0;
switch (cmd) {
default:
ret = BIO_callback_ctrl(b->next_bio, cmd, fp);
break;
}
return ret;
}
static int nullf_gets(BIO *bp, char *buf, int size)
{
if (bp->next_bio == NULL)
return 0;
return BIO_gets(bp->next_bio, buf, size);
}
static int nullf_puts(BIO *bp, const char *str)
{
if (bp->next_bio == NULL)
return 0;
return BIO_puts(bp->next_bio, str);
}
|
{
"pile_set_name": "Github"
}
|
$(document).ready(function() {
// $("#id_permissions_role").sSelect();
$("#newchannel-name").blur(function() {
$("#name-spinner").spin('small');
var zreg_name = $("#newchannel-name").val();
$.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
$("#newchannel-nickname").val(data);
zFormError("#newchannel-name-feedback",data.error);
$("#name-spinner").spin(false);
});
});
$("#newchannel-nickname").blur(function() {
$("#nick-spinner").spin('small');
var zreg_nick = $("#newchannel-nickname").val();
$.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
$("#newchannel-nickname").val(data);
zFormError("#newchannel-nickname-feedback",data.error);
$("#nick-spinner").spin(false);
});
});
});
|
{
"pile_set_name": "Github"
}
|
package example.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Customer1390 {
@Id @GeneratedValue(strategy = GenerationType.AUTO) private long id;
private String firstName;
private String lastName;
protected Customer1390() {}
public Customer1390(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
@Override
public String toString() {
return String.format("Customer1390[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName);
}
}
|
{
"pile_set_name": "Github"
}
|
const func1 = function() {};
const object = {
func2: function() {}
};
console.log(func1.name);
// expected output: "func1"
console.log(object.func2.name);
// expected output: "func2"
|
{
"pile_set_name": "Github"
}
|
#include "api_config.h"
#include "common.h"
#include <iostream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/algorithm/string.hpp>
// === implementation of the api_config class ===
using namespace lsl;
using namespace lslboost::algorithm;
/// Helper function: Substitute the "~" character by the full home directory (according to environment variables).
std::string expand_tilde(const std::string &filename) {
if (!filename.empty() && filename[0] == '~') {
std::string homedir;
if (getenv("HOME"))
homedir = getenv("HOME");
else if (getenv("USERPROFILE"))
homedir = getenv("USERPROFILE");
else if (getenv("HOMEDRIVE") && getenv("HOMEPATH"))
homedir = std::string(getenv("HOMEDRIVE")) + getenv("HOMEPATH");
else {
std::cerr << "Cannot determine the user's home directory; config files in the home directory will not be discovered." << std::endl;
return filename;
}
return homedir + filename.substr(1);
}
return filename;
}
/// Helper function: Parse a set specifier (a string of the form {a, b, c, ...}) into a vector of strings.
static std::vector<std::string> parse_set(const std::string &setstr) {
std::vector<std::string> result;
if ((setstr.size() > 2) && setstr[0] == '{' && setstr[setstr.size()-1] == '}') {
// non-empty set: split by ","
std::string sub = setstr.substr(1,setstr.size()-2);
lslboost::algorithm::split(result,sub,lslboost::algorithm::is_any_of(","));
// remove leading and trailing whitespace from each element
for (std::vector<std::string>::iterator i=result.begin(); i!=result.end(); i++)
trim(*i);
}
return result;
}
// Returns true if the file exists and is openable for reading
bool file_is_readable(const std::string& filename) {
std::ifstream f(filename.c_str());
return f.good();
}
/**
* Constructor.
* Applies default settings and overrides them based on a config file (if present).
*/
api_config::api_config() {
// for each config file location under consideration...
std::string filenames[] = {"lsl_api.cfg", expand_tilde("~/lsl_api/lsl_api.cfg"), "/etc/lsl_api/lsl_api.cfg"};
for (std::size_t k=0; k < sizeof(filenames)/sizeof(filenames[0]); k++) {
try {
if (file_is_readable(filenames[k])) {
// try to load it if the file exists
load_from_file(filenames[k]);
// successful: finished
return;
}
} catch(std::exception &e) {
std::cerr << "Error trying to load config file " << filenames[k] << ": " << e.what() << std::endl;
}
}
// unsuccessful: load default settings
load_from_file();
}
/**
* Load a configuration file (or use defaults if a filename is empty).
* Expects a proper platform-native file name. Throws if there's an error.
*/
void api_config::load_from_file(const std::string &filename) {
try {
lslboost::property_tree::ptree pt;
if (!filename.empty())
read_ini(filename, pt);
// read out the [ports] parameters
multicast_port_ = pt.get("ports.MulticastPort",16571);
base_port_ = pt.get("ports.BasePort",16572);
port_range_ = pt.get("ports.PortRange",32);
allow_random_ports_ = pt.get("ports.AllowRandomPorts",true);
#ifdef __APPLE__
ipv6_ = pt.get("ports.IPv6","disable"); // on Mac OS (10.7) there's a bug in the IPv6 implementation that breaks LSL when it tries to use both v4 and v6
#else
ipv6_ = pt.get("ports.IPv6","allow");
#endif
// fix some common mis-spellings
if (ipv6_ == "disabled")
ipv6_ = "disable";
if (ipv6_ == "allowed")
ipv6_ = "allow";
if (ipv6_ == "forced")
ipv6_ = "force";
if (ipv6_ != "disable" && ipv6_ != "allow" && ipv6_ != "force")
throw std::runtime_error("Unsupported setting for the IPv6 parameter.");
// read the [multicast] parameters
resolve_scope_ = pt.get("multicast.ResolveScope","site");
listen_address_ = pt.get("multicast.ListenAddress","");
std::vector<std::string> machine_group = parse_set(pt.get("multicast.MachineAddresses","{127.0.0.1, FF31:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}"));
std::vector<std::string> link_group = parse_set(pt.get("multicast.LinkAddresses","{255.255.255.255, 224.0.0.183, FF02:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}"));
std::vector<std::string> site_group = parse_set(pt.get("multicast.SiteAddresses","{239.255.172.215, FF05:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}"));
std::vector<std::string> organization_group = parse_set(pt.get("multicast.OrganizationAddresses","{239.192.172.215, FF08:113D:6FDD:2C17:A643:FFE2:1BD1:3CD2}"));
std::vector<std::string> global_group = parse_set(pt.get("multicast.GlobalAddresses","{}"));
multicast_ttl_ = -1;
// construct list of addresses & TTL according to the ResolveScope.
if (resolve_scope_ == "machine") {
multicast_addresses_ = machine_group;
multicast_ttl_ = 0;
}
if (resolve_scope_ == "link") {
multicast_addresses_ = machine_group;
multicast_addresses_.insert(multicast_addresses_.end(),link_group.begin(),link_group.end());
multicast_ttl_ = 1;
}
if (resolve_scope_ == "site") {
multicast_addresses_ = machine_group;
multicast_addresses_.insert(multicast_addresses_.end(),link_group.begin(),link_group.end());
multicast_addresses_.insert(multicast_addresses_.end(),site_group.begin(),site_group.end());
multicast_ttl_ = 24;
}
if (resolve_scope_ == "organization") {
multicast_addresses_ = machine_group;
multicast_addresses_.insert(multicast_addresses_.end(),link_group.begin(),link_group.end());
multicast_addresses_.insert(multicast_addresses_.end(),site_group.begin(),site_group.end());
multicast_addresses_.insert(multicast_addresses_.end(),organization_group.begin(),organization_group.end());
multicast_ttl_ = 32;
}
if (resolve_scope_ == "global") {
multicast_addresses_ = machine_group;
|
{
"pile_set_name": "Github"
}
|
var path = require('path');
var test = require('tape');
var resolve = require('../');
test('mock', function (t) {
t.plan(8);
var files = {};
files[path.resolve('/foo/bar/baz.js')] = 'beep';
function opts(basedir) {
return {
basedir: path.resolve(basedir),
isFile: function (file, cb) {
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
},
readFile: function (file, cb) {
cb(null, files[path.resolve(file)]);
}
};
}
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
if (err) return t.fail(err);
t.equal(res, path.resolve('/foo/bar/baz.js'));
t.equal(pkg, undefined);
});
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
if (err) return t.fail(err);
t.equal(res, path.resolve('/foo/bar/baz.js'));
t.equal(pkg, undefined);
});
resolve('baz', opts('/foo/bar'), function (err, res) {
t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
t.equal(err.code, 'MODULE_NOT_FOUND');
});
resolve('../baz', opts('/foo/bar'), function (err, res) {
t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
t.equal(err.code, 'MODULE_NOT_FOUND');
});
});
test('mock from package', function (t) {
t.plan(8);
var files = {};
files[path.resolve('/foo/bar/baz.js')] = 'beep';
function opts(basedir) {
return {
basedir: path.resolve(basedir),
isFile: function (file, cb) {
cb(null, Object.prototype.hasOwnProperty.call(files, file));
},
'package': { main: 'bar' },
readFile: function (file, cb) {
cb(null, files[file]);
}
};
}
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
if (err) return t.fail(err);
t.equal(res, path.resolve('/foo/bar/baz.js'));
t.equal(pkg && pkg.main, 'bar');
});
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
if (err) return t.fail(err);
t.equal(res, path.resolve('/foo/bar/baz.js'));
t.equal(pkg && pkg.main, 'bar');
});
resolve('baz', opts('/foo/bar'), function (err, res) {
t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
t.equal(err.code, 'MODULE_NOT_FOUND');
});
resolve('../baz', opts('/foo/bar'), function (err, res) {
t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
t.equal(err.code, 'MODULE_NOT_FOUND');
});
});
test('mock package', function (t) {
t.plan(2);
var files = {};
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
main: './baz.js'
});
function opts(basedir) {
return {
basedir: path.resolve(basedir),
isFile: function (file, cb) {
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
},
readFile: function (file, cb) {
cb(null, files[path.resolve(file)]);
}
};
}
resolve('bar', opts('/foo'), function (err, res, pkg) {
if (err) return t.fail(err);
t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
t.equal(pkg && pkg.main, './baz.js');
});
});
test('mock package from package', function (t) {
t.plan(2);
var files = {};
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
main: './baz.js'
});
function opts(basedir) {
return {
basedir: path.resolve(basedir),
isFile: function (file, cb) {
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
},
'package': { main: 'bar' },
readFile: function (file, cb) {
cb(null, files[path.resolve(file)]);
}
};
}
resolve('bar', opts('/foo'), function (err, res, pkg) {
if (err) return t.fail(err);
t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
t.equal(pkg && pkg.main, './baz.js');
});
});
|
{
"pile_set_name": "Github"
}
|
def extractLambytlWordpressCom(item):
'''
Parser for 'lambytl.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('King of Classical Music', 'King of Classical Music', 'translated'),
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiterous', 'oel'),
]
for tagname, name, tl_type in tagmap:
if tagname in item['tags']:
return buildReleaseMessageWithType(item, name, vol, chp, frag=frag, postfix=postfix, tl_type=tl_type)
return False
|
{
"pile_set_name": "Github"
}
|
import fetch from 'dva/fetch';
import { notification } from 'antd';
function checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return response;
}
notification.error({
message: `请求错误 ${response.status}: ${response.url}`,
description: response.statusText,
});
const error = new Error(response.statusText);
error.response = response;
throw error;
}
/**
* Requests a URL, returning a promise.
*
* @param {string} url The URL we want to request
* @param {object} [options] The options we want to pass to "fetch"
* @return {object} An object containing either "data" or "err"
*/
export default function request(url, options) {
const defaultOptions = {
credentials: 'include',
};
const newOptions = { ...defaultOptions, ...options };
if (newOptions.method === 'POST' || newOptions.method === 'PUT') {
newOptions.headers = {
Accept: 'application/json',
'Content-Type': 'application/json; charset=utf-8',
...newOptions.headers,
};
newOptions.body = JSON.stringify(newOptions.body);
}
return fetch(url, newOptions)
.then(checkStatus)
.then(response => response.json())
.catch((error) => {
if (error.code) {
notification.error({
message: error.name,
description: error.message,
});
}
if ('stack' in error && 'message' in error) {
notification.error({
message: `request error: ${url}`,
description: error.message,
});
}
return error;
});
}
|
{
"pile_set_name": "Github"
}
|
// Copyright Aleksey Gurtovoy 2000-2004
//
// 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)
//
// Preprocessed version of "boost/mpl/apply_wrap.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename F
, typename has_apply_ = typename aux::has_apply<F>::type
>
struct apply_wrap0
: F::template apply< >
{
};
template<
typename F, typename T1
>
struct apply_wrap1
: F::template apply<T1>
{
};
template<
typename F, typename T1, typename T2
>
struct apply_wrap2
: F::template apply< T1,T2 >
{
};
template<
typename F, typename T1, typename T2, typename T3
>
struct apply_wrap3
: F::template apply< T1,T2,T3 >
{
};
template<
typename F, typename T1, typename T2, typename T3, typename T4
>
struct apply_wrap4
: F::template apply< T1,T2,T3,T4 >
{
};
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct apply_wrap5
: F::template apply< T1,T2,T3,T4,T5 >
{
};
}}
|
{
"pile_set_name": "Github"
}
|
export type ModuleAddress =
ModuleAddress.GitHubRepo |
ModuleAddress.GitHubRawUrl |
ModuleAddress.DenoLandUrl
;
export namespace ModuleAddress {
/** e.g: "github:userOrOrg/repositoryName#branch" */
export type GitHubRepo = {
type: "GITHUB REPO";
userOrOrg: string;
repositoryName: string;
branch?: string;
};
export namespace GitHubRepo {
/**
* Input example
* KSXGitHub/simple-js-yaml-port-for-deno or
* github:KSXGitHub/simple-js-yaml-port-for-deno or
* KSXGitHub/simple-js-yaml-port-for-deno#3.12.1 or
* github:KSXGitHub/simple-js-yaml-port-for-deno#3.12.1 or
*/
export function parse(
raw: string
): GitHubRepo {
const match = raw.match(/^(?:github:\s*)?([^\/]*)\/([^\/]+)$/i)!;
const [repositoryName, branch] = match[2].split("#");
return {
"type": "GITHUB REPO",
"userOrOrg": match[1],
repositoryName,
branch
};
}
/** Match valid parse input */
export function match(raw: string): boolean {
return /^(?:github:)?[^\/\:]+\/[^\/]+$/.test(raw);
}
}
/** https://raw.githubusercontent.com/user/repo/branch/path/to/file.ts */
export type GitHubRawUrl = {
type: "GITHUB-RAW URL"
baseUrlWithoutBranch: string;
pathToIndex: string;
branch: string;
};
export namespace GitHubRawUrl {
export function parse(raw: string): GitHubRawUrl {
const match = raw.match(
/^(https?:\/\/raw\.github(?:usercontent)?\.com\/[^\/]+\/[^\/]+\/)([^\/]+)\/(.*)$/
)!;
return {
"type": "GITHUB-RAW URL",
"baseUrlWithoutBranch": match[1]
.replace(
/^https?:\/\/raw\.github(?:usercontent)?/,
"https://raw.githubusercontent"
)
.replace(/\/$/, "")
,
"branch": match[2],
"pathToIndex": match[3]
};
}
export function match(raw: string): boolean {
return /^https?:\/\/raw\.github(?:usercontent)?\.com/.test(raw);
}
}
/** e.g: https://deno.land/x/foo@1.2.3/mod.js */
export type DenoLandUrl = {
type: "DENO.LAND URL"
isStd: boolean;
baseUrlWithoutBranch: string;
pathToIndex: string;
branch?: string;
};
export namespace DenoLandUrl {
export function parse(raw: string): DenoLandUrl {
const isStd = /^https?:\/\/deno\.land\/std/.test(raw);
const match = isStd ?
raw.match(/^(https?:\/\/deno\.land\/std)([@\/].*)$/)! :
raw.match(/^(https?:\/\/deno\.land\/x\/[^@\/]+)([@\/].*)$/)!
;
// https://deno.land/std@master/node/querystring.ts
// [1]: https://deno.land/std
// [2]: @master/node/querystring.ts
// https://deno.land/std/node/querystring.ts
// [1]: https://deno.land/std
// [2]: /node/querystring.ts
//https://deno.land/x/foo@1.2.3/mod.js
// [1]: https://deno.land/x/foo
// [2]: @1.2.3/mod.js
//https://deno.land/x/foo/mod.js
// [1]: https://deno.land/x/foo
// [2]: /mod.js
const { branch, pathToIndex } = match[2].startsWith("@") ? (() => {
const [
, branch, // 1.2.3
pathToIndex // mod.js
] = match[2].match(/^@([^\/]+)\/(.*)$/)!;
return { branch, pathToIndex }
})() : ({
"branch": undefined,
"pathToIndex": match[2].replace(/^\//, "") // mod.js
});
return {
"type": "DENO.LAND URL",
isStd,
"baseUrlWithoutBranch": match[1],
"branch": branch,
pathToIndex
};
}
export function match(raw: string): boolean {
return /^https?:\/\/deno\.land\/(?:(?:std)|(?:x))[\/|@]/.test(raw);
}
}
export function parse(raw: string): ModuleAddress {
for (const ns of [GitHubRepo, GitHubRawUrl, DenoLandUrl]) {
if (!ns.match(raw)) {
continue;
}
return ns.parse(raw);
}
throw new Error(`${raw} is not a valid module address`);
}
}
|
{
"pile_set_name": "Github"
}
|
/**
* 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 org.activiti.designer.validation.bpmn20.bundle;
/**
* Plugin constants for the org.activiti.designer.validation.bpmn20 bundle.
*
* @author Tiese Barrell
* @version 1
* @since 5.6
*
*/
public final class PluginConstants {
public static final String VALIDATOR_ID = "com.atosorigin.esuite.editor.process.validation.ESuiteProcessValidator";
public static final String VALIDATOR_NAME = "E-Suite Process Validator";
public static final String FORMAT_NAME = "E-Suite ZaakType jPDL";
public static final String MARKER_MESSAGE_PATTERN = "[%s] %s";
public static final int WORK_CLEAR_MARKERS = 5;
public static final int WORK_EXTRACT_CONSTRUCTS = 20;
public static final int WORK_USER_TASK = 10;
public static final int WORK_SCRIPT_TASK = 10;
public static final int WORK_SERVICE_TASK = 10;
public static final int WORK_SEQUENCE_FLOW = 10;
public static final int WORK_SUB_PROCESS = 10;
public static final int WORK_TOTAL = WORK_CLEAR_MARKERS + WORK_EXTRACT_CONSTRUCTS + WORK_USER_TASK + WORK_SCRIPT_TASK + WORK_SERVICE_TASK
+ WORK_SEQUENCE_FLOW + WORK_SUB_PROCESS;
}
|
{
"pile_set_name": "Github"
}
|
'use strict';
module.exports = function(Chart) {
var helpers = Chart.helpers;
function filterByPosition(array, position) {
return helpers.where(array, function(v) {
return v.position === position;
});
}
function sortByWeight(array, reverse) {
array.forEach(function(v, i) {
v._tmpIndex_ = i;
return v;
});
array.sort(function(a, b) {
var v0 = reverse ? b : a;
var v1 = reverse ? a : b;
return v0.weight === v1.weight ?
v0._tmpIndex_ - v1._tmpIndex_ :
v0.weight - v1.weight;
});
array.forEach(function(v) {
delete v._tmpIndex_;
});
}
/**
* @interface ILayoutItem
* @prop {String} position - The position of the item in the chart layout. Possible values are
* 'left', 'top', 'right', 'bottom', and 'chartArea'
* @prop {Number} weight - The weight used to sort the item. Higher weights are further away from the chart area
* @prop {Boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down
* @prop {Function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)
* @prop {Function} update - Takes two parameters: width and height. Returns size of item
* @prop {Function} getPadding - Returns an object with padding on the edges
* @prop {Number} width - Width of item. Must be valid after update()
* @prop {Number} height - Height of item. Must be valid after update()
* @prop {Number} left - Left edge of the item. Set by layout system and cannot be used in update
* @prop {Number} top - Top edge of the item. Set by layout system and cannot be used in update
* @prop {Number} right - Right edge of the item. Set by layout system and cannot be used in update
* @prop {Number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update
*/
// The layout service is very self explanatory. It's responsible for the layout within a chart.
// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need
// It is this service's responsibility of carrying out that layout.
Chart.layoutService = {
defaults: {},
/**
* Register a box to a chart.
* A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.
* @param {Chart} chart - the chart to use
* @param {ILayoutItem} item - the item to add to be layed out
*/
addBox: function(chart, item) {
if (!chart.boxes) {
chart.boxes = [];
}
// initialize item with default values
item.fullWidth = item.fullWidth || false;
item.position = item.position || 'top';
item.weight = item.weight || 0;
chart.boxes.push(item);
},
/**
* Remove a layoutItem from a chart
* @param {Chart} chart - the chart to remove the box from
* @param {Object} layoutItem - the item to remove from the layout
*/
removeBox: function(chart, layoutItem) {
var index = chart.boxes? chart.boxes.indexOf(layoutItem) : -1;
if (index !== -1) {
chart.boxes.splice(index, 1);
}
},
/**
* Sets (or updates) options on the given `item`.
* @param {Chart} chart - the chart in which the item lives (or will be added to)
* @param {Object} item - the item to configure with the given options
* @param {Object} options - the new item options.
*/
configure: function(chart, item, options) {
var props = ['fullWidth', 'position', 'weight'];
var ilen = props.length;
var i = 0;
var prop;
for (; i<ilen; ++i) {
prop = props[i];
if (options.hasOwnProperty(prop)) {
item[prop] = options[prop];
}
}
},
/**
* Fits boxes of the given chart into the given size by having each box measure itself
* then running a fitting algorithm
* @param {Chart} chart - the chart
* @param {Number} width - the width to fit into
* @param {Number} height - the height to fit into
*/
update: function(chart, width, height) {
if (!chart) {
return;
}
var layoutOptions = chart.options.layout;
var padding = layoutOptions ? layoutOptions.padding : null;
var leftPadding = 0;
var rightPadding = 0;
var topPadding = 0;
var bottomPadding = 0;
if (!isNaN(padding)) {
// options.layout.padding is a number. assign to all
leftPadding = padding;
rightPadding = padding;
topPadding = padding;
bottomPadding = padding;
} else {
leftPadding = padding.left || 0;
rightPadding = padding.right || 0;
topPadding = padding.top || 0;
bottomPadding = padding.bottom || 0;
}
var leftBoxes = filterByPosition(chart.boxes, 'left');
var rightBoxes = filterByPosition(chart.boxes, 'right');
var topBoxes = filterByPosition(chart.boxes, 'top');
var bottomBoxes = filterByPosition(chart.boxes, 'bottom');
var chartAreaBoxes = filterByPosition(chart.boxes, 'chartArea');
// Sort boxes by weight. A higher weight is further away from the chart area
sortByWeight(leftBoxes, true);
sortByWeight(rightBoxes, false);
sortByWeight(topBoxes, true);
sortByWeight(bottomBoxes, false);
// Essentially we now have any number of boxes on each of the 4 sides.
// Our canvas looks like the following.
// The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and
// B1 is the bottom axis
// There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays
// These locations are single-box locations only, when trying to register a chartArea location that is already taken,
// an error will be thrown.
//
// |----------------------------------------------------|
// | T1 (Full Width) |
// |----------------------------------------------------|
// | | | T2 | |
// | |----|-------------------------------------|----|
// | | | C1 | | C2 | |
// | | |----| |----| |
// | | | | |
// | L1 | L2 | ChartArea (C0) | R1 |
// | | | | |
// | | |----| |----| |
// | | | C3 | | C4 | |
// | |----|-------------------------------------|----|
// | | | B1 | |
// |----------------------------------------------------|
// | B2 (Full Width) |
// |----------------------------------------------------|
//
// What we do to find the best sizing, we do the following
// 1. Determine the minimum size of the chart area.
// 2. Split the remaining width equally between each vertical axis
// 3. Split the remaining height equally between each horizontal axis
// 4. Give each layout the maximum size it can be. The layout will return it's minimum size
// 5. Adjust the sizes of each axis based on it's minimum reported size.
// 6. Refit each axis
// 7. Position each axis in the final location
// 8. Tell the chart the final location of the chart area
// 9. Tell any axes that overlay the chart area the positions of the chart area
// Step 1
var chartWidth = width - leftPadding - rightPadding;
var chartHeight = height - topPadding - bottomPadding;
var chartAreaWidth = chartWidth / 2; // min 50%
var chartAreaHeight = chartHeight / 2; // min 50%
//
|
{
"pile_set_name": "Github"
}
|
--- a/pppd/sha1.c
+++ b/pppd/sha1.c
@@ -18,7 +18,7 @@
#include <string.h>
#include <netinet/in.h> /* htonl() */
-#include <net/ppp_defs.h>
+#include "pppd.h"
#include "sha1.h"
static void
|
{
"pile_set_name": "Github"
}
|
// SPDX-License-Identifier: GPL-2.0
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <time.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
#include <sys/time.h>
#include <linux/hpet.h>
extern void hpet_open_close(int, const char **);
extern void hpet_info(int, const char **);
extern void hpet_poll(int, const char **);
extern void hpet_fasync(int, const char **);
extern void hpet_read(int, const char **);
#include <sys/poll.h>
#include <sys/ioctl.h>
struct hpet_command {
char *command;
void (*func)(int argc, const char ** argv);
} hpet_command[] = {
{
"open-close",
hpet_open_close
},
{
"info",
hpet_info
},
{
"poll",
hpet_poll
},
{
"fasync",
hpet_fasync
},
};
int
main(int argc, const char ** argv)
{
unsigned int i;
argc--;
argv++;
if (!argc) {
fprintf(stderr, "-hpet: requires command\n");
return -1;
}
for (i = 0; i < (sizeof (hpet_command) / sizeof (hpet_command[0])); i++)
if (!strcmp(argv[0], hpet_command[i].command)) {
argc--;
argv++;
fprintf(stderr, "-hpet: executing %s\n",
hpet_command[i].command);
hpet_command[i].func(argc, argv);
return 0;
}
fprintf(stderr, "do_hpet: command %s not implemented\n", argv[0]);
return -1;
}
void
hpet_open_close(int argc, const char **argv)
{
int fd;
if (argc != 1) {
fprintf(stderr, "hpet_open_close: device-name\n");
return;
}
fd = open(argv[0], O_RDONLY);
if (fd < 0)
fprintf(stderr, "hpet_open_close: open failed\n");
else
close(fd);
return;
}
void
hpet_info(int argc, const char **argv)
{
struct hpet_info info;
int fd;
if (argc != 1) {
fprintf(stderr, "hpet_info: device-name\n");
return;
}
fd = open(argv[0], O_RDONLY);
if (fd < 0) {
fprintf(stderr, "hpet_info: open of %s failed\n", argv[0]);
return;
}
if (ioctl(fd, HPET_INFO, &info) < 0) {
fprintf(stderr, "hpet_info: failed to get info\n");
goto out;
}
fprintf(stderr, "hpet_info: hi_irqfreq 0x%lx hi_flags 0x%lx ",
info.hi_ireqfreq, info.hi_flags);
fprintf(stderr, "hi_hpet %d hi_timer %d\n",
info.hi_hpet, info.hi_timer);
out:
close(fd);
return;
}
void
hpet_poll(int argc, const char **argv)
{
unsigned long freq;
int iterations, i, fd;
struct pollfd pfd;
struct hpet_info info;
struct timeval stv, etv;
struct timezone tz;
long usec;
if (argc != 3) {
fprintf(stderr, "hpet_poll: device-name freq iterations\n");
return;
}
freq = atoi(argv[1]);
iterations = atoi(argv[2]);
fd = open(argv[0], O_RDONLY);
if (fd < 0) {
fprintf(stderr, "hpet_poll: open of %s failed\n", argv[0]);
return;
}
if (ioctl(fd, HPET_IRQFREQ, freq) < 0) {
fprintf(stderr, "hpet_poll: HPET_IRQFREQ failed\n");
goto out;
}
if (ioctl(fd, HPET_INFO, &info) < 0) {
fprintf(stderr, "hpet_poll: failed to get info\n");
goto out;
}
fprintf(stderr, "hpet_poll: info.hi_flags 0x%lx\n", info.hi_flags);
if (info.hi_flags && (ioctl(fd, HPET_EPI, 0) < 0)) {
fprintf(stderr, "hpet_poll: HPET_EPI failed\n");
goto out;
}
if (ioctl(fd, HPET_IE_ON, 0) < 0) {
fprintf(stderr, "hpet_poll, HPET_IE_ON failed\n");
goto out;
}
pfd.fd = fd;
pfd.events = POLLIN;
for (i = 0; i < iterations; i++) {
pfd.revents = 0;
gettimeofday(&stv, &tz);
if (poll(&pfd, 1, -1) < 0)
fprintf(stderr, "hpet_poll: poll failed\n");
else {
long data;
gettimeofday(&etv, &tz);
usec = stv.tv_sec * 1000000 + stv.tv_usec;
usec = (etv.tv_sec * 1000000 + etv.tv_usec) - usec;
fprintf(stderr,
"hpet_poll: expired time = 0x%lx\n", usec);
fprintf(stderr, "hpet_poll: revents = 0x%x\n",
pfd.revents);
if (read(fd, &data, sizeof(data)) != sizeof(data)) {
fprintf(stderr, "hpet_poll: read failed\n");
}
else
fprintf(stderr, "hpet_poll: data 0x%lx\n",
data);
}
}
out:
close(fd);
return;
}
static int hpet_sigio_count;
static void
hpet_sigio(int val)
{
fprintf(stderr, "hpet_sigio: called\n");
hpet_sigio_count++;
}
void
hpet_fasync(int argc, const char **argv)
{
unsigned long freq;
int iterations, i, fd, value;
sig_t oldsig;
struct hpet_info info;
hpet_sigio_count = 0;
fd = -1;
if ((oldsig = signal(SIGIO, hpet_sigio)) == SIG_ERR) {
fprintf(stderr, "hpet_fasync: failed to set signal handler\n");
return;
}
if (argc != 3) {
fprintf(stderr, "hpet_fasync: device-name freq iterations\n");
goto out;
}
fd = open(argv[0], O_RDONLY);
if (fd < 0) {
fprintf(stderr, "hpet_fasync: failed to open %s\n", argv[0]);
return;
}
if ((fcntl(fd, F_SETOWN, getpid()) == 1) ||
|
{
"pile_set_name": "Github"
}
|
<?xml version='1.0' ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="include/StorageFunctions.xsl"/>
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:element name="StorageObjects">
<xsl:apply-templates select="Strings"/>
<xsl:call-template name="TaskingInfo">
<xsl:with-param name="info" select="TaskingInfo"/>
</xsl:call-template>
</xsl:element>
</xsl:template>
<xsl:template match="Strings">
<xsl:element name="ObjectValue">
<xsl:attribute name="name">Strings</xsl:attribute>
<xsl:apply-templates select="String"/>
</xsl:element>
</xsl:template>
<xsl:template match="String">
<xsl:element name="ObjectValue">
<xsl:attribute name="name">String</xsl:attribute>
<xsl:element name="StringValue">
<xsl:attribute name="name">string</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
<xsl:element name="IntValue">
<xsl:attribute name="name">offset</xsl:attribute>
<xsl:value-of select="@offset"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:transform>
|
{
"pile_set_name": "Github"
}
|
//
// Created by Fabrice Aneche on 06/01/14.
// Copyright (c) 2014 Dailymotion. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSData (ImageContentType)
/**
* Compute the content type for an image data
*
* @param data the input data
*
* @return the content type as string (i.e. image/jpeg, image/gif)
*/
+ (NSString *)sd_contentTypeForImageData:(NSData *)data;
@end
@interface NSData (ImageContentTypeDeprecated)
+ (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`");
@end
|
{
"pile_set_name": "Github"
}
|
package io.quarkus.it.panache;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
@Entity
@IdClass(ObjectWithCompositeId.ObjectKey.class)
public class ObjectWithCompositeId extends PanacheEntityBase {
@Id
public String part1;
@Id
public String part2;
public String description;
static class ObjectKey implements Serializable {
private String part1;
private String part2;
public ObjectKey() {
}
public ObjectKey(String part1, String part2) {
this.part1 = part1;
this.part2 = part2;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ObjectKey objectKey = (ObjectKey) o;
return part1.equals(objectKey.part1) &&
part2.equals(objectKey.part2);
}
@Override
public int hashCode() {
return Objects.hash(part1, part2);
}
}
}
|
{
"pile_set_name": "Github"
}
|
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: __init__.py
# Compiled at: 2012-05-08 15:43:06
pass
|
{
"pile_set_name": "Github"
}
|
{{ define "shared/style" }}
<link rel="stylesheet" href={{ Mix "/css/app.css" }}>
{{ end }}
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_Sales
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Order configuration model
*
* @category Mage
* @package Mage_Sales
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Sales_Model_Order_Config extends Mage_Core_Model_Config_Base
{
/**
* Statuses per state array
*
* @var array
*/
protected $_stateStatuses;
private $_states;
public function __construct()
{
parent::__construct(Mage::getConfig()->getNode('global/sales/order'));
}
protected function _getStatus($status)
{
return $this->getNode('statuses/'.$status);
}
protected function _getState($state)
{
return $this->getNode('states/'.$state);
}
/**
* Retrieve default status for state
*
* @param string $state
* @return string
*/
public function getStateDefaultStatus($state)
{
$status = false;
if ($stateNode = $this->_getState($state)) {
$status = Mage::getModel('sales/order_status')
->loadDefaultByState($state);
$status = $status->getStatus();
}
return $status;
}
/**
* Retrieve status label
*
* @param string $code
* @return string
*/
public function getStatusLabel($code)
{
$status = Mage::getModel('sales/order_status')
->load($code);
return $status->getStoreLabel();
}
/**
* State label getter
*
* @param string $state
* @return string
*/
public function getStateLabel($state)
{
if ($stateNode = $this->_getState($state)) {
$state = (string) $stateNode->label;
return Mage::helper('sales')->__($state);
}
return $state;
}
/**
* Retrieve all statuses
*
* @return array
*/
public function getStatuses()
{
$statuses = Mage::getResourceModel('sales/order_status_collection')
->toOptionHash();
return $statuses;
}
/**
* Order states getter
*
* @return array
*/
public function getStates()
{
$states = array();
foreach ($this->getNode('states')->children() as $state) {
$label = (string) $state->label;
$states[$state->getName()] = Mage::helper('sales')->__($label);
}
return $states;
}
/**
* Retrieve statuses available for state
* Get all possible statuses, or for specified state, or specified states array
* Add labels by default. Return plain array of statuses, if no labels.
*
* @param mixed $state
* @param bool $addLabels
* @return array
*/
public function getStateStatuses($state, $addLabels = true)
{
if (is_array($state)) {
$key = implode("|", $state) . $addLabels;
} else {
$key = $state . $addLabels;
}
if (isset($this->_stateStatuses[$key])) {
return $this->_stateStatuses[$key];
}
$statuses = array();
if (empty($state) || !is_array($state)) {
$state = array($state);
}
foreach ($state as $_state) {
if ($stateNode = $this->_getState($_state)) {
$collection = Mage::getResourceModel('sales/order_status_collection')
->addStateFilter($_state)
->orderByLabel();
foreach ($collection as $status) {
$code = $status->getStatus();
if ($addLabels) {
$statuses[$code] = $status->getStoreLabel();
} else {
$statuses[] = $code;
}
}
}
}
$this->_stateStatuses[$key] = $statuses;
return $statuses;
}
/**
* Retrieve states which are visible on front end
*
* @return array
*/
public function getVisibleOnFrontStates()
{
$this->_getStates();
return $this->_states['visible'];
}
/**
* Get order states, visible on frontend
*
* @return array
*/
public function getInvisibleOnFrontStates()
{
$this->_getStates();
return $this->_states['invisible'];
}
private function _getStates()
{
if (null === $this->_states) {
$this->_states = array(
'all' => array(),
'visible' => array(),
'invisible' => array(),
'statuses' => array(),
);
foreach ($this->getNode('states')->children() as $state) {
$name = $state->getName();
$this->_states['all'][] = $name;
$isVisibleOnFront = (string)$state->visible_on_front;
if ((bool)$isVisibleOnFront || ($state->visible_on_front && $isVisibleOnFront == '')) {
$this->_states['visible'][] = $name;
}
else {
$this->_states['invisible'][] = $name;
}
foreach ($state->statuses->children() as $status) {
$this->_states['statuses'][$name][] = $status->getName();
}
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
* {
margin: 0;
padding: 0;
}
#igs {
margin: 10px auto;
width: 700px;
height: 320px;
position: relative;
}
.ig {
position: absolute;
}
#tabs {
position: absolute;
list-style: none;
background-color: rgba(255,255,255,.5);
left: 300px;
bottom: 10px;
border-radius: 10px;
padding: 5px 0 5px 5px;
}
.tab{
float: left;
text-align: center;
line-height: 20px;
width: 20px;
height: 20px;
cursor: pointer;
overflow: hidden;
margin-right: 4px;
border-radius: 100%;
background-color: rgb(200,100,150);
}
.btn{
position: absolute;
color: #fff;
top: 110px;
width: 40px;
height: 100px;
background-color: rgba(255,255,255,.3);
font-size: 40px;
font-weight: bold;
text-align: center;
line-height: 100px;
border-radius: 5px;
margin: 0 5px;
}
.btn2{
position: absolute;
right: 0px;
}
.btn:hover{
background-color: rgba(0,0,0,.7);
}
|
{
"pile_set_name": "Github"
}
|
use azure_sdk_storage_core::{EndpointProtocol, ConnectionStringBuilder};
pub fn main() {
let account_name =
std::env::var("STORAGE_ACCOUNT").expect("Set env variable STORAGE_ACCOUNT first!");
let account_key = std::env::var("ACCOUNT_KEY").expect("Set env variable ACCOUNT_KEY first!");
let default_endpoints_protocol = std::env::var("DEFAULT_ENDPOINTS_PROTOCOL")
.expect("Set env variable DEFAULT_ENDPOINTS_PROTOCOL first!");
let default_endpoints_protocol = match &default_endpoints_protocol[..] {
"https" => EndpointProtocol::Https,
"http" => EndpointProtocol::Http,
_ => panic!("Invalid default endpoints protocol")
};
let connection_string = ConnectionStringBuilder::new()
.with_account_name(&account_name)
.with_account_key(&account_key)
.with_default_endpoints_protocol(default_endpoints_protocol)
.build();
println!("The connection string is: '{}'", connection_string);
}
|
{
"pile_set_name": "Github"
}
|
# KeyboardController
[](http://cocoapods.org/pods/KeyboardController)
[](https://travis-ci.org/michalkonturek/KeyboardController)
[](http://swift.org)
[](http://cocoapods.org/pods/KeyboardController)
[](http://twitter.com/michalkonturek)
Simplifies iOS keyboard handling.
## License
Source code of this project is available under the standard MIT license. Please see [the license file][LICENSE].
[PODS]:http://cocoapods.org/
[LICENSE]:https://github.com/michalkonturek/KeyboardController/blob/master/LICENSE
## Usage
To use `KeyboardController`, simply initialize it with an array of `UITextField` objects.
```swift
let fields = [field1!, field2!, field3!, field4!, field5!]
self.controller = KeyboardController(fields: fields)
```
You can interact with `KeyboardController` directly via the following methods:
```swift
func moveToNextField()
func moveToPreviousField()
func closeKeyboard()
```
`KeyboardController`, depending on a `returnKeyType` property of an `UITextField` instance, will:
* `UIReturnKeyNext` - move to next text field
* `UIReturnKeyDone` - close keyboard
### KeyboardControllerDelegate
You could also take advantage of delegation methods:
```swift
func controllerDidHideKeyboard(controller: KeyboardController)
func controllerDidShowKeyboard(controller: KeyboardController)
func controllerWillHideKeyboard(controller: KeyboardController)
func controllerWillShowKeyboard(controller: KeyboardController)
```
by setting a `delegate` property of a `KeyboardController`:
```swift
self.keyboardController.delegate = self;
```
### UITextFieldDelegate
There is also an option of setting a `textFieldDelegate` property of all textFields that are under control of `KeyboardController`:
```swift
self.keyboardController.textFieldDelegate = self;
```
This could be particulary useful if you would like to add individual behaviour to `UITextFields` objects.
```swift
func textFieldDidBeginEditing(_ textField: UITextField) {
if (textField == self.field4) { self.moveViewBy(-10) }
if (textField == self.field5) { self.moveViewBy(-200) }
}
func textFieldDidEndEditing(_ textField: UITextField) {
if (textField == self.field4) { self.moveViewBy(10) }
if (textField == self.field5) { self.moveViewBy(200) }
}
```
## Contributing
1. Fork it.
2. Create your feature branch (`git checkout -b new-feature`).
3. Commit your changes (`git commit -am 'Added new-feature'`).
4. Push to the branch (`git push origin new-feature`).
5. Create new Pull Request.
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="charset" content="ISO-8859-1" />
<meta http-equiv="content-language" content="English" />
<meta http-equiv="vw96.object type" content="Document" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="Global" />
<meta name="rating" content="General" />
<meta name="robots" content="all" />
<meta name="revist-after" content="2 days" />
<link rel="shortcut icon" href="../../../favicon.ico" />
<title>The Original Hip-Hop (Rap) Lyrics Archive</title>
<!-- link rel="stylesheet" type="text/css" href="http://ohhla.com/files/main.css" / -->
<!-- BEGIN SITE ANALYTICS //-->
<script type="text/javascript">
if (typeof siteanalytics == 'undefined') { siteanalytics = {}; };
siteanalytics.gn_tracking_defaults = {google: '',comscore: {},quantcast:''};
siteanalytics.website_id = 180;
siteanalytics.cdn_hostname = 'cdn.siteanalytics.evolvemediametrics.com';
</script>
<script type="text/javascript" src='http://cdn.siteanalytics.evolvemediametrics.com/js/siteanalytics.js'></script>
<!-- END SITE ANALYTICS //-->
</head>
<body>
<a href="javascript: history.go(-1)">Back to the previous page</a>
<div>
</div>
<div style="width: 720px; text-align: center; color: #ff0000; font-weight: bold; font-size: 1em;">
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style" style="margin: auto 0 auto 0; padding-left: 185px;">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4e8ea9f77f69af2f"></script>
<!-- AddThis Button END -->
</div>
<br />
<div style="float: left; min-width: 560px;">
<pre>
Artist: The Roots
Album: The Tipping Point
Song: Duck Down!
Typed by: kkbonsu@hotmail.com
[Black Thought]
Yea we gettin' ready to break y'all it's winner take all
The game is locked we down to the eight ball
The time is now, it ain't nothin' to wait for
I'm a king by blood a soldier by nature
I'm somthin' like a threat to y'all space cadets
'Cause you never met brother nothin' like me yet
So push another slice into your toast and tighten your vests
Cause it's a warrior you seein' here tonight in the flesh
I give you somthin' high voltage double dosage
Runnin' with these vultures givin' me ulcers
Which one of these hustlers bringin' the thunder
'Riq Geez not another man takin' us under
Nigga please which Philly cat doin' his own thing
Might say black my give you a code name
Round my neck see the microphone hang
Have your lady lips singin' like on soul train
The niggaz that's a problem is minimal margin
The Colonel, Capitan, Lieutenant, General Sergeant
Black, one man army move in on your squadron
You sittin' still you know you a target
You heard you better duck down!
[Chorus: repeat 2X]
See me comin' better tuck those chains
Cause you don't wanna feel them thangs
If you want it, you can get it baby
You know you need to get low
Duck Down! (Duck Down!)
[Black Thought]
Yea we gettin' set to get rid of y'all that's what it's headin' for
The underdog knuckle and brawl with the bigger ball
I spit what your wig absorb sicker than sycamore
I'm creatin' a circumstance that you a victim of
The rebel or the renegade out on the quest
The super black man runnin' wit a S on his chest
And stand for the straight struggle to escape the stress
You think it's sweet tryin' to eat, you ain't taste this yet
So make y'all steps precautious into the darkness
Thoughts cold and heartless makin' me nauseous
Gettin' more remorses for what I done
If the lawyers and courts wonder what I run
You see the liberty it's free but just for some
How you a gangster and you scared to bust your gun
For the call, trust your fam' and trust nobody at all
Seein' brothers gettin' struck down
You better duck down!
[Chorus]
[Verse 3: Black Thought]
Yeah
I can feel somethin' for sure, I've been up in here before
A gladiator in a colliseum ready for war
That old timer holdin' his revolver set to blow
Just like a gladiator at whoever stick his head in the door
And one who been through it all, anything go
Rather give it to you straight 'stead of speakin in codes
Cuz man, that bullshit can get you riddled with holes
If you ain't insured than the hospitals is close
You got to go up-town while ya leakin' on the ground
In cases like these, you need to duck down
You're five dollar toys, I'm a million dollar man
Esquire 'Riq Geez go according to plan
I'm thinkin' outside the box, off the blocks
An outside your concept of time, off the clocks for real
Well it's Black Thought your boss DJ
Whatever you brothers weigh that's what ya gonna pay
[Chorus] - 2X</pre>
</div>
<div style="float: left;">
</div>
</body></html>
|
{
"pile_set_name": "Github"
}
|
#include "ExtractionOptionsJsonObject.h"
#include <regex>
namespace polycube {
namespace service {
namespace model {
ExtractionOptionsJsonObject::ExtractionOptionsJsonObject() {
m_swapOnRead = false;
m_swapOnReadIsSet = true;
m_emptyOnRead = false;
m_emptyOnReadIsSet = true;
}
ExtractionOptionsJsonObject::ExtractionOptionsJsonObject(const nlohmann::json &val) : JsonObjectBase(val) {
m_swapOnReadIsSet = false;
m_emptyOnReadIsSet = false;
if (val.count("swap-on-read"))
setSwapOnRead(val.at("swap-on-read").get<bool>());
if (val.count("empty-on-read"))
setEmptyOnRead(val.at("empty-on-read").get<bool>());
}
nlohmann::json ExtractionOptionsJsonObject::toJson() const {
nlohmann::json val = nlohmann::json::object();
if (!getBase().is_null())
val.update(getBase());
if (m_swapOnReadIsSet)
val["swap-on-read"] = m_swapOnRead;
if (m_emptyOnReadIsSet)
val["empty-on-read"] = m_emptyOnRead;
return val;
}
bool ExtractionOptionsJsonObject::getSwapOnRead() const {
return m_swapOnRead;
}
void ExtractionOptionsJsonObject::setSwapOnRead(bool value) {
m_swapOnRead = value;
m_swapOnReadIsSet = true;
}
bool ExtractionOptionsJsonObject::swapOnReadIsSet() const {
return m_swapOnReadIsSet;
}
void ExtractionOptionsJsonObject::unsetSwapOnRead() {
m_swapOnReadIsSet = false;
}
bool ExtractionOptionsJsonObject::getEmptyOnRead() const {
return m_emptyOnRead;
}
void ExtractionOptionsJsonObject::setEmptyOnRead(bool value) {
m_emptyOnRead = value;
m_emptyOnReadIsSet = true;
}
bool ExtractionOptionsJsonObject::emptyOnReadIsSet() const {
return m_emptyOnReadIsSet;
}
void ExtractionOptionsJsonObject::unsetEmptyOnRead() {
m_emptyOnReadIsSet = false;
}
}// namespace model
}// namespace service
}// namespace polycube
|
{
"pile_set_name": "Github"
}
|
{
"id": "draft04.json",
"$schema": "draft04.json",
"description": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
},
"positiveInteger": {
"type": "integer",
"minimum": 0
},
"positiveIntegerDefault0": {
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
},
"simpleTypes": {
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
}
},
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uri"
},
"$schema": {
"type": "string",
"format": "uri"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": {},
"multipleOf": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "boolean",
"default": false
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "boolean",
"default": false
},
"maxLength": { "$ref": "#/definitions/positiveInteger" },
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"items": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" }
],
"default": {}
},
"maxItems": { "$ref": "#/definitions/positiveInteger" },
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/stringArray" }
]
}
},
"enum": {
"type": "array",
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"format": { "type": "string" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
"dependencies": {
"exclusiveMaximum": [ "maximum" ],
"exclusiveMinimum": [ "minimum" ]
},
"default": {}
}
|
{
"pile_set_name": "Github"
}
|
/*
Mantis PCI bridge driver
Copyright (C) Manu Abraham (abraham.manu@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <asm/io.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include "dmxdev.h"
#include "dvbdev.h"
#include "dvb_demux.h"
#include "dvb_frontend.h"
#include "dvb_net.h"
#include "mantis_common.h"
#include "mantis_reg.h"
#include "mantis_i2c.h"
#define TRIALS 10000
static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
u32 rxd, i, stat, trials;
dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ",
__func__, msg->addr);
for (i = 0; i < msg->len; i++) {
rxd = (msg->addr << 25) | (1 << 24)
| MANTIS_I2C_RATE_3
| MANTIS_I2C_STOP
| MANTIS_I2C_PGMODE;
if (i == (msg->len - 1))
rxd &= ~MANTIS_I2C_STOP;
mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(rxd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
for (trials = 0; trials < TRIALS; trials++) {
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
}
dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
/* wait for xfer completion */
for (trials = 0; trials < TRIALS; trials++) {
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CRACK)
break;
}
dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
rxd = mmread(MANTIS_I2CDATA_CTL);
msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
}
dprintk(MANTIS_INFO, 0, "]\n");
return 0;
}
static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
int i;
u32 txd = 0, stat, trials;
dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ",
__func__, msg->addr);
for (i = 0; i < msg->len; i++) {
dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
txd = (msg->addr << 25) | (msg->buf[i] << 8)
| MANTIS_I2C_RATE_3
| MANTIS_I2C_STOP
| MANTIS_I2C_PGMODE;
if (i == (msg->len - 1))
txd &= ~MANTIS_I2C_STOP;
mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(txd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
for (trials = 0; trials < TRIALS; trials++) {
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
}
dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
/* wait for xfer completion */
for (trials = 0; trials < TRIALS; trials++) {
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CRACK)
break;
}
dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
}
dprintk(MANTIS_INFO, 0, "]\n");
return 0;
}
static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
{
int ret = 0, i = 0, trials;
u32 stat, data, txd;
struct mantis_pci *mantis;
struct mantis_hwconfig *config;
mantis = i2c_get_adapdata(adapter);
BUG_ON(!mantis);
config = mantis->hwconfig;
BUG_ON(!config);
dprintk(MANTIS_DEBUG, 1, "Messages:%d", num);
mutex_lock(&mantis->i2c_lock);
while (i < num) {
/* Byte MODE */
if ((config->i2c_mode & MANTIS_BYTE_MODE) &&
((i + 1) < num) &&
(msgs[i].len < 2) &&
(msgs[i + 1].len < 2) &&
(msgs[i + 1].flags & I2C_M_RD)) {
dprintk(MANTIS_DEBUG, 0, " Byte MODE:\n");
/* Read operation */
txd = msgs[i].addr << 25 | (0x1 << 24)
| (msgs[i].buf[0] << 16)
| MANTIS_I2C_RATE_3;
mmwrite(txd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
for (trials = 0; trials < TRIALS; trials++) {
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
}
/* check for xfer completion */
if (stat & MANTIS_INT_I2CDONE) {
/* check xfer was acknowledged */
if (stat & MANTIS_INT_I2CRACK) {
data = mmread(MANTIS_I2CDATA_CTL);
msgs[i + 1].buf[0] = (data >> 8) & 0xff;
dprintk(MANTIS_DEBUG, 0, " Byte <%d> RXD=0x%02x [%02x]\n", 0x0, data, msgs[i + 1].buf[0]);
} else {
/* I/O error */
dprintk(MANTIS_ERROR, 1, " I/O error, LINE:%d", __LINE__);
ret = -EIO;
break;
}
} else {
/* I/O error */
dprintk(MANTIS_ERROR, 1, " I/O error, LINE:%d", __LINE__);
ret = -EIO;
break;
}
i += 2; /* Write/Read operation in one go */
}
if (i < num) {
if (msgs[i].flags & I2C_M_
|
{
"pile_set_name": "Github"
}
|
chef-integration-test_1.1-1_amd64.deb ruby extra
|
{
"pile_set_name": "Github"
}
|
version: '2'
services:
web:
image: nginx:latest
ports:
- "8080:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/default.conf
networks:
- code-network
php:
image: php:fpm
volumes:
- ./code:/code
networks:
- code-network
networks:
code-network:
driver: bridge
|
{
"pile_set_name": "Github"
}
|
<?php
final class PhabricatorFileDropUploadController
extends PhabricatorFileController {
public function shouldAllowRestrictedParameter($parameter_name) {
// Prevent false positives from file content when it is submitted via
// drag-and-drop upload.
return true;
}
/**
* @phutil-external-symbol class PhabricatorStartup
*/
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
// NOTE: Throws if valid CSRF token is not present in the request.
$request->validateCSRF();
$name = $request->getStr('name');
$file_phid = $request->getStr('phid');
// If there's no explicit view policy, make it very restrictive by default.
// This is the correct policy for files dropped onto objects during
// creation, comment and edit flows.
$view_policy = $request->getStr('viewPolicy');
if (!$view_policy) {
$view_policy = $viewer->getPHID();
}
$is_chunks = $request->getBool('querychunks');
if ($is_chunks) {
$params = array(
'filePHID' => $file_phid,
);
$result = id(new ConduitCall('file.querychunks', $params))
->setUser($viewer)
->execute();
return id(new AphrontAjaxResponse())->setContent($result);
}
$is_allocate = $request->getBool('allocate');
if ($is_allocate) {
$params = array(
'name' => $name,
'contentLength' => $request->getInt('length'),
'viewPolicy' => $view_policy,
);
$result = id(new ConduitCall('file.allocate', $params))
->setUser($viewer)
->execute();
$file_phid = $result['filePHID'];
if ($file_phid) {
$file = $this->loadFile($file_phid);
$result += $file->getDragAndDropDictionary();
}
return id(new AphrontAjaxResponse())->setContent($result);
}
// Read the raw request data. We're either doing a chunk upload or a
// vanilla upload, so we need it.
$data = PhabricatorStartup::getRawInput();
$is_chunk_upload = $request->getBool('uploadchunk');
if ($is_chunk_upload) {
$params = array(
'filePHID' => $file_phid,
'byteStart' => $request->getInt('byteStart'),
'data' => $data,
);
$result = id(new ConduitCall('file.uploadchunk', $params))
->setUser($viewer)
->execute();
$file = $this->loadFile($file_phid);
if ($file->getIsPartial()) {
$result = array();
} else {
$result = array(
'complete' => true,
) + $file->getDragAndDropDictionary();
}
return id(new AphrontAjaxResponse())->setContent($result);
}
$file = PhabricatorFile::newFromXHRUpload(
$data,
array(
'name' => $request->getStr('name'),
'authorPHID' => $viewer->getPHID(),
'viewPolicy' => $view_policy,
'isExplicitUpload' => true,
));
$result = $file->getDragAndDropDictionary();
return id(new AphrontAjaxResponse())->setContent($result);
}
private function loadFile($file_phid) {
$viewer = $this->getViewer();
$file = id(new PhabricatorFileQuery())
->setViewer($viewer)
->withPHIDs(array($file_phid))
->executeOne();
if (!$file) {
throw new Exception(pht('Failed to load file.'));
}
return $file;
}
}
|
{
"pile_set_name": "Github"
}
|
/**
* Durandal 2.0.1 Copyright (c) 2012 Blue Spire Consulting, Inc. All Rights Reserved.
* Available via the MIT license.
* see: http://durandaljs.com or https://github.com/BlueSpire/Durandal for details.
*/
/**
* The viewLocator module collaborates with the viewEngine module to provide views (literally dom sub-trees) to other parts of the framework as needed. The primary consumer of the viewLocator is the composition module.
* @module viewLocator
* @requires system
* @requires viewEngine
*/
define(['durandal/system', 'durandal/viewEngine'], function (system, viewEngine) {
function findInElements(nodes, url) {
for (var i = 0; i < nodes.length; i++) {
var current = nodes[i];
var existingUrl = current.getAttribute('data-view');
if (existingUrl == url) {
return current;
}
}
}
function escape(str) {
return (str + '').replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
}
/**
* @class ViewLocatorModule
* @static
*/
return {
/**
* Allows you to set up a convention for mapping module folders to view folders. It is a convenience method that customizes `convertModuleIdToViewId` and `translateViewIdToArea` under the covers.
* @method useConvention
* @param {string} [modulesPath] A string to match in the path and replace with the viewsPath. If not specified, the match is 'viewmodels'.
* @param {string} [viewsPath] The replacement for the modulesPath. If not specified, the replacement is 'views'.
* @param {string} [areasPath] Partial views are mapped to the "views" folder if not specified. Use this parameter to change their location.
*/
useConvention: function(modulesPath, viewsPath, areasPath) {
modulesPath = modulesPath || 'viewmodels';
viewsPath = viewsPath || 'views';
areasPath = areasPath || viewsPath;
var reg = new RegExp(escape(modulesPath), 'gi');
this.convertModuleIdToViewId = function (moduleId) {
return moduleId.replace(reg, viewsPath);
};
this.translateViewIdToArea = function (viewId, area) {
if (!area || area == 'partial') {
return areasPath + '/' + viewId;
}
return areasPath + '/' + area + '/' + viewId;
};
},
/**
* Maps an object instance to a view instance.
* @method locateViewForObject
* @param {object} obj The object to locate the view for.
* @param {string} [area] The area to translate the view to.
* @param {DOMElement[]} [elementsToSearch] An existing set of elements to search first.
* @return {Promise} A promise of the view.
*/
locateViewForObject: function(obj, area, elementsToSearch) {
var view;
if (obj.getView) {
view = obj.getView();
if (view) {
return this.locateView(view, area, elementsToSearch);
}
}
if (obj.viewUrl) {
return this.locateView(obj.viewUrl, area, elementsToSearch);
}
var id = system.getModuleId(obj);
if (id) {
return this.locateView(this.convertModuleIdToViewId(id), area, elementsToSearch);
}
return this.locateView(this.determineFallbackViewId(obj), area, elementsToSearch);
},
/**
* Converts a module id into a view id. By default the ids are the same.
* @method convertModuleIdToViewId
* @param {string} moduleId The module id.
* @return {string} The view id.
*/
convertModuleIdToViewId: function(moduleId) {
return moduleId;
},
/**
* If no view id can be determined, this function is called to genreate one. By default it attempts to determine the object's type and use that.
* @method determineFallbackViewId
* @param {object} obj The object to determine the fallback id for.
* @return {string} The view id.
*/
determineFallbackViewId: function (obj) {
var funcNameRegex = /function (.{1,})\(/;
var results = (funcNameRegex).exec((obj).constructor.toString());
var typeName = (results && results.length > 1) ? results[1] : "";
return 'views/' + typeName;
},
/**
* Takes a view id and translates it into a particular area. By default, no translation occurs.
* @method translateViewIdToArea
* @param {string} viewId The view id.
* @param {string} area The area to translate the view to.
* @return {string} The translated view id.
*/
translateViewIdToArea: function (viewId, area) {
return viewId;
},
/**
* Locates the specified view.
* @method locateView
* @param {string|DOMElement} viewOrUrlOrId A view, view url or view id to locate.
* @param {string} [area] The area to translate the view to.
* @param {DOMElement[]} [elementsToSearch] An existing set of elements to search first.
* @return {Promise} A promise of the view.
*/
locateView: function(viewOrUrlOrId, area, elementsToSearch) {
if (typeof viewOrUrlOrId === 'string') {
var viewId;
if (viewEngine.isViewUrl(viewOrUrlOrId)) {
viewId = viewEngine.convertViewUrlToViewId(viewOrUrlOrId);
} else {
viewId = viewOrUrlOrId;
}
if (area) {
viewId = this.translateViewIdToArea(viewId, area);
}
if (elementsToSearch) {
var existing = findInElements(elementsToSearch, viewId);
if (existing) {
return system.defer(function(dfd) {
dfd.resolve(existing);
}).promise();
}
}
return viewEngine.createView(viewId);
}
return system.defer(function(dfd) {
dfd.resolve(viewOrUrlOrId);
}).promise();
}
};
});
|
{
"pile_set_name": "Github"
}
|
#include <elle/das/tuple.hh>
#include <elle/test.hh>
#include <elle/serialization/json.hh>
#include <elle/das/Symbol.hh>
#include <elle/das/serializer.hh>
ELLE_DAS_SYMBOL(foo);
ELLE_DAS_SYMBOL(bar);
static
void
basics()
{
auto t = elle::das::make_tuple(foo = 3, bar = "lol");
BOOST_CHECK_EQUAL(t.foo, 3);
BOOST_CHECK_EQUAL(t.bar, "lol");
}
static
void
move()
{
elle::das::make_tuple(foo = elle::make_unique<int>(42),
bar = std::vector<int>());
auto f = elle::make_unique<int>(42);
auto b = std::vector<int>();
elle::das::make_tuple(foo = std::move(f), bar = b);
}
static
void
print()
{
auto t = elle::das::make_tuple(foo = 3, bar = "lol");
BOOST_CHECK_EQUAL(elle::sprintf("%s", t), "(foo = 3, bar = lol)");
}
static
void
serialize()
{
auto t = elle::das::make_tuple(foo = 3, bar = std::string("lol"));
auto s = elle::serialization::json::serialize(t);
auto j = elle::json::read(s.string());
BOOST_CHECK(j["foo"] == 3);
BOOST_CHECK(j["bar"] == "lol");
auto d = elle::serialization::json::deserialize<decltype(t)>(s);
BOOST_CHECK(d.foo == t.foo);
BOOST_CHECK(d.bar == t.bar);
}
static
void
hash()
{
using elle::das::make_tuple;
BOOST_TEST(
hash_value(elle::das::make_tuple()) ==
hash_value(elle::das::make_tuple()));
BOOST_TEST(
hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) ==
hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))));
BOOST_TEST(
hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) !=
hash_value(elle::das::make_tuple(foo = 4, bar = std::string("lol"))));
BOOST_TEST(
hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) !=
hash_value(elle::das::make_tuple(foo = 3, bar = std::string("bar"))));
BOOST_TEST(
hash_value(elle::das::make_tuple(foo = 3, bar = std::string("lol"))) !=
hash_value(elle::das::make_tuple(bar = std::string("lol"), foo = 3)));
}
static
void
compare()
{
BOOST_TEST(
elle::das::make_tuple() ==
elle::das::make_tuple());
BOOST_TEST(
elle::das::make_tuple(foo = 3, bar = std::string("lol")) ==
elle::das::make_tuple(foo = 3, bar = std::string("lol")));
BOOST_TEST(
elle::das::make_tuple(foo = 3, bar = std::string("lol")) !=
elle::das::make_tuple(foo = 4, bar = std::string("lol")));
BOOST_TEST(
elle::das::make_tuple(foo = 3, bar = std::string("lol")) !=
elle::das::make_tuple(foo = 3, bar = std::string("bar")));
}
/*-------.
| Driver |
`-------*/
ELLE_TEST_SUITE()
{
auto& master = boost::unit_test::framework::master_test_suite();
master.add(BOOST_TEST_CASE(basics));
master.add(BOOST_TEST_CASE(move));
master.add(BOOST_TEST_CASE(print));
master.add(BOOST_TEST_CASE(serialize));
master.add(BOOST_TEST_CASE(hash));
master.add(BOOST_TEST_CASE(compare));
}
|
{
"pile_set_name": "Github"
}
|
@echo off
reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set UNAME=i686 || set UNAME=amd64
set PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files\Git\bin
FOR /F "tokens=1 delims=" %%A in ('git describe --abbrev^=0 --tags') do SET VERSION=%%A
set DIR=%0\..\..
set DISTNAME=glitch-windows-%UNAME%-%VERSION%
set DISTDIR=%DIR%\dist\%DISTNAME%
mkdir %DISTDIR%
windres -i %DIR%\dist\glitch.rc -O coff -o %DIR%\cmd\glitch\glitch_rc.syso
go generate github.com/naivesound/glitch/cmd/glitch
go test github.com/naivesound/glitch/...
go vet github.com/naivesound/glitch/...
go build -ldflags "-H windowsgui" -o %DISTDIR%\glitch.exe github.com/naivesound/glitch/cmd/glitch
copy /y %DIR%\LICENSE %DISTDIR%\LICENSE.txt
xcopy /y %DIR%\API.md %DISTDIR%
xcopy /i /y %DIR%\examples %DISTDIR%\examples
xcopy /i /y %DIR%\samples %DISTDIR%\samples
cd %DIR%/dist
7z a %DISTNAME%.zip %DISTNAME%
|
{
"pile_set_name": "Github"
}
|
// Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
#pragma once
namespace Designer
{
class Model;
enum ECompilerFlag
{
eCompiler_CastShadow = BIT(1),
eCompiler_Physicalize = BIT(2),
eCompiler_General = eCompiler_CastShadow | eCompiler_Physicalize
};
//! This class plays a role of creating engine resources used for rendering and physicalizing out of the Designer::Model instance.
class ModelCompiler : public _i_reference_target_t
{
public:
ModelCompiler(int nCompilerFlag);
ModelCompiler(const ModelCompiler& compiler);
virtual ~ModelCompiler();
bool IsValid() const;
void Compile(CBaseObject* pBaseObject, Model* pModel, ShelfID shelfID = eShelf_Any, bool bUpdateOnlyRenderNode = false);
void DeleteAllRenderNodes();
void DeleteRenderNode(ShelfID shelfID);
IRenderNode* GetRenderNode() { return m_pRenderNode[0]; }
void UpdateHighlightPassState(bool bSelected, bool bHighlighted);
bool GetIStatObj(_smart_ptr<IStatObj>* pStatObj);
bool CreateIndexdMesh(Model* pModel, IIndexedMesh* pMesh, bool bCreateBackFaces);
void SaveToCgf(const char* filename);
void SetViewDistRatio(int nViewDistRatio) { m_viewDistRatio = nViewDistRatio; }
int GetViewDistRatio() const { return m_viewDistRatio; }
void SetRenderFlags(uint64 nRenderFlag) { m_RenderFlags = nRenderFlag; }
uint64 GetRenderFlags() const { return m_RenderFlags; }
void SetStaticObjFlags(int nStaticObjFlag);
int GetStaticObjFlags();
void SetSelected(bool bSelect);
void AddFlags(int nFlags) { m_nCompilerFlag |= nFlags; }
void RemoveFlags(int nFlags) { m_nCompilerFlag &= (~nFlags); }
bool CheckFlags(int nFlags) const { return (m_nCompilerFlag & nFlags) ? true : false; }
void SaveMesh(CArchive& ar, CBaseObject* pObj, Model* pModel);
bool LoadMesh(CArchive& ar, CBaseObject* pObj, Model* pModel);
bool SaveMesh(int nVersion, std::vector<char>& buffer, CBaseObject* pObj, Model* pModel);
bool LoadMesh(int nVersion, std::vector<char>& buffer, CBaseObject* pObj, Model* pModel);
private:
bool UpdateMesh(CBaseObject* pBaseObject, Model* pModel, ShelfID nShelf);
void UpdateRenderNode(CBaseObject* pBaseObject, ShelfID nShelf);
void RemoveStatObj(ShelfID nShelf);
void CreateStatObj(ShelfID nShelf);
IMaterial* GetMaterialFromBaseObj(CBaseObject* pObj) const;
void InvalidateStatObj(IStatObj* pStatObj, bool bPhysics);
private:
mutable IStatObj* m_pStatObj[cShelfMax];
mutable IRenderNode* m_pRenderNode[cShelfMax];
uint64 m_RenderFlags;
int m_viewDistRatio;
int m_nCompilerFlag;
};
}
|
{
"pile_set_name": "Github"
}
|
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2012 Giacomo Po <gpo@ucla.edu>
// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <cmath>
#include "../../test/sparse_solver.h"
#include <Eigen/IterativeSolvers>
template<typename T> void test_minres_T()
{
// Identity preconditioner
MINRES<SparseMatrix<T>, Lower, IdentityPreconditioner > minres_colmajor_lower_I;
MINRES<SparseMatrix<T>, Upper, IdentityPreconditioner > minres_colmajor_upper_I;
// Diagonal preconditioner
MINRES<SparseMatrix<T>, Lower, DiagonalPreconditioner<T> > minres_colmajor_lower_diag;
MINRES<SparseMatrix<T>, Upper, DiagonalPreconditioner<T> > minres_colmajor_upper_diag;
MINRES<SparseMatrix<T>, Lower|Upper, DiagonalPreconditioner<T> > minres_colmajor_uplo_diag;
// call tests for SPD matrix
CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_I) );
CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_I) );
CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_diag) );
CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_diag) );
CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_uplo_diag) );
// TO DO: symmetric semi-definite matrix
// TO DO: symmetric indefinite matrix
}
void test_minres()
{
CALL_SUBTEST_1(test_minres_T<double>());
// CALL_SUBTEST_2(test_minres_T<std::compex<double> >());
}
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) Rich Hickey. All rights reserved.
* The use and distribution terms for this software are covered by the
* Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
* which can be found in the file epl-v10.html at the root of this distribution.
* By using this software in any fashion, you are agreeing to be bound by
* the terms of this license.
* You must not remove this notice, or any other, from this software.
**/
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Clojure")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Clojure")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("92a6be2b-759d-4d62-8912-9dde0052bc33")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.3")]
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
|
{
"pile_set_name": "Github"
}
|
#define YEAR 2013
#define STATUS "release"
#ifndef ROOT_DIR
#define ROOT_DIR ".."
#endif
#define BUILD_DIR ROOT_DIR + "/build/NetBox/
#ifndef SOURCE_DIR
#define SOURCE_DIR ROOT_DIR + "/src/NetBox"
#endif
#ifndef OUTPUT_DIR
#define OUTPUT_DIR ROOT_DIR + "/build"
#endif
#ifndef BINARIES_DIR_FAR2
#define BINARIES_DIR_FAR2 BUILD_DIR + "/Far2"
#endif
#ifndef BINARIES_DIR_FAR3
#define BINARIES_DIR_FAR3 BUILD_DIR + "/Far3"
#endif
#ifndef PUTTY_SOURCE_DIR
#define PUTTY_SOURCE_DIR "C:/Program Files/Putty"
#endif
#define FileSourceMain_Far2x86 BINARIES_DIR_FAR2 + "/x86/NetBox.dll"
#define FileSourceMain_Far2x64 BINARIES_DIR_FAR2 + "/x64/NetBox.dll"
#define FileSourceMain_Far3x86 BINARIES_DIR_FAR3 + "/x86/NetBox.dll"
#define FileSourceMain_Far3x64 BINARIES_DIR_FAR3 + "/x64/NetBox.dll"
#define FileSourceEng SOURCE_DIR + "/NetBoxEng.lng"
#define FileSourceRus SOURCE_DIR + "/NetBoxRus.lng"
#define FileSourceChangeLog ROOT_DIR + "/ChangeLog"
#define FileSourceReadmeEng ROOT_DIR + "/README.md"
#define FileSourceReadmeRu ROOT_DIR + "/README.RU.md"
#define FileSourceLicense ROOT_DIR + "/LICENSE.txt"
#define PluginSubDirName "NetBox"
#define Major
#define Minor
#define Rev
#define Build
#expr ParseVersion(FileSourceMain_Far2x86, Major, Minor, Rev, Build)
#define Version Str(Major) + "." + Str(Minor) + (Rev > 0 ? "." + Str(Rev) : "") + \
(STATUS != "" ? " " + STATUS : "")
[Setup]
AppId=netbox
AppMutex=NetBox
AppName=NetBox plugin for Far2/Far3
AppPublisher=Michael Lukashov
AppPublisherURL=https://github.com/michaellukashov/Far-NetBox
AppSupportURL=http://forum.farmanager.com/viewtopic.php?f=39&t=6638
AppUpdatesURL=http://plugring.farmanager.com/plugin.php?pid=859&l=en
VersionInfoCompany=Michael Lukashov
VersionInfoDescription=Setup for NetBox plugin for Far2/Far3 {#Version}
VersionInfoVersion={#Major}.{#Minor}.{#Rev}.{#Build}
VersionInfoTextVersion={#Version}
VersionInfoCopyright=(c) 2011-{#YEAR} Michael Lukashov
DefaultDirName={pf}\Far Manager\Plugins\{#PluginSubDirName}
UsePreviousAppDir=false
DisableProgramGroupPage=true
LicenseFile=licence.setup
; UninstallDisplayIcon={app}\winscp.ico
OutputDir={#OUTPUT_DIR}
DisableStartupPrompt=yes
AppVersion={#Version}
AppVerName=NetBox plugin for Far2/Far3 {#Version}
OutputBaseFilename=FarNetBox-{#Major}.{#Minor}.{#Rev}_Far2_Far3_x86_x64
Compression=lzma2/ultra
SolidCompression=yes
PrivilegesRequired=none
Uninstallable=no
MinVersion=5.1
DisableDirPage=yes
; AlwaysShowDirOnReadyPage=yes
ArchitecturesInstallIn64BitMode=x64
[Types]
Name: full; Description: "Full installation"
; Name: compact; Description: "Compact installation"
Name: custom; Description: "Custom installation"; Flags: iscustom
; Languages: en ru
[Components]
Name: main_far2_x86; Description: "NetBox for Far2/x86"; Types: full custom; check: IsFar2X86Installed
Name: main_far2_x64; Description: "NetBox for Far2/x64"; Types: full custom; check: IsWin64 and IsFar3X64Installed
Name: main_far3_x86; Description: "NetBox for Far3/x86"; Types: full custom; check: IsFar3X86Installed
Name: main_far3_x64; Description: "NetBox for Far3/x64"; Types: full custom; check: IsWin64 and IsFar3X64Installed
; Name: pageant; Description: "Pageant (SSH authentication agent)"; Types: full
; Name: puttygen; Description: "PuTTYgen (key generator)"; Types: full
[Files]
Source: "{#FileSourceMain_Far2x86}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion
Source: "{#FileSourceMain_Far2x64}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion
Source: "{#FileSourceMain_Far3x86}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion
Source: "{#FileSourceMain_Far3x64}"; DestName: "NetBox.dll"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion
Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion
Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion
Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion
Source: "{#FileSourceEng}"; DestName: "NetBoxEng.lng"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion
Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion
Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion
Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main_far3_x86; Flags: ignoreversion
Source: "{#FileSourceRus}"; DestName: "NetBoxRus.lng"; DestDir: "{code:GetPlugin3X64Dir}"; Components: main_far3_x64; Flags: ignoreversion
Source: "{#FileSourceChangeLog}"; DestName: "ChangeLog"; DestDir: "{code:GetPlugin2X86Dir}"; Components: main_far2_x86; Flags: ignoreversion
Source: "{#FileSourceChangeLog}"; DestName: "ChangeLog"; DestDir: "{code:GetPlugin2X64Dir}"; Components: main_far2_x64; Flags: ignoreversion
Source: "{#FileSourceChangeLog}"; DestName: "ChangeLog"; DestDir: "{code:GetPlugin3X86Dir}"; Components: main
|
{
"pile_set_name": "Github"
}
|
/* fre:ac - free audio converter
* Copyright (C) 2001-2020 Robert Kausch <robert.kausch@freac.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
#include <dialogs/config/configcomponent.h>
#include <config.h>
#include <resources.h>
#ifdef __WIN32__
# include <smooth/init.win32.h>
#endif
using namespace BoCA;
using namespace BoCA::AS;
freac::ConfigComponentDialog::ConfigComponentDialog(Component *component)
{
BoCA::Config *config = BoCA::Config::Get();
BoCA::I18n *i18n = BoCA::I18n::Get();
i18n->SetContext("Configuration");
layer = component->GetConfigurationLayer();
if (layer != NIL)
{
mainWnd = new Window(component->GetName(), Point(config->GetIntValue(Config::CategorySettingsID, Config::SettingsWindowPosXID, Config::SettingsWindowPosXDefault), config->GetIntValue(Config::CategorySettingsID, Config::SettingsWindowPosYID, Config::SettingsWindowPosYDefault)) + Point(60, 60), layer->GetSize() + Size(8, 73));
mainWnd->SetRightToLeft(i18n->IsActiveLanguageRightToLeft());
mainWnd_titlebar = new Titlebar(TB_CLOSEBUTTON);
divbar = new Divider(39, OR_HORZ | OR_BOTTOM);
btn_cancel = new Button(i18n->TranslateString("Cancel"), Point(175, 29), Size());
btn_cancel->onAction.Connect(&ConfigComponentDialog::Cancel, this);
btn_cancel->SetOrientation(OR_LOWERRIGHT);
btn_ok = new Button(i18n->TranslateString("OK"), btn_cancel->GetPosition() - Point(88, 0), Size());
btn_ok->onAction.Connect(&ConfigComponentDialog::OK, this);
btn_ok->SetOrientation(OR_LOWERRIGHT);
Add(mainWnd);
mainWnd->Add(mainWnd_titlebar);
mainWnd->Add(divbar);
mainWnd->Add(btn_ok);
mainWnd->Add(btn_cancel);
mainWnd->GetMainLayer()->Add(layer);
mainWnd->SetFlags(mainWnd->GetFlags() | WF_NOTASKBUTTON | WF_MODAL);
mainWnd->SetIcon(ImageLoader::Load(String(Config::Get()->resourcesPath).Append("icons/freac.png")));
#ifdef __WIN32__
mainWnd->SetIconDirect(LoadImageA(hInstance, MAKEINTRESOURCEA(IDI_ICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
#endif
}
else
{
mainWnd = NIL;
mainWnd_titlebar = NIL;
btn_cancel = NIL;
btn_ok = NIL;
divbar = NIL;
}
}
freac::ConfigComponentDialog::~ConfigComponentDialog()
{
if (layer == NIL) return;
DeleteObject(mainWnd_titlebar);
DeleteObject(mainWnd);
DeleteObject(btn_ok);
DeleteObject(btn_cancel);
DeleteObject(divbar);
}
const Error &freac::ConfigComponentDialog::ShowDialog()
{
if (layer != NIL) mainWnd->WaitUntilClosed();
else error = Error();
return error;
}
Void freac::ConfigComponentDialog::OK()
{
if (layer->SaveSettings() == Error()) return;
mainWnd->Close();
}
Void freac::ConfigComponentDialog::Cancel()
{
mainWnd->Close();
}
|
{
"pile_set_name": "Github"
}
|
--- record.c.orig 2001-08-14 20:10:46.000000000 +0800
+++ record.c 2011-09-05 15:09:11.000000000 +0800
@@ -31,14 +31,18 @@
** May 25, 2000 Ver 1.0
*/
-#include<stdio.h>
-#include<fcntl.h>
-#include<sys/types.h>
-#include<pwd.h>
-#include<ctype.h>
-#include<errno.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <ctype.h>
+#include <errno.h>
-#include"record.h"
+#include "record.h"
+#include "xjump.h"
#define FS '\t' /* field separator */
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Customer\Controller\Adminhtml\Index;
class Wishlist extends \Magento\Customer\Controller\Adminhtml\Index
{
/**
* Wishlist Action
*
* @return \Magento\Framework\View\Result\Layout
*/
public function execute()
{
$customerId = $this->initCurrentCustomer();
$itemId = (int)$this->getRequest()->getParam('delete');
if ($customerId && $itemId) {
try {
$this->_objectManager->create(\Magento\Wishlist\Model\Item::class)->load($itemId)->delete();
} catch (\Exception $exception) {
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($exception);
}
}
$resultLayout = $this->resultLayoutFactory->create();
return $resultLayout;
}
}
|
{
"pile_set_name": "Github"
}
|
import { ChildProcessReporter } from '@integration/testing-tools';
import { serenity, StreamReporter } from '@serenity-js/core';
export = function () {
this.setDefaultTimeout(5000);
serenity.configure({
crew: [
new ChildProcessReporter(),
new StreamReporter(),
],
});
};
|
{
"pile_set_name": "Github"
}
|
/*
* linux/fs/super.c
*
* (C) 1991 Linus Torvalds
*/
/*
* super.c contains code to handle the super-block tables.
*/
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <errno.h>
#include <sys/stat.h>
int sync_dev(int dev);
void wait_for_keypress(void);
/* set_bit uses setb, as gas doesn't recognize setc */
#define set_bit(bitnr,addr) ({ \
register int __res __asm__("ax"); \
__asm__("bt %2,%3;setb %%al":"=a" (__res):"a" (0),"r" (bitnr),"m" (*(addr))); \
__res; })
struct super_block super_block[NR_SUPER];
/* this is initialized in init/main.c */
int ROOT_DEV = 0;
static void lock_super(struct super_block * sb)
{
cli();
while (sb->s_lock)
sleep_on(&(sb->s_wait));
sb->s_lock = 1;
sti();
}
static void free_super(struct super_block * sb)
{
cli();
sb->s_lock = 0;
wake_up(&(sb->s_wait));
sti();
}
static void wait_on_super(struct super_block * sb)
{
cli();
while (sb->s_lock)
sleep_on(&(sb->s_wait));
sti();
}
struct super_block * get_super(int dev)
{
struct super_block * s;
if (!dev)
return NULL;
s = 0+super_block;
while (s < NR_SUPER+super_block)
if (s->s_dev == dev) {
wait_on_super(s);
if (s->s_dev == dev)
return s;
s = 0+super_block;
} else
s++;
return NULL;
}
void put_super(int dev)
{
struct super_block * sb;
struct m_inode * inode;
int i;
if (dev == ROOT_DEV) {
printk("root diskette changed: prepare for armageddon\n\r");
return;
}
if (!(sb = get_super(dev)))
return;
if (sb->s_imount) {
printk("Mounted disk changed - tssk, tssk\n\r");
return;
}
lock_super(sb);
sb->s_dev = 0;
for(i=0;i<I_MAP_SLOTS;i++)
brelse(sb->s_imap[i]);
for(i=0;i<Z_MAP_SLOTS;i++)
brelse(sb->s_zmap[i]);
free_super(sb);
return;
}
static struct super_block * read_super(int dev)
{
struct super_block * s;
struct buffer_head * bh;
int i,block;
if (!dev)
return NULL;
check_disk_change(dev);
if (s = get_super(dev))
return s;
for (s = 0+super_block ;; s++) {
if (s >= NR_SUPER+super_block)
return NULL;
if (!s->s_dev)
break;
}
s->s_dev = dev;
s->s_isup = NULL;
s->s_imount = NULL;
s->s_time = 0;
s->s_rd_only = 0;
s->s_dirt = 0;
lock_super(s);
if (!(bh = bread(dev,1))) {
s->s_dev=0;
free_super(s);
return NULL;
}
*((struct d_super_block *) s) =
*((struct d_super_block *) bh->b_data);
brelse(bh);
if (s->s_magic != SUPER_MAGIC) {
s->s_dev = 0;
free_super(s);
return NULL;
}
for (i=0;i<I_MAP_SLOTS;i++)
s->s_imap[i] = NULL;
for (i=0;i<Z_MAP_SLOTS;i++)
s->s_zmap[i] = NULL;
block=2;
for (i=0 ; i < s->s_imap_blocks ; i++)
if (s->s_imap[i]=bread(dev,block))
block++;
else
break;
for (i=0 ; i < s->s_zmap_blocks ; i++)
if (s->s_zmap[i]=bread(dev,block))
block++;
else
break;
if (block != 2+s->s_imap_blocks+s->s_zmap_blocks) {
for(i=0;i<I_MAP_SLOTS;i++)
brelse(s->s_imap[i]);
for(i=0;i<Z_MAP_SLOTS;i++)
brelse(s->s_zmap[i]);
s->s_dev=0;
free_super(s);
return NULL;
}
s->s_imap[0]->b_data[0] |= 1;
s->s_zmap[0]->b_data[0] |= 1;
free_super(s);
return s;
}
int sys_umount(char * dev_name)
{
struct m_inode * inode;
struct super_block * sb;
int dev;
if (!(inode=namei(dev_name)))
return -ENOENT;
dev = inode->i_zone[0];
if (!S_ISBLK(inode->i_mode)) {
iput(inode);
return -ENOTBLK;
}
iput(inode);
if (dev==ROOT_DEV)
return -EBUSY;
if (!(sb=get_super(dev)) || !(sb->s_imount))
return -ENOENT;
if (!sb->s_imount->i_mount)
printk("Mounted inode has i_mount=0\n");
for (inode=inode_table+0 ; inode<inode_table+NR_INODE ; inode++)
if (inode->i_dev==dev && inode->i_count)
return -EBUSY;
sb->s_imount->i_mount=0;
iput(sb->s_imount);
sb->s_imount = NULL;
iput(sb->s_isup);
sb->s_isup = NULL;
put_super(dev);
sync_dev(dev);
return 0;
}
int sys_mount(char * dev_name, char * dir_name, int rw_flag)
{
struct m_inode * dev_i, * dir_i;
struct super_block * sb;
int dev;
if (!(dev_i=namei(dev_name)))
return -ENOENT;
dev = dev_i->i_zone[0];
if (!S_ISBLK(dev_i->i_mode)) {
iput(dev_i);
return -EPERM;
}
iput(dev_i);
if (!(dir_i=namei(dir_name)))
return -ENOENT;
if (dir_i->i_count != 1 || dir_i->i_num == ROOT_INO) {
iput(dir_i);
return -EBUSY;
}
if (!S_ISDIR(dir_i->i_mode)) {
iput(dir_i);
return -EPERM;
}
if (!(sb=read_super(dev))) {
iput(dir
|
{
"pile_set_name": "Github"
}
|
require 'brakeman/processors/lib/basic_processor'
#Finds method calls matching the given target(s).
# #-- This should be deprecated --#
# #-- Do not use for new code --#
#
#Targets/methods can be:
#
# - nil: matches anything, including nothing
# - Empty array: matches nothing
# - Symbol: matches single target/method exactly
# - Array of symbols: matches against any of the symbols
# - Regular expression: matches the expression
# - Array of regular expressions: matches any of the expressions
#
#If a target is also the name of a class, methods called on instances
#of that class will also be matched, in a very limited way.
#(Any methods called on Klass.new, basically. More useful when used
#in conjunction with AliasProcessor.)
#
#Examples:
#
# #To find any uses of this class:
# FindCall.new :FindCall, nil
#
# #Find system calls without a target
# FindCall.new [], [:system, :exec, :syscall]
#
# #Find all calls to length(), no matter the target
# FindCall.new nil, :length
#
# #Find all calls to sub, sub!, gsub, or gsub!
# FindCall.new nil, /^g?sub!?$/
class Brakeman::FindCall < Brakeman::BasicProcessor
def initialize targets, methods, tracker
super tracker
@calls = []
@find_targets = targets
@find_methods = methods
@current_class = nil
@current_method = nil
end
#Returns a list of results.
#
#A result looks like:
#
# s(:result, :ClassName, :method_name, s(:call, ...))
def matches
@calls
end
#Process the given source. Provide either class and method being searched
#or the template. These names are used when reporting results.
#
#Use FindCall#matches to retrieve results.
def process_source exp
process exp
end
#Process body of method
def process_defn exp
process_all exp.body
end
alias :process_defs :process_defn
#Look for matching calls and add them to results
def process_call exp
target = get_target exp.target
method = exp.method
process_call_args exp
if match(@find_targets, target) and match(@find_methods, method)
@calls << Sexp.new(:result, @current_module, @current_class, @current_method, exp).line(exp.line)
end
exp
end
#Process an assignment like a call
def process_attrasgn exp
process_call exp
end
private
#Gets the target of a call as a Symbol
#if possible
def get_target exp
if sexp? exp
case exp.node_type
when :ivar, :lvar, :const, :lit
exp.value
when :colon2
class_name exp
else
exp
end
else
exp
end
end
#Checks if the search terms match the given item
def match search_terms, item
case search_terms
when Symbol
if search_terms == item
true
else
false
end
when Enumerable
if search_terms.empty?
item == nil
end
end
end
end
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.tools.jconsole;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.management.*;
import java.lang.reflect.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.List;
import static sun.tools.jconsole.Utilities.*;
@SuppressWarnings("serial")
class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSelectionListener {
PlotterPanel threadMeter;
TimeComboBox timeComboBox;
JTabbedPane threadListTabbedPane;
DefaultListModel<Long> listModel;
JTextField filterTF;
JLabel messageLabel;
JSplitPane threadsSplitPane;
HashMap<Long, String> nameCache = new HashMap<Long, String>();
private ThreadOverviewPanel overviewPanel;
private boolean plotterListening = false;
private static final String threadCountKey = "threadCount";
private static final String peakKey = "peak";
private static final Color threadCountColor = Plotter.defaultColor;
private static final Color peakColor = Color.red;
private static final Border thinEmptyBorder = new EmptyBorder(2, 2, 2, 2);
/*
Hierarchy of panels and layouts for this tab:
ThreadTab (BorderLayout)
North: topPanel (BorderLayout)
Center: controlPanel (FlowLayout)
timeComboBox
Center: plotterPanel (BorderLayout)
Center: plotter
*/
public static String getTabName() {
return Messages.THREADS;
}
public ThreadTab(VMPanel vmPanel) {
super(vmPanel, getTabName());
setLayout(new BorderLayout(0, 0));
setBorder(new EmptyBorder(4, 4, 3, 4));
JPanel topPanel = new JPanel(new BorderLayout());
JPanel plotterPanel = new JPanel(new VariableGridLayout(0, 1, 4, 4, true, true));
add(topPanel, BorderLayout.NORTH);
add(plotterPanel, BorderLayout.CENTER);
JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 5));
topPanel.add(controlPanel, BorderLayout.CENTER);
threadMeter = new PlotterPanel(Messages.NUMBER_OF_THREADS,
Plotter.Unit.NONE, true);
threadMeter.plotter.createSequence(threadCountKey, Messages.LIVE_THREADS, threadCountColor, true);
threadMeter.plotter.createSequence(peakKey, Messages.PEAK, peakColor, true);
setAccessibleName(threadMeter.plotter,
Messages.THREAD_TAB_THREAD_PLOTTER_ACCESSIBLE_NAME);
plotterPanel.add(threadMeter);
timeComboBox = new TimeComboBox(threadMeter.plotter);
controlPanel.add(new LabeledComponent(Messages.TIME_RANGE_COLON,
Resources.getMnemonicInt(Messages.TIME_RANGE_COLON),
timeComboBox));
listModel = new DefaultListModel<Long>();
JTextArea textArea = new JTextArea();
textArea.setBorder(thinEmptyBorder);
textArea.setEditable(false);
setAccessibleName(textArea,
Messages.THREAD_TAB_THREAD_INFO_ACCESSIBLE_NAME);
ThreadJList list = new ThreadJList(listModel, textArea);
Dimension di = new Dimension(super.getPreferredSize());
di.width = Math.min(di.width, 200);
JScrollPane threadlistSP = new JScrollPane(list);
threadlistSP.setPreferredSize(di);
threadlistSP.setBorder(null);
JScrollPane textAreaSP = new JScrollPane(textArea);
textAreaSP.setBorder(null);
threadListTabbedPane = new JTabbedPane(JTabbedPane.TOP);
threadsSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
threadlistSP, textAreaSP);
threadsSplitPane.setOneTouchExpandable(true);
threadsSplitPane.setBorder(null);
JPanel firstTabPanel = new JPanel(new BorderLayout());
firstTabPanel.setOpaque(false);
JPanel firstTabToolPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 2));
firstTabToolPanel.setOpaque(false);
filterTF = new PromptingTextField("Filter", 20);
filterTF.getDocument().addDocumentListener(this);
firstTabToolPanel.add(filterTF);
JSeparator separator = new JSeparator(JSeparator.VERTICAL);
separator.setPreferredSize(new Dimension(separator.getPreferredSize().width,
filterTF.getPreferredSize().height));
firstTabToolPanel.add(separator);
JButton detectDeadlockButton = new JButton(Messages.DETECT_DEADLOCK);
detectDeadlockButton.setMnemonic(Resources.getMnemonicInt(Messages.DETECT_DEADLOCK));
detectDeadlockButton.setActionCommand("detectDeadlock");
detectDeadlockButton.addActionListener(this);
detectDeadlockButton.setToolTipText(Messages.DETECT_DEADLOCK_TOOLTIP);
firstTabToolPanel.add(detectDeadlockButton);
messageLabel = new JLabel();
firstTabToolPanel.add(messageLabel);
firstTabPanel.add(threadsSplitPane, BorderLayout.CENTER);
firstTabPanel.add(firstTabToolPanel, BorderLayout.SOUTH);
threadListTabbedPane.addTab(Messages.THREADS, firstTabPanel);
plotterPanel.add(threadListTabbedPane);
}
private long oldThreads[] = new long[0];
public SwingWorker<?, ?> newSwingWorker() {
final ProxyClient proxyClient = vmPanel.getProxyClient();
if (!plotterListening) {
proxyClient.addWeakPropertyChangeListener(threadMeter.plotter);
plotterListening = true;
}
return new SwingWorker<Boolean, Object>() {
private int tlCount;
private int tpCount;
private long ttCount;
private long[] threads;
private long timeStamp;
public Boolean doInBackground() {
try {
ThreadMXBean threadMBean = proxyClient.getThreadMXBean();
tlCount = threadMBean.getThreadCount();
tpCount = threadMBean.getPeakThreadCount();
if (overviewPanel != null) {
ttCount = threadMBean.getTotalStartedThreadCount();
} else {
ttCount = 0L;
}
threads = threadMBean.getAllThreadIds();
for (long newThread : threads) {
if (nameCache.get(newThread) == null) {
ThreadInfo ti = threadMBean.getThreadInfo(newThread);
if (ti !=
|
{
"pile_set_name": "Github"
}
|
[weewx]
name=weewx
baseurl=http://weewx.com/yum/weewx/el7
enabled=1
gpgcheck=0
|
{
"pile_set_name": "Github"
}
|
//
// GDDropboxUploadStateWrapper.m
// GDFileManagerExample
//
// Created by Graham Dennis on 11/08/13.
// Copyright (c) 2013 Graham Dennis. All rights reserved.
//
#import "GDFileManagerUploadState.h"
@implementation GDFileManagerUploadState
@synthesize parentVersionID = _parentVersionID;
- (instancetype)initWithUploadState:(id<NSCoding>)uploadState mimeType:(NSString *)mimeType uploadURL:(NSURL *)uploadURL parentVersionID:(NSString *)parentVersionID
{
return [self initWithUploadState:uploadState mimeType:mimeType uploadURL:uploadURL parentVersionID:parentVersionID extraState:nil];
}
- (instancetype)initWithUploadState:(id <NSCoding>)uploadState mimeType:(NSString *)mimeType uploadURL:(NSURL *)uploadURL parentVersionID:(NSString *)parentVersionID extraState:(NSDictionary *)extraState
{
if ((self = [super init])) {
_uploadState = uploadState;
_uploadURL = uploadURL;
_parentVersionID = parentVersionID;
_mimeType = mimeType;
_extraState = extraState;
}
return self;
}
- (NSURL *)fileServiceSessionURL { return self.uploadURL; }
#pragma mark - NSCoding
static NSString *const kUploadState = @"UploadState";
static NSString *const kUploadURL = @"UploadURL";
static NSString *const kParentVersionID = @"ParentVersionID";
static NSString *const kMIMEType = @"MIMEType";
static NSString *const kExtraState = @"ExtraState";
- (id)initWithCoder:(NSCoder *)aDecoder
{
id <NSCoding> uploadState = [aDecoder decodeObjectForKey:kUploadState];
NSURL *uploadURL = [aDecoder decodeObjectForKey:kUploadURL];
NSString *parentVersionID = [aDecoder decodeObjectForKey:kParentVersionID];
NSString *mimeType = [aDecoder decodeObjectForKey:kMIMEType];
NSDictionary *extraState = [aDecoder decodeObjectForKey:kExtraState];
return [self initWithUploadState:uploadState mimeType:mimeType uploadURL:uploadURL parentVersionID:parentVersionID extraState:extraState];
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:self.uploadState forKey:kUploadState];
[aCoder encodeObject:self.uploadURL forKey:kUploadURL];
[aCoder encodeObject:self.parentVersionID forKey:kParentVersionID];
[aCoder encodeObject:self.mimeType forKey:kMIMEType];
[aCoder encodeObject:self.extraState forKey:kExtraState];
}
@end
|
{
"pile_set_name": "Github"
}
|
File.open(${1:path_to_yml}, "w") { |${2:file}| YAML.dump(${3:obj}, ${4:$2}) }
|
{
"pile_set_name": "Github"
}
|
# matchPath
Re-exported from core [`matchPath`](../../../react-router/docs/api/matchPath.md)
|
{
"pile_set_name": "Github"
}
|
$ brew update
$ brew install opam
|
{
"pile_set_name": "Github"
}
|
/dts-v1/;
#include "bcm6348.dtsi"
#include <dt-bindings/input/input.h>
/ {
model = "Sagem F@st 2404";
compatible = "sagem,fast-2404", "brcm,bcm6348";
chosen {
bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
stdout-path = "serial0:115200n8";
};
};
&pflash {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
cfe@0 {
label = "CFE";
reg = <0x000000 0x010000>;
read-only;
};
linux@10000 {
label = "linux";
reg = <0x010000 0x3e0000>;
compatible = "brcm,bcm963xx-imagetag";
};
nvram@3f0000 {
label = "nvram";
reg = <0x3f0000 0x010000>;
};
};
};
&pinctrl {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>;
};
&uart0 {
status = "okay";
};
|
{
"pile_set_name": "Github"
}
|
;
; Definition file of CRYPTCATSVC.dll
; Automatic generated by gendef
; written by Kai Tietz 2008-2014
;
LIBRARY "CRYPTCATSVC.dll"
EXPORTS
CryptsvcDllCtrl
|
{
"pile_set_name": "Github"
}
|
//
// TAPIResponse.m
// TwitterNetworkLayer
//
// Created on 10/17/14.
// Copyright © 2020 Twitter. All rights reserved.
//
#import "TAPIError.h"
#import "TAPIResponse.h"
#import "TNL_Project.h"
NS_INLINE BOOL _DataBeginsWithHTMLDocType(NSData *data)
{
static const char sDocType[] = "<!DOCTYPE html";
static const size_t sDocTypeLength = (sizeof(sDocType) / sizeof(sDocType[0])) - 1; // minus 1 to ignore the NULL terminator
return data.length >= sDocTypeLength && 0 == strncmp(data.bytes, sDocType, sDocTypeLength);
}
static id _ParseAPIResponse(TNLResponseInfo *info, NSError ** parseErrorOut, NSError ** apiErrorOut);
static NSArray *_ExtractAPIErrors(id parsedObject);
@implementation TAPIResponse
@synthesize apiError = _apiError;
@synthesize parseError = _parseError;
@synthesize parsedObject = _parsedObject;
- (void)prepare
{
[super prepare];
if (!_operationError) {
NSError *apiError;
NSError *parseError;
_parsedObject = _ParseAPIResponse(_info, &parseError, &apiError);
_parseError = parseError;
_apiError = apiError;
TNLAttemptMetrics *metrics = _metrics.attemptMetrics.lastObject;
metrics.responseBodyParseError = parseError;
if (apiError) {
metrics.APIErrors = @[apiError];
}
}
}
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
_parsedObject = [coder decodeObjectOfClasses:[NSSet setWithObjects:[NSString class], [NSNumber class], [NSArray class], [NSDictionary class], nil]
forKey:@"parsedObject"];
_parseError = [coder decodeObjectOfClass:[NSError class] forKey:@"parseError"];
_apiError = [coder decodeObjectOfClass:[NSError class] forKey:@"apiError"];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeObject:TNLErrorToSecureCodingError(_parsedObject) forKey:@"parsedObject"];
[aCoder encodeObject:TNLErrorToSecureCodingError(_apiError) forKey:@"apiError"];
[aCoder encodeObject:TNLErrorToSecureCodingError(_parseError) forKey:@"parseError"];
}
- (NSError *)anyError
{
return self.operationError ?: self.parseError ?: self.apiError;
}
@end
static id _ParseAPIResponse(TNLResponseInfo *info, NSError ** errorOut, NSError ** apiErrorOut)
{
id json = nil;
NSError *parseError = nil;
__block NSError *apiError = TNLHTTPStatusCodeIsSuccess(info.statusCode) ? nil : [NSError errorWithDomain:TAPIErrorDomain code:0 userInfo:nil];
NSInteger statusCode = info.statusCode;
NSData *data = info.data;
TNLAssert(statusCode > 0);
BOOL hasDocTypePrefix = _DataBeginsWithHTMLDocType(data);
if (hasDocTypePrefix) {
parseError = [NSError errorWithDomain:TAPIOperationErrorDomain
code:TAPIOperationErrorCodeServiceEncounteredTechnicalError
userInfo:nil];
} else {
json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
if (json) {
NSArray *apiErrors = _ExtractAPIErrors(json);
// Underlying behavior in some 4XX errors
if (TNLHTTPStatusCodeIsClientError(statusCode)) {
[apiErrors enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSError *currentError = obj;
if ([currentError.domain isEqualToString:TAPIErrorDomain]) {
apiError = currentError;
*stop = YES;
}
}];
}
} else {
parseError = [NSError errorWithDomain:TAPIParseErrorDomain
code:TAPIParseErrorCodeCannotParseResponse
userInfo:(parseError) ? @{ NSUnderlyingErrorKey : parseError } : nil];
}
}
if (errorOut) {
*errorOut = parseError;
}
if (apiErrorOut) {
*apiErrorOut = apiError;
}
return json;
}
static NSArray *_ExtractAPIErrors(id parsedObject)
{
TNLAssert(parsedObject != nil);
NSMutableArray *errorItems = [[NSMutableArray alloc] init];
if ([parsedObject isKindOfClass:[NSDictionary class]]) {
id errors = [parsedObject objectForKey:@"errors"];
if ([errors isKindOfClass:[NSArray class]]) {
[errors enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
BOOL successfullyParsedError = NO;
if ([obj isKindOfClass:[NSDictionary class]]) {
id codeObject = [obj objectForKey:@"code"];
id messageObject = [obj objectForKey:@"message"];
if (codeObject && messageObject) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (messageObject) {
userInfo[NSLocalizedDescriptionKey] = messageObject;
}
NSInteger code = [codeObject integerValue];
id timestamp = [obj objectForKey:@"timestamp"];
if (timestamp) {
userInfo[@"timestamp"] = timestamp;
}
[errorItems addObject:[NSError errorWithDomain:TAPIErrorDomain
code:code
userInfo:userInfo]];
successfullyParsedError = YES;
}
}
if (!successfullyParsedError) {
NSLog(@"Failed to parse server error:[%@]", obj);
}
}];
}
}
return errorItems;
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 2014 Saravan Pantham
*
* 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.psaravan.filebrowserview.lib.AsyncTasks;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.AsyncTask;
import android.widget.Toast;
import com.psaravan.filebrowserview.lib.Interfaces.MoveInterface;
import com.psaravan.filebrowserview.lib.R;
import org.apache.commons.io.FileUtils;
import java.io.File;
/**
* AsyncTask that moves the specified file/folder recursively to a new location.
*
* @author Saravan Pantham
*/
public class AsyncMoveTask extends AsyncTask<String, Void, Boolean> {
private Context mContext;
private ProgressDialog pd;
private File mSourceFile;
private File mDestDirFile;
private boolean mShowProgress = true;
private MoveInterface mMoveInterface;
public AsyncMoveTask(Context context, File source, File destDir, boolean showProgress) {
mContext = context;
mSourceFile = source;
mShowProgress = showProgress;
mDestDirFile = destDir;
}
@Override
protected void onPreExecute() {
if (mSourceFile==null)
return;
//Skip the rest of this method if the user doesn't want a progress dialog.
if (!mShowProgress)
return;
pd = new ProgressDialog(mContext);
pd.setCancelable(false);
pd.setIndeterminate(false);
pd.setTitle(R.string.move);
pd.setMessage(mContext.getResources().getString(R.string.moving) + " " + mSourceFile.getName());
pd.setButton(DialogInterface.BUTTON_NEUTRAL, mContext.getResources()
.getString(R.string.run_in_background),
new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
pd.dismiss();
}
});
pd.show();
if (mMoveInterface!=null)
mMoveInterface.preMoveStartSync();
}
@Override
protected Boolean doInBackground(String... params) {
if (mMoveInterface!=null)
mMoveInterface.preMoveStartAsync();
if (mSourceFile==null || mDestDirFile==null) {
if (mMoveInterface!=null)
mMoveInterface.onMoveCompleteAsync(false);
return false;
}
if (mSourceFile.isDirectory()) {
try {
FileUtils.moveDirectory(mSourceFile, mDestDirFile);
} catch (Exception e) {
if (mMoveInterface!=null)
mMoveInterface.onMoveCompleteAsync(false);
return false;
}
} else {
try {
FileUtils.moveFile(mSourceFile, mDestDirFile);
} catch (Exception e) {
if (mMoveInterface!=null)
mMoveInterface.onMoveCompleteAsync(false);
return false;
}
}
if (mMoveInterface!=null)
mMoveInterface.onMoveCompleteAsync(true);
return true;
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
if (mMoveInterface!=null)
mMoveInterface.onMoveCompleteSync(result);
if (pd!=null)
pd.dismiss();
if (result==true) {
String message = mSourceFile.getName() + " " + mContext.getResources().getString(R.string.moved);
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
} else {
String message = mSourceFile.getName() + " " + mContext.getResources().getString(R.string.could_not_be_moved);
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
}
}
/**
* @param moveInterface The move interface instance to attach to this
* AsyncTask.
*/
public void setMoveInterface(MoveInterface moveInterface) {
mMoveInterface = moveInterface;
}
}
|
{
"pile_set_name": "Github"
}
|
<?php
/*
* This file is part of the Monolog package.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Monolog\Handler;
use Monolog\TestCase;
use Monolog\Logger;
class BufferHandlerTest extends TestCase
{
private $shutdownCheckHandler;
/**
* @covers Monolog\Handler\BufferHandler::__construct
* @covers Monolog\Handler\BufferHandler::handle
* @covers Monolog\Handler\BufferHandler::close
*/
public function testHandleBuffers()
{
$test = new TestHandler();
$handler = new BufferHandler($test);
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::INFO));
$this->assertFalse($test->hasDebugRecords());
$this->assertFalse($test->hasInfoRecords());
$handler->close();
$this->assertTrue($test->hasInfoRecords());
$this->assertTrue(count($test->getRecords()) === 2);
}
/**
* @covers Monolog\Handler\BufferHandler::close
* @covers Monolog\Handler\BufferHandler::flush
*/
public function testPropagatesRecordsAtEndOfRequest()
{
$test = new TestHandler();
$handler = new BufferHandler($test);
$handler->handle($this->getRecord(Logger::WARNING));
$handler->handle($this->getRecord(Logger::DEBUG));
$this->shutdownCheckHandler = $test;
register_shutdown_function(array($this, 'checkPropagation'));
}
public function checkPropagation()
{
if (!$this->shutdownCheckHandler->hasWarningRecords() || !$this->shutdownCheckHandler->hasDebugRecords()) {
echo '!!! BufferHandlerTest::testPropagatesRecordsAtEndOfRequest failed to verify that the messages have been propagated' . PHP_EOL;
exit(1);
}
}
/**
* @covers Monolog\Handler\BufferHandler::handle
*/
public function testHandleBufferLimit()
{
$test = new TestHandler();
$handler = new BufferHandler($test, 2);
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::INFO));
$handler->handle($this->getRecord(Logger::WARNING));
$handler->close();
$this->assertTrue($test->hasWarningRecords());
$this->assertTrue($test->hasInfoRecords());
$this->assertFalse($test->hasDebugRecords());
}
/**
* @covers Monolog\Handler\BufferHandler::handle
*/
public function testHandleBufferLimitWithFlushOnOverflow()
{
$test = new TestHandler();
$handler = new BufferHandler($test, 3, Logger::DEBUG, true, true);
// send two records
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::DEBUG));
$this->assertFalse($test->hasDebugRecords());
$this->assertCount(0, $test->getRecords());
// overflow
$handler->handle($this->getRecord(Logger::INFO));
$this->assertTrue($test->hasDebugRecords());
$this->assertCount(3, $test->getRecords());
// should buffer again
$handler->handle($this->getRecord(Logger::WARNING));
$this->assertCount(3, $test->getRecords());
$handler->close();
$this->assertCount(5, $test->getRecords());
$this->assertTrue($test->hasWarningRecords());
$this->assertTrue($test->hasInfoRecords());
}
/**
* @covers Monolog\Handler\BufferHandler::handle
*/
public function testHandleLevel()
{
$test = new TestHandler();
$handler = new BufferHandler($test, 0, Logger::INFO);
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::INFO));
$handler->handle($this->getRecord(Logger::WARNING));
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->close();
$this->assertTrue($test->hasWarningRecords());
$this->assertTrue($test->hasInfoRecords());
$this->assertFalse($test->hasDebugRecords());
}
/**
* @covers Monolog\Handler\BufferHandler::flush
*/
public function testFlush()
{
$test = new TestHandler();
$handler = new BufferHandler($test, 0);
$handler->handle($this->getRecord(Logger::DEBUG));
$handler->handle($this->getRecord(Logger::INFO));
$handler->flush();
$this->assertTrue($test->hasInfoRecords());
$this->assertTrue($test->hasDebugRecords());
$this->assertFalse($test->hasWarningRecords());
}
/**
* @covers Monolog\Handler\BufferHandler::handle
*/
public function testHandleUsesProcessors()
{
$test = new TestHandler();
$handler = new BufferHandler($test);
$handler->pushProcessor(function ($record) {
$record['extra']['foo'] = true;
return $record;
});
$handler->handle($this->getRecord(Logger::WARNING));
$handler->flush();
$this->assertTrue($test->hasWarningRecords());
$records = $test->getRecords();
$this->assertTrue($records[0]['extra']['foo']);
}
}
|
{
"pile_set_name": "Github"
}
|
tparadox.png
tparadox_150.png
tparadox_200.png
|
{
"pile_set_name": "Github"
}
|
{
"type": "minecraft:crafting_shaped",
"pattern": [
"X ",
"XX ",
"XXX"
],
"key": {
"X": {
"item": "tfc:wood/planks/douglas_fir"
}
},
"result": {
"item": "tfc:stairs/wood/douglas_fir",
"count": 8
}
}
|
{
"pile_set_name": "Github"
}
|
diff --git a/README b/README
index 2f68e14..262822a 100644
--- a/README
+++ b/README
@@ -1,3 +1,38 @@
+This is an Nginx fork that adds dtrace USDT probes.
-Documentation is available at http://nginx.org
+Installation:
+
+ ./configure --with-dtrace-probes \
+ --with-dtrace=/usr/sbin/dtrace \
+ ...
+ make
+ make install
+
+Usage on Linux (with systemtap):
+
+ # make the stap-nginx script visiable in your PATH
+ export PATH=/usr/local/nginx/sbin:$PATH
+
+ # list all the static probes available in your nginx
+ stap-nginx -L 'process("nginx").mark("*")'
+
+ # run the test.stp file
+ stap-nginx test.stp
+
+Sample test.stp file:
+
+ probe begin
+ {
+ print("Tracing. Hit CTRL-C to stop.\n")
+ }
+
+ probe process("nginx").mark("http-subrequest-start")
+ {
+ printf("uri: %s?%s\n", ngx_http_req_uri($arg1),
+ ngx_http_req_args($arg1))
+ }
+
+For now, only tested on Solaris 11 Express and Fedora Linux 17.
+
+The original Nginx documentation is available at http://nginx.org
diff --git a/auto/install b/auto/install
index f7f686c..d6bc457 100644
--- a/auto/install
+++ b/auto/install
@@ -16,6 +16,20 @@ END
fi
+case ".$NGX_STAP_NGX_PATH" in
+ ./*)
+ ;;
+
+ .)
+ NGX_STAP_NGX_PATH=$NGX_PREFIX/sbin/stap-nginx
+ ;;
+
+ *)
+ NGX_STAP_NGX_PATH=$NGX_PREFIX/$NGX_STAP_NGX_PATH
+ ;;
+esac
+
+
case ".$NGX_SBIN_PATH" in
./*)
;;
@@ -49,6 +63,16 @@ case ".$NGX_PID_PATH" in
esac
+case ".$NGX_TAPSET_PREFIX" in
+ ./* | .)
+ ;;
+
+ *)
+ NGX_TAPSET_PREFIX=$NGX_PREFIX/$NGX_TAPSET_PREFIX
+ ;;
+esac
+
+
case ".$NGX_ERROR_LOG_PATH" in
./* | .)
;;
@@ -147,6 +171,36 @@ install: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext} \
|| cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX'
END
+if [ $NGX_DTRACE = YES -a $DTRACE_FROM_SYSTEMTAP = YES ]; then
+
+ ngx_tapset_srcs="$NGX_TAPSET_SRCS"
+
+ cat << END >> $NGX_MAKEFILE
+ test -d '\$(DESTDIR)$NGX_TAPSET_PREFIX' || \
+ mkdir -p '\$(DESTDIR)$NGX_TAPSET_PREFIX'
+END
+
+ for ngx_tapset_src in $ngx_tapset_srcs
+ do
+ ngx_tapset_file=`basename $ngx_tapset_src`
+
+ cat << END >> $NGX_MAKEFILE
+
+ sed -e "s|NGX_SBIN_PATH|$NGX_SBIN_PATH|g" $ngx_long_cont \
+ $ngx_tapset_src > '\$(DESTDIR)$NGX_TAPSET_PREFIX/$ngx_tapset_file'
+END
+
+ done
+
+ cat << END >> $NGX_MAKEFILE
+
+ test -d '\$(DESTDIR)`dirname "$NGX_STAP_NGX_PATH"`' || \
+ mkdir -p '\$(DESTDIR)`dirname "$NGX_STAP_NGX_PATH"`'
+ cp $NGX_OBJS/stap-nginx '\$(DESTDIR)$NGX_STAP_NGX_PATH'
+ chmod 0755 '\$(DESTDIR)$NGX_STAP_NGX_PATH'
+END
+
+fi
if test -n "$NGX_ERROR_LOG_PATH"; then
cat << END >> $NGX_MAKEFILE
@@ -158,6 +212,18 @@ END
fi
+if [ $NGX_DTRACE = YES ]; then
+ cat << END >> $NGX_MAKEFILE
+
+$NGX_OBJS${ngx_dirsep}stap-nginx: src/dtrace/stap-nginx
+ sed -e "s|NGX_TAPSET_PREFIX|$NGX_TAPSET_PREFIX|g" $ngx_long_cont \
+ -e "s|NGX_SBIN_DIR|`dirname $NGX_SBIN_PATH`|g" $ngx_long_cont \
+ -e "s|NGX_SBIN_PATH|$NGX_SBIN_PATH|g" $ngx_long_cont \
+ src/dtrace/stap-nginx > $NGX_OBJS${ngx_dirsep}stap-nginx
+END
+fi
+
+
# create Makefile
cat << END >> Makefile
diff --git a/auto/make b/auto/make
index dca011c..57ed99f 100644
--- a/auto/make
+++ b/auto/make
@@ -27,6 +27,9 @@ LINK = $LINK
END
+if [ $NGX_DTRACE = YES ]; then
+ echo DTRACE = $DTRACE >> $NGX_MAKEFILE
+fi
if test -n "$NGX_PERL_CFLAGS"; then
echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS >> $NGX_MAKEFILE
@@ -204,6 +207,44 @@ ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
+if [ $NGX_DTRACE = YES ]; then
+
+ ngx_dtrace_obj=$NGX_OBJS${ngx_dirsep}ngx_dtrace_provider.$ngx_objext
+
+ ngx_dtrace_h=$NGX_OBJS${ngx_dirsep}ngx_dtrace_provider.h
+
+ ngx_dtrace_d=$NGX_OBJS${ngx_dirsep}dtrace_providers.d
+
+ ngx_dtrace_providers=`echo $NGX_DTRACE_PROVIDERS \
+ | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
+ -e "s/\//$ngx_regex_dirsep/g"`
+
+ cat << END >> $NGX_MAKEFILE
+
+all: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext}
+
+$ngx_dtrace_d: $ngx_dtrace_providers
+ cat $ngx_dtrace_providers > $ngx_dtrace_d
+
+$ngx_dtrace_h: $ngx_dtrace_d
+ \$(DTRACE) -h -o $ngx_dtrace_h -s $ngx_dtrace_d
+END
+
+ if [ $DTRACE_PROBE_OBJ = YES ]; then
+ cat << END >> $NGX_MAKEFILE
+$ngx
|
{
"pile_set_name": "Github"
}
|
using Mirror;
namespace WeaverTargetRpcTests.TargetRpcValid
{
class TargetRpcValid : NetworkBehaviour
{
[TargetRpc]
void TargetThatIsTotallyValid(NetworkConnection nc) { }
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This implements a Clang tool to convert all instances of std::string("") to
// std::string(). The latter is more efficient (as std::string doesn't have to
// take a copy of an empty string) and generates fewer instructions as well. It
// should be run using the tools/clang/scripts/run_tool.py helper.
#include <memory>
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Refactoring.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/CommandLine.h"
using namespace clang::ast_matchers;
using clang::tooling::CommonOptionsParser;
using clang::tooling::Replacement;
using clang::tooling::Replacements;
namespace {
// Handles replacements for stack and heap-allocated instances, e.g.:
// std::string a("");
// std::string* b = new std::string("");
class ConstructorCallback : public MatchFinder::MatchCallback {
public:
ConstructorCallback(Replacements* replacements)
: replacements_(replacements) {}
virtual void run(const MatchFinder::MatchResult& result) override;
private:
Replacements* const replacements_;
};
// Handles replacements for invocations of std::string("") in an initializer
// list.
class InitializerCallback : public MatchFinder::MatchCallback {
public:
InitializerCallback(Replacements* replacements)
: replacements_(replacements) {}
virtual void run(const MatchFinder::MatchResult& result) override;
private:
Replacements* const replacements_;
};
// Handles replacements for invocations of std::string("") in a temporary
// context, e.g. FunctionThatTakesString(std::string("")). Note that this
// handles implicits construction of std::string as well.
class TemporaryCallback : public MatchFinder::MatchCallback {
public:
TemporaryCallback(Replacements* replacements) : replacements_(replacements) {}
virtual void run(const MatchFinder::MatchResult& result) override;
private:
Replacements* const replacements_;
};
class EmptyStringConverter {
public:
explicit EmptyStringConverter(Replacements* replacements)
: constructor_callback_(replacements),
initializer_callback_(replacements),
temporary_callback_(replacements) {}
void SetupMatchers(MatchFinder* match_finder);
private:
ConstructorCallback constructor_callback_;
InitializerCallback initializer_callback_;
TemporaryCallback temporary_callback_;
};
void EmptyStringConverter::SetupMatchers(MatchFinder* match_finder) {
const clang::ast_matchers::StatementMatcher& constructor_call = id(
"call",
cxxConstructExpr(
hasDeclaration(cxxMethodDecl(ofClass(hasName("std::basic_string")))),
argumentCountIs(2), hasArgument(0, id("literal", stringLiteral())),
hasArgument(1, cxxDefaultArgExpr())));
// Note that expr(has()) in the matcher is significant; the Clang AST wraps
// calls to the std::string constructor with exprWithCleanups nodes. Without
// the expr(has()) matcher, the first and last rules would not match anything!
match_finder->addMatcher(varDecl(forEach(expr(has(constructor_call)))),
&constructor_callback_);
match_finder->addMatcher(cxxNewExpr(has(constructor_call)),
&constructor_callback_);
// The implicitly generated constructor for temporary could be wrapped by
// implicitCastExpr, so ignoringParenImpCasts is needed.
match_finder->addMatcher(
cxxBindTemporaryExpr(ignoringParenImpCasts(forEach(constructor_call))),
&temporary_callback_);
// Note that forEachConstructorInitializer is needed. The std::string
// constructor is wrapped by exprWithCleanups and cxxCtorInitializer.
// forEach() would not work.
match_finder->addMatcher(cxxConstructorDecl(forEachConstructorInitializer(
withInitializer(expr(has(constructor_call))))),
&initializer_callback_);
}
void ConstructorCallback::run(const MatchFinder::MatchResult& result) {
const clang::StringLiteral* literal =
result.Nodes.getNodeAs<clang::StringLiteral>("literal");
if (literal->getLength() > 0)
return;
const clang::CXXConstructExpr* call =
result.Nodes.getNodeAs<clang::CXXConstructExpr>("call");
clang::CharSourceRange range =
clang::CharSourceRange::getTokenRange(call->getParenOrBraceRange());
auto err = replacements_->add(Replacement(*result.SourceManager, range, ""));
assert(!err);
}
void InitializerCallback::run(const MatchFinder::MatchResult& result) {
const clang::StringLiteral* literal =
result.Nodes.getNodeAs<clang::StringLiteral>("literal");
if (literal->getLength() > 0)
return;
const clang::CXXConstructExpr* call =
result.Nodes.getNodeAs<clang::CXXConstructExpr>("call");
auto err = replacements_->add(Replacement(*result.SourceManager, call, ""));
assert(!err);
}
void TemporaryCallback::run(const MatchFinder::MatchResult& result) {
const clang::StringLiteral* literal =
result.Nodes.getNodeAs<clang::StringLiteral>("literal");
if (literal->getLength() > 0)
return;
const clang::CXXConstructExpr* call =
result.Nodes.getNodeAs<clang::CXXConstructExpr>("call");
// Differentiate between explicit and implicit calls to std::string's
// constructor. An implicitly generated constructor won't have a valid
// source range for the parenthesis. We do this because the matched expression
// for |call| in the explicit case doesn't include the closing parenthesis.
clang::SourceRange range = call->getParenOrBraceRange();
if (range.isValid()) {
auto err =
replacements_->add(Replacement(*result.SourceManager, literal, ""));
assert(!err);
} else {
auto err = replacements_->add(
Replacement(*result.SourceManager, call,
literal->isWide() ? "std::wstring()" : "std::string()"));
assert(!err);
}
}
} // namespace
static llvm::cl::extrahelp common_help(CommonOptionsParser::HelpMessage);
int main(int argc, const char* argv[]) {
llvm::cl::OptionCategory category("EmptyString Tool");
CommonOptionsParser options(argc, argv, category);
clang::tooling::ClangTool tool(options.getCompilations(),
options.getSourcePathList());
Replacements replacements;
EmptyStringConverter converter(&replacements);
MatchFinder match_finder;
converter.SetupMatchers(&match_finder);
std::unique_ptr<clang::tooling::FrontendActionFactory> frontend_factory =
clang::tooling::newFrontendActionFactory(&match_finder);
int result = tool.run(frontend_factory.get());
if (result != 0)
return result;
if (replacements.empty())
return 0;
// Each replacement line should have the following format:
// r:<file path>:<offset>:<length>:<replacement text>
// Only the <replacement text> field can contain embedded ":" characters.
// TODO(dcheng): Use a more clever serialization. Ideally we'd use the YAML
// serialization and then use clang-apply-replacements, but that would require
// copying and pasting a larger amount of boilerplate for all Chrome clang
// tools.
llvm::outs() << "====
|
{
"pile_set_name": "Github"
}
|
using NHapi.Base.Parser;
using NHapi.Base;
using NHapi.Base.Log;
using System;
using System.Collections.Generic;
using NHapi.Model.V26.Segment;
using NHapi.Model.V26.Datatype;
using NHapi.Base.Model;
namespace NHapi.Model.V26.Group
{
///<summary>
///Represents the RRI_I12_AUTHORIZATION_CONTACT Group. A Group is an ordered collection of message
/// segments that can repeat together or be optionally in/excluded together.
/// This Group contains the following elements:
///<ol>
///<li>0: AUT (Authorization Information) </li>
///<li>1: CTD (Contact Data) optional </li>
///</ol>
///</summary>
[Serializable]
public class RRI_I12_AUTHORIZATION_CONTACT : AbstractGroup {
///<summary>
/// Creates a new RRI_I12_AUTHORIZATION_CONTACT Group.
///</summary>
public RRI_I12_AUTHORIZATION_CONTACT(IGroup parent, IModelClassFactory factory) : base(parent, factory){
try {
this.add(typeof(AUT), true, false);
this.add(typeof(CTD), false, false);
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error creating RRI_I12_AUTHORIZATION_CONTACT - this is probably a bug in the source code generator.", e);
}
}
///<summary>
/// Returns AUT (Authorization Information) - creates it if necessary
///</summary>
public AUT AUT {
get{
AUT ret = null;
try {
ret = (AUT)this.GetStructure("AUT");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
///<summary>
/// Returns CTD (Contact Data) - creates it if necessary
///</summary>
public CTD CTD {
get{
CTD ret = null;
try {
ret = (CTD)this.GetStructure("CTD");
} catch(HL7Exception e) {
HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
throw new System.Exception("An unexpected error ocurred",e);
}
return ret;
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
#!/bin/bash
if [ -z "$1" ]; then
echo "This script must be called with an argument" >&2
exit 1
fi
/usr/local/bin/mine $(script/find_spec_or_impl.rb $1)
|
{
"pile_set_name": "Github"
}
|
/*
This repository is no longer actively maintained. To find all solutions
to this problem (and practice coding more problems) at:
~~~~~~~~~~~~~~~~~~~~~~~~~
https://backtobackswe.com
~~~~~~~~~~~~~~~~~~~~~~~~~
*/
public class Solution {
public static void main(String args[]) {
/*
Here you are given the adjacency list, but even if you were
given the raw edges and vertices (remember: G = (V, E)), you'd
still be able to build the adjacency list in O(|E|) time.
Just loop over the edges and build what you see below.
*/
Map<Integer, List<Integer>> originalNodeToAdjacents = new HashMap<>();
originalNodeToAdjacents.put(0, Arrays.asList(1));
originalNodeToAdjacents.put(1, Arrays.asList(2));
originalNodeToAdjacents.put(2, Arrays.asList(3, 4));
originalNodeToAdjacents.put(3, Arrays.asList(0));
originalNodeToAdjacents.put(4, Arrays.asList(2));
/*
The graph above:
0 ---> 1 ---> 2 <---> 4
^ /
\ /
\ /
\ ⌄
3
*/
/*
If we reverse each edge:
0 <--- 1 <--- 2 <---> 4
\ ^
\ /
\ /
⌄ /
3
*/
System.out.println(isStronglyConnected(originalNodeToAdjacents));
}
private static boolean isStronglyConnected(Map<Integer, List<Integer>> originalNodeToAdjacents) {
boolean allNodesReached = allNodesReachedViaBFS(originalNodeToAdjacents);
if (!allNodesReached) {
return false;
}
Map<Integer, List<Integer>> reversedNodeToAdjacents = reverseGraph(originalNodeToAdjacents);
boolean allNodesReachedWithReverseGraph = allNodesReachedViaBFS(reversedNodeToAdjacents);
return allNodesReachedWithReverseGraph;
}
private static boolean allNodesReachedViaBFS(Map<Integer, List<Integer>> originalNodeToAdjacents) {
Set<Integer> visited = new HashSet<>();
Queue<Integer> queue = new LinkedList<>();
queue.add(0);
visited.add(0);
while (!queue.isEmpty()) {
int node = queue.poll();
List<Integer> adjacents = originalNodeToAdjacents.get(node);
if (adjacents != null) {
for (int adjacent: adjacents) {
if (!visited.contains(adjacent)) {
visited.add(adjacent);
queue.add(adjacent);
}
}
}
}
return visited.size() == originalNodeToAdjacents.size();
}
private static Map<Integer, List<Integer>> reverseGraph(Map<Integer, List<Integer>> originalNodeToAdjacents) {
Map<Integer, List<Integer>> reversedNodeToAdjacents = new HashMap<>();
for (Map.Entry<Integer, List<Integer>> entry: originalNodeToAdjacents.entrySet()) {
int nodeValue = entry.getKey();
List<Integer> adjacents = entry.getValue();
// Reverse each edge
for (int adjacent: adjacents) {
List<Integer> reversedAdjacents;
if (!reversedNodeToAdjacents.containsKey(adjacent)) {
reversedAdjacents = new ArrayList<>();
} else {
reversedAdjacents = reversedNodeToAdjacents.get(adjacent);
}
// Reverse edge, before node went to adjacent, now adjacent maps to the node
reversedAdjacents.add(nodeValue);
reversedNodeToAdjacents.put(adjacent, reversedAdjacents);
}
}
return reversedNodeToAdjacents;
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* QEMU Common PCI Host bridge configuration data space access routines.
*
* Copyright (c) 2006 Fabrice Bellard
*
* 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.
*/
/* Worker routines for a PCI host controller that uses an {address,data}
register pair to access PCI configuration space. */
#ifndef PCI_HOST_H
#define PCI_HOST_H
#include "hw/sysbus.h"
#define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
#define PCI_HOST_BRIDGE(obj) \
OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST_BRIDGE)
#define PCI_HOST_BRIDGE_CLASS(klass) \
OBJECT_CLASS_CHECK(PCIHostBridgeClass, (klass), TYPE_PCI_HOST_BRIDGE)
#define PCI_HOST_BRIDGE_GET_CLASS(obj) \
OBJECT_GET_CLASS(PCIHostBridgeClass, (obj), TYPE_PCI_HOST_BRIDGE)
struct PCIHostState {
SysBusDevice busdev;
MemoryRegion conf_mem;
MemoryRegion data_mem;
MemoryRegion mmcfg;
uint32_t config_reg;
PCIBus *bus;
QLIST_ENTRY(PCIHostState) next;
};
typedef struct PCIHostBridgeClass {
SysBusDeviceClass parent_class;
const char *(*root_bus_path)(PCIHostState *, PCIBus *);
} PCIHostBridgeClass;
/* common internal helpers for PCI/PCIe hosts, cut off overflows */
void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
uint32_t limit, uint32_t val, uint32_t len);
uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
uint32_t limit, uint32_t len);
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, unsigned len);
uint32_t pci_data_read(PCIBus *s, uint32_t addr, unsigned len);
extern const MemoryRegionOps pci_host_conf_le_ops;
extern const MemoryRegionOps pci_host_conf_be_ops;
extern const MemoryRegionOps pci_host_data_le_ops;
extern const MemoryRegionOps pci_host_data_be_ops;
#endif /* PCI_HOST_H */
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <XCTest/XCTest.h>
#import <IGListKit/IGListKit.h>
#import "IGListDebugger.h"
#import "IGListAdapterUpdaterInternal.h"
#import "IGListTestAdapterDataSource.h"
#import "IGListMoveIndexInternal.h"
#import "IGListMoveIndexPathInternal.h"
@interface IGListDebuggerTests : XCTestCase
@end
@implementation IGListDebuggerTests
- (void)test_whenSearchingAdapterInstances_thatCorrectCountReturned {
UIViewController *controller = [UIViewController new];
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:[UICollectionViewFlowLayout new]];
IGListAdapterUpdater *updater = [IGListAdapterUpdater new];
NSIndexPath *path = [NSIndexPath indexPathForItem:0 inSection:0];
updater.applyingUpdateData = [[IGListBatchUpdateData alloc] initWithInsertSections:[NSIndexSet indexSetWithIndex:1]
deleteSections:[NSIndexSet indexSetWithIndex:2]
moveSections:[NSSet setWithObject:[[IGListMoveIndex alloc] initWithFrom:3 to:4]]
insertIndexPaths:@[path]
deleteIndexPaths:@[path]
moveIndexPaths:@[[[IGListMoveIndexPath alloc] initWithFrom:path to:path]]];
IGListTestAdapterDataSource *dataSource = [IGListTestAdapterDataSource new];
dataSource.objects = @[@1, @2, @3];
IGListAdapter *adapter1 = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new] viewController:nil workingRangeSize:0];
adapter1.collectionView = collectionView;
adapter1.dataSource = dataSource;
IGListAdapter *adapter2 = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new] viewController:controller workingRangeSize:2];
adapter2.collectionView = collectionView;
IGListAdapter *adapter3 = [[IGListAdapter alloc] initWithUpdater:[IGListAdapterUpdater new] viewController:controller workingRangeSize:2];
adapter3.collectionView = collectionView;
NSArray *descriptions = [IGListDebugger adapterDescriptions];
XCTAssertEqual(descriptions.count, 4);
}
@end
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>my_text_area_field</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_text_area_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
|
{
"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.
*/
drop dataverse test if exists;
create dataverse test;
use test;
create type test.MyRecord as
{
id : bigint,
point : point,
kwds : string
};
create external dataset MyData(MyRecord) using localfs((`path`=`asterix_nc1://data/spatial/spatialData.json`),(`format`=`adm`));
|
{
"pile_set_name": "Github"
}
|
<!--
~ Copyright 2019. Google LLC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_blue"
android:orientation="vertical"
android:padding="20dp"
tools:context="com.google.android.apps.santatracker.dasherdancer.CharacterActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="invisible" />
<ImageButton
android:id="@+id/btn_character_santa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@drawable/dasher_ripple"
android:onClick="onCharacterClick"
android:scaleType="fitCenter"
android:layout_gravity="bottom"
android:src="@drawable/santa" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/btn_character_elf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@drawable/dasher_ripple"
android:onClick="onCharacterClick"
android:scaleType="fitCenter"
android:layout_gravity="center"
android:src="@drawable/elf" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="invisible" />
<ImageButton
android:id="@+id/btn_character_reindeer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@drawable/dasher_ripple"
android:onClick="onCharacterClick"
android:scaleType="fitCenter"
android:layout_gravity="center"
android:src="@drawable/reindeer" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="invisible" />
<ImageButton
android:id="@+id/btn_character_snowman"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@drawable/dasher_ripple"
android:onClick="onCharacterClick"
android:scaleType="fitCenter"
android:layout_gravity="top"
android:src="@drawable/snowman" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
|
{
"pile_set_name": "Github"
}
|
# Airspeed Velocity
`pandera`'s performance benchmarks over time can be [viewed on this airspeed-velocity dashboard](https://pandera-dev.github.io/pandera-asv-logs/).
The [config](https://github.com/pandera-dev/pandera-asv-logs/tree/master/asv_bench/asv.conf.json) and [results files](https://github.com/pandera-dev/pandera-asv-logs/tree/master/results) files are tracked in the [pandera-asv-logs](https://github.com/pandera-dev/pandera-asv-logs) repo to avoid build files in the main repo.
The [benchmarks](https://github.com/pandera-dev/pandera/tree/master/benchmarks/) are tracked in the main [pandera repo](https://github.com/pandera-dev/pandera).
## Running `asv`
Ensure both the `pandera` and `pandera-asv-logs` repos are checked out to the same parent directory.
From the `pandera-asv-logs` repo, run:
```
asv run ALL --config asv_bench/asv.conf.json
```
## Publishing results:
To build the html and preview the results:
```
asv publish --config asv_bench/asv.conf.json
asv preview --config asv_bench/asv.conf.json
```
The `.json` results files are committed or PR'd into the master branch of `pandera-asv-logs`.
The published html is pushed directly to the gh-pages branch of `pandera-asv-logs` by running:
```
asv gh-pages --rewrite --config asv_bench/asv.conf.json
```
The `--rewrite` flag overwrites the existing `gh-pages`, avoiding duplication of data.
The `asv` docs are [here](https://asv.readthedocs.io/en/stable/index.html).
|
{
"pile_set_name": "Github"
}
|
var baseSum = require('./_baseSum'),
identity = require('./identity');
/**
* Computes the sum of the values in `array`.
*
* @static
* @memberOf _
* @since 3.4.0
* @category Math
* @param {Array} array The array to iterate over.
* @returns {number} Returns the sum.
* @example
*
* _.sum([4, 2, 8, 6]);
* // => 20
*/
function sum(array) {
return (array && array.length)
? baseSum(array, identity)
: 0;
}
module.exports = sum;
|
{
"pile_set_name": "Github"
}
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class StorageProfile(Model):
"""Storage Profile properties of a server.
:param backup_retention_days: Backup retention days for the server.
:type backup_retention_days: int
:param geo_redundant_backup: Enable Geo-redundant or not for server
backup. Possible values include: 'Enabled', 'Disabled'
:type geo_redundant_backup: str or
~azure.mgmt.rdbms.mariadb.models.GeoRedundantBackup
:param storage_mb: Max storage allowed for a server.
:type storage_mb: int
"""
_attribute_map = {
'backup_retention_days': {'key': 'backupRetentionDays', 'type': 'int'},
'geo_redundant_backup': {'key': 'geoRedundantBackup', 'type': 'str'},
'storage_mb': {'key': 'storageMB', 'type': 'int'},
}
def __init__(self, *, backup_retention_days: int=None, geo_redundant_backup=None, storage_mb: int=None, **kwargs) -> None:
super(StorageProfile, self).__init__(**kwargs)
self.backup_retention_days = backup_retention_days
self.geo_redundant_backup = geo_redundant_backup
self.storage_mb = storage_mb
|
{
"pile_set_name": "Github"
}
|
<html>
<head>
<meta HTTP-EQUIV="Context-Type" CONTEXT="text/html;charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>tr Summary</title>
</head>
<body>
<h1>tr Summary</h1>
<ul>
<li><h2>tr input MUST come from standard input </h2>
</li>
</ul>
<ul>
<li><h2>tr does NOT change the input file but puts its modified values on standard output </h2>
</li>
</ul>
<ul>
<li><h2>recognizes the range, set regular expressions </h2>
</li>
</ul>
<ul>
<li><h2>if more than a single character then characters replaced match up on left with
characters which replace them (i.e. “qex” “abc </h2>
<ul>
<li>a for a </li>
<li>b for e </li>
<li>c for x </li>
</ul>
</li>
</ul>
<ul>
<li><h2>characters can be deleted with the -d option </h2>
</li>
</ul>
<ul>
<li><h2>multiple characters removed with the -s option </h2>
</li>
</ul>
<ul>
<li> </li>
</ul>
<table>
<tr>
<td HEIGHT="100" WIDTH="100"><a HREF="tsld019.htm">Previous slide</a> </td>
<td HEIGHT="100" WIDTH="100"></td>
<td HEIGHT="100" WIDTH="150"><a HREF="tsld001.htm">Back to first slide</a> </td>
<td HEIGHT="100" WIDTH="150"></td>
</tr>
</table>
<p><br>
</p>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
<TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
</PropertyGroup>
<Import Project="$(TPath)"/>
<Target Name="Default">
<ItemGroup>
<Database Include="ADatabase">
<NewName>ADatabase2</NewName>
</Database>
<Database2 Include="ADatabase2">
<NewName>ADatabase</NewName>
</Database2>
</ItemGroup>
<!-- Get information on a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="GetInfo" DatabaseItem="ADatabase">
<Output TaskParameter="Information" ItemName="AllInfo"/>
</MSBuild.ExtensionPack.Sql2012.Database>
<!-- All the database information properties are available as metadata on the Infomation item -->
<Message Text="SpaceAvailable: %(AllInfo.SpaceAvailable)"/>
<!-- Backup a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Backup" DatabaseItem="ADatabase" DataFilePath="c:\a\ADatabase.bak"/>
<!-- Verify a database backup -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="VerifyBackup" DataFilePath="c:\a\ADatabase.bak"/>
<!-- Restore a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Restore" DatabaseItem="ADatabase" DataFilePath="c:\a\ADatabase.bak"/>
<!-- Restore a database to a different location-->
<MSBuild.ExtensionPack.Sql2012.Database MachineName="Desktop\Sql2012" TaskAction="Restore" DatabaseItem="ADatabase" DataFilePath="c:\a\ADatabase.bak" NewDataFilePath="c:\k\ADatabase2.mdf" LogFilePath="c:\a\ADatabase2_log.LDF"/>
<!-- Create a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Create" DatabaseItem="ADatabase2"/>
<!-- Create the database again, using Force to delete the existing database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Create" DatabaseItem="ADatabase2" Collation="Latin1_General_CI_AI" Force="true"/>
<!-- Check whether a database exists -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="CheckExists" DatabaseItem="ADatabase2">
<Output TaskParameter="Exists" PropertyName="DoesExist"/>
</MSBuild.ExtensionPack.Sql2012.Database>
<Message Text="Database Exists: $(DoesExist)"/>
<!-- Delete a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Delete" DatabaseItem="ADatabase2"/>
<!-- Check whether a database exists -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="CheckExists" DatabaseItem="ADatabase2">
<Output TaskParameter="Exists" PropertyName="DoesExist"/>
</MSBuild.ExtensionPack.Sql2012.Database>
<Message Text="Database Exists: $(DoesExist)"/>
<!-- Get the number of active connections to a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="GetConnectionCount" DatabaseItem="ADatabase">
<Output TaskParameter="ConnectionCount" PropertyName="Count"/>
</MSBuild.ExtensionPack.Sql2012.Database>
<Message Text="Database ConnectionCount: $(Count)"/>
<!-- Delete the backup history for a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="DeleteBackupHistory" DatabaseItem="ADatabase"/>
<!-- Set a database offline -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="SetOffline" DatabaseItem="ADatabase"/>
<!-- Set a database online -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="SetOnline" DatabaseItem="ADatabase"/>
<!-- Rename a database -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Rename" DatabaseItem="@(Database)"/>
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Rename" DatabaseItem="@(Database2)"/>
<!-- Script a database to file -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Script" DatabaseItem="ReportServer" OutputFilePath="c:\ADatabaseScript.sql"/>
<!-- Restore a database to a new Name -->
<MSBuild.ExtensionPack.Sql2012.Database TaskAction="Restore" MachineName="$(SqlServerName)" DatabaseItem="$(DatabaseName)" DataFilePath="$(DbDataFilePath)" PrimaryDataFileName="SomeDatabase" LogName="SomeDatabase_log" SecondaryDataFileName="SomeDatabase_CDC" NewDataFilePath="$(OSFilePath)$(DatabaseName).mdf" SecondaryDataFilePath="$(OSFilePath)$(DatabaseName)_CDC.ndf" LogFilePath="$(OSFilePath)\$(DatabaseName)_log.ldf" ReplaceDatabase="True" />
</Target>
</Project>
|
{
"pile_set_name": "Github"
}
|
namespace ScriptableObjectArchitecture
{
public static class SOArchitecture_Utility
{
public const int ASSET_MENU_ORDER_VARIABLES = 121;
public const int ASSET_MENU_ORDER_EVENTS = 122;
public const int ASSET_MENU_ORDER_COLLECTIONS = 123;
public const string VARIABLE_SUBMENU = "Variables/";
public const string COLLECTION_SUBMENU = "Collections/";
public const string GAME_EVENT = "Game Events/";
public const string ADVANCED_GAME_EVENT = GAME_EVENT + "Advanced/";
public const string ADVANCED_VARIABLE_SUBMENU = VARIABLE_SUBMENU + "Advanced/";
public const string ADVANCED_VARIABLE_COLLECTION = COLLECTION_SUBMENU + "Advanced/";
// Add Component Menus
public const string ADD_COMPONENT_ROOT_MENU = "SO Architecture/";
public const string EVENT_LISTENER_SUBMENU = ADD_COMPONENT_ROOT_MENU + "Event Listeners/";
}
}
|
{
"pile_set_name": "Github"
}
|
package net.sgoliver.android.controlpers2;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
public class ControlLogin extends LinearLayout {
private EditText txtUsuario;
private EditText txtPassword;
private Button btnLogin;
private TextView lblMensaje;
private OnLoginListener listener;
public ControlLogin(Context context) {
super(context);
inicializar();
}
public ControlLogin(Context context, AttributeSet attrs) {
super(context, attrs);
inicializar();
// Procesamos los atributos XML personalizados
TypedArray a =
getContext().obtainStyledAttributes(attrs,
R.styleable.ControlLogin);
String textoBoton = a.getString(
R.styleable.ControlLogin_login_text);
btnLogin.setText(textoBoton);
a.recycle();
}
private void inicializar()
{
//Utilizamos el layout 'control_login' como interfaz del control
String infService = Context.LAYOUT_INFLATER_SERVICE;
LayoutInflater li =
(LayoutInflater)getContext().getSystemService(infService);
li.inflate(R.layout.control_login, this, true);
//Obtenemoslas referencias a los distintos control
txtUsuario = (EditText)findViewById(R.id.TxtUsuario);
txtPassword = (EditText)findViewById(R.id.TxtPassword);
btnLogin = (Button)findViewById(R.id.BtnAceptar);
lblMensaje = (TextView)findViewById(R.id.LblMensaje);
//Asociamos los eventos necesarios
asignarEventos();
}
public void setOnLoginListener(OnLoginListener l)
{
listener = l;
}
private void asignarEventos()
{
btnLogin.setOnClickListener(new OnClickListener()
{
public void onClick(View v) {
listener.onLogin(txtUsuario.getText().toString(),
txtPassword.getText().toString());
}
});
}
public void setMensaje(String msg)
{
lblMensaje.setText(msg);
}
}
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE pov SYSTEM "/usr/share/cgc-docs/replay.dtd">
<pov>
<cbid>service</cbid>
<replay>
<write><data>UUUUUUUU</data></write>
<read><delim>\x0a</delim><match><data>What is your name?\x0a</data></match></read>
<write><data>User\x0a</data></write>
<read><delim>\x0a</delim><match><data>Hi\x2c User\x0a</data></match></read>
<read><delim>\x3e</delim><match><pcre>.*?0 B ></pcre></match></read>
<write><data>7 6\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?1 B ></pcre></match></read>
<write><data>3 2\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?2 B ></pcre></match></read>
<write><data>18 11\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?3 B ></pcre></match></read>
<write><data>5 6\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?4 B ></pcre></match></read>
<write><data>8 1\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?5 B ></pcre></match></read>
<write><data>0 9\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?6 B ></pcre></match></read>
<write><data>6 8\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?7 B ></pcre></match></read>
<write><data>19 6\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?7 B ></pcre></match></read>
<write><data>5 12\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?8 B ></pcre></match></read>
<write><data>11 14\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?9 B ></pcre></match></read>
<write><data>2 3\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?10 B ></pcre></match></read>
<write><data>11 7\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?11 B ></pcre></match></read>
<write><data>16 18\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?12 B ></pcre></match></read>
<write><data>9 5\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?13 B ></pcre></match></read>
<write><data>16 11\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?14 B ></pcre></match></read>
<write><data>11 12\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?15 B ></pcre></match></read>
<write><data>10 3\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?16 B ></pcre></match></read>
<write><data>10 13\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?17 B ></pcre></match></read>
<write><data>0 3\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?17 B ></pcre></match></read>
<write><data>14 16\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?18 B ></pcre></match></read>
<write><data>0 7\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?19 B ></pcre></match></read>
<write><data>11 7\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?19 B ></pcre></match></read>
<write><data>6 12\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?20 B ></pcre></match></read>
<write><data>4 19\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?20 B ></pcre></match></read>
<write><data>17 12\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?21 B ></pcre></match></read>
<write><data>7 11\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?22 B ></pcre></match></read>
<write><data>17 19\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?22 B ></pcre></match></read>
<write><data>18 12\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?23 B ></pcre></match></read>
<write><data>0 17\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?24 B ></pcre></match></read>
<write><data>10 2\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?25 B ></pcre></match></read>
<write><data>9 15\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?26 B ></pcre></match></read>
<write><data>2 8\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?27 B ></pcre></match></read>
<write><data>6 6\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?28 B ></pcre></match></read>
<write><data>9 6\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?29 B ></pcre></match></read>
<write><data>7 8\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?30 B ></pcre></match></read>
<write><data>4 10\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?31 B ></pcre></match></read>
<write><data>18 12\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?31 B ></pcre></match></read>
<write><data>7 9\x0a</data></write>
<read><delim>\x3e</delim><match><pcre>.*?32 B ></pcre></match></read>
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use
* of this software is subject to the Facebook Developer Principles and
* Policies [http://developers.facebook.com/policy/]. This copyright notice
* shall be included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
package com.facebook.ads.sdk;
import java.io.File;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.facebook.ads.sdk.APIException.MalformedResponseException;
/**
* This class is auto-generated.
*
* For any issues or feature requests related to this class, please let us know
* on github and we'll fix in our codegen framework. We'll not be able to accept
* pull request for this class.
*
*/
public class Flight extends APINode {
@SerializedName("applinks")
private CatalogItemAppLinks mApplinks = null;
@SerializedName("category_specific_fields")
private CatalogSubVerticalList mCategorySpecificFields = null;
@SerializedName("currency")
private String mCurrency = null;
@SerializedName("description")
private String mDescription = null;
@SerializedName("destination_airport")
private String mDestinationAirport = null;
@SerializedName("destination_city")
private String mDestinationCity = null;
@SerializedName("flight_id")
private String mFlightId = null;
@SerializedName("id")
private String mId = null;
@SerializedName("images")
private List<String> mImages = null;
@SerializedName("oneway_currency")
private String mOnewayCurrency = null;
@SerializedName("oneway_price")
private String mOnewayPrice = null;
@SerializedName("origin_airport")
private String mOriginAirport = null;
@SerializedName("origin_city")
private String mOriginCity = null;
@SerializedName("price")
private String mPrice = null;
@SerializedName("sanitized_images")
private List<String> mSanitizedImages = null;
@SerializedName("url")
private String mUrl = null;
protected static Gson gson = null;
Flight() {
}
public Flight(Long id, APIContext context) {
this(id.toString(), context);
}
public Flight(String id, APIContext context) {
this.mId = id;
this.context = context;
}
public Flight fetch() throws APIException{
Flight newInstance = fetchById(this.getPrefixedId().toString(), this.context);
this.copyFrom(newInstance);
return this;
}
public static Flight fetchById(Long id, APIContext context) throws APIException {
return fetchById(id.toString(), context);
}
public static ListenableFuture<Flight> fetchByIdAsync(Long id, APIContext context) throws APIException {
return fetchByIdAsync(id.toString(), context);
}
public static Flight fetchById(String id, APIContext context) throws APIException {
return
new APIRequestGet(id, context)
.requestAllFields()
.execute();
}
public static ListenableFuture<Flight> fetchByIdAsync(String id, APIContext context) throws APIException {
return
new APIRequestGet(id, context)
.requestAllFields()
.executeAsync();
}
public static APINodeList<Flight> fetchByIds(List<String> ids, List<String> fields, APIContext context) throws APIException {
return (APINodeList<Flight>)(
new APIRequest<Flight>(context, "", "/", "GET", Flight.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.execute()
);
}
public static ListenableFuture<APINodeList<Flight>> fetchByIdsAsync(List<String> ids, List<String> fields, APIContext context) throws APIException {
return
new APIRequest(context, "", "/", "GET", Flight.getParser())
.setParam("ids", APIRequest.joinStringList(ids))
.requestFields(fields)
.executeAsyncBase();
}
private String getPrefixedId() {
return getId();
}
public String getId() {
return getFieldId().toString();
}
public static Flight loadJSON(String json, APIContext context, String header) {
Flight flight = getGson().fromJson(json, Flight.class);
if (context.isDebug()) {
JsonParser parser = new JsonParser();
JsonElement o1 = parser.parse(json);
JsonElement o2 = parser.parse(flight.toString());
if (o1.getAsJsonObject().get("__fb_trace_id__") != null) {
o2.getAsJsonObject().add("__fb_trace_id__", o1.getAsJsonObject().get("__fb_trace_id__"));
}
if (!o1.equals(o2)) {
context.log("[Warning] When parsing response, object is not consistent with JSON:");
context.log("[JSON]" + o1);
context.log("[Object]" + o2);
}
}
flight.context = context;
flight.rawValue = json;
flight.header = header;
return flight;
}
public static APINodeList<Flight> parseResponse(String json, APIContext context, APIRequest request, String header) throws MalformedResponseException {
APINodeList<Flight> flights = new APINodeList<Flight>(request, json, header);
JsonArray arr;
JsonObject obj;
JsonParser parser = new JsonParser();
Exception exception = null;
try{
JsonElement result = parser.parse(json);
if (result.isJsonArray()) {
// First, check if it's a pure JSON Array
arr = result.getAsJsonArray();
for (int i = 0; i < arr.size(); i++) {
flights.add(loadJSON(arr.get(i).getAsJsonObject().toString(), context, header));
};
return flights;
} else if (result.isJsonObject()) {
obj = result.getAsJsonObject();
if (obj.has("data")) {
if (obj.has("paging")) {
JsonObject paging = obj.get("paging").getAsJsonObject();
if (paging.has("cursors")) {
JsonObject cursors = paging.get("cursors").getAsJsonObject();
String before = cursors.has("before") ? cursors
|
{
"pile_set_name": "Github"
}
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TEST_UTILS_H_
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TEST_UTILS_H_
#include <map>
#include <memory>
#include <string>
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
#include "components/prefs/testing_pref_service.h"
#include "net/log/test_net_log.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
class PrefService;
class TestingPrefServiceSimple;
namespace data_reduction_proxy {
class DataReductionProxyTestContext;
class MockDataReductionProxyConfig;
template <class C>
class MockDataReductionProxySettings : public C {
public:
MockDataReductionProxySettings<C>() : C() {
}
MOCK_METHOD0(GetOriginalProfilePrefs, PrefService*());
MOCK_METHOD0(GetLocalStatePrefs, PrefService*());
MOCK_METHOD1(RecordStartupState,
void(ProxyStartupState state));
};
class DataReductionProxySettingsTestBase : public testing::Test {
public:
static void AddTestProxyToCommandLine();
DataReductionProxySettingsTestBase();
DataReductionProxySettingsTestBase(bool allowed,
bool fallback_allowed,
bool promo_allowed);
~DataReductionProxySettingsTestBase() override;
void AddProxyToCommandLine();
void SetUp() override;
template <class C> void ResetSettings(bool allowed,
bool fallback_allowed,
bool promo_allowed,
bool holdback);
virtual void ResetSettings(bool allowed,
bool fallback_allowed,
bool promo_allowed,
bool holdback) = 0;
void ExpectSetProxyPrefs(bool expected_enabled,
bool expected_at_startup);
void CheckMaybeActivateDataReductionProxy(bool initially_enabled,
bool request_succeeded,
bool expected_enabled,
bool expected_restricted,
bool expected_fallback_restricted);
void CheckOnPrefChange(bool enabled, bool expected_enabled, bool managed);
void InitWithStatisticsPrefs();
void InitDataReductionProxy(bool enabled_at_startup);
void CheckDataReductionProxySyntheticTrial(bool enabled);
bool SyntheticFieldTrialRegistrationCallback(const std::string& trial_name,
const std::string& group_name) {
synthetic_field_trials_[trial_name] = group_name;
return true;
}
base::MessageLoopForIO message_loop_;
std::unique_ptr<DataReductionProxyTestContext> test_context_;
std::unique_ptr<DataReductionProxySettings> settings_;
base::Time last_update_time_;
std::map<std::string, std::string> synthetic_field_trials_;
};
// Test implementations should be subclasses of an instantiation of this
// class parameterized for whatever DataReductionProxySettings class
// is being tested.
template <class C>
class ConcreteDataReductionProxySettingsTest
: public DataReductionProxySettingsTestBase {
public:
typedef MockDataReductionProxySettings<C> MockSettings;
void ResetSettings(bool allowed,
bool fallback_allowed,
bool promo_allowed,
bool holdback) override {
return DataReductionProxySettingsTestBase::ResetSettings<C>(
allowed, fallback_allowed, promo_allowed, holdback);
}
};
} // namespace data_reduction_proxy
#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_SETTINGS_TEST_UTILS_H_
|
{
"pile_set_name": "Github"
}
|
%HOMWARP Warp image by an homography
%
% OUT = HOMWARP(H, IM, OPTIONS) is a warp of the image IM obtained by
% applying the homography H to the coordinates of every input pixel.
%
% [OUT,OFFS] = HOMWARP(H, IM, OPTIONS) as above but OFFS is the offset of the
% warped tile OUT with respect to the origin of IM.
%
% Options::
% 'full' output image contains all the warped pixels, but its
% position with respect to the input image is given by the
% second return value OFFS.
% 'extrapval',V set unmapped pixels to this value (default NaN)
% 'roi',R output image contains the specified ROI in the input image
% 'scale',S scale the output by this factor
% 'dimension',D ensure output image is DxD
% 'size',S size of output image S=[W,H]
% 'coords',{U,V} coordinate matrices for im, each same size as im.
%
% Notes::
% - The edges of the resulting output image will in general not be
% be vertical and horizontal lines.
%
% See also HOMOGRAPHY, ITRIM, INTERP2.
% Copyright (C) 1993-2011, by Peter I. Corke
%
% This file is part of The Machine Vision Toolbox for Matlab (MVTB).
%
% MVTB 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, either version 3 of the License, or
% (at your option) any later version.
%
% MVTB 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 Lesser General Public License for more details.
%
% You should have received a copy of the GNU Leser General Public License
% along with MVTB. If not, see <http://www.gnu.org/licenses/>.
function [w,foffs] = homwarp(H, im, varargin)
% the result of a warp can have negative pixel coordinates or very
% large coordinates, well away from the origin.
opt.full = false;
opt.extrapval = NaN;
opt.size = [];
opt.roi = [];
opt.scale = 1;
opt.dimension = [];
opt.coords = [];
opt = tb_optparse(opt, varargin);
[w,h] = isize(im);
if opt.roi
% opt.box is specified in standard ROI format
l = opt.roi(1,1); t = opt.roi(2,1);
r = opt.roi(1,2); b = opt.roi(2,2);
box = [l r r l; t t b b];
else
% bounding box in the input image is the full extent
box = [1 w w 1; 1 1 h h];
end
% map the box vertices in input image to vertices in output image
Hbox = homtrans(H, box);
% determine the extent of the image after warping
xmin = min(Hbox(1,:)); xmax = max(Hbox(1,:));
ymin = min(Hbox(2,:)); ymax = max(Hbox(2,:));
% we want the pixel coordinates to map to positive values, determine the minimum
if opt.full
offs = floor([xmin, ymin]);
% and prepend a translational homography that translates the output image
H = [1 0 -offs(1); 0 1 -offs(2); 0 0 1] * H;
end
sz = round([xmax-xmin+1, ymax-ymin+1]);
% we can specify the maxmimum dimension of the resulting image
if ~isempty(opt.dimension)
s = opt.dimension / max(sz);
H = diag([s s 1]) * H;
Hbox = homtrans(H, box);
% determine the extent
xmin = min(Hbox(1,:)); xmax = max(Hbox(1,:));
ymin = min(Hbox(2,:)); ymax = max(Hbox(2,:));
% we want the pixel coordinates to map to positive values, determine the minimum
offs = floor([xmin, ymin]);
% and prepend a translational homography that translates the output image
H = [1 0 -offs(1); 0 1 -offs(2); 0 0 1] * H;
sz = round([xmax-xmin+1, ymax-ymin+1]);
end
if isempty(opt.coords)
[Ui,Vi] = imeshgrid(im);
else
Ui = opt.coords{1};
Vi = opt.coords{2};
end
% determine size of the output image
if ~isempty(opt.size)
[Uo,Vo] = imeshgrid(opt.size);
else
if opt.full
[Uo,Vo] = imeshgrid(sz);
else
[Uo,Vo] = imeshgrid(im);
end
end
% warp the coordinates of the output pixels
UV = homtrans(inv(H), [Uo(:) Vo(:)]');
U = reshape(UV(1,:), size(Uo));
V = reshape(UV(2,:), size(Vo));
% interpolate for each color plane
for p=1:size(im,3)
imh(:,:,p) = interp2(Ui, Vi, idouble(im(:,:,p)), U, V, 'linear', opt.extrapval);
end
if nargout > 0
w = imh;
else
idisp(imh);
end
if nargout > 1 && opt.full
foffs = offs;
end
|
{
"pile_set_name": "Github"
}
|
//
// CSSlider.m
// AppSlate
//
// Created by Taehan Kim on 12. 01. 26..
// Copyright (c) 2012년 ChocolateSoft. All rights reserved.
//
#import "CSSlider.h"
@implementation CSSlider
-(id) object
{
return ((UISlider*)csView);
}
//===========================================================================
#pragma mark -
-(void) setMinimumBarColor:(UIColor*)color
{
if( [color isKindOfClass:[UIColor class]] )
[((UISlider*)csView) setMinimumTrackTintColor:color];
}
-(UIColor*) getMinimumBarColor
{
return ((UISlider*)csView).minimumTrackTintColor;
}
-(void) setMaximumBarColor:(UIColor*)color
{
if( [color isKindOfClass:[UIColor class]] )
[((UISlider*)csView) setMaximumTrackTintColor:color];
}
-(UIColor*) getMaximumBarColor
{
return ((UISlider*)csView).maximumTrackTintColor;
}
-(void) setThumbColor:(UIColor*)color
{
if( [color isKindOfClass:[UIColor class]] )
[((UISlider*)csView) setThumbTintColor:color];
}
-(UIColor*) getThumbColor
{
return ((UISlider*)csView).thumbTintColor;
}
-(void) setMinimumValue:(NSNumber*)number
{
if( [number isKindOfClass:[NSNumber class]] )
[((UISlider*)csView) setMinimumValue:[number floatValue]];
else if( [number isKindOfClass:[NSString class]] )
[((UISlider*)csView) setMinimumValue:[(NSString*)number length]];
}
-(NSNumber*) getMinimumValue
{
return @( ((UISlider*)csView).minimumValue );
}
-(void) setMaximumValue:(NSNumber*)number
{
if( [number isKindOfClass:[NSNumber class]] )
[((UISlider*)csView) setMaximumValue:[number floatValue]];
else if( [number isKindOfClass:[NSString class]] )
[((UISlider*)csView) setMaximumValue:[(NSString*)number length]];
}
-(NSNumber*) getMaximumValue
{
return @( ((UISlider*)csView).maximumValue );
}
-(void) setThumbValue:(NSNumber*)number
{
CGFloat toValue;
if( [number isKindOfClass:[NSNumber class]] )
toValue = [number floatValue];
else if( [number isKindOfClass:[NSString class]] )
toValue = [(NSString*)number length];
else{
EXCLAMATION;
return;
}
if( toValue > ((UISlider*)csView).maximumValue )
toValue = ((UISlider*)csView).maximumValue;
if( toValue < ((UISlider*)csView).minimumValue )
toValue = ((UISlider*)csView).minimumValue;
[((UISlider*)csView) setValue:toValue animated:YES];
}
-(NSNumber*) getThumbValue
{
return @( ((UISlider*)csView).value );
}
-(void) setContinuosChange:(NSNumber*)boolVal
{
if( [boolVal isKindOfClass:[NSNumber class]] )
[((UISlider*)csView) setContinuous:[boolVal boolValue]];
}
-(NSNumber*) getContinuosChange
{
return@( ((UISlider*)csView).continuous );
}
#pragma mark -
-(id) initGear
{
if( !(self = [super init]) ) return nil;
csView = [[UISlider alloc] initWithFrame:CGRectMake(0, 0, 400, MINSIZE)];
[csView setBackgroundColor:[UIColor clearColor]];
[csView setUserInteractionEnabled:YES];
csCode = CS_SLIDER;
isUIObj = YES;
[((UISlider*)csView) setMinimumValue:0];
[((UISlider*)csView) setMaximumValue:10];
[((UISlider*)csView) setValue:5];
[((UISlider*)csView) setContinuous:NO];
[((UISlider*)csView) setMinimumTrackTintColor:[UIColor darkGrayColor]];
[((UISlider*)csView) setMaximumTrackTintColor:[UIColor whiteColor]];
[((UISlider*)csView) setThumbTintColor:[UIColor whiteColor]];
[((UISlider*)csView) addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
DEFAULT_CENTER_D;
NSDictionary *d0 = ALPHA_D;
NSDictionary *d1 = MAKE_PROPERTY_D(@"Value", P_NUM, @selector(setThumbValue:),@selector(getThumbValue));
NSDictionary *d2 = MAKE_PROPERTY_D(@"Minimum Value", P_NUM, @selector(setMinimumValue:),@selector(getMinimumValue));
NSDictionary *d3 = MAKE_PROPERTY_D(@"Maximum Value", P_NUM, @selector(setMaximumValue:),@selector(getMaximumValue));
NSDictionary *d4 = MAKE_PROPERTY_D(@"Minimum Bar Color", P_COLOR, @selector(setMinimumBarColor:),@selector(getMinimumBarColor));
NSDictionary *d5 = MAKE_PROPERTY_D(@"Maximum Bar Color", P_COLOR, @selector(setMaximumBarColor:),@selector(getMaximumBarColor));
// NSDictionary *d6 = MAKE_PROPERTY_D(@"Thumb Color", P_COLOR, @selector(setThumbColor:),@selector(getThumbColor));
NSDictionary *d7 = MAKE_PROPERTY_D(@"Continuos Change", P_BOOL, @selector(setContinuosChange:),@selector(getContinuosChange));
pListArray = @[xc,yc,d0,d1,d2,d3,d4,d5,d7];
NSMutableDictionary MAKE_ACTION_D(@"Changed Value", A_NUM, a1);
NSMutableDictionary MAKE_ACTION_D(@"Minimum Value", A_NUM, a2);
NSMutableDictionary MAKE_ACTION_D(@"Maximum Value", A_NUM, a3);
actionArray = @[a1, a2, a3];
return self;
}
-(id)initWithCoder:(NSCoder *)decoder
{
if( (self=[super initWithCoder:decoder]) ) {
[((UISlider*)csView) addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
}
return self;
}
#pragma mark - Gear's Unique Actions
-(void) valueChanged:(id) sender
{
SEL act;
NSNumber *nsMagicNum;
CGFloat myValue = ((UISlider*)sender).value;
// 1. value changed
act = ((NSValue*)((NSDictionary*)actionArray[0])[@"selector"]).pointerValue;
if( nil != act ){
nsMagicNum = ((NSDictionary*)actionArray[0])[@"mNum"];
CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue];
if( nil != gObj ){
if( [gObj respondsToSelector:act] )
[gObj performSelector:act withObject:@(myValue)];
else
EXCLAMATION;
}
}
// 2. did min value
act = ((NSValue*)((NSDictionary*)actionArray[1])[@"selector"]).pointerValue;
if( nil != act && myValue == ((UISlider*)sender).minimumValue )
{
nsMagicNum = ((NSDictionary*)actionArray[1])[@"mNum"];
CSGearObject *gObj = [USERCONTEXT getGearWithMagicNum:nsMagicNum.integerValue];
if( nil != gObj ){
if( [gObj respondsToSelector:act] )
[gObj performSelector:act
|
{
"pile_set_name": "Github"
}
|
// Copyright 2009 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.
// +build !gccgo
#include "textflag.h"
//
// System call support for AMD64, OpenBSD
//
// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.
TEXT ·Syscall(SB),NOSPLIT,$0-56
JMP syscall·Syscall(SB)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
JMP syscall·Syscall6(SB)
TEXT ·Syscall9(SB),NOSPLIT,$0-104
JMP syscall·Syscall9(SB)
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JMP syscall·RawSyscall(SB)
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JMP syscall·RawSyscall6(SB)
|
{
"pile_set_name": "Github"
}
|
describe('jsdoc/src/astNode', () => {
const astBuilder = require('jsdoc/src/astbuilder');
const astNode = require('jsdoc/src/astnode');
const babelParser = require('@babel/parser');
const env = require('jsdoc/env');
const Syntax = require('jsdoc/src/syntax').Syntax;
function parse(str) {
return babelParser.parse(str, astBuilder.parserOptions).program.body[0];
}
// create the AST nodes we'll be testing
const arrayExpression = parse('[,]').expression;
const arrowFunctionExpression = parse('var foo = () => {};').declarations[0].init;
const assignmentExpression = parse('foo = 1;').expression;
const binaryExpression = parse('foo & foo;').expression;
const experimentalObjectRestSpread = parse('var one = {...two, three: 4};').declarations[0].init;
const functionDeclaration1 = parse('function foo() {}');
const functionDeclaration2 = parse('function foo(bar) {}');
const functionDeclaration3 = parse('function foo(bar, baz, qux) {}');
const functionDeclaration4 = parse('function foo(...bar) {}');
const functionExpression1 = parse('var foo = function() {};').declarations[0].init;
const functionExpression2 = parse('var foo = function(bar) {};').declarations[0].init;
const identifier = parse('foo;').expression;
const literal = parse('1;').expression;
const memberExpression = parse('foo.bar;').expression;
const memberExpressionComputed1 = parse('foo["bar"];').expression;
const memberExpressionComputed2 = parse('foo[\'bar\'];').expression;
const methodDefinition1 = parse('class Foo { bar() {} }').body.body[0];
const methodDefinition2 = parse('var foo = () => class { bar() {} };').declarations[0].init.body
.body[0];
const propertyGet = parse('var foo = { get bar() {} };').declarations[0].init.properties[0];
const propertyInit = parse('var foo = { bar: {} };').declarations[0].init.properties[0];
const propertySet = parse('var foo = { set bar(a) {} };').declarations[0].init.properties[0];
const thisExpression = parse('this;').expression;
const unaryExpression1 = parse('+1;').expression;
const unaryExpression2 = parse('+foo;').expression;
const variableDeclarator1 = parse('var foo = 1;').declarations[0];
const variableDeclarator2 = parse('var foo;').declarations[0];
it('should exist', () => {
expect(astNode).toBeObject();
});
it('should export an addNodeProperties method', () => {
expect(astNode.addNodeProperties).toBeFunction();
});
it('should export a getInfo method', () => {
expect(astNode.getInfo).toBeFunction();
});
it('should export a getParamNames method', () => {
expect(astNode.getParamNames).toBeFunction();
});
it('should export an isAccessor method', () => {
expect(astNode.isAccessor).toBeFunction();
});
it('should export an isAssignment method', () => {
expect(astNode.isAssignment).toBeFunction();
});
it('should export an isFunction method', () => {
expect(astNode.isFunction).toBeFunction();
});
it('should export an isScope method', () => {
expect(astNode.isScope).toBeFunction();
});
it('should export a nodeToString method', () => {
expect(astNode.nodeToString).toBeFunction();
});
it('should export a nodeToValue method', () => {
expect(astNode.nodeToValue).toBeFunction();
});
describe('addNodeProperties', () => {
let debugEnabled;
beforeEach(() => {
debugEnabled = Boolean(env.opts.debug);
});
afterEach(() => {
env.opts.debug = debugEnabled;
});
it('should return null for undefined input', () => {
expect( astNode.addNodeProperties() ).toBe(null);
});
it('should return null if the input is not an object', () => {
expect( astNode.addNodeProperties('foo') ).toBe(null);
});
it('should preserve existing properties that are not "node properties"', () => {
const node = astNode.addNodeProperties({foo: 1});
expect(node).toBeObject();
expect(node.foo).toBe(1);
});
it('should add a non-enumerable nodeId if necessary', () => {
const node = astNode.addNodeProperties({});
const descriptor = Object.getOwnPropertyDescriptor(node, 'nodeId');
expect(descriptor).toBeObject();
expect(descriptor.value).toBeString();
expect(descriptor.enumerable).toBeFalse();
});
it('should not overwrite an existing nodeId', () => {
const nodeId = 'foo';
const node = astNode.addNodeProperties({nodeId: nodeId});
expect(node.nodeId).toBe(nodeId);
});
it('should add an enumerable nodeId in debug mode', () => {
let descriptor;
let node;
env.opts.debug = true;
node = astNode.addNodeProperties({});
descriptor = Object.getOwnPropertyDescriptor(node, 'nodeId');
expect(descriptor.enumerable).toBeTrue();
});
it('should add a non-enumerable, writable parent if necessary', () => {
const node = astNode.addNodeProperties({});
const descriptor = Object.getOwnPropertyDescriptor(node, 'parent');
expect(descriptor).toBeDefined();
expect(descriptor.value).toBeUndefined();
expect(descriptor.enumerable).toBeFalse();
expect(descriptor.writable).toBeTrue();
});
it('should not overwrite an existing parent', () => {
const parent = {};
const node = astNode.addNodeProperties({parent: parent});
expect(node.parent).toBe(parent);
});
it('should not overwrite a null parent', () => {
const node = astNode.addNodeProperties({parent: null});
expect(node.parent).toBeNull();
});
it('should add an enumerable parentId in debug mode', () => {
let descriptor;
let node;
env.opts.debug = true;
node = astNode.addNodeProperties({});
descriptor = Object.getOwnPropertyDescriptor(node, 'parentId');
expect(descriptor).toBeObject();
expect(descriptor.enumerable).toBeTrue();
});
it('should provide a null parentId in debug mode for nodes with no parent', () => {
let node;
env.opts.debug = true;
node = astNode.addNodeProperties({});
expect(node.parentId).toBeNull();
});
it('should provide a non-null parentId in debug mode for nodes with a parent', () => {
let node;
let parent;
env.opts.debug = true;
node = astNode.addNodeProperties({});
parent = astNode.addNodeProperties({});
node.parent = parent;
expect(node.parentId).toBe(parent.nodeId);
});
it('should add a non-enumerable, writable enclosingScope if necessary', () => {
const node = astNode.addNodeProperties({});
const descriptor = Object.getOwnPropertyDescriptor(node, 'enclosingScope');
expect(descriptor).toBeObject();
expect(descriptor.value).toBeUndefined();
expect(descriptor.enumerable).toBeFalse();
expect(descriptor.writable).toBeTrue();
});
it('should not overwrite an existing enclosingScope', () => {
const enclosingScope = {};
const node = astNode.addNodeProperties({enclosingScope: enclosingScope});
expect(node.enclosingScope).toBe(enclosingScope);
});
it('should not overwrite a null enclosingScope', () => {
const node = astNode.addNodeProperties({enclosingScope: null});
expect(node.enclosingScope).toBeNull();
});
|
{
"pile_set_name": "Github"
}
|
SubDir HAIKU_TOP src tests system network posixnet ;
UsePrivateHeaders private shared ;
UnitTestLib posixnettest.so :
PosixNetTestAddon.cpp
GetAddrInfo.cpp
SocketTests.cpp
: be $(TARGET_NETWORK_LIBS) [ TargetLibstdc++ ]
;
|
{
"pile_set_name": "Github"
}
|
// This file was generated by go generate; DO NOT EDIT
package currency
import "golang.org/x/text/internal/tag"
// CLDRVersion is the CLDR version from which the tables in this package are derived.
const CLDRVersion = "29"
const (
xxx = 282
xts = 280
usd = 249
eur = 92
jpy = 131
gbp = 97
chf = 60
aud = 19
nzd = 190
cad = 57
sek = 217
nok = 188
dkk = 80
xag = 263
xau = 264
xpt = 277
xpd = 275
brl = 46
cny = 66
inr = 123
rub = 208
hkd = 112
idr = 118
krw = 139
mxn = 176
pln = 199
sar = 211
thb = 232
try = 241
twd = 243
zar = 290
)
// currency holds an alphabetically sorted list of canonical 3-letter currency
// identifiers. Each identifier is followed by a byte of type currencyInfo,
// defined in gen_common.go.
var currency tag.Index = "" + // Size: 1196 bytes
"\x00\x00\x00\x00ADP\x09AED\x00AFA\x00AFN\x09ALK\x00ALL\x09AMD\x09ANG\x00" +
"AOA\x00AOK\x00AON\x00AOR\x00ARA\x00ARL\x00ARM\x00ARP\x00ARS\x00ATS\x00AU" +
"D\x00AWG\x00AZM\x00AZN\x00BAD\x00BAM\x00BAN\x00BBD\x00BDT\x00BEC\x00BEF" +
"\x00BEL\x00BGL\x00BGM\x00BGN\x00BGO\x00BHD\x1bBIF\x09BMD\x00BND\x00BOB" +
"\x00BOL\x00BOP\x00BOV\x00BRB\x00BRC\x00BRE\x00BRL\x00BRN\x00BRR\x00BRZ" +
"\x00BSD\x00BTN\x00BUK\x00BWP\x00BYB\x00BYR\x09BZD\x00CAD(CDF\x00CHE\x00C" +
"HF(CHW\x00CLE\x00CLF$CLP\x09CNX\x00CNY\x00COP\x09COU\x00CRC\x09CSD\x00CS" +
"K\x00CUC\x00CUP\x00CVE\x00CYP\x00CZK\x08DDM\x00DEM\x00DJF\x09DKK\x00DOP" +
"\x00DZD\x00ECS\x00ECV\x00EEK\x00EGP\x00ERN\x00ESA\x00ESB\x00ESP\x09ETB" +
"\x00EUR\x00FIM\x00FJD\x00FKP\x00FRF\x00GBP\x00GEK\x00GEL\x00GHC\x00GHS" +
"\x00GIP\x00GMD\x00GNF\x09GNS\x00GQE\x00GRD\x00GTQ\x00GWE\x00GWP\x00GYD" +
"\x09HKD\x00HNL\x00HRD\x00HRK\x00HTG\x00HUF\x08IDR\x09IEP\x00ILP\x00ILR" +
"\x00ILS\x00INR\x00IQD\x09IRR\x09ISJ\x00ISK\x09ITL\x09JMD\x00JOD\x1bJPY" +
"\x09KES\x00KGS\x00KHR\x00KMF\x09KPW\x09KRH\x00KRO\x00KRW\x09KWD\x1bKYD" +
"\x00KZT\x00LAK\x09LBP\x09LKR\x00LRD\x00LSL\x00LTL\x00LTT\x00LUC\x00LUF" +
"\x09LUL\x00LVL\x00LVR\x00LYD\x1bMAD\x00MAF\x00MCF\x00MDC\x00MDL\x00MGA" +
"\x09MGF\x09MKD\x00MKN\x00MLF\x00MMK\x09MNT\x09MOP\x00MRO\x09MTL\x00MTP" +
"\x00MUR\x09MVP\x00MVR\x00MWK\x00MXN\x00MXP\x00MXV\x00MYR\x00MZE\x00MZM" +
"\x00MZN\x00NAD\x00NGN\x00NIC\x00NIO\x00NLG\x00NOK\x00NPR\x00NZD\x00OMR" +
"\x1bPAB\x00PEI\x00PEN\x00PES\x00PGK\x00PHP\x00PKR\x09PLN\x00PLZ\x00PTE" +
"\x00PYG\x09QAR\x00RHD\x00ROL\x00RON\x00RSD\x09RUB\x00RUR\x00RWF\x09SAR" +
"\x00SBD\x00SCR\x00SDD\x00SDG\x00SDP\x00SEK\x00SGD\x00SHP\x00SIT\x00SKK" +
"\x00SLL\x09SOS\x09SRD\x00SRG\x00SSP\x00STD\x09SUR\x00SVC\x00SYP\x09SZL" +
"\x00THB\x00TJR\x00TJS\x00TMM\x09TMT\x00TND\x1bTOP\x00TPE\x00TRL\x09TRY" +
"\x00TTD\x00TWD\x08TZS\x09UAH\x00UAK\x00UGS\x00UGX\x09USD\x00USN\x00USS" +
"\x00UYI\x09UYP\x00UYU\x00UZS\x09VEB\x00VEF\x00VND\x09VNN\x00VUV\x09WST" +
"\x00XAF\x09XAG\x00XAU\x00XBA\x00XBB\x00XBC\x00XBD\x00XCD\x00XDR\x00XEU" +
"\x00XFO\x00XFU\x00XOF\x09XPD\x00XPF\x09XPT\x00XRE\x00XSU\x00XTS\x00XUA" +
"\x00XXX\x00YDD\x00YER\x09YUD\x00YUM\x00YUN\x00YUR\x00ZAL\x00ZAR\x00ZMK" +
"\x09ZMW\x00ZRN\x00ZRZ\x00ZWD\x09ZWL\x00ZWR\x00\xff\xff\xff\xff"
const numCurrencies = 297
type toCurrency struct {
region uint16
code uint16
}
var regionToCurrency = []toCurrency{ // 255 elements
0: {region: 0x4143, code: 0xdb},
1: {region: 0x4144, code: 0x5c},
2: {region: 0x4145, code: 0x2},
3: {region: 0x4146, code: 0x4},
4: {region: 0x4147, code
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef _LIBROOT_MEMORY_PRIVATE_H
#define _LIBROOT_MEMORY_PRIVATE_H
#include <OS.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
status_t get_memory_properties(team_id teamID, const void* address,
uint32* _protected, uint32* _lock);
__END_DECLS
#endif // _LIBROOT_MEMORY_PRIVATE_H
|
{
"pile_set_name": "Github"
}
|
% File src/library/base/man/any.Rd
% Part of the R package, https://www.R-project.org
% Copyright 1995-2010 R Core Team
% Distributed under GPL 2 or later
\name{any}
\title{Are Some Values True?}
\usage{
any(\dots, na.rm = FALSE)
}
\alias{any}
\description{
Given a set of logical vectors, is at least one of the values true?
}
\arguments{
\item{\dots}{zero or more logical vectors. Other objects of zero
length are ignored, and the rest are coerced to logical ignoring
any class.}
\item{na.rm}{logical. If true \code{NA} values are removed before
the result is computed.}
}
\details{
This is a generic function: methods can be defined for it
directly or via the \code{\link[=S3groupGeneric]{Summary}} group generic.
For this to work properly, the arguments \code{\dots} should be
unnamed, and dispatch is on the first argument.
Coercion of types other than integer (raw, double, complex, character,
list) gives a warning as this is often unintentional.
This is a \link{primitive} function.
}
\value{
The value is a logical vector of length one.
Let \code{x} denote the concatenation of all the logical vectors in
\code{...} (after coercion), after removing \code{NA}s if requested by
\code{na.rm = TRUE}.
The value returned is \code{TRUE} if at least one of the values in
\code{x} is \code{TRUE}, and \code{FALSE} if all of the values in
\code{x} are \code{FALSE} (including if there are no values). Otherwise
the value is \code{NA} (which can only occur if \code{na.rm = FALSE}
and \code{\dots} contains no \code{TRUE} values and at least one
\code{NA} value).
}
\section{S4 methods}{
This is part of the S4 \code{\link[=S4groupGeneric]{Summary}}
group generic. Methods for it must use the signature
\code{x, \dots, na.rm}.
}
\references{
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth & Brooks/Cole.
}
\seealso{
\code{\link{all}}, the \sQuote{complement} of \code{any}.
}
\examples{
range(x <- sort(round(stats::rnorm(10) - 1.2, 1)))
if(any(x < 0)) cat("x contains negative values\n")
}
\keyword{logic}
|
{
"pile_set_name": "Github"
}
|
apiVersion: v1
description: A Helm chart for Kubernetes
name: certmanager
version: 1.0.1
appVersion: 0.3.1
tillerVersion: ">=2.7.2"
|
{
"pile_set_name": "Github"
}
|
/*************************************************************
*
* MathJax/localization/cy/HTML-CSS.js
*
* Copyright (c) 2009-2016 The MathJax Consortium
*
* 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.
*
*/
MathJax.Localization.addTranslation("cy","HTML-CSS",{
version: "2.7.2",
isLoaded: true,
strings: {
}
});
MathJax.Ajax.loadComplete("[MathJax]/localization/cy/HTML-CSS.js");
|
{
"pile_set_name": "Github"
}
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html
module Stratosphere.ResourceProperties.DLMLifecyclePolicySchedule where
import Stratosphere.ResourceImports
import Stratosphere.ResourceProperties.DLMLifecyclePolicyCreateRule
import Stratosphere.ResourceProperties.DLMLifecyclePolicyCrossRegionCopyRule
import Stratosphere.ResourceProperties.DLMLifecyclePolicyFastRestoreRule
import Stratosphere.ResourceProperties.DLMLifecyclePolicyRetainRule
import Stratosphere.ResourceProperties.Tag
-- | Full data type definition for DLMLifecyclePolicySchedule. See
-- 'dlmLifecyclePolicySchedule' for a more convenient constructor.
data DLMLifecyclePolicySchedule =
DLMLifecyclePolicySchedule
{ _dLMLifecyclePolicyScheduleCopyTags :: Maybe (Val Bool)
, _dLMLifecyclePolicyScheduleCreateRule :: Maybe DLMLifecyclePolicyCreateRule
, _dLMLifecyclePolicyScheduleCrossRegionCopyRules :: Maybe [DLMLifecyclePolicyCrossRegionCopyRule]
, _dLMLifecyclePolicyScheduleFastRestoreRule :: Maybe DLMLifecyclePolicyFastRestoreRule
, _dLMLifecyclePolicyScheduleName :: Maybe (Val Text)
, _dLMLifecyclePolicyScheduleRetainRule :: Maybe DLMLifecyclePolicyRetainRule
, _dLMLifecyclePolicyScheduleTagsToAdd :: Maybe [Tag]
, _dLMLifecyclePolicyScheduleVariableTags :: Maybe [Tag]
} deriving (Show, Eq)
instance ToJSON DLMLifecyclePolicySchedule where
toJSON DLMLifecyclePolicySchedule{..} =
object $
catMaybes
[ fmap (("CopyTags",) . toJSON) _dLMLifecyclePolicyScheduleCopyTags
, fmap (("CreateRule",) . toJSON) _dLMLifecyclePolicyScheduleCreateRule
, fmap (("CrossRegionCopyRules",) . toJSON) _dLMLifecyclePolicyScheduleCrossRegionCopyRules
, fmap (("FastRestoreRule",) . toJSON) _dLMLifecyclePolicyScheduleFastRestoreRule
, fmap (("Name",) . toJSON) _dLMLifecyclePolicyScheduleName
, fmap (("RetainRule",) . toJSON) _dLMLifecyclePolicyScheduleRetainRule
, fmap (("TagsToAdd",) . toJSON) _dLMLifecyclePolicyScheduleTagsToAdd
, fmap (("VariableTags",) . toJSON) _dLMLifecyclePolicyScheduleVariableTags
]
-- | Constructor for 'DLMLifecyclePolicySchedule' containing required fields
-- as arguments.
dlmLifecyclePolicySchedule
:: DLMLifecyclePolicySchedule
dlmLifecyclePolicySchedule =
DLMLifecyclePolicySchedule
{ _dLMLifecyclePolicyScheduleCopyTags = Nothing
, _dLMLifecyclePolicyScheduleCreateRule = Nothing
, _dLMLifecyclePolicyScheduleCrossRegionCopyRules = Nothing
, _dLMLifecyclePolicyScheduleFastRestoreRule = Nothing
, _dLMLifecyclePolicyScheduleName = Nothing
, _dLMLifecyclePolicyScheduleRetainRule = Nothing
, _dLMLifecyclePolicyScheduleTagsToAdd = Nothing
, _dLMLifecyclePolicyScheduleVariableTags = Nothing
}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-copytags
dlmlpsCopyTags :: Lens' DLMLifecyclePolicySchedule (Maybe (Val Bool))
dlmlpsCopyTags = lens _dLMLifecyclePolicyScheduleCopyTags (\s a -> s { _dLMLifecyclePolicyScheduleCopyTags = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-createrule
dlmlpsCreateRule :: Lens' DLMLifecyclePolicySchedule (Maybe DLMLifecyclePolicyCreateRule)
dlmlpsCreateRule = lens _dLMLifecyclePolicyScheduleCreateRule (\s a -> s { _dLMLifecyclePolicyScheduleCreateRule = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-crossregioncopyrules
dlmlpsCrossRegionCopyRules :: Lens' DLMLifecyclePolicySchedule (Maybe [DLMLifecyclePolicyCrossRegionCopyRule])
dlmlpsCrossRegionCopyRules = lens _dLMLifecyclePolicyScheduleCrossRegionCopyRules (\s a -> s { _dLMLifecyclePolicyScheduleCrossRegionCopyRules = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-fastrestorerule
dlmlpsFastRestoreRule :: Lens' DLMLifecyclePolicySchedule (Maybe DLMLifecyclePolicyFastRestoreRule)
dlmlpsFastRestoreRule = lens _dLMLifecyclePolicyScheduleFastRestoreRule (\s a -> s { _dLMLifecyclePolicyScheduleFastRestoreRule = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-name
dlmlpsName :: Lens' DLMLifecyclePolicySchedule (Maybe (Val Text))
dlmlpsName = lens _dLMLifecyclePolicyScheduleName (\s a -> s { _dLMLifecyclePolicyScheduleName = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-retainrule
dlmlpsRetainRule :: Lens' DLMLifecyclePolicySchedule (Maybe DLMLifecyclePolicyRetainRule)
dlmlpsRetainRule = lens _dLMLifecyclePolicyScheduleRetainRule (\s a -> s { _dLMLifecyclePolicyScheduleRetainRule = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-tagstoadd
dlmlpsTagsToAdd :: Lens' DLMLifecyclePolicySchedule (Maybe [Tag])
dlmlpsTagsToAdd = lens _dLMLifecyclePolicyScheduleTagsToAdd (\s a -> s { _dLMLifecyclePolicyScheduleTagsToAdd = a })
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dlm-lifecyclepolicy-schedule.html#cfn-dlm-lifecyclepolicy-schedule-variabletags
dlmlpsVariableTags :: Lens' DLMLifecyclePolicySchedule (Maybe [Tag])
dlmlpsVariableTags = lens _dLMLifecyclePolicyScheduleVariableTags (\s a -> s { _dLMLifecyclePolicyScheduleVariableTags = a })
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* @author Lajos Molnár <lajax.m@gmail.com>
*
* @since 1.0
*/
namespace lajax\translatemanager\models;
use Yii;
/**
* This is the model class for table "language_translate".
*
* @property string $id
* @property string $language
* @property string $translation
* @property LanguageSource $LanguageSource
* @property Language $language0
*/
class LanguageTranslate extends \yii\db\ActiveRecord
{
/**
* @var int Number of translated language elements.
*/
public $cnt;
/**
* @inheritdoc
*/
public static function getDb()
{
$dbMessageSources = Yii::getObjectVars(Yii::$app->i18n->getMessageSource('DbMessageSource'));
return $dbMessageSources['db'];
}
/**
* @inheritdoc
*/
public static function tableName()
{
$dbMessageSources = Yii::getObjectVars(Yii::$app->i18n->getMessageSource('DbMessageSource'));
return isset($dbMessageSources['messageTable']) ? $dbMessageSources['messageTable'] : '{{%message}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id', 'language'], 'required'],
[['id'], 'integer'],
[['id'], 'exist', 'targetClass' => '\lajax\translatemanager\models\LanguageSource'],
[['language'], 'exist', 'targetClass' => '\lajax\translatemanager\models\Language', 'targetAttribute' => 'language_id'],
[['translation'], 'string'],
[['language'], 'string', 'max' => 5],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('model', 'ID'),
'language' => Yii::t('model', 'Language'),
'translation' => Yii::t('model', 'Translation'),
];
}
/**
* Returnes language object by id and language_id. If not found, creates a new one.
*
* @param int $id LanguageSource id
* @param string $languageId Language language_id
*
* @return LanguageTranslate
*
* @deprecated since version 1.2.7
*/
public static function getLanguageTranslateByIdAndLanguageId($id, $languageId)
{
$languageTranslate = self::findOne(['id' => $id, 'language' => $languageId]);
if (!$languageTranslate) {
$languageTranslate = new self([
'id' => $id,
'language' => $languageId,
]);
}
return $languageTranslate;
}
/**
* @return array The name of languages the language element has been translated into.
*/
public function getTranslatedLanguageNames()
{
$translatedLanguages = $this->getTranslatedLanguages();
$data = [];
foreach ($translatedLanguages as $languageTranslate) {
$data[$languageTranslate->language] = $languageTranslate->getLanguageName();
}
return $data;
}
/**
* Returns the language element in all other languages.
*
* @return LanguageTranslate[]
*/
public function getTranslatedLanguages()
{
return static::find()->where('id = :id AND language != :language', [':id' => $this->id, 'language' => $this->language])->all();
}
/**
* @staticvar array $language_names caching the list of languages.
*
* @return string
*/
public function getLanguageName()
{
static $language_names;
if (!$language_names || empty($language_names[$this->language])) {
$language_names = Language::getLanguageNames();
}
return empty($language_names[$this->language]) ? $this->language : $language_names[$this->language];
}
/**
* @return \yii\db\ActiveQuery
*
* @deprecated since version 1.4.5
*/
public function getId0()
{
return $this->hasOne(LanguageSource::className(), ['id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getLanguageSource()
{
return $this->hasOne(LanguageSource::className(), ['id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getLanguage0()
{
return $this->hasOne(Language::className(), ['language_id' => 'language']);
}
}
|
{
"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 pkcs12
import (
"errors"
"unicode/utf16"
)
// bmpString returns s encoded in UCS-2 with a zero terminator.
func bmpString(s string) ([]byte, error) {
// References:
// https://tools.ietf.org/html/rfc7292#appendix-B.1
// https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane
// - non-BMP characters are encoded in UTF 16 by using a surrogate pair of 16-bit codes
// EncodeRune returns 0xfffd if the rune does not need special encoding
// - the above RFC provides the info that BMPStrings are NULL terminated.
ret := make([]byte, 0, 2*len(s)+2)
for _, r := range s {
if t, _ := utf16.EncodeRune(r); t != 0xfffd {
return nil, errors.New("pkcs12: string contains characters that cannot be encoded in UCS-2")
}
ret = append(ret, byte(r/256), byte(r%256))
}
return append(ret, 0, 0), nil
}
func decodeBMPString(bmpString []byte) (string, error) {
if len(bmpString)%2 != 0 {
return "", errors.New("pkcs12: odd-length BMP string")
}
// strip terminator if present
if l := len(bmpString); l >= 2 && bmpString[l-1] == 0 && bmpString[l-2] == 0 {
bmpString = bmpString[:l-2]
}
s := make([]uint16, 0, len(bmpString)/2)
for len(bmpString) > 0 {
s = append(s, uint16(bmpString[0])<<8+uint16(bmpString[1]))
bmpString = bmpString[2:]
}
return string(utf16.Decode(s)), nil
}
|
{
"pile_set_name": "Github"
}
|
/**************************************************************************/
/* */
/* This file is part of Frama-C. */
/* */
/* Copyright (C) 2007-2019 */
/* CEA (Commissariat à l'énergie atomique et aux énergies */
/* alternatives) */
/* */
/* 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, version 2.1. */
/* */
/* It 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 Lesser General Public License for more details. */
/* */
/* See the GNU Lesser General Public License version 2.1 */
/* for more details (enclosed in the file licenses/LGPLv2.1). */
/* */
/**************************************************************************/
#ifndef _SYS_TIMEX_H
#define _SYS_TIMEX_H 1
#include "features.h"
#include "stdint.h"
#include "time.h"
__PUSH_FC_STDLIB
__BEGIN_DECLS
#define ADJ_OFFSET 0x0001
#define ADJ_FREQUENCY 0x0002
#define ADJ_MAXERROR 0x0004
#define ADJ_ESTERROR 0x0008
#define ADJ_STATUS 0x0010
#define ADJ_TIMECONST 0x0020
#define ADJ_TICK 0x4000
#define ADJ_OFFSET_SINGLESHOT 0x8001
#define MOD_OFFSET ADJ_OFFSET
#define MOD_FREQUENCY ADJ_FREQUENCY
#define MOD_MAXERROR ADJ_MAXERROR
#define MOD_ESTERROR ADJ_ESTERROR
#define MOD_STATUS ADJ_STATUS
#define MOD_TIMECONST ADJ_TIMECONST
#define MOD_CLKB ADJ_TICK
#define MOD_CLKA ADJ_OFFSET_SINGLESHOT
#define STA_PLL 0x0001
#define STA_PPSFREQ 0x0002
#define STA_PPSTIME 0x0004
#define STA_FLL 0x0008
#define STA_INS 0x0010
#define STA_DEL 0x0020
#define STA_UNSYNC 0x0040
#define STA_FREQHOLD 0x0080
#define STA_PPSSIGNAL 0x0100
#define STA_PPSJITTER 0x0200
#define STA_PPSWANDER 0x0400
#define STA_PPSERROR 0x0800
#define STA_CLOCKERR 0x1000
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
STA_PPSERROR | STA_CLOCKERR)
#define TIME_OK 0
#define TIME_INS 1
#define TIME_DEL 2
#define TIME_OOP 3
#define TIME_WAIT 4
#define TIME_ERROR 5
#define TIME_BAD TIME_ERROR
struct timex {
unsigned int modes;
int64_t offset;
int64_t freq;
int64_t maxerror;
int64_t esterror;
int status;
int64_t constant;
int64_t precision;
int64_t tolerance;
struct timeval time;
int64_t tick;
int64_t ppsfreq;
int64_t jitter;
int shift;
int64_t stabil;
int64_t jitcnt;
int64_t calcnt;
int64_t errcnt;
int64_t stbcnt;
int tai;
int32_t _padding[11];
};
extern int adjtimex(struct timex *buf);
extern int ntp_adjtime(struct timex *buf);
__END_DECLS
__POP_FC_STDLIB
#endif
|
{
"pile_set_name": "Github"
}
|
# GENERATED VERSION FILE
# TIME: Sun May 24 21:24:18 2020
__version__ = '1.0.rc0'
short_version = '1.0.rc0'
|
{
"pile_set_name": "Github"
}
|
---
name: Bug Report
about: Create a report to help us improve
---
### Describe the bug
A clear and concise description of what the bug is.
### To Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
### Expected behavior
A clear and concise description of what you expected to happen.
### Screenshots
If applicable, add screenshots to help explain your problem.
### Desktop (please complete the following information):
* OS: [e.g. iOS]
* Browser [e.g. Chrome, Safari]
* Version [e.g. 22]
### Smartphone (please complete the following information):
* Device: [e.g. iPhone 8]
* OS: [e.g. iOS 12.0.0]
* Browser [e.g. Stock browser, Safari]
* Version [e.g. 22]
### Additional context
Add any other context about the problem here.
|
{
"pile_set_name": "Github"
}
|
Car -1 -1 -10 575 171 597 191 1.51 1.59 3.86 -1.10 0.79 55.82 -1.57 0.01
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2004-2008 Chelsio, Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* 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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef T3_CPL_H
#define T3_CPL_H
#if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD)
# include <asm/byteorder.h>
#endif
enum CPL_opcode {
CPL_PASS_OPEN_REQ = 0x1,
CPL_PASS_ACCEPT_RPL = 0x2,
CPL_ACT_OPEN_REQ = 0x3,
CPL_SET_TCB = 0x4,
CPL_SET_TCB_FIELD = 0x5,
CPL_GET_TCB = 0x6,
CPL_PCMD = 0x7,
CPL_CLOSE_CON_REQ = 0x8,
CPL_CLOSE_LISTSRV_REQ = 0x9,
CPL_ABORT_REQ = 0xA,
CPL_ABORT_RPL = 0xB,
CPL_TX_DATA = 0xC,
CPL_RX_DATA_ACK = 0xD,
CPL_TX_PKT = 0xE,
CPL_RTE_DELETE_REQ = 0xF,
CPL_RTE_WRITE_REQ = 0x10,
CPL_RTE_READ_REQ = 0x11,
CPL_L2T_WRITE_REQ = 0x12,
CPL_L2T_READ_REQ = 0x13,
CPL_SMT_WRITE_REQ = 0x14,
CPL_SMT_READ_REQ = 0x15,
CPL_TX_PKT_LSO = 0x16,
CPL_PCMD_READ = 0x17,
CPL_BARRIER = 0x18,
CPL_TID_RELEASE = 0x1A,
CPL_CLOSE_LISTSRV_RPL = 0x20,
CPL_ERROR = 0x21,
CPL_GET_TCB_RPL = 0x22,
CPL_L2T_WRITE_RPL = 0x23,
CPL_PCMD_READ_RPL = 0x24,
CPL_PCMD_RPL = 0x25,
CPL_PEER_CLOSE = 0x26,
CPL_RTE_DELETE_RPL = 0x27,
CPL_RTE_WRITE_RPL = 0x28,
CPL_RX_DDP_COMPLETE = 0x29,
CPL_RX_PHYS_ADDR = 0x2A,
CPL_RX_PKT = 0x2B,
CPL_RX_URG_NOTIFY = 0x2C,
CPL_SET_TCB_RPL = 0x2D,
CPL_SMT_WRITE_RPL = 0x2E,
CPL_TX_DATA_ACK = 0x2F,
CPL_ABORT_REQ_RSS = 0x30,
CPL_ABORT_RPL_RSS = 0x31,
CPL_CLOSE_CON_RPL = 0x32,
CPL_ISCSI_HDR = 0x33,
CPL_L2T_READ_RPL = 0x34,
CPL_RDMA_CQE = 0x35,
CPL_RDMA_CQE_READ_RSP = 0x36,
CPL_RDMA_CQE_ERR = 0x37,
CPL_RTE_READ_RPL = 0x38,
CPL_RX_DATA = 0x39,
CPL_ACT_OPEN_RPL = 0x40,
CPL_PASS_OPEN_RPL = 0x41,
CPL_RX_DATA_DDP = 0x42,
CPL_SMT_READ_RPL = 0x43,
CPL_ACT_ESTABLISH = 0x50,
CPL_PASS_ESTABLISH = 0x51,
CPL_PASS_ACCEPT_REQ = 0x70,
CPL_ASYNC_NOTIF = 0x80, /* fake opcode for async notifications */
CPL_TX_DMA_ACK = 0xA0,
CPL_RDMA_READ_REQ = 0xA1,
CPL_RDMA_TERMINATE = 0xA2,
CPL_TRACE_PKT = 0xA3,
CPL_RDMA_EC_STATUS = 0xA5,
NUM_CPL_CMDS /* must be last and previous entries must be sorted */
};
enum CPL_error {
CPL_ERR_NONE = 0,
CPL_ERR_TCAM_PARITY = 1,
CPL_ERR_TCAM_FULL = 3,
CPL_ERR_CONN_RESET = 20,
CPL_ERR_CONN_EXIST = 22,
CPL_ERR_ARP_MISS = 23,
CPL_ERR_BAD_SYN = 24,
CPL_ERR_CONN_TIMEDOUT = 30,
CPL_ERR_XMIT_TIMEDOUT = 31,
CPL_ERR_PERSIST_TIMEDOUT = 32,
CPL_ERR_FINWAIT2_TIMEDOUT = 33,
CPL_ERR_KEEPALIVE_TIMEDOUT = 34,
CPL_ERR_RTX_NEG_ADVICE = 35,
CPL_ERR_PERSIST_NEG_ADVICE = 36,
CPL_ERR_ABORT_FAILED = 42,
CPL_ERR_GENERAL = 99
};
enum {
CPL_CONN_POLICY_AUTO = 0,
CPL_CONN_POLICY_ASK = 1,
CPL_CONN_POLICY_DENY = 3
};
enum {
ULP_MODE_NONE = 0,
ULP_MODE_ISCSI = 2,
ULP_MODE_RDMA = 4,
ULP_MODE_TCPDDP = 5
};
enum {
ULP_CRC_HEADER = 1 << 0,
ULP_CRC_DATA = 1 << 1
};
enum {
CPL_PASS_OPEN_ACCEPT,
CPL_PASS_OPEN_REJECT
};
enum {
CPL_ABORT_SEND_RST = 0,
CPL_ABORT_NO_RST,
CPL_ABORT_POST_CLOSE_REQ = 2
};
enum { /* TX_PKT_LSO ethernet types */
CPL_ETH_II,
CPL_ETH_II_VLAN,
CPL_ETH_802_3,
CPL_ETH_802_3_VLAN
};
enum { /* TCP congestion control algorithms */
CONG_ALG_RENO,
CONG_ALG_TAHOE,
CONG_ALG_NEWRENO,
CONG_ALG_HIGHSPEED
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.