code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30
values | license stringclasses 15
values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
/*
* max7359_keypad.c - MAX7359 Key Switch Controller Driver
*
* Copyright (C) 2009 Samsung Electronics
* Kim Kyuwon <q1.kim@samsung.com>
*
* Based on pxa27x_keypad.c
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Datasheet: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/5456
*/
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/input.h>
#include <linux/input/matrix_keypad.h>
#define MAX7359_MAX_KEY_ROWS 8
#define MAX7359_MAX_KEY_COLS 8
#define MAX7359_MAX_KEY_NUM (MAX7359_MAX_KEY_ROWS * MAX7359_MAX_KEY_COLS)
#define MAX7359_ROW_SHIFT 3
/*
* MAX7359 registers
*/
#define MAX7359_REG_KEYFIFO 0x00
#define MAX7359_REG_CONFIG 0x01
#define MAX7359_REG_DEBOUNCE 0x02
#define MAX7359_REG_INTERRUPT 0x03
#define MAX7359_REG_PORTS 0x04
#define MAX7359_REG_KEYREP 0x05
#define MAX7359_REG_SLEEP 0x06
/*
* Configuration register bits
*/
#define MAX7359_CFG_SLEEP (1 << 7)
#define MAX7359_CFG_INTERRUPT (1 << 5)
#define MAX7359_CFG_KEY_RELEASE (1 << 3)
#define MAX7359_CFG_WAKEUP (1 << 1)
#define MAX7359_CFG_TIMEOUT (1 << 0)
/*
* Autosleep register values (ms)
*/
#define MAX7359_AUTOSLEEP_8192 0x01
#define MAX7359_AUTOSLEEP_4096 0x02
#define MAX7359_AUTOSLEEP_2048 0x03
#define MAX7359_AUTOSLEEP_1024 0x04
#define MAX7359_AUTOSLEEP_512 0x05
#define MAX7359_AUTOSLEEP_256 0x06
struct max7359_keypad {
/* matrix key code map */
unsigned short keycodes[MAX7359_MAX_KEY_NUM];
struct input_dev *input_dev;
struct i2c_client *client;
};
static int max7359_write_reg(struct i2c_client *client, u8 reg, u8 val)
{
int ret = i2c_smbus_write_byte_data(client, reg, val);
if (ret < 0)
dev_err(&client->dev, "%s: reg 0x%x, val 0x%x, err %d\n",
__func__, reg, val, ret);
return ret;
}
static int max7359_read_reg(struct i2c_client *client, int reg)
{
int ret = i2c_smbus_read_byte_data(client, reg);
if (ret < 0)
dev_err(&client->dev, "%s: reg 0x%x, err %d\n",
__func__, reg, ret);
return ret;
}
static void max7359_build_keycode(struct max7359_keypad *keypad,
const struct matrix_keymap_data *keymap_data)
{
struct input_dev *input_dev = keypad->input_dev;
int i;
for (i = 0; i < keymap_data->keymap_size; i++) {
unsigned int key = keymap_data->keymap[i];
unsigned int row = KEY_ROW(key);
unsigned int col = KEY_COL(key);
unsigned int scancode = MATRIX_SCAN_CODE(row, col,
MAX7359_ROW_SHIFT);
unsigned short keycode = KEY_VAL(key);
keypad->keycodes[scancode] = keycode;
__set_bit(keycode, input_dev->keybit);
}
__clear_bit(KEY_RESERVED, input_dev->keybit);
}
/* runs in an IRQ thread -- can (and will!) sleep */
static irqreturn_t max7359_interrupt(int irq, void *dev_id)
{
struct max7359_keypad *keypad = dev_id;
struct input_dev *input_dev = keypad->input_dev;
int val, row, col, release, code;
val = max7359_read_reg(keypad->client, MAX7359_REG_KEYFIFO);
row = val & 0x7;
col = (val >> 3) & 0x7;
release = val & 0x40;
code = MATRIX_SCAN_CODE(row, col, MAX7359_ROW_SHIFT);
dev_dbg(&keypad->client->dev,
"key[%d:%d] %s\n", row, col, release ? "release" : "press");
input_event(input_dev, EV_MSC, MSC_SCAN, code);
input_report_key(input_dev, keypad->keycodes[code], !release);
input_sync(input_dev);
return IRQ_HANDLED;
}
/*
* Let MAX7359 fall into a deep sleep:
* If no keys are pressed, enter sleep mode for 8192 ms. And if any
* key is pressed, the MAX7359 returns to normal operating mode.
*/
static inline void max7359_fall_deepsleep(struct i2c_client *client)
{
max7359_write_reg(client, MAX7359_REG_SLEEP, MAX7359_AUTOSLEEP_8192);
}
/*
* Let MAX7359 take a catnap:
* Autosleep just for 256 ms.
*/
static inline void max7359_take_catnap(struct i2c_client *client)
{
max7359_write_reg(client, MAX7359_REG_SLEEP, MAX7359_AUTOSLEEP_256);
}
static int max7359_open(struct input_dev *dev)
{
struct max7359_keypad *keypad = input_get_drvdata(dev);
max7359_take_catnap(keypad->client);
return 0;
}
static void max7359_close(struct input_dev *dev)
{
struct max7359_keypad *keypad = input_get_drvdata(dev);
max7359_fall_deepsleep(keypad->client);
}
static void max7359_initialize(struct i2c_client *client)
{
max7359_write_reg(client, MAX7359_REG_CONFIG,
MAX7359_CFG_INTERRUPT | /* Irq clears after host read */
MAX7359_CFG_KEY_RELEASE | /* Key release enable */
MAX7359_CFG_WAKEUP); /* Key press wakeup enable */
/* Full key-scan functionality */
max7359_write_reg(client, MAX7359_REG_DEBOUNCE, 0x1F);
/* nINT asserts every debounce cycles */
max7359_write_reg(client, MAX7359_REG_INTERRUPT, 0x01);
max7359_fall_deepsleep(client);
}
static int max7359_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct matrix_keymap_data *keymap_data =
dev_get_platdata(&client->dev);
struct max7359_keypad *keypad;
struct input_dev *input_dev;
int ret;
int error;
if (!client->irq) {
dev_err(&client->dev, "The irq number should not be zero\n");
return -EINVAL;
}
/* Detect MAX7359: The initial Keys FIFO value is '0x3F' */
ret = max7359_read_reg(client, MAX7359_REG_KEYFIFO);
if (ret < 0) {
dev_err(&client->dev, "failed to detect device\n");
return -ENODEV;
}
dev_dbg(&client->dev, "keys FIFO is 0x%02x\n", ret);
keypad = devm_kzalloc(&client->dev, sizeof(struct max7359_keypad),
GFP_KERNEL);
if (!keypad) {
dev_err(&client->dev, "failed to allocate memory\n");
return -ENOMEM;
}
input_dev = devm_input_allocate_device(&client->dev);
if (!input_dev) {
dev_err(&client->dev, "failed to allocate input device\n");
return -ENOMEM;
}
keypad->client = client;
keypad->input_dev = input_dev;
input_dev->name = client->name;
input_dev->id.bustype = BUS_I2C;
input_dev->open = max7359_open;
input_dev->close = max7359_close;
input_dev->dev.parent = &client->dev;
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
input_dev->keycodesize = sizeof(keypad->keycodes[0]);
input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
input_dev->keycode = keypad->keycodes;
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
input_set_drvdata(input_dev, keypad);
max7359_build_keycode(keypad, keymap_data);
error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
max7359_interrupt,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
client->name, keypad);
if (error) {
dev_err(&client->dev, "failed to register interrupt\n");
return error;
}
/* Register the input device */
error = input_register_device(input_dev);
if (error) {
dev_err(&client->dev, "failed to register input device\n");
return error;
}
/* Initialize MAX7359 */
max7359_initialize(client);
i2c_set_clientdata(client, keypad);
device_init_wakeup(&client->dev, 1);
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int max7359_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
max7359_fall_deepsleep(client);
if (device_may_wakeup(&client->dev))
enable_irq_wake(client->irq);
return 0;
}
static int max7359_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
if (device_may_wakeup(&client->dev))
disable_irq_wake(client->irq);
/* Restore the default setting */
max7359_take_catnap(client);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(max7359_pm, max7359_suspend, max7359_resume);
static const struct i2c_device_id max7359_ids[] = {
{ "max7359", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, max7359_ids);
static struct i2c_driver max7359_i2c_driver = {
.driver = {
.name = "max7359",
.pm = &max7359_pm,
},
.probe = max7359_probe,
.id_table = max7359_ids,
};
module_i2c_driver(max7359_i2c_driver);
MODULE_AUTHOR("Kim Kyuwon <q1.kim@samsung.com>");
MODULE_DESCRIPTION("MAX7359 Key Switch Controller Driver");
MODULE_LICENSE("GPL v2");
| mericon/Xp_Kernel_LGH850 | virt/drivers/input/keyboard/max7359_keypad.c | C | gpl-2.0 | 7,946 | [
30522,
1013,
1008,
1008,
4098,
2581,
19481,
2683,
1035,
3145,
15455,
1012,
1039,
1011,
4098,
2581,
19481,
2683,
3145,
6942,
11486,
4062,
1008,
1008,
9385,
1006,
1039,
1007,
2268,
19102,
8139,
1008,
5035,
18712,
25974,
2239,
1026,
1053,
2487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.cloud;
import static org.hamcrest.CoreMatchers.not;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.ClusterState;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.cloud.ZkStateReader;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** Tests using fromIndex that points to a collection in SolrCloud mode. */
public class DistribJoinFromCollectionTest extends SolrCloudTestCase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String[] scoreModes = {"avg", "max", "min", "total"};
// resetExceptionIgnores();
private static String toColl = "to_2x2";
private static String fromColl = "from_1x4";
private static String toDocId;
@BeforeClass
public static void setupCluster() throws Exception {
final Path configDir = TEST_COLL1_CONF();
String configName = "solrCloudCollectionConfig";
int nodeCount = 5;
configureCluster(nodeCount).addConfig(configName, configDir).configure();
Map<String, String> collectionProperties = new HashMap<>();
collectionProperties.put("config", "solrconfig-tlog.xml");
collectionProperties.put("schema", "schema.xml");
// create a collection holding data for the "to" side of the JOIN
int shards = 2;
int replicas = 2;
CollectionAdminRequest.createCollection(toColl, configName, shards, replicas)
.setProperties(collectionProperties)
.process(cluster.getSolrClient());
// get the set of nodes where replicas for the "to" collection exist
Set<String> nodeSet = new HashSet<>();
ZkStateReader zkStateReader = cluster.getSolrClient().getZkStateReader();
ClusterState cs = zkStateReader.getClusterState();
for (Slice slice : cs.getCollection(toColl).getActiveSlices())
for (Replica replica : slice.getReplicas()) nodeSet.add(replica.getNodeName());
assertTrue(nodeSet.size() > 0);
// deploy the "from" collection to all nodes where the "to" collection exists
CollectionAdminRequest.createCollection(fromColl, configName, 1, 4)
.setCreateNodeSet(String.join(",", nodeSet))
.setProperties(collectionProperties)
.process(cluster.getSolrClient());
toDocId = indexDoc(toColl, 1001, "a", null, "b");
indexDoc(fromColl, 2001, "a", "c", null);
Thread.sleep(1000); // so the commits fire
}
@Test
public void testScore() throws Exception {
// without score
testJoins(toColl, fromColl, toDocId, true);
}
@Test
public void testNoScore() throws Exception {
// with score
testJoins(toColl, fromColl, toDocId, false);
}
@AfterClass
public static void shutdown() {
log.info(
"DistribJoinFromCollectionTest logic complete ... deleting the {} and {} collections",
toColl,
fromColl);
// try to clean up
for (String c : new String[] {toColl, fromColl}) {
try {
CollectionAdminRequest.Delete req = CollectionAdminRequest.deleteCollection(c);
req.process(cluster.getSolrClient());
} catch (Exception e) {
// don't fail the test
log.warn("Could not delete collection {} after test completed due to:", c, e);
}
}
log.info("DistribJoinFromCollectionTest succeeded ... shutting down now!");
}
private void testJoins(String toColl, String fromColl, String toDocId, boolean isScoresTest)
throws SolrServerException, IOException, InterruptedException {
// verify the join with fromIndex works
final String fromQ = "match_s:c^2";
CloudSolrClient client = cluster.getSolrClient();
{
final String joinQ =
"{!join "
+ anyScoreMode(isScoresTest)
+ "from=join_s fromIndex="
+ fromColl
+ " to=join_s}"
+ fromQ;
QueryRequest qr =
new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
QueryResponse rsp = new QueryResponse(client.request(qr), client);
SolrDocumentList hits = rsp.getResults();
assertTrue("Expected 1 doc, got " + hits, hits.getNumFound() == 1);
SolrDocument doc = hits.get(0);
assertEquals(toDocId, doc.getFirstValue("id"));
assertEquals("b", doc.getFirstValue("get_s"));
assertScore(isScoresTest, doc);
}
// negative test before creating an alias
checkAbsentFromIndex(fromColl, toColl, isScoresTest);
// create an alias for the fromIndex and then query through the alias
String alias = fromColl + "Alias";
CollectionAdminRequest.createAlias(alias, fromColl).process(client);
{
final String joinQ =
"{!join "
+ anyScoreMode(isScoresTest)
+ "from=join_s fromIndex="
+ alias
+ " to=join_s}"
+ fromQ;
final QueryRequest qr =
new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
final QueryResponse rsp = new QueryResponse(client.request(qr), client);
final SolrDocumentList hits = rsp.getResults();
assertTrue("Expected 1 doc", hits.getNumFound() == 1);
SolrDocument doc = hits.get(0);
assertEquals(toDocId, doc.getFirstValue("id"));
assertEquals("b", doc.getFirstValue("get_s"));
assertScore(isScoresTest, doc);
}
// negative test after creating an alias
checkAbsentFromIndex(fromColl, toColl, isScoresTest);
{
// verify join doesn't work if no match in the "from" index
final String joinQ =
"{!join "
+ (anyScoreMode(isScoresTest))
+ "from=join_s fromIndex="
+ fromColl
+ " to=join_s}match_s:d";
final QueryRequest qr =
new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
final QueryResponse rsp = new QueryResponse(client.request(qr), client);
final SolrDocumentList hits = rsp.getResults();
assertTrue("Expected no hits", hits.getNumFound() == 0);
}
}
private void assertScore(boolean isScoresTest, SolrDocument doc) {
if (isScoresTest) {
assertThat(
"score join doesn't return 1.0", doc.getFirstValue("score").toString(), not("1.0"));
} else {
assertEquals("Solr join has constant score", "1.0", doc.getFirstValue("score").toString());
}
}
private String anyScoreMode(boolean isScoresTest) {
return isScoresTest ? "score=" + (scoreModes[random().nextInt(scoreModes.length)]) + " " : "";
}
private void checkAbsentFromIndex(String fromColl, String toColl, boolean isScoresTest)
throws SolrServerException, IOException {
final String wrongName = fromColl + "WrongName";
final String joinQ =
"{!join "
+ (anyScoreMode(isScoresTest))
+ "from=join_s fromIndex="
+ wrongName
+ " to=join_s}match_s:c";
final QueryRequest qr =
new QueryRequest(params("collection", toColl, "q", joinQ, "fl", "id,get_s,score"));
BaseHttpSolrClient.RemoteSolrException ex =
assertThrows(
BaseHttpSolrClient.RemoteSolrException.class,
() -> cluster.getSolrClient().request(qr));
assertEquals(SolrException.ErrorCode.BAD_REQUEST.code, ex.code());
assertTrue(ex.getMessage().contains(wrongName));
}
protected static String indexDoc(
String collection, int id, String joinField, String matchField, String getField)
throws Exception {
UpdateRequest up = new UpdateRequest();
up.setCommitWithin(50);
up.setParam("collection", collection);
SolrInputDocument doc = new SolrInputDocument();
String docId = "" + id;
doc.addField("id", docId);
doc.addField("join_s", joinField);
if (matchField != null) doc.addField("match_s", matchField);
if (getField != null) doc.addField("get_s", getField);
up.add(doc);
cluster.getSolrClient().request(up);
return docId;
}
}
| apache/solr | solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java | Java | apache-2.0 | 9,690 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
declare(strict_types=1);
namespace Symplify\EasyCodingStandard\Console\Style;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Terminal;
use Symplify\PackageBuilder\Reflection\PrivatesCaller;
final class EasyCodingStandardStyleFactory
{
/**
* @var PrivatesCaller
*/
private $privatesCaller;
/**
* @var Terminal
*/
private $terminal;
public function __construct(Terminal $terminal)
{
$this->privatesCaller = new PrivatesCaller();
$this->terminal = $terminal;
}
public function create(): EasyCodingStandardStyle
{
$input = new ArgvInput();
$output = new ConsoleOutput();
// to configure all -v, -vv, -vvv options without memory-lock to Application run() arguments
$this->privatesCaller->callPrivateMethod(new Application(), 'configureIO', $input, $output);
// --debug is called
if ($input->hasParameterOption('--debug')) {
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
}
return new EasyCodingStandardStyle($input, $output, $this->terminal);
}
}
| Symplify/Symplify | packages/EasyCodingStandard/src/Console/Style/EasyCodingStandardStyleFactory.php | PHP | mit | 1,299 | [
30522,
1026,
1029,
25718,
13520,
1006,
9384,
1035,
4127,
1027,
1015,
1007,
1025,
3415,
15327,
25353,
8737,
3669,
12031,
1032,
3733,
3597,
4667,
21515,
4232,
1032,
10122,
1032,
2806,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
6922,
1032,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace SelimSalihovic\PikPay\Requests;
use GuzzleHttp\Client as HttpClient;
use SelimSalihovic\PikPay\Gateway;
use SelimSalihovic\PikPay\Requests\Request;
use SelimSalihovic\PikPay\Responses\PurchaseResponse;
/**
* PikPay PurchaseRequest.
*
* @author Selim Salihovic <selim.salihovic@gmail.com>
* @copyright 2016 SelimSalihovic
* @license http://opensource.org/licenses/mit-license.php MIT
*/
class PurchaseRequest extends Request
{
protected $uri;
protected $params;
protected $httpClient;
protected $httpRequest;
protected $response;
public function __construct(HttpClient $httpClient, Gateway $gateway, array $params, $installments = null)
{
$this->setInstallments($params, $installments);
parent::__construct($httpClient, $gateway, 'purchase', $this->params);
$this->uri = '/api';
$this->httpClient = $httpClient;
$this->send();
}
public function response()
{
return new PurchaseResponse($this->response);
}
}
| SelimSalihovic/pikpay-php | src/Requests/PurchaseRequest.php | PHP | mit | 1,031 | [
30522,
1026,
1029,
25718,
3415,
15327,
7367,
17960,
12002,
19190,
9142,
1032,
14255,
2243,
4502,
2100,
1032,
11186,
1025,
2224,
19739,
17644,
11039,
25856,
1032,
7396,
2004,
8299,
20464,
11638,
1025,
2224,
7367,
17960,
12002,
19190,
9142,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 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.
#include "components/autofill/core/browser/autofill_profile.h"
#include <algorithm>
#include <functional>
#include <map>
#include <ostream>
#include <set>
#include "base/basictypes.h"
#include "base/guid.h"
#include "base/i18n/case_conversion.h"
#include "base/i18n/char_iterator.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/sha1.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/browser/address.h"
#include "components/autofill/core/browser/address_i18n.h"
#include "components/autofill/core/browser/autofill_country.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/autofill_type.h"
#include "components/autofill/core/browser/contact_info.h"
#include "components/autofill/core/browser/phone_number.h"
#include "components/autofill/core/browser/phone_number_i18n.h"
#include "components/autofill/core/browser/state_names.h"
#include "components/autofill/core/browser/validation.h"
#include "components/autofill/core/common/autofill_l10n_util.h"
#include "components/autofill/core/common/form_field_data.h"
#include "grit/components_strings.h"
#include "third_party/icu/source/common/unicode/uchar.h"
#include "third_party/libaddressinput/chromium/addressinput_util.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_data.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_formatter.h"
#include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_metadata.h"
#include "ui/base/l10n/l10n_util.h"
using base::ASCIIToUTF16;
using base::UTF16ToUTF8;
using i18n::addressinput::AddressData;
using i18n::addressinput::AddressField;
namespace autofill {
namespace {
// Like |AutofillType::GetStorableType()|, but also returns |NAME_FULL| for
// first, middle, and last name field types, and groups phone number types
// similarly.
ServerFieldType GetStorableTypeCollapsingGroups(ServerFieldType type) {
ServerFieldType storable_type = AutofillType(type).GetStorableType();
if (AutofillType(storable_type).group() == NAME)
return NAME_FULL;
if (AutofillType(storable_type).group() == PHONE_HOME)
return PHONE_HOME_WHOLE_NUMBER;
return storable_type;
}
// Returns a value that represents specificity/privacy of the given type. This
// is used for prioritizing which data types are shown in inferred labels. For
// example, if the profile is going to fill ADDRESS_HOME_ZIP, it should
// prioritize showing that over ADDRESS_HOME_STATE in the suggestion sublabel.
int SpecificityForType(ServerFieldType type) {
switch (type) {
case ADDRESS_HOME_LINE1:
return 1;
case ADDRESS_HOME_LINE2:
return 2;
case EMAIL_ADDRESS:
return 3;
case PHONE_HOME_WHOLE_NUMBER:
return 4;
case NAME_FULL:
return 5;
case ADDRESS_HOME_ZIP:
return 6;
case ADDRESS_HOME_SORTING_CODE:
return 7;
case COMPANY_NAME:
return 8;
case ADDRESS_HOME_CITY:
return 9;
case ADDRESS_HOME_STATE:
return 10;
case ADDRESS_HOME_COUNTRY:
return 11;
default:
break;
}
// The priority of other types is arbitrary, but deterministic.
return 100 + type;
}
bool CompareSpecificity(ServerFieldType type1, ServerFieldType type2) {
return SpecificityForType(type1) < SpecificityForType(type2);
}
// Fills |distinguishing_fields| with a list of fields to use when creating
// labels that can help to distinguish between two profiles. Draws fields from
// |suggested_fields| if it is non-NULL; otherwise returns a default list.
// If |suggested_fields| is non-NULL, does not include |excluded_field| in the
// list. Otherwise, |excluded_field| is ignored, and should be set to
// |UNKNOWN_TYPE| by convention. The resulting list of fields is sorted in
// decreasing order of importance.
void GetFieldsForDistinguishingProfiles(
const std::vector<ServerFieldType>* suggested_fields,
ServerFieldType excluded_field,
std::vector<ServerFieldType>* distinguishing_fields) {
static const ServerFieldType kDefaultDistinguishingFields[] = {
NAME_FULL,
ADDRESS_HOME_LINE1,
ADDRESS_HOME_LINE2,
ADDRESS_HOME_DEPENDENT_LOCALITY,
ADDRESS_HOME_CITY,
ADDRESS_HOME_STATE,
ADDRESS_HOME_ZIP,
ADDRESS_HOME_SORTING_CODE,
ADDRESS_HOME_COUNTRY,
EMAIL_ADDRESS,
PHONE_HOME_WHOLE_NUMBER,
COMPANY_NAME,
};
std::vector<ServerFieldType> default_fields;
if (!suggested_fields) {
default_fields.assign(
kDefaultDistinguishingFields,
kDefaultDistinguishingFields + arraysize(kDefaultDistinguishingFields));
if (excluded_field == UNKNOWN_TYPE) {
distinguishing_fields->swap(default_fields);
return;
}
suggested_fields = &default_fields;
}
// Keep track of which fields we've seen so that we avoid duplicate entries.
// Always ignore fields of unknown type and the excluded field.
std::set<ServerFieldType> seen_fields;
seen_fields.insert(UNKNOWN_TYPE);
seen_fields.insert(GetStorableTypeCollapsingGroups(excluded_field));
distinguishing_fields->clear();
for (const ServerFieldType& it : *suggested_fields) {
ServerFieldType suggested_type = GetStorableTypeCollapsingGroups(it);
if (seen_fields.insert(suggested_type).second)
distinguishing_fields->push_back(suggested_type);
}
std::sort(distinguishing_fields->begin(), distinguishing_fields->end(),
CompareSpecificity);
// Special case: If the excluded field is a partial name (e.g. first name) and
// the suggested fields include other name fields, include |NAME_FULL| in the
// list of distinguishing fields as a last-ditch fallback. This allows us to
// distinguish between profiles that are identical except for the name.
ServerFieldType effective_excluded_type =
GetStorableTypeCollapsingGroups(excluded_field);
if (excluded_field != effective_excluded_type) {
for (const ServerFieldType& it : *suggested_fields) {
if (it != excluded_field &&
GetStorableTypeCollapsingGroups(it) == effective_excluded_type) {
distinguishing_fields->push_back(effective_excluded_type);
break;
}
}
}
}
// Collapse compound field types to their "full" type. I.e. First name
// collapses to full name, area code collapses to full phone, etc.
void CollapseCompoundFieldTypes(ServerFieldTypeSet* type_set) {
ServerFieldTypeSet collapsed_set;
for (const auto& it : *type_set) {
switch (it) {
case NAME_FIRST:
case NAME_MIDDLE:
case NAME_LAST:
case NAME_MIDDLE_INITIAL:
case NAME_FULL:
case NAME_SUFFIX:
collapsed_set.insert(NAME_FULL);
break;
case PHONE_HOME_NUMBER:
case PHONE_HOME_CITY_CODE:
case PHONE_HOME_COUNTRY_CODE:
case PHONE_HOME_CITY_AND_NUMBER:
case PHONE_HOME_WHOLE_NUMBER:
collapsed_set.insert(PHONE_HOME_WHOLE_NUMBER);
break;
default:
collapsed_set.insert(it);
}
}
std::swap(*type_set, collapsed_set);
}
class FindByPhone {
public:
FindByPhone(const base::string16& phone,
const std::string& country_code,
const std::string& app_locale)
: phone_(phone),
country_code_(country_code),
app_locale_(app_locale) {}
bool operator()(const base::string16& phone) {
return i18n::PhoneNumbersMatch(phone, phone_, country_code_, app_locale_);
}
private:
base::string16 phone_;
std::string country_code_;
std::string app_locale_;
};
} // namespace
AutofillProfile::AutofillProfile(const std::string& guid,
const std::string& origin)
: AutofillDataModel(guid, origin),
record_type_(LOCAL_PROFILE),
phone_number_(this) {
}
AutofillProfile::AutofillProfile(RecordType type, const std::string& server_id)
: AutofillDataModel(base::GenerateGUID(), std::string()),
record_type_(type),
phone_number_(this),
server_id_(server_id) {
DCHECK(type == SERVER_PROFILE);
}
AutofillProfile::AutofillProfile()
: AutofillDataModel(base::GenerateGUID(), std::string()),
record_type_(LOCAL_PROFILE),
phone_number_(this) {
}
AutofillProfile::AutofillProfile(const AutofillProfile& profile)
: AutofillDataModel(std::string(), std::string()), phone_number_(this) {
operator=(profile);
}
AutofillProfile::~AutofillProfile() {
}
AutofillProfile& AutofillProfile::operator=(const AutofillProfile& profile) {
set_use_count(profile.use_count());
set_use_date(profile.use_date());
set_modification_date(profile.modification_date());
if (this == &profile)
return *this;
set_guid(profile.guid());
set_origin(profile.origin());
record_type_ = profile.record_type_;
name_ = profile.name_;
email_ = profile.email_;
company_ = profile.company_;
phone_number_ = profile.phone_number_;
phone_number_.set_profile(this);
address_ = profile.address_;
set_language_code(profile.language_code());
server_id_ = profile.server_id();
return *this;
}
void AutofillProfile::GetMatchingTypes(
const base::string16& text,
const std::string& app_locale,
ServerFieldTypeSet* matching_types) const {
FormGroupList info = FormGroups();
for (const auto& it : info) {
it->GetMatchingTypes(text, app_locale, matching_types);
}
}
base::string16 AutofillProfile::GetRawInfo(ServerFieldType type) const {
const FormGroup* form_group = FormGroupForType(AutofillType(type));
if (!form_group)
return base::string16();
return form_group->GetRawInfo(type);
}
void AutofillProfile::SetRawInfo(ServerFieldType type,
const base::string16& value) {
FormGroup* form_group = MutableFormGroupForType(AutofillType(type));
if (form_group)
form_group->SetRawInfo(type, value);
}
base::string16 AutofillProfile::GetInfo(const AutofillType& type,
const std::string& app_locale) const {
if (type.html_type() == HTML_TYPE_FULL_ADDRESS) {
scoped_ptr<AddressData> address_data =
i18n::CreateAddressDataFromAutofillProfile(*this, app_locale);
if (!addressinput::HasAllRequiredFields(*address_data))
return base::string16();
std::vector<std::string> lines;
::i18n::addressinput::GetFormattedNationalAddress(*address_data, &lines);
return base::UTF8ToUTF16(base::JoinString(lines, "\n"));
}
const FormGroup* form_group = FormGroupForType(type);
if (!form_group)
return base::string16();
return form_group->GetInfo(type, app_locale);
}
bool AutofillProfile::SetInfo(const AutofillType& type,
const base::string16& value,
const std::string& app_locale) {
FormGroup* form_group = MutableFormGroupForType(type);
if (!form_group)
return false;
base::string16 trimmed_value;
base::TrimWhitespace(value, base::TRIM_ALL, &trimmed_value);
return form_group->SetInfo(type, trimmed_value, app_locale);
}
bool AutofillProfile::IsEmpty(const std::string& app_locale) const {
ServerFieldTypeSet types;
GetNonEmptyTypes(app_locale, &types);
return types.empty();
}
bool AutofillProfile::IsPresentButInvalid(ServerFieldType type) const {
std::string country = UTF16ToUTF8(GetRawInfo(ADDRESS_HOME_COUNTRY));
base::string16 data = GetRawInfo(type);
if (data.empty())
return false;
switch (type) {
case ADDRESS_HOME_STATE:
return country == "US" && !IsValidState(data);
case ADDRESS_HOME_ZIP:
return country == "US" && !IsValidZip(data);
case PHONE_HOME_WHOLE_NUMBER:
return !i18n::PhoneObject(data, country).IsValidNumber();
case EMAIL_ADDRESS:
return !IsValidEmailAddress(data);
default:
NOTREACHED();
return false;
}
}
int AutofillProfile::Compare(const AutofillProfile& profile) const {
const ServerFieldType types[] = {
NAME_FULL,
NAME_FIRST,
NAME_MIDDLE,
NAME_LAST,
COMPANY_NAME,
ADDRESS_HOME_STREET_ADDRESS,
ADDRESS_HOME_DEPENDENT_LOCALITY,
ADDRESS_HOME_CITY,
ADDRESS_HOME_STATE,
ADDRESS_HOME_ZIP,
ADDRESS_HOME_SORTING_CODE,
ADDRESS_HOME_COUNTRY,
EMAIL_ADDRESS,
PHONE_HOME_WHOLE_NUMBER,
};
for (size_t i = 0; i < arraysize(types); ++i) {
int comparison = GetRawInfo(types[i]).compare(profile.GetRawInfo(types[i]));
if (comparison != 0) {
return comparison;
}
}
return 0;
}
bool AutofillProfile::EqualsSansOrigin(const AutofillProfile& profile) const {
return guid() == profile.guid() &&
language_code() == profile.language_code() &&
Compare(profile) == 0;
}
bool AutofillProfile::EqualsForSyncPurposes(const AutofillProfile& profile)
const {
return use_count() == profile.use_count() &&
use_date() == profile.use_date() &&
EqualsSansGuid(profile);
}
bool AutofillProfile::operator==(const AutofillProfile& profile) const {
return guid() == profile.guid() && EqualsSansGuid(profile);
}
bool AutofillProfile::operator!=(const AutofillProfile& profile) const {
return !operator==(profile);
}
const base::string16 AutofillProfile::PrimaryValue() const {
return GetRawInfo(ADDRESS_HOME_LINE1) + GetRawInfo(ADDRESS_HOME_CITY);
}
bool AutofillProfile::IsSubsetOf(const AutofillProfile& profile,
const std::string& app_locale) const {
ServerFieldTypeSet types;
GetSupportedTypes(&types);
return IsSubsetOfForFieldSet(profile, app_locale, types);
}
bool AutofillProfile::IsSubsetOfForFieldSet(
const AutofillProfile& profile,
const std::string& app_locale,
const ServerFieldTypeSet& types) const {
scoped_ptr<l10n::CaseInsensitiveCompare> compare;
for (ServerFieldType type : types) {
base::string16 value = GetRawInfo(type);
if (value.empty())
continue;
if (type == NAME_FULL || type == ADDRESS_HOME_STREET_ADDRESS) {
// Ignore the compound "full name" field type. We are only interested in
// comparing the constituent parts. For example, if |this| has a middle
// name saved, but |profile| lacks one, |profile| could still be a subset
// of |this|. Likewise, ignore the compound "street address" type, as we
// are only interested in matching line-by-line.
continue;
} else if (AutofillType(type).group() == PHONE_HOME) {
// Phone numbers should be canonicalized prior to being compared.
if (type != PHONE_HOME_WHOLE_NUMBER) {
continue;
} else if (!i18n::PhoneNumbersMatch(
value, profile.GetRawInfo(type),
base::UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)),
app_locale)) {
return false;
}
} else {
if (!compare)
compare.reset(new l10n::CaseInsensitiveCompare());
if (!compare->StringsEqual(value, profile.GetRawInfo(type)))
return false;
}
}
return true;
}
bool AutofillProfile::OverwriteName(const NameInfo& imported_name,
const std::string& app_locale) {
if (name_.ParsedNamesAreEqual(imported_name)) {
if (name_.GetRawInfo(NAME_FULL).empty() &&
!imported_name.GetRawInfo(NAME_FULL).empty()) {
name_.SetRawInfo(NAME_FULL, imported_name.GetRawInfo(NAME_FULL));
return true;
}
return false;
}
l10n::CaseInsensitiveCompare compare;
AutofillType type = AutofillType(NAME_FULL);
base::string16 full_name = name_.GetInfo(type, app_locale);
if (compare.StringsEqual(full_name,
imported_name.GetInfo(type, app_locale))) {
// The imported name has the same full name string as the name for this
// profile. Because full names are _heuristically_ parsed into
// {first, middle, last} name components, it's possible that either the
// existing name or the imported name was misparsed. Prefer to keep the
// name whose {first, middle, last} components do not match those computed
// by the heuristic parse, as this more likely represents the correct,
// user-input parse of the name.
NameInfo heuristically_parsed_name;
heuristically_parsed_name.SetInfo(type, full_name, app_locale);
if (imported_name.ParsedNamesAreEqual(heuristically_parsed_name))
return false;
}
name_ = imported_name;
return true;
}
bool AutofillProfile::OverwriteWith(const AutofillProfile& profile,
const std::string& app_locale) {
// Verified profiles should never be overwritten with unverified data.
DCHECK(!IsVerified() || profile.IsVerified());
set_origin(profile.origin());
set_language_code(profile.language_code());
set_use_count(profile.use_count() + use_count());
if (profile.use_date() > use_date())
set_use_date(profile.use_date());
ServerFieldTypeSet field_types;
profile.GetNonEmptyTypes(app_locale, &field_types);
// Only transfer "full" types (e.g. full name) and not fragments (e.g.
// first name, last name).
CollapseCompoundFieldTypes(&field_types);
// Remove ADDRESS_HOME_STREET_ADDRESS to ensure a merge of the address line by
// line. See comment below.
field_types.erase(ADDRESS_HOME_STREET_ADDRESS);
l10n::CaseInsensitiveCompare compare;
// Special case for addresses. With the whole address comparison, it is now
// necessary to make sure to keep the best address format: both lines used.
// This is because some sites might not have an address line 2 and the
// previous value should not be replaced with an empty string in that case.
if (compare.StringsEqual(
CanonicalizeProfileString(
profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS)),
CanonicalizeProfileString(GetRawInfo(ADDRESS_HOME_STREET_ADDRESS))) &&
!GetRawInfo(ADDRESS_HOME_LINE2).empty() &&
profile.GetRawInfo(ADDRESS_HOME_LINE2).empty()) {
field_types.erase(ADDRESS_HOME_LINE1);
field_types.erase(ADDRESS_HOME_LINE2);
}
bool did_overwrite = false;
for (ServerFieldTypeSet::const_iterator iter = field_types.begin();
iter != field_types.end(); ++iter) {
FieldTypeGroup group = AutofillType(*iter).group();
// Special case names.
if (group == NAME) {
did_overwrite = OverwriteName(profile.name_, app_locale) || did_overwrite;
continue;
}
base::string16 new_value = profile.GetRawInfo(*iter);
if (!compare.StringsEqual(GetRawInfo(*iter), new_value)) {
SetRawInfo(*iter, new_value);
did_overwrite = true;
}
}
return did_overwrite;
}
bool AutofillProfile::SaveAdditionalInfo(const AutofillProfile& profile,
const std::string& app_locale) {
ServerFieldTypeSet field_types, other_field_types;
GetNonEmptyTypes(app_locale, &field_types);
profile.GetNonEmptyTypes(app_locale, &other_field_types);
// The address needs to be compared line by line to take into account the
// logic for empty fields implemented in the loop.
field_types.erase(ADDRESS_HOME_STREET_ADDRESS);
l10n::CaseInsensitiveCompare compare;
for (ServerFieldType field_type : field_types) {
if (other_field_types.count(field_type)) {
AutofillType type = AutofillType(field_type);
// Special cases for name and phone. If the whole/full value matches, skip
// the individual fields comparison.
if (type.group() == NAME &&
compare.StringsEqual(
profile.GetInfo(AutofillType(NAME_FULL), app_locale),
GetInfo(AutofillType(NAME_FULL), app_locale))) {
continue;
}
if (type.group() == PHONE_HOME &&
i18n::PhoneNumbersMatch(
GetRawInfo(PHONE_HOME_WHOLE_NUMBER),
profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER),
base::UTF16ToASCII(GetRawInfo(ADDRESS_HOME_COUNTRY)),
app_locale)) {
continue;
}
// Special case for the address because the comparison uses canonicalized
// values. Start by comparing the address line by line. If it fails, make
// sure that the address as a whole is different before returning false.
// It is possible that the user put the info from line 2 on line 1 because
// of a certain form for example.
if (field_type == ADDRESS_HOME_LINE1 ||
field_type == ADDRESS_HOME_LINE2) {
if (!compare.StringsEqual(
CanonicalizeProfileString(profile.GetRawInfo(field_type)),
CanonicalizeProfileString(GetRawInfo(field_type))) &&
!compare.StringsEqual(CanonicalizeProfileString(profile.GetRawInfo(
ADDRESS_HOME_STREET_ADDRESS)),
CanonicalizeProfileString(GetRawInfo(
ADDRESS_HOME_STREET_ADDRESS)))) {
return false;
}
continue;
}
// Special case for the state to support abbreviations. Currently only the
// US states are supported.
if (field_type == ADDRESS_HOME_STATE) {
base::string16 full, abbreviation;
state_names::GetNameAndAbbreviation(GetRawInfo(ADDRESS_HOME_STATE),
&full, &abbreviation);
if (compare.StringsEqual(profile.GetRawInfo(ADDRESS_HOME_STATE),
full) ||
compare.StringsEqual(profile.GetRawInfo(ADDRESS_HOME_STATE),
abbreviation))
continue;
}
if (!compare.StringsEqual(profile.GetRawInfo(field_type),
GetRawInfo(field_type))) {
return false;
}
}
}
if (!IsVerified() || profile.IsVerified()) {
if (OverwriteWith(profile, app_locale)) {
AutofillMetrics::LogProfileActionOnFormSubmitted(
AutofillMetrics::EXISTING_PROFILE_UPDATED);
} else {
AutofillMetrics::LogProfileActionOnFormSubmitted(
AutofillMetrics::EXISTING_PROFILE_USED);
}
}
return true;
}
// static
bool AutofillProfile::SupportsMultiValue(ServerFieldType type) {
FieldTypeGroup group = AutofillType(type).group();
return group == NAME ||
group == NAME_BILLING ||
group == EMAIL ||
group == PHONE_HOME ||
group == PHONE_BILLING;
}
// static
void AutofillProfile::CreateDifferentiatingLabels(
const std::vector<AutofillProfile*>& profiles,
const std::string& app_locale,
std::vector<base::string16>* labels) {
const size_t kMinimalFieldsShown = 2;
CreateInferredLabels(profiles, NULL, UNKNOWN_TYPE, kMinimalFieldsShown,
app_locale, labels);
DCHECK_EQ(profiles.size(), labels->size());
}
// static
void AutofillProfile::CreateInferredLabels(
const std::vector<AutofillProfile*>& profiles,
const std::vector<ServerFieldType>* suggested_fields,
ServerFieldType excluded_field,
size_t minimal_fields_shown,
const std::string& app_locale,
std::vector<base::string16>* labels) {
std::vector<ServerFieldType> fields_to_use;
GetFieldsForDistinguishingProfiles(suggested_fields, excluded_field,
&fields_to_use);
// Construct the default label for each profile. Also construct a map that
// associates each label with the profiles that have this label. This map is
// then used to detect which labels need further differentiating fields.
std::map<base::string16, std::list<size_t> > labels_to_profiles;
for (size_t i = 0; i < profiles.size(); ++i) {
base::string16 label =
profiles[i]->ConstructInferredLabel(fields_to_use,
minimal_fields_shown,
app_locale);
labels_to_profiles[label].push_back(i);
}
labels->resize(profiles.size());
for (auto& it : labels_to_profiles) {
if (it.second.size() == 1) {
// This label is unique, so use it without any further ado.
base::string16 label = it.first;
size_t profile_index = it.second.front();
(*labels)[profile_index] = label;
} else {
// We have more than one profile with the same label, so add
// differentiating fields.
CreateInferredLabelsHelper(profiles, it.second, fields_to_use,
minimal_fields_shown, app_locale, labels);
}
}
}
void AutofillProfile::GenerateServerProfileIdentifier() {
DCHECK_EQ(SERVER_PROFILE, record_type());
base::string16 contents = GetRawInfo(NAME_FIRST);
contents.append(GetRawInfo(NAME_MIDDLE));
contents.append(GetRawInfo(NAME_LAST));
contents.append(GetRawInfo(EMAIL_ADDRESS));
contents.append(GetRawInfo(COMPANY_NAME));
contents.append(GetRawInfo(ADDRESS_HOME_STREET_ADDRESS));
contents.append(GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY));
contents.append(GetRawInfo(ADDRESS_HOME_CITY));
contents.append(GetRawInfo(ADDRESS_HOME_STATE));
contents.append(GetRawInfo(ADDRESS_HOME_ZIP));
contents.append(GetRawInfo(ADDRESS_HOME_SORTING_CODE));
contents.append(GetRawInfo(ADDRESS_HOME_COUNTRY));
contents.append(GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
std::string contents_utf8 = UTF16ToUTF8(contents);
contents_utf8.append(language_code());
server_id_ = base::SHA1HashString(contents_utf8);
}
void AutofillProfile::RecordAndLogUse() {
UMA_HISTOGRAM_COUNTS_1000("Autofill.DaysSinceLastUse.Profile",
(base::Time::Now() - use_date()).InDays());
RecordUse();
}
// static
base::string16 AutofillProfile::CanonicalizeProfileString(
const base::string16& str) {
base::string16 ret;
ret.reserve(str.size());
bool previous_was_whitespace = false;
// This algorithm isn't designed to be perfect, we could get arbitrarily
// fancy here trying to canonicalize address lines. Instead, this is designed
// to handle common cases for all types of data (addresses and names)
// without the need of domain-specific logic.
base::i18n::UTF16CharIterator iter(&str);
while (!iter.end()) {
switch (u_charType(iter.get())) {
case U_DASH_PUNCTUATION:
case U_START_PUNCTUATION:
case U_END_PUNCTUATION:
case U_CONNECTOR_PUNCTUATION:
case U_OTHER_PUNCTUATION:
// Convert punctuation to spaces. This will convert "Mid-Island Plz."
// -> "Mid Island Plz" (the trailing space will be trimmed off at the
// end of the loop).
if (!previous_was_whitespace) {
ret.push_back(' ');
previous_was_whitespace = true;
}
break;
case U_CONTROL_CHAR: // To escape the '\n' character.
case U_SPACE_SEPARATOR:
case U_LINE_SEPARATOR:
case U_PARAGRAPH_SEPARATOR:
// Convert sequences of spaces to single spaces.
if (!previous_was_whitespace) {
ret.push_back(' ');
previous_was_whitespace = true;
}
break;
case U_UPPERCASE_LETTER:
case U_TITLECASE_LETTER:
previous_was_whitespace = false;
base::WriteUnicodeCharacter(u_tolower(iter.get()), &ret);
break;
default:
previous_was_whitespace = false;
base::WriteUnicodeCharacter(iter.get(), &ret);
break;
}
iter.Advance();
}
// Trim off trailing whitespace if we left one.
if (previous_was_whitespace)
ret.resize(ret.size() - 1);
return ret;
}
// static
bool AutofillProfile::AreProfileStringsSimilar(const base::string16& a,
const base::string16& b) {
return CanonicalizeProfileString(a) == CanonicalizeProfileString(b);
}
void AutofillProfile::GetSupportedTypes(
ServerFieldTypeSet* supported_types) const {
FormGroupList info = FormGroups();
for (const auto& it : info) {
it->GetSupportedTypes(supported_types);
}
}
base::string16 AutofillProfile::ConstructInferredLabel(
const std::vector<ServerFieldType>& included_fields,
size_t num_fields_to_use,
const std::string& app_locale) const {
// TODO(estade): use libaddressinput?
base::string16 separator =
l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_SUMMARY_SEPARATOR);
AutofillType region_code_type(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE);
const base::string16& profile_region_code =
GetInfo(region_code_type, app_locale);
std::string address_region_code = UTF16ToUTF8(profile_region_code);
// A copy of |this| pruned down to contain only data for the address fields in
// |included_fields|.
AutofillProfile trimmed_profile(guid(), origin());
trimmed_profile.SetInfo(region_code_type, profile_region_code, app_locale);
trimmed_profile.set_language_code(language_code());
std::vector<ServerFieldType> remaining_fields;
for (std::vector<ServerFieldType>::const_iterator it =
included_fields.begin();
it != included_fields.end() && num_fields_to_use > 0;
++it) {
AddressField address_field;
if (!i18n::FieldForType(*it, &address_field) ||
!::i18n::addressinput::IsFieldUsed(
address_field, address_region_code) ||
address_field == ::i18n::addressinput::COUNTRY) {
remaining_fields.push_back(*it);
continue;
}
AutofillType autofill_type(*it);
const base::string16& field_value = GetInfo(autofill_type, app_locale);
if (field_value.empty())
continue;
trimmed_profile.SetInfo(autofill_type, field_value, app_locale);
--num_fields_to_use;
}
scoped_ptr<AddressData> address_data =
i18n::CreateAddressDataFromAutofillProfile(trimmed_profile, app_locale);
std::string address_line;
::i18n::addressinput::GetFormattedNationalAddressLine(
*address_data, &address_line);
base::string16 label = base::UTF8ToUTF16(address_line);
for (std::vector<ServerFieldType>::const_iterator it =
remaining_fields.begin();
it != remaining_fields.end() && num_fields_to_use > 0;
++it) {
const base::string16& field_value = GetInfo(AutofillType(*it), app_locale);
if (field_value.empty())
continue;
if (!label.empty())
label.append(separator);
label.append(field_value);
--num_fields_to_use;
}
// If country code is missing, libaddressinput won't be used to format the
// address. In this case the suggestion might include a multi-line street
// address which needs to be flattened.
base::ReplaceChars(label, base::ASCIIToUTF16("\n"), separator, &label);
return label;
}
// static
void AutofillProfile::CreateInferredLabelsHelper(
const std::vector<AutofillProfile*>& profiles,
const std::list<size_t>& indices,
const std::vector<ServerFieldType>& fields,
size_t num_fields_to_include,
const std::string& app_locale,
std::vector<base::string16>* labels) {
// For efficiency, we first construct a map of fields to their text values and
// each value's frequency.
std::map<ServerFieldType,
std::map<base::string16, size_t> > field_text_frequencies_by_field;
for (const ServerFieldType& field : fields) {
std::map<base::string16, size_t>& field_text_frequencies =
field_text_frequencies_by_field[field];
for (const auto& it : indices) {
const AutofillProfile* profile = profiles[it];
base::string16 field_text =
profile->GetInfo(AutofillType(field), app_locale);
// If this label is not already in the map, add it with frequency 0.
if (!field_text_frequencies.count(field_text))
field_text_frequencies[field_text] = 0;
// Now, increment the frequency for this label.
++field_text_frequencies[field_text];
}
}
// Now comes the meat of the algorithm. For each profile, we scan the list of
// fields to use, looking for two things:
// 1. A (non-empty) field that differentiates the profile from all others
// 2. At least |num_fields_to_include| non-empty fields
// Before we've satisfied condition (2), we include all fields, even ones that
// are identical across all the profiles. Once we've satisfied condition (2),
// we only include fields that that have at last two distinct values.
for (const auto& it : indices) {
const AutofillProfile* profile = profiles[it];
std::vector<ServerFieldType> label_fields;
bool found_differentiating_field = false;
for (std::vector<ServerFieldType>::const_iterator field = fields.begin();
field != fields.end(); ++field) {
// Skip over empty fields.
base::string16 field_text =
profile->GetInfo(AutofillType(*field), app_locale);
if (field_text.empty())
continue;
std::map<base::string16, size_t>& field_text_frequencies =
field_text_frequencies_by_field[*field];
found_differentiating_field |=
!field_text_frequencies.count(base::string16()) &&
(field_text_frequencies[field_text] == 1);
// Once we've found enough non-empty fields, skip over any remaining
// fields that are identical across all the profiles.
if (label_fields.size() >= num_fields_to_include &&
(field_text_frequencies.size() == 1))
continue;
label_fields.push_back(*field);
// If we've (1) found a differentiating field and (2) found at least
// |num_fields_to_include| non-empty fields, we're done!
if (found_differentiating_field &&
label_fields.size() >= num_fields_to_include)
break;
}
(*labels)[it] = profile->ConstructInferredLabel(
label_fields, label_fields.size(), app_locale);
}
}
AutofillProfile::FormGroupList AutofillProfile::FormGroups() const {
FormGroupList v(5);
v[0] = &name_;
v[1] = &email_;
v[2] = &company_;
v[3] = &phone_number_;
v[4] = &address_;
return v;
}
const FormGroup* AutofillProfile::FormGroupForType(
const AutofillType& type) const {
return const_cast<AutofillProfile*>(this)->MutableFormGroupForType(type);
}
FormGroup* AutofillProfile::MutableFormGroupForType(const AutofillType& type) {
switch (type.group()) {
case NAME:
case NAME_BILLING:
return &name_;
case EMAIL:
return &email_;
case COMPANY:
return &company_;
case PHONE_HOME:
case PHONE_BILLING:
return &phone_number_;
case ADDRESS_HOME:
case ADDRESS_BILLING:
return &address_;
case NO_GROUP:
case CREDIT_CARD:
case PASSWORD_FIELD:
case USERNAME_FIELD:
case TRANSACTION:
return NULL;
}
NOTREACHED();
return NULL;
}
bool AutofillProfile::EqualsSansGuid(const AutofillProfile& profile) const {
return origin() == profile.origin() &&
language_code() == profile.language_code() &&
Compare(profile) == 0;
}
// So we can compare AutofillProfiles with EXPECT_EQ().
std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile) {
return os << profile.guid() << " " << profile.origin() << " "
<< UTF16ToUTF8(profile.GetRawInfo(NAME_FIRST)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(NAME_MIDDLE)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(NAME_LAST)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(EMAIL_ADDRESS)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(COMPANY_NAME)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE1)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_LINE2)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY))
<< " " << UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_CITY)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_STATE)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_ZIP)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)) << " "
<< UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)) << " "
<< profile.language_code() << " "
<< UTF16ToUTF8(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER));
}
} // namespace autofill
| Workday/OpenFrame | components/autofill/core/browser/autofill_profile.cc | C++ | bsd-3-clause | 36,304 | [
30522,
1013,
1013,
9385,
2286,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
2179,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"58020550","logradouro":"Rua Murilo Lemos","bairro":"Roger","cidade":"Jo\u00e3o Pessoa","uf":"PB","estado":"Para\u00edba"});
| lfreneda/cepdb | api/v1/58020550.jsonp.js | JavaScript | cc0-1.0 | 138 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
23712,
11387,
24087,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
14163,
15928,
2080,
3393,
15530,
1000,
1010,
1000,
21790,
18933,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.github.izhangzhihao.SpringMVCSeedProject.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 根据角色判断权限
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AuthByRole {
AuthorityType[] AuthorityType();
boolean validate() default true;
}
| izhangzhihao/SpringMVCSeedProject | src/main/java/com/github/izhangzhihao/SpringMVCSeedProject/Annotation/AuthByRole.java | Java | apache-2.0 | 435 | [
30522,
7427,
4012,
1012,
21025,
2705,
12083,
1012,
1045,
27922,
5654,
19436,
3270,
2080,
1012,
3500,
2213,
25465,
19763,
18927,
3217,
20614,
1012,
5754,
17287,
3508,
1025,
12324,
9262,
1012,
11374,
1012,
5754,
17287,
3508,
1012,
5783,
13874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright 2005-2014 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* 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.kuali.rice.kew.doctype;
import org.apache.commons.lang.StringUtils;
import org.kuali.rice.core.api.impex.xml.XmlConstants;
import org.kuali.rice.core.api.util.ConcreteKeyValue;
import org.kuali.rice.core.api.util.KeyValue;
import org.kuali.rice.kew.api.WorkflowRuntimeException;
import org.kuali.rice.kew.api.exception.WorkflowException;
import org.kuali.rice.kew.rule.xmlrouting.XPathHelper;
import org.kuali.rice.kew.util.Utilities;
import org.kuali.rice.kim.api.group.Group;
import org.kuali.rice.kim.api.services.KimApiServiceLocator;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Serializable;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
public class DocumentTypeSecurity implements Serializable {
private static final long serialVersionUID = -1886779857180381404L;
private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentTypeSecurity.class);
private Boolean active;
private Boolean initiatorOk;
private Boolean routeLogAuthenticatedOk;
private List<KeyValue> searchableAttributes = new ArrayList<KeyValue>();
private List<Group> workgroups = new ArrayList<Group>();
private List<SecurityPermissionInfo> permissions = new ArrayList<SecurityPermissionInfo>();
private List<String> allowedRoles = new ArrayList<String>();
private List<String> disallowedRoles = new ArrayList<String>();
private List<String> securityAttributeExtensionNames = new ArrayList<String>();
private List<String> securityAttributeClassNames = new ArrayList<String>();
private static XPath xpath = XPathHelper.newXPath();
public DocumentTypeSecurity() {}
/** parse <security> XML to populate security object
* @throws ParserConfigurationException
* @throws IOException
* @throws SAXException */
public DocumentTypeSecurity(String standardApplicationId, String documentTypeSecurityXml)
{
try {
if (org.apache.commons.lang.StringUtils.isEmpty(documentTypeSecurityXml)) {
return;
}
InputSource inputSource = new InputSource(new BufferedReader(new StringReader(documentTypeSecurityXml)));
Element securityElement = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputSource).getDocumentElement();
String active = (String) xpath.evaluate("./@active", securityElement, XPathConstants.STRING);
if (org.apache.commons.lang.StringUtils.isEmpty(active) || "true".equals(active.toLowerCase())) {
// true is the default
this.setActive(Boolean.valueOf(true));
}
else {
this.setActive(Boolean.valueOf(false));
}
// there should only be one <initiator> tag
NodeList initiatorNodes = (NodeList) xpath.evaluate("./initiator", securityElement, XPathConstants.NODESET);
if (initiatorNodes != null && initiatorNodes.getLength()>0) {
Node initiatorNode = initiatorNodes.item(0);
String value = initiatorNode.getTextContent();
if (org.apache.commons.lang.StringUtils.isEmpty(value) || value.toLowerCase().equals("true")) {
this.setInitiatorOk(Boolean.valueOf(true));
}
else {
this.initiatorOk = Boolean.valueOf(false);
}
}
// there should only be one <routeLogAuthenticated> tag
NodeList routeLogAuthNodes = (NodeList) xpath.evaluate("./routeLogAuthenticated", securityElement, XPathConstants.NODESET);
if (routeLogAuthNodes != null && routeLogAuthNodes.getLength()>0) {
Node routeLogAuthNode = routeLogAuthNodes.item(0);
String value = routeLogAuthNode.getTextContent();
if (org.apache.commons.lang.StringUtils.isEmpty(value) || value.toLowerCase().equals("true")) {
this.routeLogAuthenticatedOk = Boolean.valueOf(true);
}
else {
this.routeLogAuthenticatedOk = Boolean.valueOf(false);
}
}
NodeList searchableAttributeNodes = (NodeList) xpath.evaluate("./searchableAttribute", securityElement, XPathConstants.NODESET);
if (searchableAttributeNodes != null && searchableAttributeNodes.getLength()>0) {
for (int i = 0; i < searchableAttributeNodes.getLength(); i++) {
Node searchableAttributeNode = searchableAttributeNodes.item(i);
String name = (String) xpath.evaluate("./@name", searchableAttributeNode, XPathConstants.STRING);
String idType = (String) xpath.evaluate("./@idType", searchableAttributeNode, XPathConstants.STRING);
if (!org.apache.commons.lang.StringUtils.isEmpty(name) && !org.apache.commons.lang.StringUtils.isEmpty(idType)) {
KeyValue searchableAttribute = new ConcreteKeyValue(name, idType);
searchableAttributes.add(searchableAttribute);
}
}
}
NodeList workgroupNodes = (NodeList) xpath.evaluate("./workgroup", securityElement, XPathConstants.NODESET);
if (workgroupNodes != null && workgroupNodes.getLength()>0) {
LOG.warn("Document Type Security XML is using deprecated element 'workgroup', please use 'groupName' instead.");
for (int i = 0; i < workgroupNodes.getLength(); i++) {
Node workgroupNode = workgroupNodes.item(i);
String value = workgroupNode.getTextContent().trim();
if (!org.apache.commons.lang.StringUtils.isEmpty(value)) {
value = Utilities.substituteConfigParameters(value);
String namespaceCode = Utilities.parseGroupNamespaceCode(value);
String groupName = Utilities.parseGroupName(value);
Group groupObject = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(namespaceCode,
groupName);
if (groupObject == null) {
throw new WorkflowException("Could not find group: " + value);
}
workgroups.add(groupObject);
}
}
}
NodeList groupNodes = (NodeList) xpath.evaluate("./groupName", securityElement, XPathConstants.NODESET);
if (groupNodes != null && groupNodes.getLength()>0) {
for (int i = 0; i < groupNodes.getLength(); i++) {
Node groupNode = groupNodes.item(i);
if (groupNode.getNodeType() == Node.ELEMENT_NODE) {
String groupName = groupNode.getTextContent().trim();
if (!org.apache.commons.lang.StringUtils.isEmpty(groupName)) {
groupName = Utilities.substituteConfigParameters(groupName).trim();
String namespaceCode = Utilities.substituteConfigParameters(((Element) groupNode).getAttribute(XmlConstants.NAMESPACE)).trim();
Group groupObject = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(namespaceCode,
groupName);
if (groupObject != null) {
workgroups.add(groupObject);
} else {
LOG.warn("Could not find group with name '" + groupName + "' and namespace '" + namespaceCode + "' which was defined on Document Type security");
}
// if (groupObject == null) {
// throw new WorkflowException("Could not find group with name '" + groupName + "' and namespace '" + namespaceCode + "'");
// }
}
}
}
}
NodeList permissionNodes = (NodeList) xpath.evaluate("./permission", securityElement, XPathConstants.NODESET);
if (permissionNodes != null && permissionNodes.getLength()>0) {
for (int i = 0; i < permissionNodes.getLength(); i++) {
Node permissionNode = permissionNodes.item(i);
if (permissionNode.getNodeType() == Node.ELEMENT_NODE) {
SecurityPermissionInfo securityPermission = new SecurityPermissionInfo();
securityPermission.setPermissionName(Utilities.substituteConfigParameters(((Element) permissionNode).getAttribute(XmlConstants.NAME)).trim());
securityPermission.setPermissionNamespaceCode(Utilities.substituteConfigParameters(((Element) permissionNode).getAttribute(XmlConstants.NAMESPACE)).trim());
if (!StringUtils.isEmpty(securityPermission.getPermissionName()) && !StringUtils.isEmpty(securityPermission.getPermissionNamespaceCode())) {
//get details and qualifications
if (permissionNode.hasChildNodes()) {
NodeList permissionChildNodes = permissionNode.getChildNodes();
for (int j = 0; j <permissionChildNodes.getLength(); j++) {
Node permissionChildNode = permissionChildNodes.item(j);
if (permissionChildNode.getNodeType() == Node.ELEMENT_NODE) {
String childAttributeName = Utilities.substituteConfigParameters(((Element) permissionChildNode).getAttribute(XmlConstants.NAME)).trim();
String childAttributeValue = permissionChildNode.getTextContent().trim();
if (!StringUtils.isEmpty(childAttributeValue)) {
childAttributeValue = Utilities.substituteConfigParameters(childAttributeValue).trim();
}
if (!StringUtils.isEmpty(childAttributeValue)) {
childAttributeValue = Utilities.substituteConfigParameters(childAttributeValue).trim();
}
if (permissionChildNode.getNodeName().trim().equals("permissionDetail")) {
securityPermission.getPermissionDetails().put(childAttributeName, childAttributeValue);
}
if (permissionChildNode.getNodeName().trim().equals("qualification")) {
securityPermission.getQualifications().put(childAttributeName, childAttributeValue);
}
}
}
}
//if ( KimApiServiceLocator.getPermissionService().isPermissionDefined(securityPermission.getPermissionNamespaceCode(), securityPermission.getPermissionName(), securityPermission.getPermissionDetails())) {
permissions.add(securityPermission);
//} else {
// LOG.warn("Could not find permission with name '" + securityPermission.getPermissionName() + "' and namespace '" + securityPermission.getPermissionNamespaceCode() + "' which was defined on Document Type security");
//}
}
}
}
}
NodeList roleNodes = (NodeList) xpath.evaluate("./role", securityElement, XPathConstants.NODESET);
if (roleNodes != null && roleNodes.getLength()>0) {
for (int i = 0; i < roleNodes.getLength(); i++) {
Element roleElement = (Element)roleNodes.item(i);
String value = roleElement.getTextContent().trim();
String allowedValue = roleElement.getAttribute("allowed");
if (StringUtils.isBlank(allowedValue)) {
allowedValue = "true";
}
if (!org.apache.commons.lang.StringUtils.isEmpty(value)) {
if (Boolean.parseBoolean(allowedValue)) {
allowedRoles.add(value);
} else {
disallowedRoles.add(value);
}
}
}
}
NodeList attributeNodes = (NodeList) xpath.evaluate("./securityAttribute", securityElement, XPathConstants.NODESET);
if (attributeNodes != null && attributeNodes.getLength()>0) {
for (int i = 0; i < attributeNodes.getLength(); i++) {
Element attributeElement = (Element)attributeNodes.item(i);
NamedNodeMap elemAttributes = attributeElement.getAttributes();
// can be an attribute name or an actual classname
String attributeOrClassName = null;
String applicationId = standardApplicationId;
if (elemAttributes.getNamedItem("name") != null) {
// found a name attribute so find the class name
String extensionName = elemAttributes.getNamedItem("name").getNodeValue().trim();
this.securityAttributeExtensionNames.add(extensionName);
} else if (elemAttributes.getNamedItem("class") != null) {
// class name defined
String className = elemAttributes.getNamedItem("class").getNodeValue().trim();
this.securityAttributeClassNames.add(className);
} else {
throw new WorkflowException("Cannot find attribute 'name' or attribute 'class' for securityAttribute Node");
}
}
}
} catch (Exception err) {
throw new WorkflowRuntimeException(err);
}
}
public List<String> getSecurityAttributeExtensionNames() {
return this.securityAttributeExtensionNames;
}
public void setSecurityAttributeExtensionNames(List<String> securityAttributeExtensionNames) {
this.securityAttributeExtensionNames = securityAttributeExtensionNames;
}
public List<String> getSecurityAttributeClassNames() {
return securityAttributeClassNames;
}
public void setSecurityAttributeClassNames(List<String> securityAttributeClassNames) {
this.securityAttributeClassNames = securityAttributeClassNames;
}
public Boolean getInitiatorOk() {
return initiatorOk;
}
public void setInitiatorOk(Boolean initiatorOk) {
this.initiatorOk = initiatorOk;
}
public Boolean getRouteLogAuthenticatedOk() {
return routeLogAuthenticatedOk;
}
public void setRouteLogAuthenticatedOk(Boolean routeLogAuthenticatedOk) {
this.routeLogAuthenticatedOk = routeLogAuthenticatedOk;
}
public List<String> getAllowedRoles() {
return allowedRoles;
}
public void setAllowedRoles(List<String> allowedRoles) {
this.allowedRoles = allowedRoles;
}
public List<String> getDisallowedRoles() {
return disallowedRoles;
}
public void setDisallowedRoles(List<String> disallowedRoles) {
this.disallowedRoles = disallowedRoles;
}
public List<KeyValue> getSearchableAttributes() {
return searchableAttributes;
}
public void setSearchableAttributes(List<KeyValue> searchableAttributes) {
this.searchableAttributes = searchableAttributes;
}
public List<Group> getWorkgroups() {
return workgroups;
}
public void setWorkgroups(List<Group> workgroups) {
this.workgroups = workgroups;
}
public List<SecurityPermissionInfo> getPermissions() {
return this.permissions;
}
public void setPermissions(List<SecurityPermissionInfo> permissions) {
this.permissions = permissions;
}
public Boolean getActive() {
return active;
}
public void setActive(Boolean active) {
this.active = active;
}
public boolean isActive() {
if (active != null) {
return active.booleanValue();
}
else {
return false;
}
}
}
| ricepanda/rice-git3 | rice-middleware/impl/src/main/java/org/kuali/rice/kew/doctype/DocumentTypeSecurity.java | Java | apache-2.0 | 15,608 | [
30522,
1013,
1008,
1008,
1008,
9385,
2384,
1011,
2297,
1996,
13970,
11475,
3192,
1008,
1008,
7000,
2104,
1996,
4547,
2451,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<feed app='ibos2' type='comment' info='评论'>
<title comment="评论标题">
<![CDATA[<?php echo $actorRealName; ?>]]>
</title>
<body comment="评论内容">
<![CDATA[<?php echo $body; ?> ]]>
</body>
<feedAttr feedid="<?php echo $feedid; ?>"/>
</feed> | vlinhd11/IBOS | system/modules/message/views/feed/commentFeed.php | PHP | lgpl-3.0 | 285 | [
30522,
1026,
5438,
10439,
1027,
1005,
21307,
2891,
2475,
1005,
2828,
1027,
1005,
7615,
1005,
18558,
1027,
1005,
100,
100,
1005,
1028,
1026,
2516,
7615,
1027,
1000,
100,
100,
100,
100,
1000,
1028,
1026,
999,
1031,
3729,
6790,
1031,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# frozen_string_literal: true
# Copyright 2021 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.
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
require "gapic/config"
require "gapic/config/method"
require "google/cloud/compute/v1/version"
require "google/cloud/compute/v1/security_policies/credentials"
require "google/cloud/compute/v1/security_policies/rest"
module Google
module Cloud
module Compute
module V1
# To load this service and instantiate a REST client:
#
# require "google/cloud/compute/v1/security_policies"
# client = ::Google::Cloud::Compute::V1::SecurityPolicies::Rest::Client.new
#
module SecurityPolicies
end
end
end
end
end
helper_path = ::File.join __dir__, "security_policies", "helpers.rb"
require "google/cloud/compute/v1/security_policies/helpers" if ::File.file? helper_path
| googleapis/google-cloud-ruby | google-cloud-compute-v1/lib/google/cloud/compute/v1/security_policies.rb | Ruby | apache-2.0 | 1,412 | [
30522,
1001,
7708,
1035,
5164,
1035,
18204,
1024,
2995,
1001,
9385,
25682,
8224,
11775,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1001,
2017,
2089,
2025,
2224,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>metacoq-translations: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.0 / metacoq-translations - 1.0~beta1+8.11</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
metacoq-translations
<small>
1.0~beta1+8.11
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-03-09 10:28:59 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-09 10:28:59 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.7.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "matthieu.sozeau@inria.fr"
homepage: "https://metacoq.github.io/metacoq"
dev-repo: "git+https://github.com/MetaCoq/metacoq.git#coq-8.11"
bug-reports: "https://github.com/MetaCoq/metacoq/issues"
authors: ["Simon Boulier <simon.boulier@inria.fr>"
"Cyril Cohen <cyril.cohen@inria.fr>"
"Matthieu Sozeau <matthieu.sozeau@inria.fr>"
"Nicolas Tabareau <nicolas.tabareau@inria.fr>"
"Théo Winterhalter <theo.winterhalter@inria.fr>"
]
license: "MIT"
build: [
["sh" "./configure.sh"]
[make "-j%{jobs}%" "-C" "translations"]
]
install: [
[make "-C" "translations" "install"]
]
depends: [
"ocaml" {>= "4.07.1"}
"coq" {>= "8.11" & < "8.12~"}
"conf-python-3" {build}
"conf-time" {build}
"coq-metacoq-template" {= version}
"coq-metacoq-checker" {= version}
]
synopsis: "Translations built on top of MetaCoq"
description: """
MetaCoq is a meta-programming framework for Coq.
The Translations modules provides implementation of standard translations
from type theory to type theory, e.g. parametricity and the `cross-bool`
translation that invalidates functional extensionality.
"""
url {
src: "https://github.com/MetaCoq/metacoq/archive/v1.0-beta1-8.11.tar.gz"
checksum: "sha256=1644c5bd9d02385c802535c6c46dbcaf279afcecd4ffb3da5fae08618c628c75"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-metacoq-translations.1.0~beta1+8.11 coq.8.7.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.0).
The following dependencies couldn't be met:
- coq-metacoq-translations -> ocaml >= 4.07.1
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-metacoq-translations.1.0~beta1+8.11</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.02.3-2.0.6/released/8.7.0/metacoq-translations/1.0~beta1+8.11.html | HTML | mit | 7,657 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
require __DIR__ . "/../vendor/autoload.php";
// NOTE: To run this you need to have installed violent-death
// see https://github.com/gabrielelana/violent-death
// Sorry but I don't want to have an explicit dependency
// with violent-death (wich is not so easy to install) only
// to run this example
// The output will be:
//
// Segmentation fault in 3... 2... 1...
// You didn't notice but it happend! ;-)
GracefulDeath::around(function() {
echo "Segmentation fault in 3... 2... 1...\n";
die_violently();
})
->afterViolentDeath(
"You didn't notice but it happend! ;-)\n"
)
->run();
| gabrielelana/graceful-death | examples/catch_segmentation_fault.php | PHP | mit | 606 | [
30522,
1026,
1029,
25718,
5478,
1035,
1035,
16101,
1035,
1035,
1012,
1000,
1013,
1012,
1012,
1013,
21431,
1013,
8285,
11066,
1012,
25718,
1000,
1025,
1013,
1013,
3602,
1024,
2000,
2448,
2023,
2017,
2342,
2000,
2031,
5361,
6355,
1011,
2331,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Cacheonix Systems licenses this file to You under the LGPL 2.1
* (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.cacheonix.org/products/cacheonix/license-lgpl-2.1.htm
*
* 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.cacheonix.impl.cache.distributed.partitioned;
import java.io.IOException;
import org.cacheonix.CacheonixTestCase;
import org.cacheonix.TestUtils;
import org.cacheonix.impl.cache.item.Binary;
import org.cacheonix.impl.net.ClusterNodeAddress;
import org.cacheonix.impl.net.serializer.Serializer;
import org.cacheonix.impl.net.serializer.SerializerFactory;
import org.cacheonix.impl.net.serializer.Wireable;
/**
* AtomicRemoveRequestTest Tester.
*
* @author simeshev@cacheonix.org
* @version 1.0
*/
public final class AtomicRemoveRequestTest extends CacheonixTestCase {
private static final String CACHE_NAME = "cache.name";
private static final Binary KEY = toBinary("key");
private static final Binary VALUE = toBinary("value");
private AtomicRemoveRequest request = null;
private ClusterNodeAddress clusterNodeAddress;
/**
* Tests that no exceptions occur when creating the object using a default constructor.
*/
public void testDefaultConstructor() {
assertNotNull(new AtomicRemoveRequest().toString());
}
public void testGetPartitionName() {
assertEquals(CACHE_NAME, request.getCacheName());
}
public void testGetKey() {
assertEquals(KEY, request.getKey());
}
public void testGetValue() {
assertEquals(VALUE, request.getValue());
}
public void testToString() {
assertNotNull(request.toString());
}
public void testGetProcessID() {
assertEquals(clusterNodeAddress, request.getSender());
}
public void testSerializeDeserialize() throws IOException {
final Serializer ser = SerializerFactory.getInstance().getSerializer(Serializer.TYPE_JAVA);
final AtomicRemoveRequest deserializedRequest = (AtomicRemoveRequest) ser.deserialize(ser.serialize(request));
assertEquals(request, deserializedRequest);
assertEquals(request.getValue(), deserializedRequest.getValue());
}
public void testHashCode() {
assertTrue(request.hashCode() != 0);
}
public void testGetType() {
assertEquals(Wireable.TYPE_CACHE_ATOMIC_REMOVE_REQUEST, request.getWireableType());
}
protected void setUp() throws Exception {
super.setUp();
clusterNodeAddress = TestUtils.createTestAddress();
request = new AtomicRemoveRequest(clusterNodeAddress, CACHE_NAME, KEY, VALUE);
}
public String toString() {
return "AtomicRemoveRequestTest{" +
"request=" + request +
", clusterNodeAddress=" + clusterNodeAddress +
"} " + super.toString();
}
}
| cacheonix/cacheonix-core | test/src/org/cacheonix/impl/cache/distributed/partitioned/AtomicRemoveRequestTest.java | Java | lgpl-2.1 | 3,189 | [
30522,
1013,
1008,
1008,
17053,
10698,
2595,
3001,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
1048,
21600,
2140,
1016,
1012,
1015,
1008,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
export default function reducer (state = {}, action) {
return state;
};
| moooink/too-much-noise | client/source/reducers/language.js | JavaScript | mit | 74 | [
30522,
9167,
12398,
3853,
5547,
2099,
1006,
2110,
1027,
1063,
1065,
1010,
2895,
1007,
1063,
2709,
2110,
1025,
1065,
1025,
102,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package kinesisvideo
const (
// ErrCodeAccountStreamLimitExceededException for service response error code
// "AccountStreamLimitExceededException".
//
// The number of streams created for the account is too high.
ErrCodeAccountStreamLimitExceededException = "AccountStreamLimitExceededException"
// ErrCodeClientLimitExceededException for service response error code
// "ClientLimitExceededException".
//
// Kinesis Video Streams has throttled the request because you have exceeded
// the limit of allowed client calls. Try making the call later.
ErrCodeClientLimitExceededException = "ClientLimitExceededException"
// ErrCodeDeviceStreamLimitExceededException for service response error code
// "DeviceStreamLimitExceededException".
//
// Not implemented.
ErrCodeDeviceStreamLimitExceededException = "DeviceStreamLimitExceededException"
// ErrCodeInvalidArgumentException for service response error code
// "InvalidArgumentException".
//
// The value for this input parameter is invalid.
ErrCodeInvalidArgumentException = "InvalidArgumentException"
// ErrCodeInvalidDeviceException for service response error code
// "InvalidDeviceException".
//
// Not implemented.
ErrCodeInvalidDeviceException = "InvalidDeviceException"
// ErrCodeInvalidResourceFormatException for service response error code
// "InvalidResourceFormatException".
//
// The format of the StreamARN is invalid.
ErrCodeInvalidResourceFormatException = "InvalidResourceFormatException"
// ErrCodeNotAuthorizedException for service response error code
// "NotAuthorizedException".
//
// The caller is not authorized to perform this operation.
ErrCodeNotAuthorizedException = "NotAuthorizedException"
// ErrCodeResourceInUseException for service response error code
// "ResourceInUseException".
//
// The stream is currently not available for this operation.
ErrCodeResourceInUseException = "ResourceInUseException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// Amazon Kinesis Video Streams can't find the stream that you specified.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
// ErrCodeTagsPerResourceExceededLimitException for service response error code
// "TagsPerResourceExceededLimitException".
//
// You have exceeded the limit of tags that you can associate with the resource.
// Kinesis video streams support up to 50 tags.
ErrCodeTagsPerResourceExceededLimitException = "TagsPerResourceExceededLimitException"
// ErrCodeVersionMismatchException for service response error code
// "VersionMismatchException".
//
// The stream version that you specified is not the latest version. To get the
// latest version, use the DescribeStream (https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_DescribeStream.html)
// API.
ErrCodeVersionMismatchException = "VersionMismatchException"
)
| HotelsDotCom/kube-aws | vendor/github.com/aws/aws-sdk-go/service/kinesisvideo/errors.go | GO | apache-2.0 | 2,983 | [
30522,
1013,
1013,
3642,
7013,
2011,
2797,
1013,
2944,
1013,
18856,
2072,
1013,
8991,
1011,
17928,
1013,
2364,
1012,
2175,
1012,
2079,
2025,
10086,
1012,
7427,
12631,
19009,
17258,
8780,
9530,
3367,
1006,
1013,
1013,
9413,
29566,
3207,
6305... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace OCA\DAV\Command;
use OCA\DAV\CardDAV\SyncService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SyncSystemAddressBook extends Command {
/** @var SyncService */
private $syncService;
/**
* @param SyncService $syncService
*/
function __construct(SyncService $syncService) {
parent::__construct();
$this->syncService = $syncService;
}
protected function configure() {
$this
->setName('dav:sync-system-addressbook')
->setDescription('Synchronizes users to the system addressbook');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('Syncing users ...');
$progress = new ProgressBar($output);
$progress->start();
$this->syncService->syncInstance(function() use ($progress) {
$progress->advance();
});
$progress->finish();
$output->writeln('');
}
}
| pixelipo/server | apps/dav/lib/Command/SyncSystemAddressBook.php | PHP | agpl-3.0 | 1,847 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
2355,
1010,
2219,
20464,
19224,
1010,
4297,
1012,
1008,
1008,
1030,
3166,
2726,
12304,
1026,
2726,
1012,
26774,
1030,
1056,
22930,
1012,
7327,
1028,
1008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<title>76-47-1.smi.png.html</title>
</head>
<body>ID76-47-1<br/>
<img border="0" src="76-47-1.smi.png" alt="76-47-1.smi.png"></img><br/>
<br/>
<table border="1">
<tr>
<td></td><td>ID</td><td>Formula</td><td>FW</td><td>DSSTox_CID</td><td>DSSTox_RID</td><td>DSSTox_GSID</td><td>DSSTox_FileID_Sort</td><td>TS_ChemName</td><td>TS_ChemName_Synonyms</td><td>TS_CASRN</td><td>CASRN_ChemName_Relationship</td><td>TS_Description</td><td>ChemNote</td><td>STRUCTURE_Shown</td><td>STRUCTURE_Formula</td><td>STRUCTURE_MW</td><td>STRUCTURE_ChemType</td><td>STRUCTURE_DefinedOrganicForm</td><td>STRUCTURE_IUPAC</td><td>STRUCTURE_SMILES</td><td>STRUCTURE_SMILES_Desalt</td><td>Substance_modify_yyyymmdd</td></tr>
<tr>
<td>76-47-1</td><td>16222</td><td>C27H41NO6</td><td>475.6175</td><td>31613</td><td>97497</td><td>57824</td><td>8564</td><td>Hydrocortamate</td><td></td><td>76-47-1</td><td>primary</td><td>single chemical compound</td><td></td><td>tested chemical</td><td>C27H41NO6</td><td>475.6175</td><td>defined organic</td><td>parent</td><td>(11beta)-11,17-dihydroxy-3,20-dioxopregn-4-en-21-yl N,N-diethylglycinate</td><td>CCN(CC)CC(=O)OCC(=O)[C@@]4(O)CC[C@@H]2[C@]4(C)C[C@H](O)[C@@H]1[C@@]3(C)CCC(=O)C=C3CC[C@H]12</td><td>CCN(CC)CC(=O)OCC(=O)[C@@]4(O)CC[C@@H]2[C@]4(C)C[C@H](O)[C@@H]1[C@@]3(C)CCC(=O)C=C3CC[C@H]12</td><td>20131018</td></tr>
</table>
<br/><br/><font size="-2">(Page generated on Wed Sep 17 04:05:54 2014 by <a href="http://www.embl.de/~gpau/hwriter/index.html">hwriter</a> 1.3)</font><br/>
</body></html> | andrewdefries/ToxCast | Figure3/Tox21_nnm/WorkHere/76-47-1.smi.png.html | HTML | mit | 1,784 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <ui_animationControls.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
class AnimationToolboxWidget : public QWidget, public Ui::AnimationControls
{
Q_OBJECT
public:
AnimationToolboxWidget(QWidget *parent = 0);
};
| heartvalve/OpenFlipper | Plugin-SkeletalAnimation/AnimationToolbox.hh | C++ | gpl-3.0 | 274 | [
30522,
1001,
2421,
1026,
21318,
1035,
7284,
8663,
13181,
4877,
1012,
1044,
2232,
1028,
1001,
2065,
1053,
2102,
1035,
2544,
1028,
1027,
1014,
2595,
2692,
29345,
8889,
1001,
2421,
1026,
1053,
2102,
9148,
28682,
1028,
1001,
2842,
1001,
2421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <mpi.h>
#include <stdio.h>
int main (int argc, char* argv[]){
int rank, size;
int sum;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Allreduce(&rank, &sum, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
/* Display the result on all ranks, along with the correct answer */
printf("Rank %2d has sum of ranks %d; Answer %d \n", rank, sum, (size-1)*size/2);
MPI_Finalize();
return 0;
}
| PawseySupercomputing/Develop-with-MPI | Solutions/c/ex5-collective/collective.c | C | cc0-1.0 | 471 | [
30522,
1001,
2421,
1026,
6131,
2072,
1012,
1044,
1028,
1001,
2421,
1026,
2358,
20617,
1012,
1044,
1028,
20014,
2364,
1006,
20014,
12098,
18195,
1010,
25869,
1008,
12098,
2290,
2615,
1031,
1033,
1007,
1063,
20014,
4635,
1010,
2946,
1025,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
'''
:author: Patrick Lauer
This class holds the Artificial Bee Colony(ABC) algorithm, based on Karaboga (2007):
D. Karaboga, AN IDEA BASED ON HONEY BEE SWARM FOR NUMERICAL OPTIMIZATION,TECHNICAL REPORT-TR06, Erciyes University, Engineering Faculty, Computer Engineering Department 2005.
D. Karaboga, B. Basturk, A powerful and Efficient Algorithm for Numerical Function Optimization: Artificial Bee Colony (ABC) Algorithm, Journal of Global Optimization, Volume:39, Issue:3,pp:459-171, November 2007,ISSN:0925-5001 , doi: 10.1007/s10898-007-9149-x
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from . import _algorithm
import spotpy
import numpy as np
import time
import random
import itertools
class abc(_algorithm):
'''
Implements the ABC algorithm from Karaboga (2007).
Input
----------
spot_setup: class
model: function
Should be callable with a parameter combination of the parameter-function
and return an list of simulation results (as long as evaluation list)
parameter: function
When called, it should return a random parameter combination. Which can
be e.g. uniform or Gaussian
objectivefunction: function
Should return the objectivefunction for a given list of a model simulation and
observation.
evaluation: function
Should return the true values as return by the model.
dbname: str
* Name of the database where parameter, objectivefunction value and simulation results will be saved.
dbformat: str
* ram: fast suited for short sampling time. no file will be created and results are saved in an array.
* csv: A csv file will be created, which you can import afterwards.
parallel: str
* seq: Sequentiel sampling (default): Normal iterations on one core of your cpu.
* mpc: Multi processing: Iterations on all available cores on your cpu (recommended for windows os).
* mpi: Message Passing Interface: Parallel computing on cluster pcs (recommended for unix os).
save_sim: boolean
*True: Simulation results will be saved
*False: Simulationt results will not be saved
'''
def __init__(self, spot_setup, dbname=None, dbformat=None, parallel='seq',save_sim=True):
_algorithm.__init__(self,spot_setup, dbname=dbname, dbformat=dbformat, parallel=parallel,save_sim=save_sim)
def simulate(self,id_params_tuple):
id,params = id_params_tuple
simulations=self.model(params)
return id,params,simulations
def sample(self,repetitions,eb=48,a=(1/10),peps=0.0001,ownlimit=False,limit=24):
"""
Parameters
----------
repetitions: int
maximum number of function evaluations allowed during optimization
eb: int
number of employed bees (half of population size)
a: float
mutation factor
peps: float
Convergence criterium
ownlimit: boolean
determines if an userdefined limit is set or not
limit: int
sets the limit
"""
#Initialize the Progress bar
starttime = time.time()
intervaltime = starttime
#Initialize ABC parameters:
randompar=self.parameter()['random']
self.nopt=randompar.size
random.seed()
if ownlimit == True:
self.limit=limit
else:
self.limit=eb
lb,ub=self.parameter()['minbound'],self.parameter()['maxbound']
#Initialization
work=[]
#Calculate the objective function
param_generator = ((rep,list(self.parameter()['random'])) for rep in range(eb))
for rep,randompar,simulations in self.repeat(param_generator):
#Calculate fitness
like = self.objectivefunction(evaluation = self.evaluation, simulation = simulations)
self.status(rep,like,randompar)
#Save everything in the database
self.datawriter.save(like,randompar,simulations=simulations)
c=0
p=0
work.append([like,randompar,like,randompar,c,p])#(fit_x,x,fit_v,v,limit,normalized fitness)
#Progress bar
acttime=time.time()
#get str showing approximate timeleft to end of simulation in H, M, S
timestr = time.strftime("%H:%M:%S", time.gmtime(round(((acttime-starttime)/
(rep + 1))*(repetitions-(rep + 1 )))))
#Refresh progressbar every second
if acttime-intervaltime>=2:
text='%i of %i (best like=%g) est. time remaining: %s' % (rep,repetitions,
self.status.objectivefunction,timestr)
print(text)
intervaltime=time.time()
icall=0
gnrng=1e100
while icall<repetitions and gnrng>peps: #and criter_change>pcento:
psum=0
#Employed bee phase
#Generate new input parameters
for i,val in enumerate(work):
k=i
while k==i: k=random.randint(0,(eb-1))
j=random.randint(0,(self.nopt-1))
work[i][3][j]=work[i][1][j]+random.uniform(-a,a)*(work[i][1][j]-work[k][1][j])
if work[i][3][j]<lb[j]: work[i][3][j]=lb[j]
if work[i][3][j]>ub[j]: work[i][3][j]=ub[j]
'''
#Scout bee phase
if work[i][4] >= self.limit:
work[i][3]=self.parameter()['random']
work[i][4]=0
'''
#Calculate the objective function
param_generator = ((rep,work[rep][3]) for rep in range(eb))
for rep,randompar,simulations in self.repeat(param_generator):
#Calculate fitness
clike = self.objectivefunction(evaluation = self.evaluation, simulation = simulations)
if clike > work[rep][0]:
work[rep][1]=work[rep][3]
work[rep][0]=clike
work[rep][4]=0
else:
work[rep][4]=work[rep][4]+1
self.status(rep,work[rep][0],work[rep][1])
self.datawriter.save(clike,work[rep][3],simulations=simulations,chains=icall)
icall += 1
#Probability distribution for roulette wheel selection
bn=[]
for i,val in enumerate(work):
psum=psum+(1/work[i][0])
for i,val in enumerate(work):
work[i][5]=((1/work[i][0])/psum)
bn.append(work[i][5])
bounds = np.cumsum(bn)
#Onlooker bee phase
#Roulette wheel selection
for i,val in enumerate(work):
pn=random.uniform(0,1)
k=i
while k==i:
k=random.randint(0,eb-1)
for t,vol in enumerate(bounds):
if bounds[t]-pn>=0:
z=t
break
j=random.randint(0,(self.nopt-1))
#Generate new input parameters
work[i][3][j]=work[z][1][j]+random.uniform(-a,a)*(work[z][1][j]-work[k][1][j])
if work[i][3][j]<lb[j]: work[i][3][j]=lb[j]
if work[i][3][j]>ub[j]: work[i][3][j]=ub[j]
#Calculate the objective function
param_generator = ((rep,work[rep][3]) for rep in range(eb))
for rep,randompar,simulations in self.repeat(param_generator):
#Calculate fitness
clike = self.objectivefunction(evaluation = self.evaluation, simulation = simulations)
if clike > work[rep][0]:
work[rep][1]=work[rep][3]
work[rep][0]=clike
work[rep][4]=0
else:
work[rep][4]=work[rep][4]+1
self.status(rep,work[rep][0],work[rep][1])
self.datawriter.save(clike,work[rep][3],simulations=simulations,chains=icall)
icall += 1
#Scout bee phase
for i,val in enumerate(work):
if work[i][4] >= self.limit:
work[i][1]=self.parameter()['random']
work[i][4]=0
t,work[i][0],simulations=self.simulate((icall,work[i][1]))
clike = self.objectivefunction(evaluation = self.evaluation, simulation = simulations)
self.datawriter.save(clike,work[rep][3],simulations=simulations,chains=icall)
work[i][0]=clike
icall += 1
gnrng=-self.status.objectivefunction
text='%i of %i (best like=%g) est. time remaining: %s' % (icall,repetitions,self.status.objectivefunction,timestr)
print(text)
if icall >= repetitions:
print('*** OPTIMIZATION SEARCH TERMINATED BECAUSE THE LIMIT')
print('ON THE MAXIMUM NUMBER OF TRIALS ')
print(repetitions)
print('HAS BEEN EXCEEDED.')
if gnrng < peps:
print('THE POPULATION HAS CONVERGED TO A PRESPECIFIED SMALL PARAMETER SPACE')
print('Best parameter set:')
print(self.status.params)
text='Duration:'+str(round((acttime-starttime),2))+' s'
print(-self.status.objectivefunction)
print(icall)
try:
self.datawriter.finalize()
except AttributeError: #Happens if no database was assigned
pass | gitporst/spotpy | spotpy/algorithms/abc.py | Python | mit | 9,796 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1005,
1005,
1005,
1024,
3166,
1024,
4754,
21360,
2121,
2023,
2465,
4324,
1996,
7976,
10506,
5701,
1006,
5925,
1007,
9896,
1010,
2241,
2006,
13173,
5092,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.melvin.share.rx;
import com.hwangjr.rxbus.Bus;
/**
* Author: Melvin
* <p>
* Data: 2017/4/6
* <p>
* 描述:订单
*/
public final class RxOrderBus {
private static Bus mBus;
public synchronized static Bus get() {
if (mBus == null) {
mBus = new Bus();
}
return mBus;
}
}
| MelvinWang/NewShare | NewShare/app/src/main/java/com/melvin/share/rx/RxOrderBus.java | Java | apache-2.0 | 342 | [
30522,
7427,
4012,
1012,
20993,
1012,
3745,
1012,
1054,
2595,
1025,
12324,
4012,
1012,
1044,
16600,
3501,
2099,
1012,
1054,
2595,
8286,
1012,
3902,
1025,
1013,
1008,
1008,
1008,
3166,
1024,
20993,
1008,
1026,
1052,
1028,
1008,
2951,
1993,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `FIOCLEX` constant in crate `libc`.">
<meta name="keywords" content="rust, rustlang, rust-lang, FIOCLEX">
<title>libc::unix::linux::x86_64::FIOCLEX - Rust</title>
<link rel="stylesheet" type="text/css" href="../../../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../../../main.css">
<link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<a href='../../../../libc/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a>
<p class='location'><a href='../../../index.html'>libc</a>::<wbr><a href='../../index.html'>unix</a>::<wbr><a href='../index.html'>linux</a>::<wbr><a href='index.html'>x86_64</a></p><script>window.sidebarCurrent = {name: 'FIOCLEX', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content constant">
<h1 class='fqn'><span class='in-band'><a href='../../../index.html'>libc</a>::<wbr><a href='../../index.html'>unix</a>::<wbr><a href='../index.html'>linux</a>::<wbr><a href='index.html'>x86_64</a>::<wbr><a class='constant' href=''>FIOCLEX</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-3335' class='srclink' href='../../../../src/libc/unix/notbsd/linux/other/b64/x86_64.rs.html#115' title='goto source code'>[src]</a></span></h1>
<pre class='rust const'>pub const FIOCLEX: <a class='type' href='../../../../libc/unix/notbsd/linux/other/b64/type.c_ulong.html' title='libc::unix::notbsd::linux::other::b64::c_ulong'>c_ulong</a><code> = </code><code>21585</code></pre></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../../../";
window.currentCrate = "libc";
window.playgroundUrl = "";
</script>
<script src="../../../../jquery.js"></script>
<script src="../../../../main.js"></script>
<script defer src="../../../../search-index.js"></script>
</body>
</html> | servo/doc.servo.org | libc/unix/linux/x86_64/constant.FIOCLEX.html | HTML | mpl-2.0 | 4,711 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
18804,
2171,
1027,
1000,
3193,
6442,
1000,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
(function(jQuery) {
"use strict";
var control = Echo.Control.manifest("Echo.Tests.Controls.TestControl");
if (Echo.Control.isDefined(control)) return;
control.init = function() {
if (!Echo.Variables) {
Echo.Variables = {};
}
Echo.Variables.TestControl = "production";
this.ready();
};
control.config = {};
control.templates.main = "";
Echo.Control.create(control);
})(Echo.jQuery);
| EchoAppsTeam/js-sdk | tests/fixtures/resources/loader/scripts.prod.js | JavaScript | apache-2.0 | 395 | [
30522,
1006,
3853,
1006,
1046,
4226,
2854,
1007,
1063,
1000,
2224,
9384,
1000,
1025,
13075,
2491,
1027,
9052,
1012,
2491,
1012,
19676,
1006,
1000,
9052,
1012,
5852,
1012,
7711,
1012,
3231,
8663,
13181,
2140,
1000,
1007,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="header-title">
<?php if(is_home()){ ?>
<?php $blog_text = of_get_option('blog_text'); ?>
<?php if($blog_text){?>
<h1><?php echo of_get_option('blog_text'); ?></h1>
<?php } else { ?>
<h1><?php _e('Blog','theme1599');?></h1>
<?php } ?>
<?php } else { ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $pagetitle = get_post_custom_values("page-title");?>
<?php $pagedesc = get_post_custom_values("page-desc");?>
<?php if($pagetitle == ""){ ?>
<h1><?php the_title(); ?></h1>
<?php } else { ?>
<h1><?php echo $pagetitle[0]; ?></h1>
<?php } ?>
<?php if($pagedesc != ""){ ?>
<span class="page-desc"><?php echo $pagedesc[0];?></span>
<?php } ?>
<?php endwhile; endif; ?>
<?php wp_reset_query();?>
<?php } ?>
</div> | yosagarrane/testsite | wp-content/themes/65_65fd76e4b7c1e295a14f4b0cdfb23039/title.php | PHP | gpl-2.0 | 822 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
20346,
1011,
2516,
1000,
1028,
1026,
1029,
25718,
2065,
1006,
2003,
1035,
2188,
1006,
1007,
1007,
1063,
1029,
1028,
1026,
1029,
25718,
1002,
9927,
1035,
3793,
1027,
1997,
1035,
2131,
1035,
5724,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* 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 https://mozilla.org/MPL/2.0/. */
<%namespace name="helpers" file="/helpers.mako.rs" />
<%helpers:shorthand name="text-decoration"
engines="gecko servo-2013"
flags="SHORTHAND_IN_GETCS"
sub_properties="text-decoration-line
${' text-decoration-style text-decoration-color text-decoration-thickness' if engine == 'gecko' else ''}"
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration">
% if engine == "gecko":
use crate::values::specified;
use crate::properties::longhands::{text_decoration_style, text_decoration_color, text_decoration_thickness};
use crate::properties::{PropertyId, LonghandId};
% endif
use crate::properties::longhands::text_decoration_line;
pub fn parse_value<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
% if engine == "gecko":
let text_decoration_thickness_enabled =
PropertyId::Longhand(LonghandId::TextDecorationThickness).enabled_for_all_content();
let (mut line, mut style, mut color, mut thickness, mut any) = (None, None, None, None, false);
% else:
let (mut line, mut any) = (None, false);
% endif
loop {
macro_rules! parse_component {
($value:ident, $module:ident) => (
if $value.is_none() {
if let Ok(value) = input.try(|input| $module::parse(context, input)) {
$value = Some(value);
any = true;
continue;
}
}
)
}
parse_component!(line, text_decoration_line);
% if engine == "gecko":
parse_component!(style, text_decoration_style);
parse_component!(color, text_decoration_color);
if text_decoration_thickness_enabled {
parse_component!(thickness, text_decoration_thickness);
}
% endif
break;
}
if !any {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
Ok(expanded! {
text_decoration_line: unwrap_or_initial!(text_decoration_line, line),
% if engine == "gecko":
text_decoration_style: unwrap_or_initial!(text_decoration_style, style),
text_decoration_color: unwrap_or_initial!(text_decoration_color, color),
text_decoration_thickness: unwrap_or_initial!(text_decoration_thickness, thickness),
% endif
})
}
impl<'a> ToCss for LonghandsToSerialize<'a> {
#[allow(unused)]
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result where W: fmt::Write {
use crate::values::specified::TextDecorationLine;
let (is_solid_style, is_current_color, is_auto_thickness) =
(
% if engine == "gecko":
*self.text_decoration_style == text_decoration_style::SpecifiedValue::Solid,
*self.text_decoration_color == specified::Color::CurrentColor,
self.text_decoration_thickness.map_or(true, |t| t.is_auto())
% else:
true, true, true
% endif
);
let mut has_value = false;
let is_none = *self.text_decoration_line == TextDecorationLine::none();
if (is_solid_style && is_current_color && is_auto_thickness) || !is_none {
self.text_decoration_line.to_css(dest)?;
has_value = true;
}
% if engine == "gecko":
if !is_solid_style {
if has_value {
dest.write_str(" ")?;
}
self.text_decoration_style.to_css(dest)?;
has_value = true;
}
if !is_current_color {
if has_value {
dest.write_str(" ")?;
}
self.text_decoration_color.to_css(dest)?;
has_value = true;
}
if !is_auto_thickness {
if has_value {
dest.write_str(" ")?;
}
self.text_decoration_thickness.to_css(dest)?;
}
% endif
Ok(())
}
}
</%helpers:shorthand>
| larsbergstrom/servo | components/style/properties/shorthands/text.mako.rs | Rust | mpl-2.0 | 4,754 | [
30522,
1013,
1008,
2023,
3120,
3642,
2433,
2003,
3395,
2000,
1996,
3408,
1997,
1996,
9587,
5831,
4571,
2270,
1008,
6105,
1010,
1058,
1012,
1016,
1012,
1014,
1012,
2065,
1037,
6100,
1997,
1996,
6131,
2140,
2001,
2025,
5500,
2007,
2023,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
title: Visual Structure
page_title: Visual Structure | RadSpreadsheet
description: RadSpreadsheet is a control that allows editing tabular data utilizing a variety of cell formatting options, styles and themes.
slug: radspreadsheet-visual-structure
tags: visual,structure
published: True
position: 2
---
# Visual Structure
This section defines terms and concepts used in the scope of __RadSpreadsheet__ that will help you get familiar with the control. We highly encourage you to read the article before you continue with the rest of the documentation of __RadSpreadsheet__.
__RadSpreadsheet__ is a control that allows editing tabular data utilizing a variety of cell formatting options, styles and themes. It can contain one or more Worksheets, each of which with its own Scale Factor. Every worksheet contains cells that are identified by a row number (rows are represented by numbers - 1, 2, 3) and a column number (columns are represented by letters of the alphabet in the UI).
## Spreadsheet UI Visual Structure

* __Ribbon View:__ An instance of RadRibbonView filled with controls which allow you to perform different actions on RadSpreadsheet. Some of the commands include open/save different types of files, undo/redo, copy/paste, apply different types of format or styles, even insert complex formulas.
* __Formula Bar:__ It is located above the work area of the RadSpreadsheet. It holds three main components each one containing information about the active cell/cell range.
* __RadSpreadsheet:__ A control that has a number of built-in features and tools, such as functions, formulas and data analysis tools that make it easier to work with large amounts of data.
* __StatusBar:__ A control displaying the current status of the document and allowing zooming the content.
## RadSpradsheet's Ribbon View Visual Structure

* __Title__: The title allows you to specify the name of the application or the current document. In this case we have chosen the name "Spreadsheet".
* __Ribbon Tab__: RadSpradsheet comes with a RibbonView full of controls for manipulating it. Those controls are grouped logically in tabs. Every tab has a name and it pretty much describes what can be achieved with its content.
* __Ribbon Group__: Furthermore every tab is divided into groups. Groups allow for finer grained distribution of the controls among the tabs.
* __Quick Access Toolbar__: It is located in the upper left corner of the Spreadsheet UI above the individual tabs of the Ribbon View. It contains shortcuts to a number of commonly performed tasks such as save, undo and redo.
* __Application Menu__: It is placed to the left of the Quick Access Toolbar. It enables you to open spreadsheet files, create new ones or save them to different file formats.
## RadSpreadsheet's Formula Bar Visual Structure

* __Name Box__: It displays the cell reference of the active cell or the active cell range.
* __Buttons Box__: Contains three buttons. The first one, which cancels the edit action, and the second one, which accepts the edit action, are active only when editing a cell. The third button is always active and it opens the Insert Function dialog.
* __Formula Box__: Displays the data or formula stored in the active cell. It can be used to enter or edit a formula, a function, or data in a cell.
## RadSpreadsheet's Status Bar Visual Structure

* __Label__: Indicates the current status of the loaded document.
* __Zoom Control__: Zooms in and out the document. The control consists of a button opening a dialog with the zoom percentage and a track bar.
## RadSpreadsheet Visual Structure

1. __Select All Control__: Allows you to quickly select all cells in a worksheet. It is located in the top left corner of the worksheet where the row header and column header meet.
2. __Worksheet__: A grid or table composed of columns and rows that make it convenient to enter, organize, calculate and consolidate data. It is composed of cells where you actually keep and manipulate data.
3. __Merged Cell__: Multiple adjacent cells combined into a single larger cell. When merging multiple cells, only the value of the top-left cell is preserved.
4. __Column Header__: It is the top-most row containing the letters used to identify each column in a worksheet. It is located above row 1 in the worksheet.
5. __Row Header__: It is the left-most column containing the numbers used to identify each row in a worksheet. It is located to the left of column A in the worksheet.
6. __Cell__: Cell is the intersection point between a row and a column. It is the basic storage unit for data in RadSpreadsheet. In a cell name the row numbers always comes after the column letter.
7. __Rows__: Rows run horizontally in a worksheet. Each row is identified by a number in the row header. There are more than one million rows in each worksheet.
8. __Column__: Columns run vertically in a worksheet. Each column is identified by a letter in the column header starting with A and running through to XFD.
9. __Selection__: can occur either using the mouse pointer or through code behind. All actions performed on data, including formatting must be executed using selection.
10. __Sheet Selector__: Allows you to change the currently selected sheet or create a new one. In addition you can change the name of a given worksheet or the color of the corresponding tab.
| telerik/winforms-docs | controls/spreadsheet/getting-started/structure.md | Markdown | apache-2.0 | 5,956 | [
30522,
1011,
1011,
1011,
2516,
1024,
5107,
3252,
3931,
1035,
2516,
1024,
5107,
3252,
1064,
10958,
5104,
28139,
19303,
21030,
2102,
6412,
1024,
10958,
5104,
28139,
19303,
21030,
2102,
2003,
1037,
2491,
2008,
4473,
9260,
21628,
7934,
2951,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rx;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Test;
import rx.functions.Action0;
import rx.functions.Action1;
public class ObservableDoOnTest {
@Test
public void testDoOnEach() {
final AtomicReference<String> r = new AtomicReference<String>();
String output = Observable.from("one").doOnNext(new Action1<String>() {
@Override
public void call(String v) {
r.set(v);
}
}).toBlocking().single();
assertEquals("one", output);
assertEquals("one", r.get());
}
@Test
public void testDoOnError() {
final AtomicReference<Throwable> r = new AtomicReference<Throwable>();
Throwable t = null;
try {
Observable.<String> error(new RuntimeException("an error")).doOnError(new Action1<Throwable>() {
@Override
public void call(Throwable v) {
r.set(v);
}
}).toBlocking().single();
fail("expected exception, not a return value");
} catch (Throwable e) {
t = e;
}
assertNotNull(t);
assertEquals(t, r.get());
}
@Test
public void testDoOnCompleted() {
final AtomicBoolean r = new AtomicBoolean();
String output = Observable.from("one").doOnCompleted(new Action0() {
@Override
public void call() {
r.set(true);
}
}).toBlocking().single();
assertEquals("one", output);
assertTrue(r.get());
}
}
| srvaroa/RxJava | rxjava-core/src/test/java/rx/ObservableDoOnTest.java | Java | apache-2.0 | 2,430 | [
30522,
1013,
1008,
1008,
1008,
9385,
2297,
20907,
1010,
4297,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Vent
A simple tunneling system designed to make a small footprint HTTP
server behind a firewall available on a different machine with a
public IP address.
## details
A complete running system would involve three machines:
- A client running a web browser
- The tunneling server running at least python, available on a public IP
- The tunneling client which runs the small footprint program behind a firewall, and also has an HTTP server running on it.
The tunneling server waits for connections from the tunneling client.
Once a connection is made, a standard web browser can talk to the
tunneling server IP address, and the HTTP connection is tunelled to
the web server running on the tunneling client.
The tunneling server program is written in python. The tunneling
client program is written in pure C, and compiles to between 50k - 60k
on the ARM architecture. It's small enough to run even on the
tightest linux distros, such as those that ship on routers and IP
cameras.
As of 8/23/2015 this project supports generating a firmware binary
suitable for the Tenvis JPT3815w. It could easily be extended to
support other platforms. WARNING: reflashing a device with firmware
from a source other than the factory is risky at best. If you destroy
your device by installing this firmware, it's your problem, your cost,
your loss, and no one elses. There are no warranties.
## build instructions
Assuming you are building for an arm device, you will first need a
toolchain. Checkout my other project buildroot-arm for an arm based
toolchain designed to work with this project.
Assuming you have the toolchain in a folder next to 'vent' (i.e
./vent/../buildroot-arm).
```
cd vent; #presumably where you downloaded this project
make
```
| tongfa/vent | README.md | Markdown | mit | 1,757 | [
30522,
1001,
18834,
1037,
3722,
5234,
2075,
2291,
2881,
2000,
2191,
1037,
2235,
24319,
8299,
8241,
2369,
1037,
2543,
9628,
2800,
2006,
1037,
2367,
3698,
2007,
1037,
2270,
12997,
4769,
1012,
1001,
1001,
4751,
1037,
3143,
2770,
2291,
2052,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
def tryprint():
return ('it will be oke') | cherylyli/stress-aid | env/lib/python3.5/site-packages/helowrld/__init__.py | Python | mit | 45 | [
30522,
13366,
3046,
16550,
1006,
1007,
1024,
2709,
1006,
1005,
2009,
2097,
2022,
7929,
2063,
1005,
1007,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Asynchronous Example
An example showing how to delay rendering for asynchronous events.
## Commands
```sh
$ npm install
$ npm run dev
$ npm run build
```
## Code
```js
// webpack.config.babel.js
new HtmlPlugin((assets, defaultTemplate, compiler) => {
return new Promise((resolve, reject) => {
var templateData = {
...assets,
title: 'Asynchronous Example'
}
setTimeout(resolve, 5 * 1000, {
'index.html': defaultTemplate(templateData)
})
})
})
```
## License
This software is released into the public domain.
| urban/webpack-html-plugin | examples/asynchronous/README.md | Markdown | mit | 557 | [
30522,
1001,
2004,
6038,
2818,
4948,
3560,
30524,
2824,
1012,
1001,
1001,
10954,
1036,
1036,
1036,
14021,
1002,
27937,
2213,
16500,
1002,
27937,
2213,
2448,
16475,
1002,
27937,
2213,
2448,
3857,
1036,
1036,
1036,
1001,
1001,
3642,
1036,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package de.leif.ffmanagementsuite.service;
import de.leif.ffmanagementsuite.domain.Authority;
import de.leif.ffmanagementsuite.domain.User;
import de.leif.ffmanagementsuite.repository.AuthorityRepository;
import de.leif.ffmanagementsuite.config.Constants;
import de.leif.ffmanagementsuite.repository.UserRepository;
import de.leif.ffmanagementsuite.security.AuthoritiesConstants;
import de.leif.ffmanagementsuite.security.SecurityUtils;
import de.leif.ffmanagementsuite.service.util.RandomUtil;
import de.leif.ffmanagementsuite.service.dto.UserDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cache.CacheManager;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
/**
* Service class for managing users.
*/
@Service
@Transactional
public class UserService {
private final Logger log = LoggerFactory.getLogger(UserService.class);
private final UserRepository userRepository;
private final PasswordEncoder passwordEncoder;
private final AuthorityRepository authorityRepository;
private final CacheManager cacheManager;
public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder, AuthorityRepository authorityRepository, CacheManager cacheManager) {
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
this.authorityRepository = authorityRepository;
this.cacheManager = cacheManager;
}
public Optional<User> activateRegistration(String key) {
log.debug("Activating user for activation key {}", key);
return userRepository.findOneByActivationKey(key)
.map(user -> {
// activate given user for the registration key.
user.setActivated(true);
user.setActivationKey(null);
cacheManager.getCache("users").evict(user.getLogin());
log.debug("Activated user: {}", user);
return user;
});
}
public Optional<User> completePasswordReset(String newPassword, String key) {
log.debug("Reset user password for reset key {}", key);
return userRepository.findOneByResetKey(key)
.filter(user -> user.getResetDate().isAfter(Instant.now().minusSeconds(86400)))
.map(user -> {
user.setPassword(passwordEncoder.encode(newPassword));
user.setResetKey(null);
user.setResetDate(null);
cacheManager.getCache("users").evict(user.getLogin());
return user;
});
}
public Optional<User> requestPasswordReset(String mail) {
return userRepository.findOneByEmailIgnoreCase(mail)
.filter(User::getActivated)
.map(user -> {
user.setResetKey(RandomUtil.generateResetKey());
user.setResetDate(Instant.now());
cacheManager.getCache("users").evict(user.getLogin());
return user;
});
}
public User createUser(String login, String password, String firstName, String lastName, String email,
String imageUrl, String langKey) {
User newUser = new User();
Authority authority = authorityRepository.findOne(AuthoritiesConstants.USER);
Set<Authority> authorities = new HashSet<>();
String encryptedPassword = passwordEncoder.encode(password);
newUser.setLogin(login);
// new user gets initially a generated password
newUser.setPassword(encryptedPassword);
newUser.setFirstName(firstName);
newUser.setLastName(lastName);
newUser.setEmail(email);
newUser.setImageUrl(imageUrl);
newUser.setLangKey(langKey);
// new user is not active
newUser.setActivated(false);
// new user gets registration key
newUser.setActivationKey(RandomUtil.generateActivationKey());
authorities.add(authority);
newUser.setAuthorities(authorities);
userRepository.save(newUser);
log.debug("Created Information for User: {}", newUser);
return newUser;
}
public User createUser(UserDTO userDTO) {
User user = new User();
user.setLogin(userDTO.getLogin());
user.setFirstName(userDTO.getFirstName());
user.setLastName(userDTO.getLastName());
user.setEmail(userDTO.getEmail());
user.setImageUrl(userDTO.getImageUrl());
if (userDTO.getLangKey() == null) {
user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language
} else {
user.setLangKey(userDTO.getLangKey());
}
if (userDTO.getAuthorities() != null) {
Set<Authority> authorities = new HashSet<>();
userDTO.getAuthorities().forEach(
authority -> authorities.add(authorityRepository.findOne(authority))
);
user.setAuthorities(authorities);
}
String encryptedPassword = passwordEncoder.encode(RandomUtil.generatePassword());
user.setPassword(encryptedPassword);
user.setResetKey(RandomUtil.generateResetKey());
user.setResetDate(Instant.now());
user.setActivated(true);
userRepository.save(user);
log.debug("Created Information for User: {}", user);
return user;
}
/**
* Update basic information (first name, last name, email, language) for the current user.
*
* @param firstName first name of user
* @param lastName last name of user
* @param email email id of user
* @param langKey language key
* @param imageUrl image URL of user
*/
public void updateUser(String firstName, String lastName, String email, String langKey, String imageUrl) {
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(user -> {
user.setFirstName(firstName);
user.setLastName(lastName);
user.setEmail(email);
user.setLangKey(langKey);
user.setImageUrl(imageUrl);
cacheManager.getCache("users").evict(user.getLogin());
log.debug("Changed Information for User: {}", user);
});
}
/**
* Update all information for a specific user, and return the modified user.
*
* @param userDTO user to update
* @return updated user
*/
public Optional<UserDTO> updateUser(UserDTO userDTO) {
return Optional.of(userRepository
.findOne(userDTO.getId()))
.map(user -> {
user.setLogin(userDTO.getLogin());
user.setFirstName(userDTO.getFirstName());
user.setLastName(userDTO.getLastName());
user.setEmail(userDTO.getEmail());
user.setImageUrl(userDTO.getImageUrl());
user.setActivated(userDTO.isActivated());
user.setLangKey(userDTO.getLangKey());
Set<Authority> managedAuthorities = user.getAuthorities();
managedAuthorities.clear();
userDTO.getAuthorities().stream()
.map(authorityRepository::findOne)
.forEach(managedAuthorities::add);
cacheManager.getCache("users").evict(user.getLogin());
log.debug("Changed Information for User: {}", user);
return user;
})
.map(UserDTO::new);
}
public void deleteUser(String login) {
userRepository.findOneByLogin(login).ifPresent(user -> {
userRepository.delete(user);
cacheManager.getCache("users").evict(login);
log.debug("Deleted User: {}", user);
});
}
public void changePassword(String password) {
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(user -> {
String encryptedPassword = passwordEncoder.encode(password);
user.setPassword(encryptedPassword);
cacheManager.getCache("users").evict(user.getLogin());
log.debug("Changed password for User: {}", user);
});
}
@Transactional(readOnly = true)
public Page<UserDTO> getAllManagedUsers(Pageable pageable) {
return userRepository.findAllByLoginNot(pageable, Constants.ANONYMOUS_USER).map(UserDTO::new);
}
@Transactional(readOnly = true)
public Optional<User> getUserWithAuthoritiesByLogin(String login) {
return userRepository.findOneWithAuthoritiesByLogin(login);
}
@Transactional(readOnly = true)
public User getUserWithAuthorities(Long id) {
return userRepository.findOneWithAuthoritiesById(id);
}
@Transactional(readOnly = true)
public User getUserWithAuthorities() {
return userRepository.findOneWithAuthoritiesByLogin(SecurityUtils.getCurrentUserLogin()).orElse(null);
}
/**
* Not activated users should be automatically deleted after 3 days.
* <p>
* This is scheduled to get fired everyday, at 01:00 (am).
*/
@Scheduled(cron = "0 0 1 * * ?")
public void removeNotActivatedUsers() {
List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(Instant.now().minus(3, ChronoUnit.DAYS));
for (User user : users) {
log.debug("Deleting not activated user {}", user.getLogin());
userRepository.delete(user);
cacheManager.getCache("users").evict(user.getLogin());
}
}
/**
* @return a list of all the authorities
*/
public List<String> getAuthorities() {
return authorityRepository.findAll().stream().map(Authority::getName).collect(Collectors.toList());
}
}
| t08094a/ffManagementSuite | src/main/java/de/leif/ffmanagementsuite/service/UserService.java | Java | gpl-3.0 | 10,089 | [
30522,
7427,
2139,
1012,
26947,
2546,
1012,
21461,
24805,
20511,
28880,
2063,
1012,
2326,
1025,
12324,
2139,
1012,
26947,
2546,
1012,
21461,
24805,
20511,
28880,
2063,
1012,
5884,
1012,
3691,
1025,
12324,
2139,
1012,
26947,
2546,
1012,
21461,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// ServiceCredentials.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2005 Novell, Inc. http://www.novell.com
//
// 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.
//
using System;
using System.Collections.ObjectModel;
using System.IdentityModel.Selectors;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
namespace System.ServiceModel.Description
{
public class ServiceCredentials
: SecurityCredentialsManager, IServiceBehavior
{
public ServiceCredentials ()
{
}
protected ServiceCredentials (ServiceCredentials other)
{
initiator = other.initiator.Clone ();
peer = other.peer.Clone ();
recipient = other.recipient.Clone ();
userpass = other.userpass.Clone ();
windows = other.windows.Clone ();
issued_token = other.issued_token.Clone ();
secure_conversation = other.secure_conversation.Clone ();
}
X509CertificateInitiatorServiceCredential initiator
= new X509CertificateInitiatorServiceCredential ();
PeerCredential peer = new PeerCredential ();
X509CertificateRecipientServiceCredential recipient
= new X509CertificateRecipientServiceCredential ();
UserNamePasswordServiceCredential userpass
= new UserNamePasswordServiceCredential ();
WindowsServiceCredential windows
= new WindowsServiceCredential ();
IssuedTokenServiceCredential issued_token =
new IssuedTokenServiceCredential ();
SecureConversationServiceCredential secure_conversation =
new SecureConversationServiceCredential ();
public X509CertificateInitiatorServiceCredential ClientCertificate {
get { return initiator; }
}
public IssuedTokenServiceCredential IssuedTokenAuthentication {
get { return issued_token; }
}
public PeerCredential Peer {
get { return peer; }
}
public SecureConversationServiceCredential SecureConversationAuthentication {
get { return secure_conversation; }
}
public X509CertificateRecipientServiceCredential ServiceCertificate {
get { return recipient; }
}
public UserNamePasswordServiceCredential UserNameAuthentication {
get { return userpass; }
}
public WindowsServiceCredential WindowsAuthentication {
get { return windows; }
}
public ServiceCredentials Clone ()
{
ServiceCredentials ret = CloneCore ();
if (ret.GetType () != GetType ())
throw new NotImplementedException ("CloneCore() must be implemented to return an instance of the same type in this custom ServiceCredentials type.");
return ret;
}
protected virtual ServiceCredentials CloneCore ()
{
return new ServiceCredentials (this);
}
public override SecurityTokenManager CreateSecurityTokenManager ()
{
return new ServiceCredentialsSecurityTokenManager (this);
}
void IServiceBehavior.AddBindingParameters (
ServiceDescription description,
ServiceHostBase serviceHostBase,
Collection<ServiceEndpoint> endpoints,
BindingParameterCollection parameters)
{
parameters.Add (this);
}
void IServiceBehavior.ApplyDispatchBehavior (
ServiceDescription description,
ServiceHostBase serviceHostBase)
{
// do nothing
}
[MonoTODO]
void IServiceBehavior.Validate (
ServiceDescription description,
ServiceHostBase serviceHostBase)
{
// unlike MSDN description, it does not throw NIE.
}
}
}
| edwinspire/VSharp | class/System.ServiceModel/System.ServiceModel.Description/ServiceCredentials.cs | C# | lgpl-3.0 | 4,458 | [
30522,
1013,
1013,
1013,
1013,
2326,
16748,
16454,
26340,
1012,
20116,
1013,
1013,
1013,
1013,
3166,
1024,
1013,
1013,
2012,
13203,
4048,
4372,
19506,
3406,
1026,
2012,
13203,
4048,
1030,
8418,
20924,
1012,
4012,
1028,
1013,
1013,
1013,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Reflection;
using LionFire.Types;
using LionFire.ExtensionMethods;
using LionFire.Structures;
using Microsoft.Extensions.Options;
namespace LionFire.Types
{
// TODO: Cleanup
// TODO: Option for falling back to .NET Type.GetType()
public class TypeResolver : ITypeResolver
{
internal IDictionary<string, Type?> Types => TypeNameRegistry.Types;
TypeNameRegistry TypeNameRegistry { get; }
public TypeResolver(TypeNameRegistry typeNameRegistry)
{
TypeNameRegistry = typeNameRegistry;
}
//#region Register
//public void Register(Type type, string? typeName = null)
//{
// if (IsFrozen) throw new ObjectFrozenException();
// if (typeName == null) typeName = type.Name;
// if (types.ContainsKey(typeName))
// {
// throw new AlreadyException($"{typeName} is already registered. Was the same Assembly registered twice, or is there a conflict?");
// }
// types.GetOrAdd(typeName, x => type);
//}
//public void Register<T>(string? typeName = null)
//{
// if (IsFrozen) throw new ObjectFrozenException();
// if (typeName == null) typeName = typeof(T).Name;
// if (types.ContainsKey(typeName)) throw new AlreadyException();
// types.GetOrAdd(typeName, x => typeof(T));
//}
//#endregion
#region Resolve
public Type? TryResolve(string typeName)
{
var type = Types.TryGetValue(typeName);
if (type != null) return type;
try
{
type = Type.GetType(typeName);
}
catch { } // EMPTYCATCH
return type;
}
public Type Resolve(string typeName)
{
Type? type = Types.TryGetValue(typeName);
var result = TryResolve(typeName);
if (result == null)
{
throw new TypeNotFoundException(typeName);
}
return result;
}
#endregion
//public void UseShortNamesForAssembly(System.Reflection.Assembly assembly)
//{
// foreach (var type in assembly.GetTypes())
// {
// if (conflictingShortNames.Contains(type.Name)) { continue; }
// else if (types.ContainsKey(type.Name))
// {
// types.Remove(type.Name); conflictingShortNames.Add(type.Name);
// System.Diagnostics.Debug.WriteLine("Type already exists: " + type);
// continue;
// }
// types.Add(type.Name, type);
// }
//}
}
}
| jaredthirsk/Core | src/LionFire.Core/Types/TypeResolver.cs | C# | mit | 2,886 | [
30522,
1001,
19701,
3085,
9585,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
2291,
1012,
9185,
1025,
2478,
7006,
10273,
1012,
4127,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use babel'
export default function destroySession(self, sharedSession) {
// Checks if shared session in the stack
let shareStackIndex = self.shareStack.indexOf(sharedSession)
if (shareStackIndex !== -1) {
// Removes share session from the stack and updates UI
self.shareStack.splice(shareStackIndex, 1)
self.updateShareView()
} else {
// Logs an error message
console.error(sharedSession, 'not found')
}
}
| lightbulb-softworks/atom-realtime-collaboration | lib/helpers/destroySession.js | JavaScript | mit | 438 | [
30522,
1005,
2224,
11561,
2140,
1005,
9167,
12398,
3853,
20735,
7971,
3258,
1006,
2969,
1010,
4207,
8583,
10992,
1007,
1063,
1013,
1013,
14148,
2065,
4207,
5219,
1999,
1996,
9991,
2292,
6661,
2696,
18009,
13629,
2595,
1027,
2969,
1012,
6661... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2001-2002 by David Brownell
*
* 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.
*/
#ifndef __USB_CORE_HCD_H
#define __USB_CORE_HCD_H
#ifdef __KERNEL__
#include <linux/rwsem.h>
#include <linux/interrupt.h>
#define MAX_TOPO_LEVEL 6
/* This file contains declarations of usbcore internals that are mostly
* used or exposed by Host Controller Drivers.
*/
/*
* USB Packet IDs (PIDs)
*/
#define USB_PID_EXT 0xf0 /* USB 2.0 LPM ECN */
#define USB_PID_OUT 0xe1
#define USB_PID_ACK 0xd2
#define USB_PID_DATA0 0xc3
#define USB_PID_PING 0xb4 /* USB 2.0 */
#define USB_PID_SOF 0xa5
#define USB_PID_NYET 0x96 /* USB 2.0 */
#define USB_PID_DATA2 0x87 /* USB 2.0 */
#define USB_PID_SPLIT 0x78 /* USB 2.0 */
#define USB_PID_IN 0x69
#define USB_PID_NAK 0x5a
#define USB_PID_DATA1 0x4b
#define USB_PID_PREAMBLE 0x3c /* Token mode */
#define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
#define USB_PID_SETUP 0x2d
#define USB_PID_STALL 0x1e
#define USB_PID_MDATA 0x0f /* USB 2.0 */
/*-------------------------------------------------------------------------*/
/*
* USB Host Controller Driver (usb_hcd) framework
*
* Since "struct usb_bus" is so thin, you can't share much code in it.
* This framework is a layer over that, and should be more sharable.
*
* @authorized_default: Specifies if new devices are authorized to
* connect by default or they require explicit
* user space authorization; this bit is settable
* through /sys/class/usb_host/X/authorized_default.
* For the rest is RO, so we don't lock to r/w it.
*/
/*-------------------------------------------------------------------------*/
struct giveback_urb_bh {
bool running;
spinlock_t lock;
struct list_head head;
struct tasklet_struct bh;
struct usb_host_endpoint *completing_ep;
};
struct usb_hcd {
/*
* housekeeping
*/
struct usb_bus self; /* hcd is-a bus */
struct kref kref; /* reference counter */
const char *product_desc; /* product/vendor string */
int speed; /* Speed for this roothub.
* May be different from
* hcd->driver->flags & HCD_MASK
*/
char irq_descr[24]; /* driver + bus # */
struct timer_list rh_timer; /* drives root-hub polling */
struct urb *status_urb; /* the current status urb */
#ifdef CONFIG_PM_RUNTIME
struct work_struct wakeup_work; /* for remote wakeup */
#endif
/*
* hardware info/state
*/
const struct hc_driver *driver; /* hw-specific hooks */
/*
* OTG and some Host controllers need software interaction with phys;
* other external phys should be software-transparent
*/
struct usb_phy *phy;
/* Flags that need to be manipulated atomically because they can
* change while the host controller is running. Always use
* set_bit() or clear_bit() to change their values.
*/
unsigned long flags;
#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
#define HCD_FLAG_DEAD 6 /* controller has died? */
#define HCD_FLAG_DWC_OTG 28 /* dwc_otg controller */
#define HCD_FLAG_DWC3 27 /* dwc3 controller */
/* The flags can be tested using these macros; they are likely to
* be slightly faster than test_bit().
*/
#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
#define HCD_DWC_OTG(hcd) ((hcd)->flags & (1U << HCD_FLAG_DWC_OTG))
#define HCD_DWC3(hcd) ((hcd)->flags & (1U << HCD_FLAG_DWC3))
/* Flags that get set only during HCD registration or removal. */
unsigned rh_registered:1;/* is root hub registered? */
unsigned rh_pollable:1; /* may we poll the root hub? */
unsigned msix_enabled:1; /* driver has MSI-X enabled? */
unsigned remove_phy:1; /* auto-remove USB phy */
/* The next flag is a stopgap, to be removed when all the HCDs
* support the new root-hub polling mechanism. */
unsigned uses_new_polling:1;
unsigned wireless:1; /* Wireless USB HCD */
unsigned authorized_default:1;
unsigned has_tt:1; /* Integrated TT in root hub */
unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
unsigned int irq; /* irq allocated */
void __iomem *regs; /* device memory/io */
resource_size_t rsrc_start; /* memory/io resource start */
resource_size_t rsrc_len; /* memory/io resource length */
unsigned power_budget; /* in mA, 0 = no limit */
struct giveback_urb_bh high_prio_bh;
struct giveback_urb_bh low_prio_bh;
/* bandwidth_mutex should be taken before adding or removing
* any new bus bandwidth constraints:
* 1. Before adding a configuration for a new device.
* 2. Before removing the configuration to put the device into
* the addressed state.
* 3. Before selecting a different configuration.
* 4. Before selecting an alternate interface setting.
*
* bandwidth_mutex should be dropped after a successful control message
* to the device, or resetting the bandwidth after a failed attempt.
*/
struct mutex *bandwidth_mutex;
struct usb_hcd *shared_hcd;
struct usb_hcd *primary_hcd;
#define HCD_BUFFER_POOLS 4
struct dma_pool *pool[HCD_BUFFER_POOLS];
int state;
# define __ACTIVE 0x01
# define __SUSPEND 0x04
# define __TRANSIENT 0x80
# define HC_STATE_HALT 0
# define HC_STATE_RUNNING (__ACTIVE)
# define HC_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE)
# define HC_STATE_RESUMING (__SUSPEND|__TRANSIENT)
# define HC_STATE_SUSPENDED (__SUSPEND)
#define HC_IS_RUNNING(state) ((state) & __ACTIVE)
#define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
/* more shared queuing code would be good; it should support
* smarter scheduling, handle transaction translators, etc;
* input size of periodic table to an interrupt scheduler.
* (ohci 32, uhci 1024, ehci 256/512/1024).
*/
/* The HC driver's private data is stored at the end of
* this structure.
*/
unsigned long hcd_priv[0]
__attribute__ ((aligned(sizeof(s64))));
};
/* 2.4 does this a bit differently ... */
static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd)
{
return &hcd->self;
}
static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus)
{
return container_of(bus, struct usb_hcd, self);
}
struct hcd_timeout { /* timeouts we allocate */
struct list_head timeout_list;
struct timer_list timer;
};
/*-------------------------------------------------------------------------*/
struct hc_driver {
const char *description; /* "ehci-hcd" etc */
const char *product_desc; /* product/vendor string */
size_t hcd_priv_size; /* size of private data */
/* irq handler */
irqreturn_t (*irq) (struct usb_hcd *hcd);
int flags;
#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
#define HCD_USB11 0x0010 /* USB 1.1 */
#define HCD_USB2 0x0020 /* USB 2.0 */
#define HCD_USB25 0x0030 /* Wireless USB 1.0 (USB 2.5)*/
#define HCD_USB3 0x0040 /* USB 3.0 */
#define HCD_MASK 0x0070
#define HCD_BH 0x0100 /* URB complete in BH context */
/* called to init HCD and root hub */
int (*reset) (struct usb_hcd *hcd);
int (*start) (struct usb_hcd *hcd);
/* NOTE: these suspend/resume calls relate to the HC as
* a whole, not just the root hub; they're for PCI bus glue.
*/
/* called after suspending the hub, before entering D3 etc */
int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
/* called after entering D0 (etc), before resuming the hub */
int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
/* cleanly make HCD stop writing memory and doing I/O */
void (*stop) (struct usb_hcd *hcd);
/* shutdown HCD */
void (*shutdown) (struct usb_hcd *hcd);
/* return current frame number */
int (*get_frame_number) (struct usb_hcd *hcd);
/* manage i/o requests, device state */
int (*urb_enqueue)(struct usb_hcd *hcd,
struct urb *urb, gfp_t mem_flags);
int (*urb_dequeue)(struct usb_hcd *hcd,
struct urb *urb, int status);
/*
* (optional) these hooks allow an HCD to override the default DMA
* mapping and unmapping routines. In general, they shouldn't be
* necessary unless the host controller has special DMA requirements,
* such as alignment contraints. If these are not specified, the
* general usb_hcd_(un)?map_urb_for_dma functions will be used instead
* (and it may be a good idea to call these functions in your HCD
* implementation)
*/
int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb,
gfp_t mem_flags);
void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb);
/* hw synch, freeing endpoint resources that urb_dequeue can't */
void (*endpoint_disable)(struct usb_hcd *hcd,
struct usb_host_endpoint *ep);
/* (optional) reset any endpoint state such as sequence number
and current window */
void (*endpoint_reset)(struct usb_hcd *hcd,
struct usb_host_endpoint *ep);
/* root hub support */
int (*hub_status_data) (struct usb_hcd *hcd, char *buf);
int (*hub_control) (struct usb_hcd *hcd,
u16 typeReq, u16 wValue, u16 wIndex,
char *buf, u16 wLength);
int (*bus_suspend)(struct usb_hcd *);
int (*bus_resume)(struct usb_hcd *);
int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
/* force handover of high-speed port to full-speed companion */
void (*relinquish_port)(struct usb_hcd *, int);
/* has a port been handed over to a companion? */
int (*port_handed_over)(struct usb_hcd *, int);
/* CLEAR_TT_BUFFER completion callback */
void (*clear_tt_buffer_complete)(struct usb_hcd *,
struct usb_host_endpoint *);
/* xHCI specific functions */
/* Called by usb_alloc_dev to alloc HC device structures */
int (*alloc_dev)(struct usb_hcd *, struct usb_device *);
/* Called by usb_disconnect to free HC device structures */
void (*free_dev)(struct usb_hcd *, struct usb_device *);
/* Change a group of bulk endpoints to support multiple stream IDs */
int (*alloc_streams)(struct usb_hcd *hcd, struct usb_device *udev,
struct usb_host_endpoint **eps, unsigned int num_eps,
unsigned int num_streams, gfp_t mem_flags);
/* Reverts a group of bulk endpoints back to not using stream IDs.
* Can fail if we run out of memory.
*/
int (*free_streams)(struct usb_hcd *hcd, struct usb_device *udev,
struct usb_host_endpoint **eps, unsigned int num_eps,
gfp_t mem_flags);
/* Bandwidth computation functions */
/* Note that add_endpoint() can only be called once per endpoint before
* check_bandwidth() or reset_bandwidth() must be called.
* drop_endpoint() can only be called once per endpoint also.
* A call to xhci_drop_endpoint() followed by a call to
* xhci_add_endpoint() will add the endpoint to the schedule with
* possibly new parameters denoted by a different endpoint descriptor
* in usb_host_endpoint. A call to xhci_add_endpoint() followed by a
* call to xhci_drop_endpoint() is not allowed.
*/
/* Allocate endpoint resources and add them to a new schedule */
int (*add_endpoint)(struct usb_hcd *, struct usb_device *,
struct usb_host_endpoint *);
/* Drop an endpoint from a new schedule */
int (*drop_endpoint)(struct usb_hcd *, struct usb_device *,
struct usb_host_endpoint *);
/* Check that a new hardware configuration, set using
* endpoint_enable and endpoint_disable, does not exceed bus
* bandwidth. This must be called before any set configuration
* or set interface requests are sent to the device.
*/
int (*check_bandwidth)(struct usb_hcd *, struct usb_device *);
/* Reset the device schedule to the last known good schedule,
* which was set from a previous successful call to
* check_bandwidth(). This reverts any add_endpoint() and
* drop_endpoint() calls since that last successful call.
* Used for when a check_bandwidth() call fails due to resource
* or bandwidth constraints.
*/
void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
/* Returns the hardware-chosen device address */
int (*address_device)(struct usb_hcd *, struct usb_device *udev);
/* prepares the hardware to send commands to the device */
int (*enable_device)(struct usb_hcd *, struct usb_device *udev);
/* Notifies the HCD after a hub descriptor is fetched.
* Will block.
*/
int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
struct usb_tt *tt, gfp_t mem_flags);
int (*reset_device)(struct usb_hcd *, struct usb_device *);
/* Notifies the HCD after a device is connected and its
* address is set
*/
int (*update_device)(struct usb_hcd *, struct usb_device *);
int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int);
/* USB 3.0 Link Power Management */
/* Returns the USB3 hub-encoded value for the U1/U2 timeout. */
int (*enable_usb3_lpm_timeout)(struct usb_hcd *,
struct usb_device *, enum usb3_link_state state);
/* The xHCI host controller can still fail the command to
* disable the LPM timeouts, so this can return an error code.
*/
int (*disable_usb3_lpm_timeout)(struct usb_hcd *,
struct usb_device *, enum usb3_link_state state);
int (*find_raw_port_number)(struct usb_hcd *, int);
};
static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
{
return hcd->driver->flags & HCD_BH;
}
static inline bool hcd_periodic_completion_in_progress(struct usb_hcd *hcd,
struct usb_host_endpoint *ep)
{
return hcd->high_prio_bh.completing_ep == ep;
}
extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
int status);
extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb);
extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
extern int usb_hcd_unlink_urb(struct urb *urb, int status);
extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
int status);
extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
gfp_t mem_flags);
extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *);
extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *);
extern void usb_hcd_flush_endpoint(struct usb_device *udev,
struct usb_host_endpoint *ep);
extern void usb_hcd_disable_endpoint(struct usb_device *udev,
struct usb_host_endpoint *ep);
extern void usb_hcd_reset_endpoint(struct usb_device *udev,
struct usb_host_endpoint *ep);
extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
struct usb_host_config *new_config,
struct usb_host_interface *old_alt,
struct usb_host_interface *new_alt);
extern int usb_hcd_get_frame_number(struct usb_device *udev);
extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
struct device *dev, const char *bus_name);
extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
struct device *dev, const char *bus_name,
struct usb_hcd *shared_hcd);
extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
extern void usb_put_hcd(struct usb_hcd *hcd);
extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd);
extern int usb_add_hcd(struct usb_hcd *hcd,
unsigned int irqnum, unsigned long irqflags);
extern void usb_remove_hcd(struct usb_hcd *hcd);
extern int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1);
struct platform_device;
extern void usb_hcd_platform_shutdown(struct platform_device *dev);
#ifdef CONFIG_PCI
struct pci_dev;
struct pci_device_id;
extern int usb_hcd_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id);
extern void usb_hcd_pci_remove(struct pci_dev *dev);
extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
#ifdef CONFIG_PM
extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
#endif
#endif /* CONFIG_PCI */
/* pci-ish (pdev null is ok) buffer alloc/mapping support */
int hcd_buffer_create(struct usb_hcd *hcd);
void hcd_buffer_destroy(struct usb_hcd *hcd);
void *hcd_buffer_alloc(struct usb_bus *bus, size_t size,
gfp_t mem_flags, dma_addr_t *dma);
void hcd_buffer_free(struct usb_bus *bus, size_t size,
void *addr, dma_addr_t dma);
/* generic bus glue, needed for host controllers that don't use PCI */
extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
extern void usb_hc_died(struct usb_hcd *hcd);
extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
extern void usb_wakeup_notification(struct usb_device *hdev,
unsigned int portnum);
extern void usb_hcd_start_port_resume(struct usb_bus *bus, int portnum);
extern void usb_hcd_end_port_resume(struct usb_bus *bus, int portnum);
/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
#define usb_settoggle(dev, ep, out, bit) \
((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
((bit) << (ep)))
/* -------------------------------------------------------------------------- */
/* Enumeration is only for the hub driver, or HCD virtual root hubs */
extern struct usb_device *usb_alloc_dev(struct usb_device *parent,
struct usb_bus *, unsigned port);
extern int usb_new_device(struct usb_device *dev);
extern void usb_disconnect(struct usb_device **);
extern int usb_get_configuration(struct usb_device *dev);
extern void usb_destroy_configuration(struct usb_device *dev);
/*-------------------------------------------------------------------------*/
/*
* HCD Root Hub support
*/
#include <linux/usb/ch11.h>
/*
* As of USB 2.0, full/low speed devices are segregated into trees.
* One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
* The other type grows from high speed hubs when they connect to
* full/low speed devices using "Transaction Translators" (TTs).
*
* TTs should only be known to the hub driver, and high speed bus
* drivers (only EHCI for now). They affect periodic scheduling and
* sometimes control/bulk error recovery.
*/
struct usb_device;
struct usb_tt {
struct usb_device *hub; /* upstream highspeed hub */
int multi; /* true means one TT per port */
unsigned think_time; /* think time in ns */
void *hcpriv; /* HCD private data */
/* for control/bulk error recovery (CLEAR_TT_BUFFER) */
spinlock_t lock;
struct list_head clear_list; /* of usb_tt_clear */
struct work_struct clear_work;
};
struct usb_tt_clear {
struct list_head clear_list;
unsigned tt;
u16 devinfo;
struct usb_hcd *hcd;
struct usb_host_endpoint *ep;
};
extern int usb_hub_clear_tt_buffer(struct urb *urb);
extern void usb_ep0_reinit(struct usb_device *);
/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
#define DeviceRequest \
((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
#define DeviceOutRequest \
((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
#define InterfaceRequest \
((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
#define EndpointRequest \
((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
#define EndpointOutRequest \
((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
/* class requests from the USB 2.0 hub spec, table 11-15 */
/* GetBusState and SetHubDescriptor are optional, omitted */
#define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE)
#define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE)
#define GetHubDescriptor (0xa000 | USB_REQ_GET_DESCRIPTOR)
#define GetHubStatus (0xa000 | USB_REQ_GET_STATUS)
#define GetPortStatus (0xa300 | USB_REQ_GET_STATUS)
#define SetHubFeature (0x2000 | USB_REQ_SET_FEATURE)
#define SetPortFeature (0x2300 | USB_REQ_SET_FEATURE)
/*-------------------------------------------------------------------------*/
/* class requests from USB 3.0 hub spec, table 10-5 */
#define SetHubDepth (0x3000 | HUB_SET_DEPTH)
#define GetPortErrorCount (0x8000 | HUB_GET_PORT_ERR_COUNT)
/*
* Generic bandwidth allocation constants/support
*/
#define FRAME_TIME_USECS 1000L
#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */
/* Trying not to use worst-case bit-stuffing
* of (7/6 * 8 * bytecount) = 9.33 * bytecount */
/* bytecount = data payload byte count */
#define NS_TO_US(ns) DIV_ROUND_UP(ns, 1000L)
/* convert nanoseconds to microseconds, rounding up */
/*
* Full/low speed bandwidth allocation constants/support.
*/
#define BW_HOST_DELAY 1000L /* nanoseconds */
#define BW_HUB_LS_SETUP 333L /* nanoseconds */
/* 4 full-speed bit times (est.) */
#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */
#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
/*
* Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
* ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
* to preallocate bandwidth)
*/
#define USB2_HOST_DELAY 5 /* nsec, guess */
#define HS_NSECS(bytes) (((55 * 8 * 2083) \
+ (2083UL * (3 + BitTime(bytes))))/1000 \
+ USB2_HOST_DELAY)
#define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \
+ (2083UL * (3 + BitTime(bytes))))/1000 \
+ USB2_HOST_DELAY)
#define HS_USECS(bytes) NS_TO_US(HS_NSECS(bytes))
#define HS_USECS_ISO(bytes) NS_TO_US(HS_NSECS_ISO(bytes))
extern long usb_calc_bus_time(int speed, int is_input,
int isoc, int bytecount);
/*-------------------------------------------------------------------------*/
extern void usb_set_device_state(struct usb_device *udev,
enum usb_device_state new_state);
/*-------------------------------------------------------------------------*/
/* exported only within usbcore */
extern struct list_head usb_bus_list;
extern struct mutex usb_bus_list_lock;
extern wait_queue_head_t usb_kill_urb_queue;
extern int usb_find_interface_driver(struct usb_device *dev,
struct usb_interface *interface);
#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))
#ifdef CONFIG_PM
extern void usb_root_hub_lost_power(struct usb_device *rhdev);
extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
#endif /* CONFIG_PM */
#ifdef CONFIG_PM_RUNTIME
extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
#else
static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
{
return;
}
#endif /* CONFIG_PM_RUNTIME */
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
struct usb_mon_operations {
void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status);
/* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
};
extern struct usb_mon_operations *mon_ops;
static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb)
{
if (bus->monitored)
(*mon_ops->urb_submit)(bus, urb);
}
static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
int error)
{
if (bus->monitored)
(*mon_ops->urb_submit_error)(bus, urb, error);
}
static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
int status)
{
if (bus->monitored)
(*mon_ops->urb_complete)(bus, urb, status);
}
int usb_mon_register(struct usb_mon_operations *ops);
void usb_mon_deregister(void);
#else
static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
int error) {}
static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
int status) {}
#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
/*-------------------------------------------------------------------------*/
/* random stuff */
#define RUN_CONTEXT (in_irq() ? "in_irq" \
: (in_interrupt() ? "in_interrupt" : "can sleep"))
/* This rwsem is for use only by the hub driver and ehci-hcd.
* Nobody else should touch it.
*/
extern struct rw_semaphore ehci_cf_port_reset_rwsem;
/* Keep track of which host controller drivers are loaded */
#define USB_UHCI_LOADED 0
#define USB_OHCI_LOADED 1
#define USB_EHCI_LOADED 2
extern unsigned long usb_hcds_loaded;
#endif /* __KERNEL__ */
#endif /* __USB_CORE_HCD_H */
| mirsys/amlogic_kernel | include/linux/usb/hcd.h | C | gpl-2.0 | 25,560 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2541,
1011,
2526,
2011,
2585,
15005,
3363,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
2009,
1008,
2104,
1996,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
(function(module) {
const splashView = {};
splashView.defaultView = function(){
$('#about').hide();
$('#map').css('z-index', -500);
$('form').fadeIn();
$('#splash-page').fadeIn();
}
module.splashView = splashView;
})(window);
$(function(){
$('#home').on('click', function(){
splashView.defaultView();
});
});
| glenrage/soundsgood | public/scripts/views/splashview.js | JavaScript | mit | 358 | [
30522,
1005,
2224,
9384,
1005,
1025,
1006,
3853,
1006,
11336,
1007,
1063,
9530,
3367,
17624,
8584,
1027,
1063,
1065,
1025,
17624,
8584,
1012,
12398,
8584,
1027,
3853,
1006,
1007,
1063,
1002,
1006,
1005,
1001,
2055,
1005,
1007,
1012,
5342,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from polyphony import testbench
def g(x):
if x == 0:
return 0
return 1
def h(x):
if x == 0:
pass
def f(v, i, j, k):
if i == 0:
return v
elif i == 1:
return v
elif i == 2:
h(g(j) + g(k))
return v
elif i == 3:
for m in range(j):
v += 2
return v
else:
for n in range(i):
v += 1
return v
def if28(code, r1, r2, r3, r4):
if code == 0:
return f(r1, r2, r3, r4)
return 0
@testbench
def test():
assert 1 == if28(0, 1, 1, 0, 0)
assert 2 == if28(0, 2, 0, 0, 0)
assert 3 == if28(0, 3, 1, 0, 0)
assert 4 == if28(0, 4, 2, 0, 0)
assert 5 == if28(0, 5, 2, 1, 1)
assert 6 == if28(0, 6, 2, 2, 2)
assert 7 == if28(0, 7, 3, 0, 0)
assert 10 == if28(0, 8, 3, 1, 1)
assert 13 == if28(0, 9, 3, 2, 2)
assert 14 == if28(0, 10, 4, 0, 0)
test()
| ktok07b6/polyphony | tests/if/if28.py | Python | mit | 922 | [
30522,
2013,
26572,
20846,
2100,
12324,
3231,
10609,
2818,
13366,
1043,
1006,
1060,
1007,
1024,
2065,
1060,
1027,
1027,
1014,
1024,
2709,
1014,
2709,
1015,
13366,
1044,
1006,
1060,
1007,
1024,
2065,
1060,
1027,
1027,
1014,
1024,
3413,
13366... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* f_rndis.c -- RNDIS link function driver
*
* Copyright (C) 2003-2005,2008 David Brownell
* Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger
* Copyright (C) 2008 Nokia Corporation
* Copyright (C) 2009 Samsung Electronics
* Author: Michal Nazarewicz (mina86@mina86.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.
*/
/* #define VERBOSE_DEBUG */
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/etherdevice.h>
#include <linux/atomic.h>
#include "u_ether.h"
#include "rndis.h"
static bool rndis_multipacket_dl_disable;
module_param(rndis_multipacket_dl_disable, bool, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(rndis_multipacket_dl_disable,
"Disable RNDIS Multi-packet support in DownLink");
/*
* This function is an RNDIS Ethernet port -- a Microsoft protocol that's
* been promoted instead of the standard CDC Ethernet. The published RNDIS
* spec is ambiguous, incomplete, and needlessly complex. Variants such as
* ActiveSync have even worse status in terms of specification.
*
* In short: it's a protocol controlled by (and for) Microsoft, not for an
* Open ecosystem or markets. Linux supports it *only* because Microsoft
* doesn't support the CDC Ethernet standard.
*
* The RNDIS data transfer model is complex, with multiple Ethernet packets
* per USB message, and out of band data. The control model is built around
* what's essentially an "RNDIS RPC" protocol. It's all wrapped in a CDC ACM
* (modem, not Ethernet) veneer, with those ACM descriptors being entirely
* useless (they're ignored). RNDIS expects to be the only function in its
* configuration, so it's no real help if you need composite devices; and
* it expects to be the first configuration too.
*
* There is a single technical advantage of RNDIS over CDC Ethernet, if you
* discount the fluff that its RPC can be made to deliver: it doesn't need
* a NOP altsetting for the data interface. That lets it work on some of the
* "so smart it's stupid" hardware which takes over configuration changes
* from the software, and adds restrictions like "no altsettings".
*
* Unfortunately MSFT's RNDIS drivers are buggy. They hang or oops, and
* have all sorts of contrary-to-specification oddities that can prevent
* them from working sanely. Since bugfixes (or accurate specs, letting
* Linux work around those bugs) are unlikely to ever come from MSFT, you
* may want to avoid using RNDIS on purely operational grounds.
*
* Omissions from the RNDIS 1.0 specification include:
*
* - Power management ... references data that's scattered around lots
* of other documentation, which is incorrect/incomplete there too.
*
* - There are various undocumented protocol requirements, like the need
* to send garbage in some control-OUT messages.
*
* - MS-Windows drivers sometimes emit undocumented requests.
*/
struct f_rndis {
struct gether port;
u8 ctrl_id, data_id;
u8 ethaddr[ETH_ALEN];
u32 vendorID;
const char *manufacturer;
int config;
struct usb_ep *notify;
struct usb_request *notify_req;
atomic_t notify_count;
};
static inline struct f_rndis *func_to_rndis(struct usb_function *f)
{
return container_of(f, struct f_rndis, port.func);
}
/* peak (theoretical) bulk transfer rate in bits-per-second */
static unsigned int bitrate(struct usb_gadget *g)
{
if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER)
return 13 * 1024 * 8 * 1000 * 8;
else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
return 13 * 512 * 8 * 1000 * 8;
else
return 19 * 64 * 1 * 1000 * 8;
}
/*-------------------------------------------------------------------------*/
/*
*/
#define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */
#define STATUS_BYTECOUNT 8 /* 8 bytes data */
/* interface descriptor: */
static struct usb_interface_descriptor rndis_control_intf = {
.bLength = sizeof rndis_control_intf,
.bDescriptorType = USB_DT_INTERFACE,
/* .bInterfaceNumber = DYNAMIC */
/* status endpoint is optional; this could be patched later */
.bNumEndpoints = 1,
.bInterfaceClass = USB_CLASS_COMM,
.bInterfaceSubClass = USB_CDC_SUBCLASS_ACM,
.bInterfaceProtocol = USB_CDC_ACM_PROTO_VENDOR,
/* .iInterface = DYNAMIC */
};
static struct usb_cdc_header_desc header_desc = {
.bLength = sizeof header_desc,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_HEADER_TYPE,
.bcdCDC = cpu_to_le16(0x0110),
};
static struct usb_cdc_call_mgmt_descriptor call_mgmt_descriptor = {
.bLength = sizeof call_mgmt_descriptor,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_CALL_MANAGEMENT_TYPE,
.bmCapabilities = 0x00,
.bDataInterface = 0x01,
};
static struct usb_cdc_acm_descriptor rndis_acm_descriptor = {
.bLength = sizeof rndis_acm_descriptor,
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_ACM_TYPE,
.bmCapabilities = 0x00,
};
static struct usb_cdc_union_desc rndis_union_desc = {
.bLength = sizeof(rndis_union_desc),
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = USB_CDC_UNION_TYPE,
/* .bMasterInterface0 = DYNAMIC */
/* .bSlaveInterface0 = DYNAMIC */
};
/* the data interface has two bulk endpoints */
static struct usb_interface_descriptor rndis_data_intf = {
.bLength = sizeof rndis_data_intf,
.bDescriptorType = USB_DT_INTERFACE,
/* .bInterfaceNumber = DYNAMIC */
.bNumEndpoints = 2,
.bInterfaceClass = USB_CLASS_CDC_DATA,
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
/* .iInterface = DYNAMIC */
};
static struct usb_interface_assoc_descriptor
rndis_iad_descriptor = {
.bLength = sizeof rndis_iad_descriptor,
.bDescriptorType = USB_DT_INTERFACE_ASSOCIATION,
.bFirstInterface = 0, /* XXX, hardcoded */
.bInterfaceCount = 2, // control + data
.bFunctionClass = USB_CLASS_COMM,
.bFunctionSubClass = USB_CDC_SUBCLASS_ETHERNET,
.bFunctionProtocol = USB_CDC_PROTO_NONE,
/* .iFunction = DYNAMIC */
};
/* full speed support: */
static struct usb_endpoint_descriptor fs_notify_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT),
.bInterval = 1 << LOG2_STATUS_INTERVAL_MSEC,
};
static struct usb_endpoint_descriptor fs_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
};
static struct usb_endpoint_descriptor fs_out_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
};
static struct usb_descriptor_header *eth_fs_function[] = {
(struct usb_descriptor_header *) &rndis_iad_descriptor,
/* control interface matches ACM, not Ethernet */
(struct usb_descriptor_header *) &rndis_control_intf,
(struct usb_descriptor_header *) &header_desc,
(struct usb_descriptor_header *) &call_mgmt_descriptor,
(struct usb_descriptor_header *) &rndis_acm_descriptor,
(struct usb_descriptor_header *) &rndis_union_desc,
(struct usb_descriptor_header *) &fs_notify_desc,
/* data interface has no altsetting */
(struct usb_descriptor_header *) &rndis_data_intf,
(struct usb_descriptor_header *) &fs_in_desc,
(struct usb_descriptor_header *) &fs_out_desc,
NULL,
};
/* high speed support: */
static struct usb_endpoint_descriptor hs_notify_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT),
.bInterval = LOG2_STATUS_INTERVAL_MSEC + 4,
};
static struct usb_endpoint_descriptor hs_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16(512),
};
static struct usb_endpoint_descriptor hs_out_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16(512),
};
static struct usb_descriptor_header *eth_hs_function[] = {
(struct usb_descriptor_header *) &rndis_iad_descriptor,
/* control interface matches ACM, not Ethernet */
(struct usb_descriptor_header *) &rndis_control_intf,
(struct usb_descriptor_header *) &header_desc,
(struct usb_descriptor_header *) &call_mgmt_descriptor,
(struct usb_descriptor_header *) &rndis_acm_descriptor,
(struct usb_descriptor_header *) &rndis_union_desc,
(struct usb_descriptor_header *) &hs_notify_desc,
/* data interface has no altsetting */
(struct usb_descriptor_header *) &rndis_data_intf,
(struct usb_descriptor_header *) &hs_in_desc,
(struct usb_descriptor_header *) &hs_out_desc,
NULL,
};
/* super speed support: */
static struct usb_endpoint_descriptor ss_notify_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = cpu_to_le16(STATUS_BYTECOUNT),
.bInterval = LOG2_STATUS_INTERVAL_MSEC + 4,
};
static struct usb_ss_ep_comp_descriptor ss_intr_comp_desc = {
.bLength = sizeof ss_intr_comp_desc,
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
/* the following 3 values can be tweaked if necessary */
/* .bMaxBurst = 0, */
/* .bmAttributes = 0, */
.wBytesPerInterval = cpu_to_le16(STATUS_BYTECOUNT),
};
static struct usb_endpoint_descriptor ss_in_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16(1024),
};
static struct usb_endpoint_descriptor ss_out_desc = {
.bLength = USB_DT_ENDPOINT_SIZE,
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
.wMaxPacketSize = cpu_to_le16(1024),
};
static struct usb_ss_ep_comp_descriptor ss_bulk_comp_desc = {
.bLength = sizeof ss_bulk_comp_desc,
.bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
/* the following 2 values can be tweaked if necessary */
/* .bMaxBurst = 0, */
/* .bmAttributes = 0, */
};
static struct usb_descriptor_header *eth_ss_function[] = {
(struct usb_descriptor_header *) &rndis_iad_descriptor,
/* control interface matches ACM, not Ethernet */
(struct usb_descriptor_header *) &rndis_control_intf,
(struct usb_descriptor_header *) &header_desc,
(struct usb_descriptor_header *) &call_mgmt_descriptor,
(struct usb_descriptor_header *) &rndis_acm_descriptor,
(struct usb_descriptor_header *) &rndis_union_desc,
(struct usb_descriptor_header *) &ss_notify_desc,
(struct usb_descriptor_header *) &ss_intr_comp_desc,
/* data interface has no altsetting */
(struct usb_descriptor_header *) &rndis_data_intf,
(struct usb_descriptor_header *) &ss_in_desc,
(struct usb_descriptor_header *) &ss_bulk_comp_desc,
(struct usb_descriptor_header *) &ss_out_desc,
(struct usb_descriptor_header *) &ss_bulk_comp_desc,
NULL,
};
/* string descriptors: */
static struct usb_string rndis_string_defs[] = {
[0].s = "RNDIS Communications Control",
[1].s = "RNDIS Ethernet Data",
[2].s = "RNDIS",
{ } /* end of list */
};
static struct usb_gadget_strings rndis_string_table = {
.language = 0x0409, /* en-us */
.strings = rndis_string_defs,
};
static struct usb_gadget_strings *rndis_strings[] = {
&rndis_string_table,
NULL,
};
/*-------------------------------------------------------------------------*/
static struct sk_buff *rndis_add_header(struct gether *port,
struct sk_buff *skb)
{
struct sk_buff *skb2;
skb2 = skb_realloc_headroom(skb, sizeof(struct rndis_packet_msg_type));
if (skb2)
rndis_add_hdr(skb2);
dev_kfree_skb_any(skb);
return skb2;
}
static void rndis_response_available(void *_rndis)
{
struct f_rndis *rndis = _rndis;
struct usb_request *req = rndis->notify_req;
struct usb_composite_dev *cdev = rndis->port.func.config->cdev;
__le32 *data = req->buf;
int status;
if (atomic_inc_return(&rndis->notify_count) != 1)
return;
/* Send RNDIS RESPONSE_AVAILABLE notification; a
* USB_CDC_NOTIFY_RESPONSE_AVAILABLE "should" work too
*
* This is the only notification defined by RNDIS.
*/
data[0] = cpu_to_le32(1);
data[1] = cpu_to_le32(0);
status = usb_ep_queue(rndis->notify, req, GFP_ATOMIC);
if (status) {
atomic_dec(&rndis->notify_count);
DBG(cdev, "notify/0 --> %d\n", status);
}
}
static void rndis_response_complete(struct usb_ep *ep, struct usb_request *req)
{
struct f_rndis *rndis = req->context;
struct usb_composite_dev *cdev;
int status = req->status;
if (!rndis->port.func.config || !rndis->port.func.config->cdev)
return;
else
cdev = rndis->port.func.config->cdev;
/* after TX:
* - USB_CDC_GET_ENCAPSULATED_RESPONSE (ep0/control)
* - RNDIS_RESPONSE_AVAILABLE (status/irq)
*/
switch (status) {
case -ECONNRESET:
case -ESHUTDOWN:
/* connection gone */
atomic_set(&rndis->notify_count, 0);
break;
default:
DBG(cdev, "RNDIS %s response error %d, %d/%d\n",
ep->name, status,
req->actual, req->length);
/* FALLTHROUGH */
case 0:
if (ep != rndis->notify)
break;
/* handle multiple pending RNDIS_RESPONSE_AVAILABLE
* notifications by resending until we're done
*/
if (atomic_dec_and_test(&rndis->notify_count))
break;
status = usb_ep_queue(rndis->notify, req, GFP_ATOMIC);
if (status) {
atomic_dec(&rndis->notify_count);
DBG(cdev, "notify/1 --> %d\n", status);
}
break;
}
}
static void rndis_command_complete(struct usb_ep *ep, struct usb_request *req)
{
struct f_rndis *rndis = req->context;
struct usb_composite_dev *cdev;
int status;
rndis_init_msg_type *buf;
if (!rndis->port.func.config || !rndis->port.func.config->cdev)
return;
else
cdev = rndis->port.func.config->cdev;
/* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */
// spin_lock(&dev->lock);
status = rndis_msg_parser(rndis->config, (u8 *) req->buf);
if (status < 0)
ERROR(cdev, "RNDIS command error %d, %d/%d\n",
status, req->actual, req->length);
buf = (rndis_init_msg_type *)req->buf;
if (buf->MessageType == REMOTE_NDIS_INITIALIZE_MSG) {
if (buf->MaxTransferSize > 2048)
rndis->port.multi_pkt_xfer = 1;
else
rndis->port.multi_pkt_xfer = 0;
DBG(cdev, "%s: MaxTransferSize: %d : Multi_pkt_txr: %s\n",
__func__, buf->MaxTransferSize,
rndis->port.multi_pkt_xfer ? "enabled" :
"disabled");
if (rndis_multipacket_dl_disable)
rndis->port.multi_pkt_xfer = 0;
}
// spin_unlock(&dev->lock);
}
static int
rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
{
struct f_rndis *rndis = func_to_rndis(f);
struct usb_composite_dev *cdev = f->config->cdev;
struct usb_request *req = cdev->req;
int value = -EOPNOTSUPP;
u16 w_index = le16_to_cpu(ctrl->wIndex);
u16 w_value = le16_to_cpu(ctrl->wValue);
u16 w_length = le16_to_cpu(ctrl->wLength);
/* composite driver infrastructure handles everything except
* CDC class messages; interface activation uses set_alt().
*/
switch ((ctrl->bRequestType << 8) | ctrl->bRequest) {
/* RNDIS uses the CDC command encapsulation mechanism to implement
* an RPC scheme, with much getting/setting of attributes by OID.
*/
case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8)
| USB_CDC_SEND_ENCAPSULATED_COMMAND:
if (w_value || w_index != rndis->ctrl_id)
goto invalid;
/* read the request; process it later */
value = w_length;
req->complete = rndis_command_complete;
req->context = rndis;
/* later, rndis_response_available() sends a notification */
break;
case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8)
| USB_CDC_GET_ENCAPSULATED_RESPONSE:
if (w_value || w_index != rndis->ctrl_id)
goto invalid;
else {
u8 *buf;
u32 n;
/* return the result */
buf = rndis_get_next_response(rndis->config, &n);
if (buf) {
memcpy(req->buf, buf, n);
req->complete = rndis_response_complete;
req->context = rndis;
rndis_free_response(rndis->config, buf);
value = n;
}
/* else stalls ... spec says to avoid that */
}
break;
default:
invalid:
VDBG(cdev, "invalid control req%02x.%02x v%04x i%04x l%d\n",
ctrl->bRequestType, ctrl->bRequest,
w_value, w_index, w_length);
}
/* respond with data transfer or status phase? */
if (value >= 0) {
DBG(cdev, "rndis req%02x.%02x v%04x i%04x l%d\n",
ctrl->bRequestType, ctrl->bRequest,
w_value, w_index, w_length);
req->zero = (value < w_length);
req->length = value;
value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
if (value < 0)
ERROR(cdev, "rndis response on err %d\n", value);
}
/* device either stalls (value < 0) or reports success */
return value;
}
static int rndis_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
{
struct f_rndis *rndis = func_to_rndis(f);
struct usb_composite_dev *cdev = f->config->cdev;
/* we know alt == 0 */
if (intf == rndis->ctrl_id) {
if (rndis->notify->driver_data) {
VDBG(cdev, "reset rndis control %d\n", intf);
usb_ep_disable(rndis->notify);
}
if (!rndis->notify->desc) {
VDBG(cdev, "init rndis ctrl %d\n", intf);
if (config_ep_by_speed(cdev->gadget, f, rndis->notify))
goto fail;
}
usb_ep_enable(rndis->notify);
rndis->notify->driver_data = rndis;
} else if (intf == rndis->data_id) {
struct net_device *net;
if (rndis->port.in_ep->driver_data) {
DBG(cdev, "reset rndis\n");
gether_disconnect(&rndis->port);
}
if (!rndis->port.in_ep->desc || !rndis->port.out_ep->desc) {
DBG(cdev, "init rndis\n");
if (config_ep_by_speed(cdev->gadget, f,
rndis->port.in_ep) ||
config_ep_by_speed(cdev->gadget, f,
rndis->port.out_ep)) {
rndis->port.in_ep->desc = NULL;
rndis->port.out_ep->desc = NULL;
goto fail;
}
}
/* Avoid ZLPs; they can be troublesome. */
rndis->port.is_zlp_ok = false;
/* RNDIS should be in the "RNDIS uninitialized" state,
* either never activated or after rndis_uninit().
*
* We don't want data to flow here until a nonzero packet
* filter is set, at which point it enters "RNDIS data
* initialized" state ... but we do want the endpoints
* to be activated. It's a strange little state.
*
* REVISIT the RNDIS gadget code has done this wrong for a
* very long time. We need another call to the link layer
* code -- gether_updown(...bool) maybe -- to do it right.
*/
rndis->port.cdc_filter = 0;
DBG(cdev, "RNDIS RX/TX early activation ... \n");
net = gether_connect(&rndis->port);
if (IS_ERR(net))
return PTR_ERR(net);
rndis_set_param_dev(rndis->config, net,
&rndis->port.cdc_filter);
} else
goto fail;
return 0;
fail:
return -EINVAL;
}
static void rndis_disable(struct usb_function *f)
{
struct f_rndis *rndis = func_to_rndis(f);
struct usb_composite_dev *cdev = f->config->cdev;
if (!rndis->notify->driver_data)
return;
DBG(cdev, "rndis deactivated\n");
rndis_uninit(rndis->config);
gether_disconnect(&rndis->port);
usb_ep_disable(rndis->notify);
rndis->notify->driver_data = NULL;
}
/*-------------------------------------------------------------------------*/
/*
* This isn't quite the same mechanism as CDC Ethernet, since the
* notification scheme passes less data, but the same set of link
* states must be tested. A key difference is that altsettings are
* not used to tell whether the link should send packets or not.
*/
static void rndis_open(struct gether *geth)
{
struct f_rndis *rndis = func_to_rndis(&geth->func);
struct usb_composite_dev *cdev = geth->func.config->cdev;
DBG(cdev, "%s\n", __func__);
rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3,
bitrate(cdev->gadget) / 100);
rndis_signal_connect(rndis->config);
}
static void rndis_close(struct gether *geth)
{
struct f_rndis *rndis = func_to_rndis(&geth->func);
DBG(geth->func.config->cdev, "%s\n", __func__);
rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0);
rndis_signal_disconnect(rndis->config);
}
/*-------------------------------------------------------------------------*/
/* ethernet function driver setup/binding */
static int
rndis_bind(struct usb_configuration *c, struct usb_function *f)
{
struct usb_composite_dev *cdev = c->cdev;
struct f_rndis *rndis = func_to_rndis(f);
int status;
struct usb_ep *ep;
/* allocate instance-specific interface IDs */
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
rndis->ctrl_id = status;
rndis_iad_descriptor.bFirstInterface = status;
rndis_control_intf.bInterfaceNumber = status;
rndis_union_desc.bMasterInterface0 = status;
status = usb_interface_id(c, f);
if (status < 0)
goto fail;
rndis->data_id = status;
rndis_data_intf.bInterfaceNumber = status;
rndis_union_desc.bSlaveInterface0 = status;
status = -ENODEV;
/* allocate instance-specific endpoints */
ep = usb_ep_autoconfig(cdev->gadget, &fs_in_desc);
if (!ep)
goto fail;
rndis->port.in_ep = ep;
ep->driver_data = cdev; /* claim */
ep = usb_ep_autoconfig(cdev->gadget, &fs_out_desc);
if (!ep)
goto fail;
rndis->port.out_ep = ep;
ep->driver_data = cdev; /* claim */
/* NOTE: a status/notification endpoint is, strictly speaking,
* optional. We don't treat it that way though! It's simpler,
* and some newer profiles don't treat it as optional.
*/
ep = usb_ep_autoconfig(cdev->gadget, &fs_notify_desc);
if (!ep)
goto fail;
rndis->notify = ep;
ep->driver_data = cdev; /* claim */
status = -ENOMEM;
/* allocate notification request and buffer */
rndis->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
if (!rndis->notify_req)
goto fail;
rndis->notify_req->buf = kmalloc(STATUS_BYTECOUNT, GFP_KERNEL);
if (!rndis->notify_req->buf)
goto fail;
rndis->notify_req->length = STATUS_BYTECOUNT;
rndis->notify_req->context = rndis;
rndis->notify_req->complete = rndis_response_complete;
/* copy descriptors, and track endpoint copies */
f->descriptors = usb_copy_descriptors(eth_fs_function);
if (!f->descriptors)
goto fail;
/* support all relevant hardware speeds... we expect that when
* hardware is dual speed, all bulk-capable endpoints work at
* both speeds
*/
if (gadget_is_dualspeed(c->cdev->gadget)) {
hs_in_desc.bEndpointAddress =
fs_in_desc.bEndpointAddress;
hs_out_desc.bEndpointAddress =
fs_out_desc.bEndpointAddress;
hs_notify_desc.bEndpointAddress =
fs_notify_desc.bEndpointAddress;
/* copy descriptors, and track endpoint copies */
f->hs_descriptors = usb_copy_descriptors(eth_hs_function);
if (!f->hs_descriptors)
goto fail;
}
if (gadget_is_superspeed(c->cdev->gadget)) {
ss_in_desc.bEndpointAddress =
fs_in_desc.bEndpointAddress;
ss_out_desc.bEndpointAddress =
fs_out_desc.bEndpointAddress;
ss_notify_desc.bEndpointAddress =
fs_notify_desc.bEndpointAddress;
/* copy descriptors, and track endpoint copies */
f->ss_descriptors = usb_copy_descriptors(eth_ss_function);
if (!f->ss_descriptors)
goto fail;
}
rndis->port.open = rndis_open;
rndis->port.close = rndis_close;
status = rndis_register(rndis_response_available, rndis);
if (status < 0)
goto fail;
rndis->config = status;
rndis_set_param_medium(rndis->config, NDIS_MEDIUM_802_3, 0);
rndis_set_host_mac(rndis->config, rndis->ethaddr);
if (rndis->manufacturer && rndis->vendorID &&
rndis_set_param_vendor(rndis->config, rndis->vendorID,
rndis->manufacturer))
goto fail;
/* NOTE: all that is done without knowing or caring about
* the network link ... which is unavailable to this code
* until we're activated via set_alt().
*/
DBG(cdev, "RNDIS: %s speed IN/%s OUT/%s NOTIFY/%s\n",
gadget_is_superspeed(c->cdev->gadget) ? "super" :
gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full",
rndis->port.in_ep->name, rndis->port.out_ep->name,
rndis->notify->name);
return 0;
fail:
if (gadget_is_superspeed(c->cdev->gadget) && f->ss_descriptors)
usb_free_descriptors(f->ss_descriptors);
if (gadget_is_dualspeed(c->cdev->gadget) && f->hs_descriptors)
usb_free_descriptors(f->hs_descriptors);
if (f->descriptors)
usb_free_descriptors(f->descriptors);
if (rndis->notify_req) {
kfree(rndis->notify_req->buf);
usb_ep_free_request(rndis->notify, rndis->notify_req);
}
/* we might as well release our claims on endpoints */
if (rndis->notify)
rndis->notify->driver_data = NULL;
if (rndis->port.out_ep)
rndis->port.out_ep->driver_data = NULL;
if (rndis->port.in_ep)
rndis->port.in_ep->driver_data = NULL;
ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
return status;
}
static void
rndis_unbind(struct usb_configuration *c, struct usb_function *f)
{
struct f_rndis *rndis = func_to_rndis(f);
rndis_deregister(rndis->config);
rndis_exit();
if (gadget_is_superspeed(c->cdev->gadget))
usb_free_descriptors(f->ss_descriptors);
if (gadget_is_dualspeed(c->cdev->gadget))
usb_free_descriptors(f->hs_descriptors);
usb_free_descriptors(f->descriptors);
kfree(rndis->notify_req->buf);
usb_ep_free_request(rndis->notify, rndis->notify_req);
kfree(rndis);
}
/* Some controllers can't support RNDIS ... */
static inline bool can_support_rndis(struct usb_configuration *c)
{
/* everything else is *presumably* fine */
return true;
}
/**
* rndis_bind_config - add RNDIS network link to a configuration
* @c: the configuration to support the network link
* @ethaddr: a buffer in which the ethernet address of the host side
* side of the link was recorded
* Context: single threaded during gadget setup
*
* Returns zero on success, else negative errno.
*
* Caller must have called @gether_setup(). Caller is also responsible
* for calling @gether_cleanup() before module unload.
*/
int
rndis_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN])
{
return rndis_bind_config_vendor(c, ethaddr, 0, NULL);
}
int
rndis_bind_config_vendor(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
u32 vendorID, const char *manufacturer)
{
struct f_rndis *rndis;
int status;
if (!can_support_rndis(c) || !ethaddr)
return -EINVAL;
/* setup RNDIS itself */
status = rndis_init();
if (status < 0)
return status;
/* maybe allocate device-global string IDs */
if (rndis_string_defs[0].id == 0) {
/* control interface label */
status = usb_string_id(c->cdev);
if (status < 0)
return status;
rndis_string_defs[0].id = status;
rndis_control_intf.iInterface = status;
/* data interface label */
status = usb_string_id(c->cdev);
if (status < 0)
return status;
rndis_string_defs[1].id = status;
rndis_data_intf.iInterface = status;
/* IAD iFunction label */
status = usb_string_id(c->cdev);
if (status < 0)
return status;
rndis_string_defs[2].id = status;
rndis_iad_descriptor.iFunction = status;
}
/* allocate and initialize one new instance */
status = -ENOMEM;
rndis = kzalloc(sizeof *rndis, GFP_KERNEL);
if (!rndis)
goto fail;
memcpy(rndis->ethaddr, ethaddr, ETH_ALEN);
rndis->vendorID = vendorID;
rndis->manufacturer = manufacturer;
/* RNDIS activates when the host changes this filter */
rndis->port.cdc_filter = 0;
/* RNDIS has special (and complex) framing */
rndis->port.header_len = sizeof(struct rndis_packet_msg_type);
rndis->port.wrap = rndis_add_header;
rndis->port.unwrap = rndis_rm_hdr;
rndis->port.func.name = "rndis";
rndis->port.func.strings = rndis_strings;
/* descriptors are per-instance copies */
rndis->port.func.bind = rndis_bind;
rndis->port.func.unbind = rndis_unbind;
rndis->port.func.set_alt = rndis_set_alt;
rndis->port.func.setup = rndis_setup;
rndis->port.func.disable = rndis_disable;
status = usb_add_function(c, &rndis->port.func);
if (status) {
kfree(rndis);
fail:
rndis_exit();
}
return status;
}
| AOSP-JF/platform_kernel_samsung_jf | drivers/usb/gadget/f_rndis.c | C | gpl-2.0 | 28,231 | [
30522,
1013,
1008,
1008,
1042,
1035,
29300,
10521,
1012,
1039,
1011,
1011,
29300,
10521,
4957,
3853,
4062,
1008,
1008,
9385,
1006,
1039,
1007,
2494,
1011,
2384,
1010,
2263,
2585,
15005,
3363,
1008,
9385,
1006,
1039,
1007,
2494,
1011,
2432,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"89260172","logradouro":"Servid\u00e3o 37","bairro":"Barra do Rio Cerro","cidade":"Jaragu\u00e1 do Sul","uf":"SC","estado":"Santa Catarina"});
| lfreneda/cepdb | api/v1/89260172.jsonp.js | JavaScript | cc0-1.0 | 156 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
6486,
23833,
24096,
2581,
2475,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
14262,
17258,
30524,
2226,
1032,
1057,
8889,
2063,
2487,
2079,
21396,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>JobStatus (xenon-2.3.0 2.4.1 API for Xenon developers)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="JobStatus (xenon-2.3.0 2.4.1 API for Xenon developers)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../nl/esciencecenter/xenon/schedulers/JobDescription.html" title="class in nl.esciencecenter.xenon.schedulers"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../nl/esciencecenter/xenon/schedulers/NoSuchJobException.html" title="class in nl.esciencecenter.xenon.schedulers"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?nl/esciencecenter/xenon/schedulers/JobStatus.html" target="_top">Frames</a></li>
<li><a href="JobStatus.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">nl.esciencecenter.xenon.schedulers</div>
<h2 title="Interface JobStatus" class="title">Interface JobStatus</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../nl/esciencecenter/xenon/adaptors/schedulers/JobStatusImplementation.html" title="class in nl.esciencecenter.xenon.adaptors.schedulers">JobStatusImplementation</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">JobStatus</span></pre>
<div class="block">JobStatus contains status information for a specific job.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="../../../../nl/esciencecenter/xenon/XenonException.html" title="class in nl.esciencecenter.xenon">XenonException</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#getException--">getException</a></span>()</code>
<div class="block">Get the exception produced by the Job or while retrieving the status.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.Integer</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#getExitCode--">getExitCode</a></span>()</code>
<div class="block">Get the exit code for the Job.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#getJobIdentifier--">getJobIdentifier</a></span>()</code>
<div class="block">Get the job identifier of the Job for which this JobStatus was created.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#getName--">getName</a></span>()</code>
<div class="block">Get the name of the Job for which this JobStatus was created.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.util.Map<java.lang.String,java.lang.String></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#getSchedulerSpecificInformation--">getSchedulerSpecificInformation</a></span>()</code>
<div class="block">Get scheduler specific information on the Job.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#getState--">getState</a></span>()</code>
<div class="block">Get the state of the Job.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#hasException--">hasException</a></span>()</code>
<div class="block">Has the Job or job retrieval produced a exception ?</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#isDone--">isDone</a></span>()</code>
<div class="block">Is the Job done.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#isRunning--">isRunning</a></span>()</code>
<div class="block">Is the Job running.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#maybeThrowException--">maybeThrowException</a></span>()</code>
<div class="block">Throws the exception produced by the Job or while retrieving the status, if it exists.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getJobIdentifier--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getJobIdentifier</h4>
<pre>java.lang.String getJobIdentifier()</pre>
<div class="block">Get the job identifier of the Job for which this JobStatus was created.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the identifier of the Job.</dd>
</dl>
</li>
</ul>
<a name="getName--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre>java.lang.String getName()</pre>
<div class="block">Get the name of the Job for which this JobStatus was created.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the name of the Job.</dd>
</dl>
</li>
</ul>
<a name="getState--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getState</h4>
<pre>java.lang.String getState()</pre>
<div class="block">Get the state of the Job.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the state of the Job.</dd>
</dl>
</li>
</ul>
<a name="getExitCode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getExitCode</h4>
<pre>java.lang.Integer getExitCode()</pre>
<div class="block">Get the exit code for the Job.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the exit code for the Job.</dd>
</dl>
</li>
</ul>
<a name="getException--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getException</h4>
<pre><a href="../../../../nl/esciencecenter/xenon/XenonException.html" title="class in nl.esciencecenter.xenon">XenonException</a> getException()</pre>
<div class="block">Get the exception produced by the Job or while retrieving the status. If no exception occurred, <code>null</code> will be returned.
See <a href="../../../../nl/esciencecenter/xenon/schedulers/JobStatus.html#maybeThrowException--"><code>maybeThrowException()</code></a> for the possible exceptions.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the exception.</dd>
</dl>
</li>
</ul>
<a name="maybeThrowException--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maybeThrowException</h4>
<pre>void maybeThrowException()
throws <a href="../../../../nl/esciencecenter/xenon/XenonException.html" title="class in nl.esciencecenter.xenon">XenonException</a></pre>
<div class="block">Throws the exception produced by the Job or while retrieving the status, if it exists. Otherwise continue.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../nl/esciencecenter/xenon/adaptors/schedulers/JobCanceledException.html" title="class in nl.esciencecenter.xenon.adaptors.schedulers">JobCanceledException</a></code> - if the job was cancelled</dd>
<dd><code><a href="../../../../nl/esciencecenter/xenon/schedulers/NoSuchJobException.html" title="class in nl.esciencecenter.xenon.schedulers">NoSuchJobException</a></code> - if the job of which the status was requested does not exist</dd>
<dd><code><a href="../../../../nl/esciencecenter/xenon/XenonException.html" title="class in nl.esciencecenter.xenon">XenonException</a></code> - if an I/O error occurred.</dd>
</dl>
</li>
</ul>
<a name="isRunning--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isRunning</h4>
<pre>boolean isRunning()</pre>
<div class="block">Is the Job running.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>if the Job is running.</dd>
</dl>
</li>
</ul>
<a name="isDone--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isDone</h4>
<pre>boolean isDone()</pre>
<div class="block">Is the Job done.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>if the Job is done.</dd>
</dl>
</li>
</ul>
<a name="hasException--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hasException</h4>
<pre>boolean hasException()</pre>
<div class="block">Has the Job or job retrieval produced a exception ?</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>if the Job has an exception.</dd>
</dl>
</li>
</ul>
<a name="getSchedulerSpecificInformation--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getSchedulerSpecificInformation</h4>
<pre>java.util.Map<java.lang.String,java.lang.String> getSchedulerSpecificInformation()</pre>
<div class="block">Get scheduler specific information on the Job.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>scheduler specific information on the Job.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../nl/esciencecenter/xenon/schedulers/JobDescription.html" title="class in nl.esciencecenter.xenon.schedulers"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../nl/esciencecenter/xenon/schedulers/NoSuchJobException.html" title="class in nl.esciencecenter.xenon.schedulers"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?nl/esciencecenter/xenon/schedulers/JobStatus.html" target="_top">Frames</a></li>
<li><a href="JobStatus.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| NLeSC/Xenon | docs/versions/2.4.1/javadoc-devel/nl/esciencecenter/xenon/schedulers/JobStatus.html | HTML | apache-2.0 | 15,572 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace Gamodo.Tabs
{
public partial class DocumentBase : DockContent
{
public DocumentBase()
{
InitializeComponent();
}
protected override string GetPersistString()
{
// Add extra information into the persist string for this document
// so that it is available when deserialized.
return GetType().ToString();
}
}
}
| ganry/Gamodo.Studio | Gamodo/Tabs/DocumentBase.cs | C# | mit | 651 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
6922,
5302,
9247,
1025,
2478,
2291,
1012,
2951,
1025,
2478,
2291,
1012,
5059,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
//var async = require('async'),
// nconf = require('nconf'),
// user = require('../user'),
// groups = require('../groups'),
// topics = require('../topics'),
// posts = require('../posts'),
// notifications = require('../notifications'),
// messaging = require('../messaging'),
// plugins = require('../plugins'),
// utils = require('../../public/src/utils'),
// websockets = require('./index'),
// meta = require('../meta'),
var linkParser = require('../controllers/mind-map/linkParser_new-format'),
swaggerBuilder = require('../modeling/swaggerBuilder'),
swaggerBuildertr069 = require('../modeling/swaggerBuilder-Scope');
var SocketCustom = {};
SocketCustom.refreshLinkParser = function(socket, sets, callback) {
if (!socket.uid) {
return callback(new Error('[[invalid-uid]]'));
}
linkParser.init(function(err) {
callback(null, '{"message": "Refreshed Link Parser"}');
});
};
SocketCustom.refreshSwagger = function(socket, data, callback) {
if (!socket.uid) {
return callback(new Error('[[invalid-uid]]'));
}
swaggerBuilder.init(function(err) {
callback(null, '{"message": "Refreshed Swagger File"}');
});
};
SocketCustom.refreshZoneSwagger = function(socket, data, callback) {
if (!socket.uid) {
return callback(new Error('[[invalid-uid]]'));
}
swaggerBuildertr069.init(function(err) {
callback(null, '{"message": "Refreshed Zone Swagger File"}');
});
};
/* Exports */
module.exports = SocketCustom;
| cablelabs/dev-portal | src/socket.io/custom.js | JavaScript | mit | 1,565 | [
30522,
1005,
2224,
9384,
1005,
1025,
1013,
1013,
13075,
2004,
6038,
2278,
1027,
5478,
1006,
1005,
2004,
6038,
2278,
1005,
1007,
1010,
1013,
1013,
13316,
2239,
2546,
1027,
5478,
1006,
1005,
13316,
2239,
2546,
1005,
1007,
1010,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (c) 2015, 2016 Saurav Sachidanand
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.
*/
//! Some programming utilities
/// Returns a float rounded upto a certain number of decimal digits
#[inline]
pub fn round_upto_digits(float: f64, decimal_digits: u32) -> f64
{
let mut d = 1.0;
for _ in 1..(decimal_digits + 1) {
d *= 10.0;
}
(float * d).round() / d
}
/**
Evaluates a polynomial using Horner's algorithm
# Arguments
* `$x` : The value of the independent variable `f32 or f64`
* `$c` : The constant term `f32 or f64`
* `$($a),*`: Sequence of coefficient terms for `$x`, in ascending
powers of `$x`
**/
#[macro_export]
macro_rules! Horner_eval
{
($x:expr, $c:expr, $($a:expr),*) =>
{
{
let mut y = $c;
let mut u = 1.0;
$(
u *= $x;
y += u * $a;
)*
y
}
}
}
| saurvs/astro-rust | src/util.rs | Rust | mit | 1,914 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2325,
1010,
2355,
7842,
4648,
2615,
17266,
27511,
5162,
4859,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
1997,
2023,
4007,
1998,
3378,
12653,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
convert images/OCS-703-A.png -crop 1545x4500+45+371 +repage images/OCS-703-A.png
#
#
#/OCS-703.png
convert images/OCS-703-B.png -crop 1581x4532+9+357 +repage images/OCS-703-B.png
#
#
#/OCS-703.png
| jonnymwalker/Staroslavjanskij-Slovar | scripts/cropedges.OCS-703.sh | Shell | gpl-2.0 | 197 | [
30522,
10463,
4871,
1013,
1051,
6169,
1011,
3963,
2509,
1011,
1037,
1012,
1052,
3070,
1011,
10416,
16666,
2629,
30524,
1011,
3963,
2509,
1011,
1038,
1012,
1052,
3070,
1011,
10416,
17696,
2487,
2595,
19961,
16703,
1009,
1023,
1009,
26231,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2013 Gunnar Kappei.
*
* 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.w3.x2001.smil20.impl;
/**
* An XML restartTimingType(@http://www.w3.org/2001/SMIL20/).
*
* This is an atomic type that is a restriction of org.w3.x2001.smil20.RestartTimingType.
*/
public class RestartTimingTypeImpl extends org.apache.xmlbeans.impl.values.JavaStringEnumerationHolderEx implements org.w3.x2001.smil20.RestartTimingType
{
private static final long serialVersionUID = 1L;
public RestartTimingTypeImpl(org.apache.xmlbeans.SchemaType sType)
{
super(sType, false);
}
protected RestartTimingTypeImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
{
super(sType, b);
}
}
| moosbusch/xbLIDO | src/org/w3/x2001/smil20/impl/RestartTimingTypeImpl.java | Java | apache-2.0 | 1,267 | [
30522,
1013,
1008,
1008,
9385,
2286,
26138,
10556,
21512,
2072,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package info.thecodinglive.service;
import info.thecodinglive.model.Team;
import info.thecodinglive.repository.TeamDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class TeamServiceImpl implements TeamService{
@Autowired
private TeamDao teamDao;
@Override
public void addTeam(Team team) {
teamDao.addTeam(team);
}
@Override
public void updateTeam(Team team) {
teamDao.updateTeam(team);
}
@Override
public Team getTeam(int id) {
return teamDao.getTeam(id);
}
@Override
public void deleteTeam(int id) {
teamDao.deleteTeam(id);
}
@Override
public List<Team> getTeams() {
return teamDao.getTeams();
}
}
| thecodinglive/hanbit-gradle-book-example | ch06/src/main/java/info/thecodinglive/service/TeamServiceImpl.java | Java | gpl-2.0 | 902 | [
30522,
7427,
18558,
1012,
1996,
3597,
4667,
3669,
3726,
1012,
2326,
1025,
12324,
18558,
1012,
1996,
3597,
4667,
3669,
3726,
1012,
2944,
1012,
2136,
1025,
12324,
18558,
1012,
1996,
3597,
4667,
3669,
3726,
1012,
22409,
1012,
2136,
2850,
2080,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package org.knowm.xchange.wex.v3.dto.trade;
import static org.assertj.core.api.Assertions.assertThat;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.Map;
import java.util.Map.Entry;
import org.junit.Test;
/** @author Benedikt Bünz Test WexTradeHistoryReturn JSON parsing */
public class WexTradeHistoryJSONTest {
@Test
public void testUnmarshal() throws IOException {
// Read in the JSON from the example resources
InputStream is =
WexTradeHistoryJSONTest.class.getResourceAsStream(
"/org/knowm/xchange/wex/v3/trade/example-trade-history-data.json");
// Use Jackson to parse it
ObjectMapper mapper = new ObjectMapper();
WexTradeHistoryReturn transactions = mapper.readValue(is, WexTradeHistoryReturn.class);
Map<Long, WexTradeHistoryResult> result = transactions.getReturnValue();
assertThat(result.size()).isEqualTo(32);
Entry<Long, WexTradeHistoryResult> firstEntry = result.entrySet().iterator().next();
// Verify that the example data was unmarshalled correctly
assertThat(firstEntry.getKey()).isEqualTo(7258275L);
assertThat(firstEntry.getValue().getAmount()).isEqualTo(new BigDecimal("0.1"));
assertThat(firstEntry.getValue().getOrderId()).isEqualTo(34870919L);
assertThat(firstEntry.getValue().getPair()).isEqualTo("btc_usd");
assertThat(firstEntry.getValue().getRate()).isEqualTo(new BigDecimal("125.75"));
assertThat(firstEntry.getValue().getTimestamp()).isEqualTo(1378194574L);
assertThat(firstEntry.getValue().getType()).isEqualTo(WexTradeHistoryResult.Type.sell);
assertThat(firstEntry.getValue().isYourOrder()).isEqualTo(false);
}
}
| LeonidShamis/XChange | xchange-wex/src/test/java/org/knowm/xchange/wex/v3/dto/trade/WexTradeHistoryJSONTest.java | Java | mit | 1,754 | [
30522,
7427,
8917,
1012,
2113,
2213,
1012,
1060,
22305,
2063,
1012,
2057,
2595,
1012,
1058,
2509,
1012,
26718,
2080,
1012,
3119,
1025,
12324,
10763,
8917,
1012,
20865,
3501,
1012,
4563,
1012,
17928,
1012,
23617,
2015,
1012,
20865,
8322,
210... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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, dis-
# tribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the fol-
# lowing 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 MERCHANTABIL-
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
# SHALL THE AUTHOR 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.
"""Unit tests for help command."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from gslib.command import Command
import gslib.tests.testcase as testcase
class HelpUnitTests(testcase.GsUtilUnitTestCase):
"""Help command unit test suite."""
def test_help_noargs(self):
stdout = self.RunCommand('help', return_stdout=True)
self.assertIn(b'Available commands', stdout)
def test_help_subcommand_arg(self):
stdout = self.RunCommand('help', ['web', 'set'], return_stdout=True)
self.assertIn(b'gsutil web set', stdout)
self.assertNotIn(b'gsutil web get', stdout)
def test_help_invalid_subcommand_arg(self):
stdout = self.RunCommand('help', ['web', 'asdf'], return_stdout=True)
self.assertIn(b'help about one of the subcommands', stdout)
def test_help_with_subcommand_for_command_without_subcommands(self):
stdout = self.RunCommand('help', ['ls', 'asdf'], return_stdout=True)
self.assertIn(b'has no subcommands', stdout)
def test_help_command_arg(self):
stdout = self.RunCommand('help', ['ls'], return_stdout=True)
self.assertIn(b'ls - List providers, buckets', stdout)
def test_command_help_arg(self):
stdout = self.RunCommand('ls', ['--help'], return_stdout=True)
self.assertIn(b'ls - List providers, buckets', stdout)
def test_subcommand_help_arg(self):
stdout = self.RunCommand('web', ['set', '--help'], return_stdout=True)
self.assertIn(b'gsutil web set', stdout)
self.assertNotIn(b'gsutil web get', stdout)
def test_command_args_with_help(self):
stdout = self.RunCommand('cp', ['foo', 'bar', '--help'], return_stdout=True)
self.assertIn(b'cp - Copy files and objects', stdout)
class HelpIntegrationTests(testcase.GsUtilIntegrationTestCase):
"""Help command integration test suite."""
def test_help_wrong_num_args(self):
stderr = self.RunGsUtil(['cp'], return_stderr=True, expected_status=1)
self.assertIn('Usage:', stderr)
def test_help_runs_for_all_commands(self):
# This test is particularly helpful because the `help` command can fail
# under unusual circumstances (e.g. someone adds a new command and they make
# the "one-line" summary longer than the defined character limit).
for command in Command.__subclasses__():
# Raises exception if the exit code is non-zero.
self.RunGsUtil(['help', command.command_spec.command_name])
| endlessm/chromium-browser | third_party/catapult/third_party/gsutil/gslib/tests/test_help.py | Python | bsd-3-clause | 3,599 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1001,
9385,
2286,
8224,
4297,
1012,
2035,
2916,
9235,
1012,
1001,
1001,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
"""
This scripts compares the autocorrelation in statsmodels with
the one that you can build using only correlate.
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
import statsmodels.api as sm
from signals.time_series_class import MixAr, AR
from signals.aux_functions import sidekick
plot = False
plot2 = True
# Time parameters
dt = 0.1
Tmax = 100
# Let's get the axuiliary class
amplitude = 1
w1 = 1
w2 = 5
beta = sidekick(w1, w2, dt, Tmax, amplitude)
# First we need the phi's vector
phi0 = 0.0
phi1 = -0.8
phi2 = 0.3
phi = np.array((phi0, phi1, phi2))
# Now we need the initial conditions
x0 = 1
x1 = 1
x2 = 0
initial_conditions = np.array((x0, x1, x2))
# First we construct the series without the sidekick
B = AR(phi, dt=dt, Tmax=Tmax)
B.initial_conditions(initial_conditions)
normal_series = B.construct_series()
# Second we construct the series with the mix
A = MixAr(phi, dt=dt, Tmax=Tmax, beta=beta)
A.initial_conditions(initial_conditions)
mix_series = A.construct_series()
time = A.time
if plot:
plt.subplot(3, 1, 1)
plt.plot(time, beta)
plt.subplot(3, 1, 2)
plt.plot(time, normal_series)
plt.subplot(3, 1, 3)
plt.plot(time, mix_series)
plt.show()
# Let's calculate the auto correlation
nlags = 40
normal_series -= normal_series.mean()
var = np.var(normal_series)
n = len(normal_series)
nlags1 = nlags
normalizing = np.arange(n, n - nlags1, -1)
auto_correlation1 = np.correlate(normal_series, normal_series, mode='full')
aux = auto_correlation1.size/2
auto_correlation1 = auto_correlation1[aux:aux + nlags1] / (normalizing * var)
auto_correlation2 = sm.tsa.stattools.acf(normal_series, nlags=nlags)
print 'result', np.sum(auto_correlation1 - auto_correlation2)
if plot2:
plt.subplot(2, 1, 1)
plt.plot(auto_correlation1)
plt.subplot(2, 1, 2)
plt.plot(auto_correlation2)
plt.show()
| h-mayorquin/time_series_basic | examples/auto_correlations_compare.py | Python | bsd-3-clause | 1,897 | [
30522,
1000,
1000,
1000,
2023,
14546,
22963,
1996,
8285,
27108,
16570,
3370,
1999,
26319,
5302,
9247,
2015,
2007,
1996,
2028,
2008,
2017,
2064,
3857,
2478,
2069,
2522,
14343,
13806,
1012,
1000,
1000,
1000,
12324,
16371,
8737,
2100,
2004,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
squareM = #x -> `(,x * ,x) -- `#` indicates macro-lambda
unittest "squareM" [
(squareM 3, 9),
(let a = 3 in squareM a, 9),
]
a = "a"
unittest "macro_expand" [
(macro_expand {squareM 3}, (*) 3 3),
(macro_expand {(squareM 3) + 1}, (+) ((*) 3 3) 1),
(macro_expand {squareM a}, (*) a a),
(macro_expand {let a = 1 in squareM a}, (\a.(*) a a) 1),
(macro_expand {let a = 1 in squareM (a+1)}, (\a.(*) ((+) a 1) ((+) a 1)) 1),
]
evalN 0 ((squareM 3) + 1)
evalN 1 ((squareM 3) + 1)
evalN 2 ((squareM 3) + 1)
evalN 3 ((squareM 3) + 1)
evalN 4 ((squareM 3) + 1)
-- (+) ((*) 3 3) 1
-- (+) ((3 *) 3) 1
-- (+) 9 1
-- (9 +) 1
-- 10
lazyevalN 0 ((squareM 3) + 1)
lazyevalN 1 ((squareM 3) + 1)
lazyevalN 2 ((squareM 3) + 1)
lazyevalN 3 ((squareM 3) + 1)
lazyevalN 4 ((squareM 3) + 1)
-- (+) ((*) 3 3) 1
-- (+) ((*) 3 3) 1
-- (+) 9 1
-- (9 +) 1
-- 10
| ocean0yohsuke/Simply-Typed-Lambda | Start/UnitTest/Macro.hs | Haskell | bsd-3-clause | 926 | [
30522,
2675,
2213,
1027,
1001,
1060,
1011,
1028,
1036,
1006,
1010,
1060,
1008,
1010,
1060,
1007,
1011,
1011,
1036,
1001,
1036,
7127,
26632,
1011,
23375,
3131,
22199,
1000,
2675,
2213,
1000,
1031,
1006,
2675,
2213,
1017,
1010,
1023,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Xunit;
using Rabbit.WeiXin.DependencyInjection;
using Rabbit.WeiXin.MP.Messages;
using Rabbit.WeiXin.MP.Messages.Events;
using Rabbit.WeiXin.MP.Messages.Events.Card;
using Rabbit.WeiXin.MP.Messages.Events.CustomMenu;
using Rabbit.WeiXin.MP.Messages.Events.CustomService;
using Rabbit.WeiXin.MP.Messages.Events.WiFi;
using Rabbit.WeiXin.MP.Messages.Request;
using Rabbit.WeiXin.Utility;
using System;
using System.Linq;
namespace Rabbit.WeiXin.Tests
{
public class RequestMessageFormatter
{
#region Field
private readonly IRequestMessageFactory _requestMessageFactory = DefaultDependencyResolver.Instance.GetService<IRequestMessageFactory>();
#endregion Field
[Fact]
public void TextMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[this is a test]]></Content>
<MsgId>1234567890123456</MsgId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<RequestMessageText>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(RequestMessageType.Text, model.MessageType);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1348831860), model.CreateTime);
Assert.Equal("this is a test", model.Content);
Assert.Equal(1234567890123456, model.MessageId);
}
[Fact]
public void ImageMessageTest()
{
const string xmlContent = @" <xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[image]]></MsgType>
<PicUrl><![CDATA[http://www.chunsun.cc/1.jpg]]></PicUrl>
<MediaId><![CDATA[1234567890-1234567]]></MediaId>
<MsgId>1234567890123456</MsgId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<RequestMessageImage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1348831860), model.CreateTime);
Assert.Equal(1234567890123456, model.MessageId);
Assert.Equal("1234567890-1234567", model.MediaId);
Assert.Equal(RequestMessageType.Image, model.MessageType);
Assert.Equal(model.PicUrl, new Uri("http://www.chunsun.cc/1.jpg"));
}
[Fact]
public void VoiceMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[voice]]></MsgType>
<MediaId><![CDATA[1234567890-1234567]]></MediaId>
<Format><![CDATA[Format]]></Format>
<MsgId>1234567890123456</MsgId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<RequestMessageVoice>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1357290913), model.CreateTime);
Assert.Equal(1234567890123456, model.MessageId);
Assert.Equal("1234567890-1234567", model.MediaId);
Assert.Equal(RequestMessageType.Voice, model.MessageType);
Assert.Equal(model.Format, "Format");
}
[Fact]
public void VideoMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[video]]></MsgType>
<MediaId><![CDATA[1234567890-1234567]]></MediaId>
<ThumbMediaId><![CDATA[1234567890-12345678]]></ThumbMediaId>
<MsgId>1234567890123456</MsgId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<RequestMessageVideo>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1357290913), model.CreateTime);
Assert.Equal(1234567890123456, model.MessageId);
Assert.Equal("1234567890-1234567", model.MediaId);
Assert.Equal(RequestMessageType.Video, model.MessageType);
Assert.Equal("1234567890-12345678", model.ThumbMediaId);
}
[Fact]
public void ShortVideoMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[shortvideo]]></MsgType>
<MediaId><![CDATA[1234567890-1234567]]></MediaId>
<ThumbMediaId><![CDATA[1234567890-12345678]]></ThumbMediaId>
<MsgId>1234567890123456</MsgId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<RequestMessageShortVideo>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1357290913), model.CreateTime);
Assert.Equal("1234567890-1234567", model.MediaId);
Assert.Equal(RequestMessageType.ShortVideo, model.MessageType);
Assert.Equal(model.ThumbMediaId, "1234567890-12345678");
}
[Fact]
public void LocationMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1351776360</CreateTime>
<MsgType><![CDATA[location]]></MsgType>
<Location_X>23.134521</Location_X>
<Location_Y>113.358803</Location_Y>
<Scale>20</Scale>
<Label><![CDATA[位置信息]]></Label>
<MsgId>1234567890123456</MsgId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<RequestMessageLocation>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1351776360), model.CreateTime);
Assert.Equal(1234567890123456, model.MessageId);
Assert.Equal(RequestMessageType.Location, model.MessageType);
Assert.Equal(23.134521, model.X);
Assert.Equal(113.358803, model.Y);
Assert.Equal("位置信息", model.Label);
Assert.Equal(20, model.Scale);
}
[Fact]
public void LinkMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1351776360</CreateTime>
<MsgType><![CDATA[link]]></MsgType>
<Title><![CDATA[公众平台官网链接]]></Title>
<Description><![CDATA[公众平台官网链接描述]]></Description>
<Url><![CDATA[http://www.chunsun.cc/]]></Url>
<MsgId>1234567890123456</MsgId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<RequestMessageLink>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1351776360), model.CreateTime);
Assert.Equal(1234567890123456, model.MessageId);
Assert.Equal(RequestMessageType.Link, model.MessageType);
Assert.Equal("公众平台官网链接", model.Title);
Assert.Equal("公众平台官网链接描述", model.Description);
Assert.Equal(new Uri("http://www.chunsun.cc/"), model.Url);
}
#region Event
[Fact]
public void SubscribeMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[subscribe]]></Event>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<SubscribeEventMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Subscribe, model.EventType);
}
[Fact]
public void UnSubscribeMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[unsubscribe]]></Event>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<UnSubscribeEventMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.UnSubscribe, model.EventType);
}
[Fact]
public void QrSubscribeMessageTest()
{
const string xmlContent = @"<xml><ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[subscribe]]></Event>
<EventKey><![CDATA[qrscene_123123]]></EventKey>
<Ticket><![CDATA[TICKET]]></Ticket>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<QrSubscribeEventKeyMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Subscribe, model.EventType);
Assert.Equal("qrscene_123123", model.EventKey);
Assert.Equal("TICKET", model.Ticket);
}
[Fact]
public void QrAlreadySubscribeMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[SCAN]]></Event>
<EventKey><![CDATA[SCENE_VALUE]]></EventKey>
<Ticket><![CDATA[TICKET]]></Ticket>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<QrAlreadySubscribeEventKeyMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Scan, model.EventType);
Assert.Equal("SCENE_VALUE", model.EventKey);
Assert.Equal("TICKET", model.Ticket);
}
[Fact]
public void TemplateSendMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[gh_7f083739789a]]></ToUserName>
<FromUserName><![CDATA[oia2TjuEGTNoeX76QEjQNrcURxG8]]></FromUserName>
<CreateTime>1395658920</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[TEMPLATESENDJOBFINISH]]></Event>
<MsgID>200163836</MsgID>
<Status><![CDATA[success]]></Status>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<TemplateMessageSendPushMessage>(xmlContent);
Assert.Equal("gh_7f083739789a", model.ToUserName);
Assert.Equal("oia2TjuEGTNoeX76QEjQNrcURxG8", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1395658920), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.TemplateSendJobFinish, model.EventType);
Assert.Equal(200163836, model.MessageId);
Assert.Equal(TemplateMessageSendStatus.Success, model.Status);
}
[Fact]
public void MassSendMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[gh_3e8adccde292]]></ToUserName>
<FromUserName><![CDATA[oR5Gjjl_eiZoUpGozMo7dbBJ362A]]></FromUserName>
<CreateTime>1394524295</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[MASSSENDJOBFINISH]]></Event>
<MsgID>1988</MsgID>
<Status><![CDATA[sendsuccess]]></Status>
<TotalCount>100</TotalCount>
<FilterCount>80</FilterCount>
<SentCount>75</SentCount>
<ErrorCount>5</ErrorCount>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<MassSendPushMessage>(xmlContent);
Assert.Equal("gh_3e8adccde292", model.ToUserName);
Assert.Equal("oR5Gjjl_eiZoUpGozMo7dbBJ362A", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1394524295), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.MassSendJobFinish, model.EventType);
Assert.Equal(1988, model.MessageId);
Assert.Equal(MassSendStatus.Success, model.Status);
Assert.Equal((ulong)100, model.TotalCount);
Assert.Equal((ulong)80, model.FilterCount);
Assert.Equal((ulong)75, model.SentCount);
Assert.Equal((ulong)5, model.ErrorCount);
}
#region CustomMenu
[Fact]
public void CustomMenuClickMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[CLICK]]></Event>
<EventKey><![CDATA[EVENTKEY]]></EventKey>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<ClickMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Click, model.EventType);
Assert.Equal("EVENTKEY", model.EventKey);
}
[Fact]
public void CustomMenuViewMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[VIEW]]></Event>
<EventKey><![CDATA[www.qq.com]]></EventKey>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<ViewMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.View, model.EventType);
Assert.Equal("www.qq.com", model.EventKey);
}
[Fact]
public void CustomMenuScanCodePushMessageTest()
{
const string xmlContent = @"<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090502</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[scancode_push]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<ScanCodeInfo><ScanType><![CDATA[qrcode]]></ScanType>
<ScanResult><![CDATA[1]]></ScanResult>
</ScanCodeInfo>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<ScanCodePushMessage>(xmlContent);
Assert.Equal("gh_e136c6e50636", model.ToUserName);
Assert.Equal("oMgHVjngRipVsoxg6TuX3vz6glDg", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1408090502), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.ScanCode_Push, model.EventType);
Assert.Equal(ScanType.QrCode, model.Type);
Assert.Equal("6", model.EventKey);
Assert.Equal("1", model.Result);
}
[Fact]
public void CustomMenuScanCodeWaitMessageMessageTest()
{
const string xmlContent = @"<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090606</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[scancode_waitmsg]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<ScanCodeInfo><ScanType><![CDATA[qrcode]]></ScanType>
<ScanResult><![CDATA[2]]></ScanResult>
</ScanCodeInfo>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<ScanCodeWaitMessage>(xmlContent);
Assert.Equal("gh_e136c6e50636", model.ToUserName);
Assert.Equal("oMgHVjngRipVsoxg6TuX3vz6glDg", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1408090606), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.ScanCode_WaitMsg, model.EventType);
Assert.Equal(ScanType.QrCode, model.Type);
Assert.Equal("6", model.EventKey);
Assert.Equal("2", model.Result);
}
[Fact]
public void CustomMenuPicSysPhotoMessageTest()
{
const string xmlContent = @"<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090651</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[pic_sysphoto]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendPicsInfo><Count>1</Count>
<PicList><item><PicMd5Sum><![CDATA[1b5f7c23b5bf75682a53e7b6d163e185]]></PicMd5Sum>
</item>
</PicList>
</SendPicsInfo>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<PicSysPhotoMessage>(xmlContent);
Assert.Equal("gh_e136c6e50636", model.ToUserName);
Assert.Equal("oMgHVjngRipVsoxg6TuX3vz6glDg", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1408090651), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Pic_SysPhoto, model.EventType);
Assert.Equal("6", model.EventKey);
Assert.Equal(1, model.Count);
Assert.Equal("1b5f7c23b5bf75682a53e7b6d163e185", model.PictureMd5List.First());
}
[Fact]
public void CustomMenuPicPhotoOrAlbumMessageTest()
{
const string xmlContent = @"<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090816</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[pic_photo_or_album]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendPicsInfo><Count>1</Count>
<PicList><item><PicMd5Sum><![CDATA[5a75aaca956d97be686719218f275c6b]]></PicMd5Sum>
</item>
</PicList>
</SendPicsInfo>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<PicPhotoOrAlbumMessage>(xmlContent);
Assert.Equal("gh_e136c6e50636", model.ToUserName);
Assert.Equal("oMgHVjngRipVsoxg6TuX3vz6glDg", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1408090816), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Pic_Photo_Or_Album, model.EventType);
Assert.Equal("6", model.EventKey);
Assert.Equal(1, model.Count);
Assert.Equal("5a75aaca956d97be686719218f275c6b", model.PictureMd5List.First());
}
[Fact]
public void CustomMenuPicWeiXinMessageTest()
{
const string xmlContent = @"<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408090816</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[pic_weixin]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendPicsInfo><Count>1</Count>
<PicList><item><PicMd5Sum><![CDATA[5a75aaca956d97be686719218f275c6b]]></PicMd5Sum>
</item>
</PicList>
</SendPicsInfo>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<PicWeiXinMessage>(xmlContent);
Assert.Equal("gh_e136c6e50636", model.ToUserName);
Assert.Equal("oMgHVjngRipVsoxg6TuX3vz6glDg", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1408090816), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Pic_WeiXin, model.EventType);
Assert.Equal("6", model.EventKey);
Assert.Equal(1, model.Count);
Assert.Equal("5a75aaca956d97be686719218f275c6b", model.PictureMd5List.First());
}
[Fact]
public void CustomMenuLocationSelectMessageTest()
{
const string xmlContent = @"<xml><ToUserName><![CDATA[gh_e136c6e50636]]></ToUserName>
<FromUserName><![CDATA[oMgHVjngRipVsoxg6TuX3vz6glDg]]></FromUserName>
<CreateTime>1408091189</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[location_select]]></Event>
<EventKey><![CDATA[6]]></EventKey>
<SendLocationInfo><Location_X><![CDATA[23]]></Location_X>
<Location_Y><![CDATA[113]]></Location_Y>
<Scale><![CDATA[15]]></Scale>
<Label><![CDATA[ 广州市海珠区客村艺苑路 106号]]></Label>
<Poiname><![CDATA[test]]></Poiname>
</SendLocationInfo>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<LocationSelectMessage>(xmlContent);
Assert.Equal("gh_e136c6e50636", model.ToUserName);
Assert.Equal("oMgHVjngRipVsoxg6TuX3vz6glDg", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1408091189), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Location_Select, model.EventType);
Assert.Equal("6", model.EventKey);
Assert.Equal(23, model.X);
Assert.Equal(113, model.Y);
Assert.Equal((uint)15, model.Scale);
Assert.Equal(" 广州市海珠区客村艺苑路 106号", model.Label);
Assert.Equal("test", model.Poiname);
}
#endregion CustomMenu
#region CustomService
[Fact]
public void CreateSessionMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[touser]]></ToUserName>
<FromUserName><![CDATA[fromuser]]></FromUserName>
<CreateTime>1399197672</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[kf_create_session]]></Event>
<KfAccount><![CDATA[test1@test]]></KfAccount>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CreateSessionMessage>(xmlContent);
Assert.Equal("touser", model.ToUserName);
Assert.Equal("fromuser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1399197672), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.KF_Create_Session, model.EventType);
Assert.Equal("test1@test", model.Account);
}
[Fact]
public void CloseSessionMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[touser]]></ToUserName>
<FromUserName><![CDATA[fromuser]]></FromUserName>
<CreateTime>1399197672</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[kf_close_session]]></Event>
<KfAccount><![CDATA[test1@test]]></KfAccount>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CloseSessionMessage>(xmlContent);
Assert.Equal("touser", model.ToUserName);
Assert.Equal("fromuser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1399197672), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.KF_Close_Session, model.EventType);
Assert.Equal("test1@test", model.Account);
}
[Fact]
public void SwitchSessionMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[touser]]></ToUserName>
<FromUserName><![CDATA[fromuser]]></FromUserName>
<CreateTime>1399197672</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[kf_switch_session]]></Event>
<FromKfAccount><![CDATA[test1@test]]></FromKfAccount>
<ToKfAccount><![CDATA[test2@test]]></ToKfAccount>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<SwitchSessionMessage>(xmlContent);
Assert.Equal("touser", model.ToUserName);
Assert.Equal("fromuser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1399197672), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.KF_Switch_Session, model.EventType);
Assert.Equal("test1@test", model.FromAccount);
Assert.Equal("test2@test", model.ToAccount);
}
#endregion CustomService
#region Card
[Fact]
public void CardEventPassCheckMessageTest()
{
const string xmlContent = @"<xml> <ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[card_pass_check]]></Event> //不通过为card_not_pass_check
<CardId><![CDATA[cardid]]></CardId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CardEventPassCheckMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Card_Pass_Check, model.EventType);
Assert.Equal("cardid", model.CardId);
}
[Fact]
public void CardEventNotPassCheckMessageTest()
{
const string xmlContent = @"<xml> <ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[card_not_pass_check]]></Event>
<CardId><![CDATA[cardid]]></CardId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CardEventNotPassCheckMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Card_Not_Pass_Check, model.EventType);
Assert.Equal("cardid", model.CardId);
}
[Fact]
public void CardEventUserGetMessageTest()
{
const string xmlContent = @"<xml> <ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<FriendUserName><![CDATA[FriendUser]]></FriendUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_get_card]]></Event>
<CardId><![CDATA[cardid]]></CardId>
<IsGiveByFriend>1</IsGiveByFriend>
<UserCardCode><![CDATA[12312312]]></UserCardCode>
<OuterId>3</OuterId>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CardEventUserGetMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Card_User_Get, model.EventType);
Assert.Equal("cardid", model.CardId);
Assert.Equal("FriendUser", model.FriendUserName);
Assert.Equal(true, model.IsGiveByFriend);
Assert.Equal("12312312", model.UserCardCode);
Assert.Equal(null, model.OldUserCardCode);
Assert.Equal(3, model.OuterId);
}
[Fact]
public void CardEventUserDeleteMessageTest()
{
const string xmlContent = @"<xml> <ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_del_card]]></Event>
<CardId><![CDATA[cardid]]></CardId>
<UserCardCode><![CDATA[12312312]]></UserCardCode>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CardEventUserDeleteMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Card_User_Delete, model.EventType);
Assert.Equal("cardid", model.CardId);
Assert.Equal("12312312", model.UserCardCode);
}
[Fact]
public void CardEventUserConsumeCardMessageTest()
{
const string xmlContent = @"<xml> <ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_consume_card]]></Event>
<CardId><![CDATA[cardid]]></CardId>
<UserCardCode><![CDATA[12312312]]></UserCardCode>
<ConsumeSource><![CDATA[(FROM_API)]]></ConsumeSource>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CardEventUserConsumeCardMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Card_User_Consume, model.EventType);
Assert.Equal("cardid", model.CardId);
Assert.Equal("12312312", model.UserCardCode);
Assert.Equal(CardEventUserConsumeCardMessage.CardConsumeSource.Api, model.ConsumeSource);
}
[Fact]
public void CardEventUserViewMessageTest()
{
const string xmlContent = @"<xml> <ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_view_card]]></Event>
<CardId><![CDATA[cardid]]></CardId>
<UserCardCode><![CDATA[12312312]]></UserCardCode>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CardEventUserViewMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Card_User_View, model.EventType);
Assert.Equal("cardid", model.CardId);
Assert.Equal("12312312", model.UserCardCode);
}
[Fact]
public void CardEventUserEnterSessionMessageTest()
{
const string xmlContent = @"<xml> <ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_enter_session_from_card]]></Event>
<CardId><![CDATA[cardid]]></CardId>
<UserCardCode><![CDATA[12312312]]></UserCardCode>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<CardEventUserEnterSessionMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.Card_UserEnterSession, model.EventType);
Assert.Equal("cardid", model.CardId);
Assert.Equal("12312312", model.UserCardCode);
}
#endregion Card
#region WiFi
[Fact]
public void WiFiConnectedMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[FromUser]]></FromUserName>
<CreateTime>123456789</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[WifiConnected]]></Event>
<ConnectTime>0</ConnectTime>
<ExpireTime>0</ExpireTime>
<VendorId>![CDATA[3001224419]]</VendorId>
<ShopId><![CDATA[PlaceId]]></ShopId>
<DeviceNo><![CDATA[DeviceNo]]></DeviceNo>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<ConnectedMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("FromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(123456789), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.WifiConnected, model.EventType);
Assert.Equal("PlaceId", model.ShopId);
Assert.Equal("DeviceNo", model.DeviceNo);
}
#endregion WiFi
#region Shakearound
[Fact]
public void ShakearoundUserShakeMessageTest()
{
const string xmlContent = @"<xml>
<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1433332012</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[ShakearoundUserShake]]></Event>
<ChosenBeacon>
<Uuid><![CDATA[uuid]]></Uuid>
<Major>major</Major>
<Minor>minor</Minor>
<Distance>0.057</Distance>
</ChosenBeacon>
<AroundBeacons>
<AroundBeacon>
<Uuid><![CDATA[uuid]]></Uuid>
<Major>major</Major>
<Minor>minor</Minor>
<Distance>166.816</Distance>
</AroundBeacon>
<AroundBeacon>
<Uuid><![CDATA[uuid]]></Uuid>
<Major>major</Major>
<Minor>minor</Minor>
<Distance>15.013</Distance>
</AroundBeacon>
</AroundBeacons>
</xml>";
var model = _requestMessageFactory.CreateRequestMessage<ShakearoundUserShakeMessage>(xmlContent);
Assert.Equal("toUser", model.ToUserName);
Assert.Equal("fromUser", model.FromUserName);
Assert.Equal(DateTimeHelper.GetTimeByTimeStamp(1433332012), model.CreateTime);
Assert.Equal(RequestMessageType.Event, model.MessageType);
Assert.Equal(EventType.ShakearoundUserShake, model.EventType);
Assert.NotNull(model.ChosenBeacon);
Assert.Equal("uuid", model.ChosenBeacon.Uuid);
Assert.Equal("major", model.ChosenBeacon.Major);
Assert.Equal("minor", model.ChosenBeacon.Minor);
Assert.Equal(0.057, model.ChosenBeacon.Distance);
Assert.NotNull(model.AroundBeacons);
Assert.Equal(2, model.AroundBeacons.Length);
Assert.Equal("uuid", model.AroundBeacons[0].Uuid);
Assert.Equal("major", model.AroundBeacons[0].Major);
Assert.Equal("minor", model.AroundBeacons[0].Minor);
Assert.Equal(166.816, model.AroundBeacons[0].Distance);
Assert.Equal("uuid", model.AroundBeacons[1].Uuid);
Assert.Equal("major", model.AroundBeacons[1].Major);
Assert.Equal("minor", model.AroundBeacons[1].Minor);
Assert.Equal(15.013, model.AroundBeacons[1].Distance);
}
#endregion Shakearound
#endregion Event
}
} | RabbitTeam/WeiXinSDK | test/Rabbit.WeiXin.Tests/RequestMessageFormatter.cs | C# | apache-2.0 | 37,044 | [
30522,
2478,
15990,
3490,
2102,
1025,
2478,
10442,
1012,
11417,
20303,
1012,
24394,
2378,
20614,
3258,
1025,
2478,
10442,
1012,
11417,
20303,
1012,
6131,
1012,
7696,
1025,
2478,
10442,
1012,
11417,
20303,
1012,
6131,
1012,
7696,
1012,
2824,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* MIT License
*
* Copyright (c) 2017 zgqq
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package mah.plugin.support.orgnote.source;
import mah.plugin.support.orgnote.entity.NodeEntity;
import java.util.List;
/**
* Created by zgq on 10/1/16.
*/
public interface Sort {
NodeEntity getNextReviewNote(List<NodeEntity> nodeEntityList);
}
| zgqq/mah | mah-plugin/src/main/java/mah/plugin/support/orgnote/source/Sort.java | Java | mit | 1,382 | [
30522,
1013,
1008,
1008,
1008,
10210,
6105,
1008,
1008,
9385,
1006,
1039,
1007,
2418,
1062,
2290,
4160,
4160,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
1008,
1997,
2023,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* This file is part of http://github.com/LukeBeer/BroadworksOCIP
*
* (c) 2013-2015 Luke Berezynskyj <eat.lemons@gmail.com>
*/
namespace BroadworksOCIP\api\Rel_17_sp4_1_197_OCISchemaAS\OCISchemaSystem;
use BroadworksOCIP\api\Rel_17_sp4_1_197_OCISchemaAS\OCISchemaDataTypes\ScheduleName;
use BroadworksOCIP\api\Rel_17_sp4_1_197_OCISchemaAS\OCISchemaDataTypes\ScheduleKey;
use BroadworksOCIP\Builder\Types\ComplexInterface;
use BroadworksOCIP\Builder\Types\ComplexType;
use BroadworksOCIP\Response\ResponseOutput;
use BroadworksOCIP\Client\Client;
/**
* Modify a system schedule.
* The response is either a SuccessResponse or an ErrorResponse.
*/
class SystemScheduleModifyRequest extends ComplexType implements ComplexInterface
{
public $elementName = 'SystemScheduleModifyRequest';
protected $scheduleKey;
protected $newScheduleName;
public function __construct(
$scheduleKey = '',
$newScheduleName = null
) {
$this->setScheduleKey($scheduleKey);
$this->setNewScheduleName($newScheduleName);
}
/**
* @return mixed $response
*/
public function get(Client $client, $responseOutput = ResponseOutput::STD)
{
return $this->send($client, $responseOutput);
}
/**
*
*/
public function setScheduleKey(ScheduleKey $scheduleKey = null)
{
$this->scheduleKey = ($scheduleKey InstanceOf ScheduleKey)
? $scheduleKey
: new ScheduleKey($scheduleKey);
$this->scheduleKey->setElementName('scheduleKey');
return $this;
}
/**
*
* @return ScheduleKey $scheduleKey
*/
public function getScheduleKey()
{
return $this->scheduleKey;
}
/**
*
*/
public function setNewScheduleName($newScheduleName = null)
{
$this->newScheduleName = ($newScheduleName InstanceOf ScheduleName)
? $newScheduleName
: new ScheduleName($newScheduleName);
$this->newScheduleName->setElementName('newScheduleName');
return $this;
}
/**
*
* @return ScheduleName $newScheduleName
*/
public function getNewScheduleName()
{
return ($this->newScheduleName)
? $this->newScheduleName->getElementValue()
: null;
}
}
| paericksen/broadworks-ocip | src/BroadworksOCIP/api/Rel_17_sp4_1_197_OCISchemaAS/OCISchemaSystem/SystemScheduleModifyRequest.php | PHP | gpl-2.0 | 2,345 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
8299,
1024,
1013,
1013,
21025,
2705,
12083,
1012,
4012,
1013,
5355,
11306,
2099,
1013,
5041,
9316,
10085,
11514,
1008,
1008,
1006,
1039,
1007,
2286,
1011,
2325,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to Islandora Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* The Islandora Foundation licenses this file to you under the MIT License.
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ca.islandora.alpaca.connector.houdini;
import static org.apache.camel.LoggingLevel.ERROR;
import static org.slf4j.LoggerFactory.getLogger;
import ca.islandora.alpaca.connector.houdini.event.AS2Event;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.Exchange;
import org.apache.camel.model.dataformat.JsonLibrary;
import org.slf4j.Logger;
/**
* @author dhlamb
*/
public class HoudiniConnector extends RouteBuilder {
private static final Logger LOGGER = getLogger(HoudiniConnector.class);
@Override
public void configure() {
// Global exception handler for the indexer.
// Just logs after retrying X number of times.
onException(Exception.class)
.maximumRedeliveries("{{error.maxRedeliveries}}")
.log(
ERROR,
LOGGER,
"Error connecting generating derivative with Houdini: ${exception.message}\n\n${exception.stacktrace}"
);
from("{{in.stream}}")
.routeId("IslandoraConnectorHoudini")
// Parse the event into a POJO.
.unmarshal().json(JsonLibrary.Jackson, AS2Event.class)
// Stash the event on the exchange.
.setProperty("event").simple("${body}")
// Make the Crayfish request.
.removeHeaders("*", "Authorization")
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.setHeader("Accept", simple("${exchangeProperty.event.attachment.content.mimetype}"))
.setHeader("X-Islandora-Args", simple("${exchangeProperty.event.attachment.content.args}"))
.setHeader("Apix-Ldp-Resource", simple("${exchangeProperty.event.attachment.content.sourceUri}"))
.setBody(simple("${null}"))
.to("{{houdini.convert.url}}")
// PUT the media.
.removeHeaders("*", "Authorization", "Content-Type")
.setHeader("Content-Location", simple("${exchangeProperty.event.attachment.content.fileUploadUri}"))
.setHeader(Exchange.HTTP_METHOD, constant("PUT"))
.toD("${exchangeProperty.event.attachment.content.destinationUri}");
}
}
| dannylamb/Alpaca | islandora-connector-houdini/src/main/java/ca/islandora/alpaca/connector/houdini/HoudiniConnector.java | Java | mit | 2,947 | [
30522,
1013,
1008,
1008,
7000,
2000,
2479,
6525,
3192,
2104,
2028,
2030,
2062,
12130,
6105,
1008,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
2023,
2147,
2005,
3176,
1008,
2592,
4953,
9385,
6095,
1012,
1008,
1008,
1996,
2479,
6525,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (c) 2014-2015 F-Secure
See LICENSE for details
*/
package cc.softwarefactory.lokki.android;
import android.app.Application;
import android.graphics.Bitmap;
import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.google.android.gms.maps.GoogleMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import cc.softwarefactory.lokki.android.utilities.AnalyticsUtils;
import cc.softwarefactory.lokki.android.utilities.PreferenceUtils;
public class MainApplication extends Application {
/**
* Indicates whether this is a development or production build
*/
private static final boolean DEVELOPER_MODE = true;
/**
* Debug tag identifying that a log message was caused by the main application
*/
private static final String TAG = "MainApplication";
/**
* Int array enumerating the codes used for different Google Maps map view types
*/
public static final int[] mapTypes = {GoogleMap.MAP_TYPE_NORMAL, GoogleMap.MAP_TYPE_SATELLITE, GoogleMap.MAP_TYPE_HYBRID};
/**
* Currently selected Google Maps map view type.
* TODO: make private with proper accessor methods to disallow values not in mapTypes
*/
public static int mapType = 0;
public static String emailBeingTracked;
/**
* User dashboard JSON object. Format:
* {
* "battery":"",
* "canseeme":["c429003ba3a3c508cba1460607ab7f8cd4a0d450"],
* "icansee":{
* "c429003ba3a3c508cba1460607ab7f8cd4a0d450":{
* "battery":"",
* "location":{},
* "visibility":true
* }
* },
* "idmapping":{
* "a1b2c3d4e5f6g7h8i9j10k11l12m13n14o15p16q":"test@test.com",
* "c429003ba3a3c508cba1460607ab7f8cd4a0d450":"family.member@example.com"
* },
* "location":{},
* "visibility":true
* }
*/
public static JSONObject dashboard = null;
public static String userAccount; // Email
/**
* User's contacts. Format:
* {
* "test.friend@example.com": {
* "id":1,
* "name":"Test Friend"
* },
* "family.member@example.com":{
* "id":2,
* "name":"Family Member"
* },
* "work.buddy@example.com":{
* "id":3,
* "name":"Work Buddy"
* },
* "mapping":{
* "Test Friend":"test.friend@example.com",
* "Family Member":"family.member@example.com",
* "Work Buddy":"work.buddy@example.com"
* }
* }
*/
public static JSONObject contacts;
/**
* Format:
* {
* "Test Friend":"test.friend@example.com",
* "Family Member":"family.member@example.com",
* "Work Buddy":"work.buddy@example.com"
* }
*/
public static JSONObject mapping;
/**
* Contacts that aren't shown on the map. Format:
* {
* "test.friend@example.com":1,
* "family.member@example.com":1
* }
*/
public static JSONObject iDontWantToSee;
public static Boolean visible = true;
public static LruCache<String, Bitmap> avatarCache;
/**
* The user's places. Format:
* {
* "f414af16-e532-49d2-999f-c3bdd160dca4":{
* "lat":11.17839332191203,
* "lon":1.4752149581909178E-5,
* "rad":6207030,
* "name":"1",
* "img":""
* },
* "b0d77236-cdad-4a25-8cca-47b4426d5f1f":{
* "lat":11.17839332191203,
* "lon":1.4752149581909178E-5,
* "rad":6207030,
* "name":"1",
* "img":""
* },
* "1f1a3303-5964-40d5-bd07-3744a0c0d0f7":{
* "lat":11.17839332191203,
* "lon":1.4752149581909178E-5,
* "rad":6207030,
* "name":"3",
* "img":""
* }
* }
*/
public static JSONObject places;
public static boolean locationDisabledPromptShown;
public static JSONArray buzzPlaces;
public static boolean firstTimeZoom = true;
@Override
public void onCreate() {
Log.d(TAG, "Lokki started component");
//Load user settings
loadSetting();
AnalyticsUtils.initAnalytics(getApplicationContext());
locationDisabledPromptShown = false;
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); // Use 1/8th of the available memory for this memory cache.
final int cacheSize = maxMemory / 8;
avatarCache = new LruCache<String, Bitmap>(cacheSize) {
@Override
protected int sizeOf(String key, Bitmap bitmap) {
// The cache size will be measured in kilobytes rather than number of items.
return (bitmap.getRowBytes() * bitmap.getHeight()) / 1024;
}
};
String iDontWantToSeeString = PreferenceUtils.getString(this, PreferenceUtils.KEY_I_DONT_WANT_TO_SEE);
if (!iDontWantToSeeString.isEmpty()) {
try {
MainApplication.iDontWantToSee = new JSONObject(iDontWantToSeeString);
} catch (JSONException e) {
MainApplication.iDontWantToSee = null;
Log.e(TAG, e.getMessage());
}
} else {
MainApplication.iDontWantToSee = new JSONObject();
}
Log.d(TAG, "MainApplication.iDontWantToSee: " + MainApplication.iDontWantToSee);
if (DEVELOPER_MODE) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.penaltyLog()
.penaltyDeath()
.build());
}
buzzPlaces = new JSONArray();
super.onCreate();
}
private void loadSetting() {
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
visible = PreferenceUtils.getBoolean(getApplicationContext(), PreferenceUtils.KEY_SETTING_VISIBILITY);
Log.d(TAG, "Visible: " + visible);
// get mapValue from preferences
try {
mapType = Integer.parseInt(PreferenceUtils.getString(getApplicationContext(), PreferenceUtils.KEY_SETTING_MAP_MODE));
}
catch (NumberFormatException e){
mapType = mapTypes[0];
Log.w(TAG, "Could not parse map type; using default value: " + e);
}
}
}
| Grandi/lokki-android | App/src/main/java/cc/softwarefactory/lokki/android/MainApplication.java | Java | apache-2.0 | 6,855 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2297,
1011,
2325,
1042,
1011,
5851,
2156,
6105,
2005,
4751,
1008,
1013,
7427,
10507,
1012,
4007,
21450,
1012,
13660,
3211,
1012,
11924,
1025,
12324,
11924,
1012,
10439,
1012,
4646,
1025,
12324,
119... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//Route::middleware('auth:api')->get('/user', function (Request $request) {
// return $request->user();
//});
//Route::get('wechat/index', 'WechatController@index');
| growu/growu-website | routes/api.php | PHP | mit | 591 | [
30522,
1026,
1029,
25718,
2224,
5665,
12717,
12556,
1032,
8299,
1032,
5227,
1025,
1013,
1008,
1064,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# keyless
Bluetooth keyless entry on a Toyota Corolla with python and raspberry pi
| susmit85/keyless | README.md | Markdown | gpl-3.0 | 83 | [
30522,
1001,
3145,
3238,
2630,
19392,
3145,
3238,
4443,
2006,
1037,
11742,
2522,
28402,
2050,
2007,
18750,
1998,
20710,
2361,
9766,
14255,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* misc-private.h: Miscellaneous internal support functions
*
* Author:
* Dick Porter (dick@ximian.com)
*
* (C) 2002 Ximian, Inc.
*/
#ifndef _WAPI_MISC_PRIVATE_H_
#define _WAPI_MISC_PRIVATE_H_
#include <glib.h>
#include <sys/time.h>
#include <time.h>
extern void _wapi_calc_timeout(struct timespec *timeout, guint32 ms);
#endif /* _WAPI_MISC_PRIVATE_H_ */
| jbatonnet/system | Source/[Libraries]/Mono/mono/io-layer/misc-private.h | C | mit | 370 | [
30522,
1013,
1008,
1008,
28616,
2278,
1011,
2797,
1012,
1044,
1024,
25408,
4722,
2490,
4972,
1008,
1008,
3166,
1024,
1008,
5980,
8716,
1006,
5980,
1030,
8418,
20924,
1012,
4012,
1007,
1008,
1008,
1006,
1039,
1007,
2526,
8418,
20924,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><li class="fa fa-remove"></li></button>
<h5 class="modal-title"></h5>
</div>
<div class="modal-body">
<form id="whisper_nodes_form" name="whisper_nodes_form" class="form-horizontal">
<input type="hidden" name="id">
<input type="hidden" name="deleted" value="0">
<input type='hidden' value="${CSRFToken}" id='csrftoken'>
<div class="box-body">
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-3 control-label">name<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="name" name="name" placeholder="请填写name">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">device_ver<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="device_ver" name="device_ver" placeholder="请填写device_ver">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">real_device_id</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="real_device_id" name="real_device_id" placeholder="请填写real_device_id">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">manufacturer<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="manufacturer" name="manufacturer" placeholder="请填写manufacturer">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">os<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="os" name="os" placeholder="请填写os">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-3 control-label">description<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="description" name="description" placeholder="请填写description">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">device_id</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="device_id" name="device_id" placeholder="请填写device_id">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">device_type<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="device_type" name="device_type" placeholder="请填写device_type">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">model<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="model" name="model" placeholder="请填写model">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">os_version<span style="color:red">*</span></label>
<div class="col-sm-8">
<input type="text" class="form-control" id="os_version" name="os_version" placeholder="请填写os_version">
</div>
</div>
</div>
</div>
<div class="box-footer text-right">
<button type="button" class="btn btn-default" data-btn-type="cancel" data-dismiss="modal">取消</button>
<button type="submit" class="btn btn-primary" data-btn-type="save">提交</button>
</div>
</form>
</div>
<script>
var form;
var id="${id?default(0)}";
$(function(){
//初始化表单
form=$("#whisper_nodes_form").form();
//数据校验
$("#whisper_nodes_form").bootstrapValidator({
message : '请输入有效值',
feedbackIcons : {
valid : 'glyphicon glyphicon-ok',
invalid : 'glyphicon glyphicon-remove',
validating : 'glyphicon glyphicon-refresh'
},
submitHandler : function() {
modals.confirm('确认保存?', function() {
var whisper_nodes = form.getFormSimpleData();
ajaxPost(basePath+'/whisper_nodes/save',whisper_nodes, function(data) {
if(data.success){
if(id!="0"){
modals.hideWin(winId);
whisper_nodesTable.reloadRowData(id);
}else{
modals.hideWin(winId);
whisper_nodesTable.reloadData();
}
}
});
});
},
fields : {
"name":{
validators:{
notEmpty:{message:'name不能为空'}
}
},
"description":{
validators:{
notEmpty:{message:'description不能为空'}
}
},
"device_ver":{
validators:{
notEmpty:{message:'device_ver不能为空'}
}
},
"device_type":{
validators:{
notEmpty:{message:'device_type不能为空'}
}
},
"manufacturer":{
validators:{
notEmpty:{message:'manufacturer不能为空'}
}
},
"model":{
validators:{
notEmpty:{message:'model不能为空'}
}
},
"os":{
validators:{
notEmpty:{message:'os不能为空'}
}
},
"os_version":{
validators:{
notEmpty:{message:'os_version不能为空'}
}
}
}
});
//初始化控件
form.initComponent();
//编辑回填
if(id!=0){
ajaxPost(basePath+"/whisper_nodes/get/"+id,null,function(data){
form.initFormData(data);
})
}
});
</script>
| XilongPei/Openparts | Openparts-web/src/main/webapp/WEB-INF/views/base/whisper_nodes_edit.html | HTML | mit | 7,429 | [
30522,
1026,
4487,
2615,
2465,
1027,
1000,
16913,
2389,
1011,
20346,
1000,
1028,
1026,
6462,
2828,
1027,
1000,
6462,
1000,
2465,
1027,
1000,
2485,
1000,
2951,
1011,
19776,
1027,
1000,
16913,
2389,
1000,
9342,
1011,
5023,
1027,
1000,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* FreeRDP: A Remote Desktop Protocol Client
* Clipboard Virtual Channel Types
*
* Copyright 2011 Vic Lee
*
* 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.
*/
#ifndef __CLIPRDR_PLUGIN
#define __CLIPRDR_PLUGIN
/**
* Event Types
*/
#define RDP_EVENT_TYPE_CB_MONITOR_READY 1
#define RDP_EVENT_TYPE_CB_FORMAT_LIST 2
#define RDP_EVENT_TYPE_CB_DATA_REQUEST 3
#define RDP_EVENT_TYPE_CB_DATA_RESPONSE 4
/**
* Clipboard Formats
*/
#define CB_FORMAT_RAW 0x0000
#define CB_FORMAT_TEXT 0x0001
#define CB_FORMAT_DIB 0x0008
#define CB_FORMAT_UNICODETEXT 0x000D
#define CB_FORMAT_HTML 0xD010
#define CB_FORMAT_PNG 0xD011
#define CB_FORMAT_JPEG 0xD012
#define CB_FORMAT_GIF 0xD013
/**
* Clipboard Events
*/
typedef RDP_EVENT RDP_CB_MONITOR_READY_EVENT;
struct _RDP_CB_FORMAT_LIST_EVENT
{
RDP_EVENT event;
uint32* formats;
uint16 num_formats;
uint8* raw_format_data;
uint32 raw_format_data_size;
};
typedef struct _RDP_CB_FORMAT_LIST_EVENT RDP_CB_FORMAT_LIST_EVENT;
struct _RDP_CB_DATA_REQUEST_EVENT
{
RDP_EVENT event;
uint32 format;
};
typedef struct _RDP_CB_DATA_REQUEST_EVENT RDP_CB_DATA_REQUEST_EVENT;
struct _RDP_CB_DATA_RESPONSE_EVENT
{
RDP_EVENT event;
uint8* data;
uint32 size;
};
typedef struct _RDP_CB_DATA_RESPONSE_EVENT RDP_CB_DATA_RESPONSE_EVENT;
#endif /* __CLIPRDR_PLUGIN */
| ctxis/RDP-Replay | libfree_rdp/include/freerdp/plugins/cliprdr.h | C | apache-2.0 | 1,833 | [
30522,
1013,
1008,
1008,
1008,
2489,
4103,
2361,
1024,
1037,
6556,
15363,
8778,
7396,
1008,
12528,
6277,
7484,
3149,
4127,
1008,
1008,
9385,
2249,
10967,
3389,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright(c) Sophist Solutions, Inc. 1990-2022. All rights reserved
*/
#ifndef _Stroika_Foundation_Containers_DataStructures_STLContainerWrapper_h_
#define _Stroika_Foundation_Containers_DataStructures_STLContainerWrapper_h_
#include "../../StroikaPreComp.h"
#include "../../Configuration/Common.h"
#include "../../Configuration/Concepts.h"
#include "../../Debug/AssertExternallySynchronizedMutex.h"
#include "../Common.h"
/**
* \file
*
* Description:
* This module genericly wraps STL containers (such as map, vector etc), and facilitates
* using them as backends for Stroika containers.
*
* TODO:
*
* @todo Replace Contains() with Lookup () - as we did for LinkedList<T>
*
* @todo Redo Contains1 versus Contains using partial template specialization of STLContainerWrapper - easy
* cuz such a trivial class. I can use THAT trick to handle the case of forward_list too. And size...
*
* @todo Add special subclass of ForwardIterator that tracks PREVPTR - and use to cleanup stuff
* that uses forward_list code...
*
*/
namespace Stroika::Foundation::Containers::DataStructures {
namespace Private_ {
template <typename T>
using has_erase_t = decltype (declval<T&> ().erase (begin (declval<T&> ()), end (declval<T&> ())));
template <typename T>
constexpr inline bool has_erase_v = Configuration::is_detected_v<has_erase_t, T>;
}
/**
* Use this to wrap an underlying stl container (like std::vector or stl:list, etc) to adapt
* it for Stroika containers.
*
* \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
*
*/
template <typename STL_CONTAINER_OF_T>
class STLContainerWrapper : public STL_CONTAINER_OF_T, public Debug::AssertExternallySynchronizedMutex {
private:
using inherited = STL_CONTAINER_OF_T;
public:
using value_type = typename STL_CONTAINER_OF_T::value_type;
using iterator = typename STL_CONTAINER_OF_T::iterator;
using const_iterator = typename STL_CONTAINER_OF_T::const_iterator;
public:
/**
* Basic (mostly internal) element used by ForwardIterator. Abstract name so can be referenced generically across 'DataStructure' objects
*/
using UnderlyingIteratorRep = const_iterator;
public:
/**
* pass through CTOR args to underlying container
*/
template <typename... EXTRA_ARGS>
STLContainerWrapper (EXTRA_ARGS&&... args);
public:
class ForwardIterator;
public:
/*
* Take iteartor 'pi' which is originally a valid iterator from 'movedFrom' - and replace *pi with a valid
* iterator from 'this' - which points at the same logical position. This requires that this container
* was just 'copied' from 'movedFrom' - and is used to produce an eqivilennt iterator (since iterators are tied to
* the container they were iterating over).
*/
nonvirtual void MoveIteratorHereAfterClone (ForwardIterator* pi, const STLContainerWrapper* movedFrom) const;
public:
nonvirtual bool Contains (ArgByValueType<value_type> item) const;
public:
/**
* \note Complexity:
* Always: O(N)
*/
template <typename FUNCTION>
nonvirtual void Apply (FUNCTION doToElement) const;
public:
/**
* \note Complexity:
* Worst Case: O(N)
* Typical: O(N), but can be less if systematically finding entries near start of container
*/
template <typename FUNCTION>
nonvirtual iterator Find (FUNCTION doToElement);
template <typename FUNCTION>
nonvirtual const_iterator Find (FUNCTION doToElement) const;
public:
template <typename PREDICATE>
nonvirtual bool FindIf (PREDICATE pred) const;
public:
nonvirtual void Invariant () const noexcept;
public:
nonvirtual iterator remove_constness (const_iterator it);
};
/**
* STLContainerWrapper::ForwardIterator is a private utility class designed
* to promote source code sharing among the patched iterator implementations.
*
* \note ForwardIterator takes a const-pointer the the container as argument since this
* iterator never MODIFIES the container.
*
* However, it does a const-cast to maintain a non-const pointer since that is needed to
* option a non-const iterator pointer, which is needed by some classes that use this, and
* there is no zero (or even low for forward_list) cost way to map from const to non const
* iterators (needed to perform the update).
*
* @see https://stroika.atlassian.net/browse/STK-538
*/
template <typename STL_CONTAINER_OF_T>
class STLContainerWrapper<STL_CONTAINER_OF_T>::ForwardIterator {
public:
/**
*/
explicit ForwardIterator (const STLContainerWrapper* data);
explicit ForwardIterator (const STLContainerWrapper* data, UnderlyingIteratorRep startAt);
explicit ForwardIterator (const ForwardIterator& from) = default;
public:
nonvirtual bool Done () const noexcept;
public:
nonvirtual ForwardIterator& operator++ () noexcept;
public:
nonvirtual value_type Current () const;
public:
/**
* Only legal to call if underlying iterator is random_access
*/
nonvirtual size_t CurrentIndex () const;
public:
nonvirtual UnderlyingIteratorRep GetUnderlyingIteratorRep () const;
public:
nonvirtual void SetUnderlyingIteratorRep (UnderlyingIteratorRep l);
public:
nonvirtual bool Equals (const ForwardIterator& rhs) const;
public:
nonvirtual const STLContainerWrapper* GetReferredToData () const;
private:
const STLContainerWrapper* fData_;
const_iterator fStdIterator_;
private:
friend class STLContainerWrapper;
};
}
/*
********************************************************************************
***************************** Implementation Details ***************************
********************************************************************************
*/
#include "STLContainerWrapper.inl"
#endif /*_Stroika_Foundation_Containers_DataStructures_STLContainerWrapper_h_ */
| SophistSolutions/Stroika | Library/Sources/Stroika/Foundation/Containers/DataStructures/STLContainerWrapper.h | C | mit | 6,578 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2061,
21850,
3367,
7300,
1010,
4297,
1012,
2901,
1011,
16798,
2475,
1012,
2035,
2916,
9235,
1008,
1013,
1001,
2065,
13629,
2546,
1035,
2358,
26692,
2912,
1035,
3192,
1035,
16143,
1035,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
PROJ := 5
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
SLASH := /
V := @
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
endif
# try to infer the correct QEMU
ifndef QEMU
QEMU := $(shell if which qemu > /dev/null; \
then echo 'qemu'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
echo "*** Is the directory containing the qemu binary in your PATH" 1>&2; \
echo "***" 1>&2; exit 1; fi)
endif
# eliminate default suffix rules
.SUFFIXES: .c .S .h
# delete target files if there is an error (or make is interrupted)
.DELETE_ON_ERROR:
# define compiler and flags
HOSTCC := gcc
HOSTCFLAGS := -g -Wall -O2
GDB := $(GCCPREFIX)gdb
CC := $(GCCPREFIX)gcc
CFLAGS := -fno-builtin -Wall -ggdb -m32 -gstabs -nostdinc $(DEFS)
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
CTYPE := c S
LD := $(GCCPREFIX)ld
LDFLAGS := -m $(shell $(LD) -V | grep elf_i386 2>/dev/null)
LDFLAGS += -nostdlib
OBJCOPY := $(GCCPREFIX)objcopy
OBJDUMP := $(GCCPREFIX)objdump
COPY := cp
MKDIR := mkdir -p
MV := mv
RM := rm -f
AWK := awk
SED := sed
SH := sh
TR := tr
TOUCH := touch -c
TAR := tar
ZIP := gzip
OBJDIR := obj
BINDIR := bin
ALLOBJS :=
ALLDEPS :=
TARGETS :=
include tools/function.mk
listf_cc = $(call listf,$(1),$(CTYPE))
# for cc
add_files_cc = $(call add_files,$(1),$(CC),$(CFLAGS) $(3),$(2),$(4))
create_target_cc = $(call create_target,$(1),$(2),$(3),$(CC),$(CFLAGS))
# for hostcc
add_files_host = $(call add_files,$(1),$(HOSTCC),$(HOSTCFLAGS),$(2),$(3))
create_target_host = $(call create_target,$(1),$(2),$(3),$(HOSTCC),$(HOSTCFLAGS))
cgtype = $(patsubst %.$(2),%.$(3),$(1))
objfile = $(call toobj,$(1))
asmfile = $(call cgtype,$(call toobj,$(1)),o,asm)
outfile = $(call cgtype,$(call toobj,$(1)),o,out)
symfile = $(call cgtype,$(call toobj,$(1)),o,sym)
# for match pattern
match = $(shell echo $(2) | $(AWK) '{for(i=1;i<=NF;i++){if(match("$(1)","^"$$(i)"$$")){exit 1;}}}'; echo $$?)
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# include kernel/user
INCLUDE += libs/
CFLAGS += $(addprefix -I,$(INCLUDE))
LIBDIR += libs
$(call add_files_cc,$(call listf_cc,$(LIBDIR)),libs,)
# -------------------------------------------------------------------
# kernel
KINCLUDE += kern/debug/ \
kern/driver/ \
kern/trap/ \
kern/mm/ \
kern/libs/ \
kern/sync/
KSRCDIR += kern/init \
kern/libs \
kern/debug \
kern/driver \
kern/trap \
kern/mm \
kern/sync
KCFLAGS += $(addprefix -I,$(KINCLUDE))
$(call add_files_cc,$(call listf_cc,$(KSRCDIR)),kernel,$(KCFLAGS))
KOBJS = $(call read_packet,kernel libs)
# create kernel target
kernel = $(call totarget,kernel)
$(kernel): tools/kernel.ld
$(kernel): $(KOBJS)
@echo + ld $@
$(V)$(LD) $(LDFLAGS) -T tools/kernel.ld -o $@ $(KOBJS)
@$(OBJDUMP) -S $@ > $(call asmfile,kernel)
@$(OBJDUMP) -t $@ | $(SED) '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $(call symfile,kernel)
$(call create_target,kernel)
# create kernel_nopage target
kernel_nopage = $(call totarget,kernel_nopage)
$(kernel_nopage): tools/kernel_nopage.ld
$(kernel_nopage): $(KOBJS)
@echo + ld $@
$(V)$(LD) $(LDFLAGS) -T tools/kernel_nopage.ld -o $@ $(KOBJS)
@$(OBJDUMP) -S $@ > $(call asmfile,kernel_nopage)
@$(OBJDUMP) -t $@ | $(SED) '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $(call symfile,kernel_nopage)
$(call create_target,kernel)
# -------------------------------------------------------------------
# create bootblock
bootfiles = $(call listf_cc,boot)
$(foreach f,$(bootfiles),$(call cc_compile,$(f),$(CC),$(CFLAGS) -Os -nostdinc))
bootblock = $(call totarget,bootblock)
$(bootblock): $(call toobj,boot/bootasm.S) $(call toobj,$(bootfiles)) | $(call totarget,sign)
@echo + ld $@
$(V)$(LD) $(LDFLAGS) -N -T tools/boot.ld $^ -o $(call toobj,bootblock)
@$(OBJDUMP) -S $(call objfile,bootblock) > $(call asmfile,bootblock)
@$(OBJCOPY) -S -O binary $(call objfile,bootblock) $(call outfile,bootblock)
@$(call totarget,sign) $(call outfile,bootblock) $(bootblock)
$(call create_target,bootblock)
# -------------------------------------------------------------------
# create 'sign' tools
$(call add_files_host,tools/sign.c,sign,sign)
$(call create_target_host,sign,sign)
# -------------------------------------------------------------------
# create ucore.img
UCOREIMG := $(call totarget,ucore.img)
$(UCOREIMG): $(kernel) $(bootblock) $(kernel_nopage)
$(V)dd if=/dev/zero of=$@ count=10000
$(V)dd if=$(bootblock) of=$@ conv=notrunc
$(V)dd if=$(kernel) of=$@ seek=1 conv=notrunc
$(call create_target,ucore.img)
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
$(call finish_all)
IGNORE_ALLDEPS = gdb \
clean \
distclean \
grade \
touch \
print-.+ \
handin
ifeq ($(call match,$(MAKECMDGOALS),$(IGNORE_ALLDEPS)),0)
-include $(ALLDEPS)
endif
# files for grade script
targets: $(TARGETS)
.DEFAULT_GOAL := targets
QEMUOPTS = -hda $(UCOREIMG)
.PHONY: qemu qemu-nox gdb debug debug-mon debug-nox
qemu: targets
$(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null
qemu-nox: targets
$(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic
gdb:
$(V)$(GDB) -q -x tools/gdbinit
debug: targets
$(V)$(QEMU) -S -s -parallel stdio $(QEMUOPTS) -serial null
debug-mon: targets
$(V)$(QEMU) -S -s -monitor stdio $(QEMUOPTS) -parallel null -serial null
debug-nox: targets
$(V)$(QEMU) -S -s -serial mon:stdio $(QEMUOPTS) -nographic
.PHONY: grade touch
GRADE_GDB_IN := .gdb.in
GRADE_QEMU_OUT := .qemu.out
HANDIN := lab2-handin.tar.gz
TOUCH_FILES := kern/trap/trap.c
MAKEOPTS := --quiet --no-print-directory
grade:
$(V)$(MAKE) $(MAKEOPTS) clean
$(V)$(SH) tools/grade.sh
touch:
$(V)$(foreach f,$(TOUCH_FILES),$(TOUCH) $(f))
print-%:
@echo $($(shell echo $(patsubst print-%,%,$@) | $(TR) [a-z] [A-Z]))
.PHONY: clean distclean handin tags
clean:
$(V)$(RM) $(GRADE_GDB_IN) $(GRADE_QEMU_OUT) cscope* tags
$(V)$(RM) -r $(OBJDIR) $(BINDIR)
distclean: clean
$(V)$(RM) $(HANDIN)
handin: distclean
$(V)$(TAR) -cf - `find . -type f -o -type d | grep -v '^\.$$' | grep -v '/CVS/' \
| grep -v '/\.git/' | grep -v '/\.svn/' | grep -v "$(HANDIN)"` \
| $(ZIP) > $(HANDIN)
tags:
@echo TAGS ALL
$(V)rm -f cscope.files cscope.in.out cscope.out cscope.po.out tags
$(V)find . -type f -name "*.[chS]" >cscope.files
$(V)cscope -bq
$(V)ctags -L cscope.files
| petronny/ucore_lab | labcodes/lab2/Makefile | Makefile | gpl-2.0 | 7,303 | [
30522,
4013,
3501,
1024,
1027,
1019,
4064,
1024,
1027,
2686,
1024,
1027,
1002,
1006,
4064,
1007,
1002,
1006,
4064,
1007,
18296,
1024,
1027,
1013,
1058,
1024,
1027,
1030,
1001,
3046,
2000,
1999,
7512,
1996,
6149,
1043,
9468,
28139,
2546,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import test from 'ava'
import Vue from 'vue'
import {createRenderer} from 'vue-server-renderer'
import ContentPlaceholder from '../src'
test.cb('ssr', t => {
const rows = [{height: '5px', boxes: [[0, '40px']]}]
const renderer = createRenderer()
const app = new Vue({
template: '<content-placeholder :rows="rows"></content-placeholder>',
components: {ContentPlaceholder},
data: {rows}
})
renderer.renderToString(app, (err, html) => {
t.falsy(err)
t.true(html.includes('data-server-rendered'))
t.end()
})
})
| StevenYuysy/vue-content-placeholder | test/ssr.spec.js | JavaScript | mit | 543 | [
30522,
12324,
3231,
2013,
1005,
10927,
1005,
12324,
24728,
2063,
2013,
1005,
24728,
2063,
1005,
12324,
1063,
3443,
7389,
4063,
2121,
1065,
2013,
1005,
24728,
2063,
1011,
8241,
1011,
17552,
2121,
1005,
12324,
4180,
24759,
10732,
14528,
2013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2010 The University of Reading
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University of Reading, nor the names of the
* authors or contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package uk.ac.rdg.resc.edal.coverage.domain;
import java.util.List;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
/**
* A geospatial/temporal domain: defines the set of points for which a {@link DiscreteCoverage}
* is defined. The domain is comprised of a set of unique domain objects in a
* defined order. The domain therefore has the semantics of both a {@link Set}
* and a {@link List} of domain objects.
* @param <DO> The type of the domain object
* @author Jon
*/
public interface Domain<DO>
{
/**
* Gets the coordinate reference system to which objects in this domain are
* referenced. Returns null if the domain objects cannot be referenced
* to an external coordinate reference system.
* @return the coordinate reference system to which objects in this domain are
* referenced, or null if the domain objects are not externally referenced.
*/
public CoordinateReferenceSystem getCoordinateReferenceSystem();
/**
* Returns the {@link List} of domain objects that comprise this domain.
* @todo There may be issues for large grids if the number of domain objects
* is greater than Integer.MAX_VALUE, as the size of this list will be recorded
* incorrectly. This will only happen for very large domains (e.g. large grids).
*/
public List<DO> getDomainObjects();
/**
* <p>Returns the number of domain objects in the domain.</p>
* <p>This is a long integer because grids can grow very large, beyond the
* range of a 4-byte integer.</p>
*/
public long size();
}
| nansencenter/GreenSeasADC-portlet | docroot/WEB-INF/src/uk/ac/rdg/resc/edal/coverage/domain/Domain.java | Java | gpl-3.0 | 3,145 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1996,
2118,
1997,
3752,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1008,
14080,
1010,
2024,
7936,
3024,
2008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using BasicVector;
using PPMonoGraphics.Components;
using Microsoft.Xna.Framework.Graphics;
using Primal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Primal.Api;
namespace PPMonoGraphics.Systems {
class ScreenSizeUpdater : DrawSystem {
private GraphicsDevice graphicsDevice;
public ScreenSizeUpdater(GraphicsDevice graphicsDevice) {
this.graphicsDevice = graphicsDevice;
}
protected override void AddKeyComponents() {
AddKeyComponent<ScreenSize>();
}
protected override void UpdateEntity(IEntity entity, double elapsedMs) {
Vector standardScreenSize = ScreenSize.NORMAL_SCREEN_SIZE;
Vector currentScreenSize = new Vector(graphicsDevice.Viewport.Bounds.Width,
graphicsDevice.Viewport.Bounds.Height);
entity.Get<ScreenSize>().CurrentScreenSize = currentScreenSize;
double standardRatio = standardScreenSize.X / standardScreenSize.Y;
double currentRatio = currentScreenSize.X / currentScreenSize.Y;
if (currentRatio > standardRatio) {
// horizontal offset.
double scale = DetermineScale(standardScreenSize.Y, currentScreenSize.Y);
double horOffset = (currentScreenSize.X - standardScreenSize.X * scale)/2;
entity.Get<ScreenSize>().Scale = scale;
entity.Get<ScreenSize>().Offset = new Vector(horOffset, 0);
}
else if (currentRatio < standardRatio) {
// vertical offset.
double scale = DetermineScale(standardScreenSize.X, currentScreenSize.X);
double verOffset = (currentScreenSize.Y - standardScreenSize.Y * scale) / 2;
entity.Get<ScreenSize>().Scale = scale;
entity.Get<ScreenSize>().Offset = new Vector(0, verOffset);
}
else {
//no offset
double scale = DetermineScale(standardScreenSize.Y, currentScreenSize.Y);
entity.Get<ScreenSize>().Scale = scale;
entity.Get<ScreenSize>().Offset = new Vector(0, 0);
}
}
private double DetermineScale(double standard, double current) {
return current / standard;
}
}
}
| styxtwo/PP-Mono-Graphics | Main/Systems/ScreenSizeUpdater.cs | C# | mit | 2,383 | [
30522,
2478,
3937,
3726,
16761,
1025,
2478,
4903,
8202,
13705,
2015,
1012,
6177,
1025,
2478,
7513,
1012,
1060,
2532,
1012,
7705,
1012,
8389,
1025,
2478,
22289,
1025,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* File containing the SectionList parser class
*
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/gnu_gpl GNU General Public License v2.0
* @version 2012.9
*/
namespace eZ\Publish\Core\REST\Client\Input\Parser;
use eZ\Publish\Core\REST\Common\Input\Parser;
use eZ\Publish\Core\REST\Common\Input\ParsingDispatcher;
/**
* Parser for SectionList
*/
class SectionList extends Parser
{
/**
* Parse input structure
*
* @param array $data
* @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
* @return \eZ\Publish\API\Repository\Values\Content\Section[]
* @todo Error handling
*/
public function parse( array $data, ParsingDispatcher $parsingDispatcher )
{
$sections = array();
foreach ( $data['Section'] as $rawSectionData )
{
$sections[] = $parsingDispatcher->parse(
$rawSectionData,
$rawSectionData['_media-type']
);
}
return $sections;
}
}
| davidrousse/ezpuplish | vendor/ezsystems/ezpublish/eZ/Publish/Core/REST/Client/Input/Parser/SectionList.php | PHP | gpl-2.0 | 1,090 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
5371,
4820,
1996,
2930,
9863,
11968,
8043,
2465,
1008,
1008,
1030,
9385,
9385,
1006,
1039,
1007,
2639,
1011,
2262,
1041,
2480,
3001,
2004,
1012,
2035,
2916,
9235,
1012,
1008,
1030,
6105,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2008 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.
// Written in NSPR style to also be suitable for adding to the NSS demo suite
/* memio is a simple NSPR I/O layer that lets you decouple NSS from
* the real network. It's rather like openssl's memory bio,
* and is useful when your app absolutely, positively doesn't
* want to let NSS do its own networking.
*/
#include <stdlib.h>
#include <string.h>
#include <prerror.h>
#include <prinit.h>
#include <prlog.h>
#include "nss_memio.h"
/*--------------- private memio types -----------------------*/
/*----------------------------------------------------------------------
Simple private circular buffer class. Size cannot be changed once allocated.
----------------------------------------------------------------------*/
struct memio_buffer {
int head; /* where to take next byte out of buf */
int tail; /* where to put next byte into buf */
int bufsize; /* number of bytes allocated to buf */
/* TODO(port): error handling is pessimistic right now.
* Once an error is set, the socket is considered broken
* (PR_WOULD_BLOCK_ERROR not included).
*/
PRErrorCode last_err;
char *buf;
};
/* The 'secret' field of a PRFileDesc created by memio_CreateIOLayer points
* to one of these.
* In the public header, we use struct memio_Private as a typesafe alias
* for this. This causes a few ugly typecasts in the private file, but
* seems safer.
*/
struct PRFilePrivate {
/* read requests are satisfied from this buffer */
struct memio_buffer readbuf;
/* write requests are satisfied from this buffer */
struct memio_buffer writebuf;
/* SSL needs to know socket peer's name */
PRNetAddr peername;
/* if set, empty I/O returns EOF instead of EWOULDBLOCK */
int eof;
};
/*--------------- private memio_buffer functions ---------------------*/
/* Forward declarations. */
/* Allocate a memio_buffer of given size. */
static void memio_buffer_new(struct memio_buffer *mb, int size);
/* Deallocate a memio_buffer allocated by memio_buffer_new. */
static void memio_buffer_destroy(struct memio_buffer *mb);
/* How many bytes can be read out of the buffer without wrapping */
static int memio_buffer_used_contiguous(const struct memio_buffer *mb);
/* How many bytes exist after the wrap? */
static int memio_buffer_wrapped_bytes(const struct memio_buffer *mb);
/* How many bytes can be written into the buffer without wrapping */
static int memio_buffer_unused_contiguous(const struct memio_buffer *mb);
/* Write n bytes into the buffer. Returns number of bytes written. */
static int memio_buffer_put(struct memio_buffer *mb, const char *buf, int n);
/* Read n bytes from the buffer. Returns number of bytes read. */
static int memio_buffer_get(struct memio_buffer *mb, char *buf, int n);
/* Allocate a memio_buffer of given size. */
static void memio_buffer_new(struct memio_buffer *mb, int size)
{
mb->head = 0;
mb->tail = 0;
mb->bufsize = size;
mb->buf = malloc(size);
}
/* Deallocate a memio_buffer allocated by memio_buffer_new. */
static void memio_buffer_destroy(struct memio_buffer *mb)
{
free(mb->buf);
mb->buf = NULL;
mb->head = 0;
mb->tail = 0;
}
/* How many bytes can be read out of the buffer without wrapping */
static int memio_buffer_used_contiguous(const struct memio_buffer *mb)
{
return (((mb->tail >= mb->head) ? mb->tail : mb->bufsize) - mb->head);
}
/* How many bytes exist after the wrap? */
static int memio_buffer_wrapped_bytes(const struct memio_buffer *mb)
{
return (mb->tail >= mb->head) ? 0 : mb->tail;
}
/* How many bytes can be written into the buffer without wrapping */
static int memio_buffer_unused_contiguous(const struct memio_buffer *mb)
{
if (mb->head > mb->tail) return mb->head - mb->tail - 1;
return mb->bufsize - mb->tail - (mb->head == 0);
}
/* Write n bytes into the buffer. Returns number of bytes written. */
static int memio_buffer_put(struct memio_buffer *mb, const char *buf, int n)
{
int len;
int transferred = 0;
/* Handle part before wrap */
len = PR_MIN(n, memio_buffer_unused_contiguous(mb));
if (len > 0) {
/* Buffer not full */
memcpy(&mb->buf[mb->tail], buf, len);
mb->tail += len;
if (mb->tail == mb->bufsize)
mb->tail = 0;
n -= len;
buf += len;
transferred += len;
/* Handle part after wrap */
len = PR_MIN(n, memio_buffer_unused_contiguous(mb));
if (len > 0) {
/* Output buffer still not full, input buffer still not empty */
memcpy(&mb->buf[mb->tail], buf, len);
mb->tail += len;
if (mb->tail == mb->bufsize)
mb->tail = 0;
transferred += len;
}
}
return transferred;
}
/* Read n bytes from the buffer. Returns number of bytes read. */
static int memio_buffer_get(struct memio_buffer *mb, char *buf, int n)
{
int len;
int transferred = 0;
/* Handle part before wrap */
len = PR_MIN(n, memio_buffer_used_contiguous(mb));
if (len) {
memcpy(buf, &mb->buf[mb->head], len);
mb->head += len;
if (mb->head == mb->bufsize)
mb->head = 0;
n -= len;
buf += len;
transferred += len;
/* Handle part after wrap */
len = PR_MIN(n, memio_buffer_used_contiguous(mb));
if (len) {
memcpy(buf, &mb->buf[mb->head], len);
mb->head += len;
if (mb->head == mb->bufsize)
mb->head = 0;
transferred += len;
}
}
return transferred;
}
/*--------------- private memio functions -----------------------*/
static PRStatus PR_CALLBACK memio_Close(PRFileDesc *fd)
{
struct PRFilePrivate *secret = fd->secret;
memio_buffer_destroy(&secret->readbuf);
memio_buffer_destroy(&secret->writebuf);
free(secret);
fd->dtor(fd);
return PR_SUCCESS;
}
static PRStatus PR_CALLBACK memio_Shutdown(PRFileDesc *fd, PRIntn how)
{
/* TODO: pass shutdown status to app somehow */
return PR_SUCCESS;
}
/* If there was a network error in the past taking bytes
* out of the buffer, return it to the next call that
* tries to read from an empty buffer.
*/
static int PR_CALLBACK memio_Recv(PRFileDesc *fd, void *buf, PRInt32 len,
PRIntn flags, PRIntervalTime timeout)
{
struct PRFilePrivate *secret;
struct memio_buffer *mb;
int rv;
if (flags) {
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return -1;
}
secret = fd->secret;
mb = &secret->readbuf;
PR_ASSERT(mb->bufsize);
rv = memio_buffer_get(mb, buf, len);
if (rv == 0 && !secret->eof) {
if (mb->last_err)
PR_SetError(mb->last_err, 0);
else
PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
return -1;
}
return rv;
}
static int PR_CALLBACK memio_Read(PRFileDesc *fd, void *buf, PRInt32 len)
{
/* pull bytes from buffer */
return memio_Recv(fd, buf, len, 0, PR_INTERVAL_NO_TIMEOUT);
}
static int PR_CALLBACK memio_Send(PRFileDesc *fd, const void *buf, PRInt32 len,
PRIntn flags, PRIntervalTime timeout)
{
struct PRFilePrivate *secret;
struct memio_buffer *mb;
int rv;
secret = fd->secret;
mb = &secret->writebuf;
PR_ASSERT(mb->bufsize);
if (mb->last_err) {
PR_SetError(mb->last_err, 0);
return -1;
}
rv = memio_buffer_put(mb, buf, len);
if (rv == 0) {
PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
return -1;
}
return rv;
}
static int PR_CALLBACK memio_Write(PRFileDesc *fd, const void *buf, PRInt32 len)
{
/* append bytes to buffer */
return memio_Send(fd, buf, len, 0, PR_INTERVAL_NO_TIMEOUT);
}
static PRStatus PR_CALLBACK memio_GetPeerName(PRFileDesc *fd, PRNetAddr *addr)
{
/* TODO: fail if memio_SetPeerName has not been called */
struct PRFilePrivate *secret = fd->secret;
*addr = secret->peername;
return PR_SUCCESS;
}
static PRStatus memio_GetSocketOption(PRFileDesc *fd, PRSocketOptionData *data)
{
/*
* Even in the original version for real tcp sockets,
* PR_SockOpt_Nonblocking is a special case that does not
* translate to a getsockopt() call
*/
if (PR_SockOpt_Nonblocking == data->option) {
data->value.non_blocking = PR_TRUE;
return PR_SUCCESS;
}
PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0);
return PR_FAILURE;
}
/*--------------- private memio data -----------------------*/
/*
* Implement just the bare minimum number of methods needed to make ssl happy.
*
* Oddly, PR_Recv calls ssl_Recv calls ssl_SocketIsBlocking calls
* PR_GetSocketOption, so we have to provide an implementation of
* PR_GetSocketOption that just says "I'm nonblocking".
*/
static struct PRIOMethods memio_layer_methods = {
PR_DESC_LAYERED,
memio_Close,
memio_Read,
memio_Write,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
memio_Shutdown,
memio_Recv,
memio_Send,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
memio_GetPeerName,
NULL,
NULL,
memio_GetSocketOption,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
static PRDescIdentity memio_identity = PR_INVALID_IO_LAYER;
static PRStatus memio_InitializeLayerName(void)
{
memio_identity = PR_GetUniqueIdentity("memio");
return PR_SUCCESS;
}
/*--------------- public memio functions -----------------------*/
PRFileDesc *memio_CreateIOLayer(int readbufsize, int writebufsize)
{
PRFileDesc *fd;
struct PRFilePrivate *secret;
static PRCallOnceType once;
PR_CallOnce(&once, memio_InitializeLayerName);
fd = PR_CreateIOLayerStub(memio_identity, &memio_layer_methods);
secret = malloc(sizeof(struct PRFilePrivate));
memset(secret, 0, sizeof(*secret));
memio_buffer_new(&secret->readbuf, readbufsize);
memio_buffer_new(&secret->writebuf, writebufsize);
fd->secret = secret;
return fd;
}
void memio_SetPeerName(PRFileDesc *fd, const PRNetAddr *peername)
{
PRFileDesc *memiofd = PR_GetIdentitiesLayer(fd, memio_identity);
struct PRFilePrivate *secret = memiofd->secret;
secret->peername = *peername;
}
memio_Private *memio_GetSecret(PRFileDesc *fd)
{
PRFileDesc *memiofd = PR_GetIdentitiesLayer(fd, memio_identity);
struct PRFilePrivate *secret = memiofd->secret;
return (memio_Private *)secret;
}
int memio_GetReadParams(memio_Private *secret, char **buf)
{
struct memio_buffer* mb = &((PRFilePrivate *)secret)->readbuf;
PR_ASSERT(mb->bufsize);
*buf = &mb->buf[mb->tail];
return memio_buffer_unused_contiguous(mb);
}
void memio_PutReadResult(memio_Private *secret, int bytes_read)
{
struct memio_buffer* mb = &((PRFilePrivate *)secret)->readbuf;
PR_ASSERT(mb->bufsize);
if (bytes_read > 0) {
mb->tail += bytes_read;
if (mb->tail == mb->bufsize)
mb->tail = 0;
} else if (bytes_read == 0) {
/* Record EOF condition and report to caller when buffer runs dry */
((PRFilePrivate *)secret)->eof = PR_TRUE;
} else /* if (bytes_read < 0) */ {
mb->last_err = bytes_read;
}
}
void memio_GetWriteParams(memio_Private *secret,
const char **buf1, unsigned int *len1,
const char **buf2, unsigned int *len2)
{
struct memio_buffer* mb = &((PRFilePrivate *)secret)->writebuf;
PR_ASSERT(mb->bufsize);
*buf1 = &mb->buf[mb->head];
*len1 = memio_buffer_used_contiguous(mb);
*buf2 = mb->buf;
*len2 = memio_buffer_wrapped_bytes(mb);
}
void memio_PutWriteResult(memio_Private *secret, int bytes_written)
{
struct memio_buffer* mb = &((PRFilePrivate *)secret)->writebuf;
PR_ASSERT(mb->bufsize);
if (bytes_written > 0) {
mb->head += bytes_written;
if (mb->head >= mb->bufsize)
mb->head -= mb->bufsize;
} else if (bytes_written < 0) {
mb->last_err = bytes_written;
}
}
/*--------------- private memio_buffer self-test -----------------*/
/* Even a trivial unit test is very helpful when doing circular buffers. */
/*#define TRIVIAL_SELF_TEST*/
#ifdef TRIVIAL_SELF_TEST
#include <stdio.h>
#define TEST_BUFLEN 7
#define CHECKEQ(a, b) { \
if ((a) != (b)) { \
printf("%d != %d, Test failed line %d\n", a, b, __LINE__); \
exit(1); \
} \
}
int main()
{
struct memio_buffer mb;
char buf[100];
int i;
memio_buffer_new(&mb, TEST_BUFLEN);
CHECKEQ(memio_buffer_unused_contiguous(&mb), TEST_BUFLEN-1);
CHECKEQ(memio_buffer_used_contiguous(&mb), 0);
CHECKEQ(memio_buffer_put(&mb, "howdy", 5), 5);
CHECKEQ(memio_buffer_unused_contiguous(&mb), TEST_BUFLEN-1-5);
CHECKEQ(memio_buffer_used_contiguous(&mb), 5);
CHECKEQ(memio_buffer_wrapped_bytes(&mb), 0);
CHECKEQ(memio_buffer_put(&mb, "!", 1), 1);
CHECKEQ(memio_buffer_unused_contiguous(&mb), 0);
CHECKEQ(memio_buffer_used_contiguous(&mb), 6);
CHECKEQ(memio_buffer_wrapped_bytes(&mb), 0);
CHECKEQ(memio_buffer_get(&mb, buf, 6), 6);
CHECKEQ(memcmp(buf, "howdy!", 6), 0);
CHECKEQ(memio_buffer_unused_contiguous(&mb), 1);
CHECKEQ(memio_buffer_used_contiguous(&mb), 0);
CHECKEQ(memio_buffer_put(&mb, "01234", 5), 5);
CHECKEQ(memio_buffer_used_contiguous(&mb), 1);
CHECKEQ(memio_buffer_wrapped_bytes(&mb), 4);
CHECKEQ(memio_buffer_unused_contiguous(&mb), TEST_BUFLEN-1-5);
CHECKEQ(memio_buffer_put(&mb, "5", 1), 1);
CHECKEQ(memio_buffer_unused_contiguous(&mb), 0);
CHECKEQ(memio_buffer_used_contiguous(&mb), 1);
/* TODO: add more cases */
printf("Test passed\n");
exit(0);
}
#endif
| leighpauls/k2cro4 | net/base/nss_memio.c | C | bsd-3-clause | 14,011 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2263,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<TS language="es_CL" version="2.1">
<context>
<name>AddressBookPage</name>
<message>
<source>Right-click to edit address or label</source>
<translation>Haga clic para editar la dirección o etiqueta</translation>
</message>
<message>
<source>Create a new address</source>
<translation>Crea una nueva dirección</translation>
</message>
<message>
<source>&New</source>
<translation>y nueva</translation>
</message>
<message>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Copia la dirección seleccionada al portapapeles</translation>
</message>
<message>
<source>&Copy</source>
<translation>y copiar</translation>
</message>
<message>
<source>C&lose</source>
<translation>C y perder</translation>
</message>
<message>
<source>Delete the currently selected address from the list</source>
<translation>Eliminar la dirección seleccionada de la lista</translation>
</message>
<message>
<source>Export the data in the current tab to a file</source>
<translation>Exportar los datos de la pestaña actual a un archivo</translation>
</message>
<message>
<source>&Export</source>
<translation>y exportar</translation>
</message>
<message>
<source>&Delete</source>
<translation>&Borrar</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<source>Enter passphrase</source>
<translation>Introduce contraseña actual </translation>
</message>
<message>
<source>New passphrase</source>
<translation>Nueva contraseña</translation>
</message>
<message>
<source>Repeat new passphrase</source>
<translation>Repite nueva contraseña</translation>
</message>
</context>
<context>
<name>BanTableModel</name>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<source>Sign &message...</source>
<translation>Firmar &Mensaje...</translation>
</message>
<message>
<source>Synchronizing with network...</source>
<translation>Sincronizando con la red...</translation>
</message>
<message>
<source>&Overview</source>
<translation>&Vista general</translation>
</message>
<message>
<source>Show general overview of wallet</source>
<translation>Muestra una vista general de la billetera</translation>
</message>
<message>
<source>&Transactions</source>
<translation>&Transacciones</translation>
</message>
<message>
<source>Browse transaction history</source>
<translation>Explora el historial de transacciónes</translation>
</message>
<message>
<source>E&xit</source>
<translation>&Salir</translation>
</message>
<message>
<source>Quit application</source>
<translation>Salir del programa</translation>
</message>
<message>
<source>&About %1</source>
<translation>S&obre %1</translation>
</message>
<message>
<source>About &Qt</source>
<translation>Acerca de</translation>
</message>
<message>
<source>Show information about Qt</source>
<translation>Mostrar Información sobre Qt</translation>
</message>
<message>
<source>&Options...</source>
<translation>&Opciones</translation>
</message>
<message>
<source>&Encrypt Wallet...</source>
<translation>&Codificar la billetera...</translation>
</message>
<message>
<source>&Backup Wallet...</source>
<translation>&Respaldar billetera...</translation>
</message>
<message>
<source>&Change Passphrase...</source>
<translation>&Cambiar la contraseña...</translation>
</message>
<message>
<source>&Sending addresses...</source>
<translation>Mandando direcciones</translation>
</message>
<message>
<source>&Receiving addresses...</source>
<translation>Recibiendo direcciones</translation>
</message>
<message>
<source>Open &URI...</source>
<translation>Abrir y url...</translation>
</message>
<message>
<source>Reindexing blocks on disk...</source>
<translation>Cargando el index de bloques...</translation>
</message>
<message>
<source>Send coins to a Chancoin address</source>
<translation>Enviar monedas a una dirección chancoin</translation>
</message>
<message>
<source>Backup wallet to another location</source>
<translation>Respaldar billetera en otra ubicación</translation>
</message>
<message>
<source>Change the passphrase used for wallet encryption</source>
<translation>Cambiar la contraseña utilizada para la codificación de la billetera</translation>
</message>
<message>
<source>&Debug window</source>
<translation>Ventana &Debug</translation>
</message>
<message>
<source>Open debugging and diagnostic console</source>
<translation>Abre consola de depuración y diagnóstico</translation>
</message>
<message>
<source>&Verify message...</source>
<translation>Verificar mensaje....</translation>
</message>
<message>
<source>Chancoin</source>
<translation>Chancoin</translation>
</message>
<message>
<source>Wallet</source>
<translation>Cartera</translation>
</message>
<message>
<source>&Send</source>
<translation>&Envía</translation>
</message>
<message>
<source>&Receive</source>
<translation>y recibir</translation>
</message>
<message>
<source>&Show / Hide</source>
<translation>&Mostrar/Ocultar</translation>
</message>
<message>
<source>Sign messages with your Chancoin addresses to prove you own them</source>
<translation>Firmar un mensaje para provar que usted es dueño de esta dirección</translation>
</message>
<message>
<source>&File</source>
<translation>&Archivo</translation>
</message>
<message>
<source>&Settings</source>
<translation>&Configuración</translation>
</message>
<message>
<source>&Help</source>
<translation>&Ayuda</translation>
</message>
<message>
<source>Tabs toolbar</source>
<translation>Barra de pestañas</translation>
</message>
<message>
<source>Request payments (generates QR codes and chancoin: URIs)</source>
<translation>Pide pagos (genera codigos QR and chancoin: URls)</translation>
</message>
<message>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<source>Warning</source>
<translation>Atención</translation>
</message>
<message>
<source>Information</source>
<translation>Información</translation>
</message>
<message>
<source>Up to date</source>
<translation>Actualizado</translation>
</message>
<message>
<source>Catching up...</source>
<translation>Recuperando...</translation>
</message>
<message>
<source>Sent transaction</source>
<translation>Transacción enviada</translation>
</message>
<message>
<source>Incoming transaction</source>
<translation>Transacción entrante</translation>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>La billetera esta <b>codificada</b> y actualmente <b>desbloqueda</b></translation>
</message>
<message>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>La billetera esta <b>codificada</b> y actualmente <b>bloqueda</b></translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<source>Amount:</source>
<translation>Cantidad:</translation>
</message>
<message>
<source>Fee:</source>
<translation>comisión:
</translation>
</message>
<message>
<source>Amount</source>
<translation>Cantidad</translation>
</message>
<message>
<source>Date</source>
<translation>Fecha</translation>
</message>
<message>
<source>Confirmations</source>
<translation>Confirmaciones</translation>
</message>
<message>
<source>Confirmed</source>
<translation>Confirmado</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<source>Edit Address</source>
<translation>Editar dirección</translation>
</message>
<message>
<source>&Label</source>
<translation>&Etiqueta</translation>
</message>
<message>
<source>&Address</source>
<translation>&Dirección</translation>
</message>
</context>
<context>
<name>FreespaceChecker</name>
<message>
<source>name</source>
<translation>Nombre</translation>
</message>
</context>
<context>
<name>HelpMessageDialog</name>
<message>
<source>version</source>
<translation>versión</translation>
</message>
<message>
<source>Command-line options</source>
<translation>opciones de linea de comando</translation>
</message>
<message>
<source>Usage:</source>
<translation>Uso:</translation>
</message>
</context>
<context>
<name>Intro</name>
<message>
<source>Welcome</source>
<translation>bienvenido</translation>
</message>
<message>
<source>Error</source>
<translation>Error</translation>
</message>
</context>
<context>
<name>ModalOverlay</name>
<message>
<source>Form</source>
<translation>Formulario</translation>
</message>
</context>
<context>
<name>OpenURIDialog</name>
<message>
<source>URI:</source>
<translation>url:</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<source>Options</source>
<translation>Opciones</translation>
</message>
<message>
<source>&Main</source>
<translation>&Principal</translation>
</message>
<message>
<source>Reset all client options to default.</source>
<translation>Reestablece todas las opciones.</translation>
</message>
<message>
<source>&Network</source>
<translation>&Red</translation>
</message>
<message>
<source>W&allet</source>
<translation>Cartera</translation>
</message>
<message>
<source>Expert</source>
<translation>experto</translation>
</message>
<message>
<source>Automatically open the Chancoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Abre automáticamente el puerto del cliente Chancoin en el router. Esto funciona solo cuando tu router es compatible con UPnP y está habilitado.</translation>
</message>
<message>
<source>Map port using &UPnP</source>
<translation>Direcciona el puerto usando &UPnP</translation>
</message>
<message>
<source>Proxy &IP:</source>
<translation>&IP Proxy:</translation>
</message>
<message>
<source>&Port:</source>
<translation>&Puerto:</translation>
</message>
<message>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Puerto del servidor proxy (ej. 9050)</translation>
</message>
<message>
<source>&Window</source>
<translation>y windows
</translation>
</message>
<message>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Muestra solo un ícono en la bandeja después de minimizar la ventana</translation>
</message>
<message>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimiza a la bandeja en vez de la barra de tareas</translation>
</message>
<message>
<source>M&inimize on close</source>
<translation>M&inimiza a la bandeja al cerrar</translation>
</message>
<message>
<source>&Display</source>
<translation>&Mostrado</translation>
</message>
<message>
<source>&Unit to show amounts in:</source>
<translation>&Unidad en la que mostrar cantitades:</translation>
</message>
<message>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Elige la subdivisión por defecto para mostrar cantidaded en la interfaz cuando se envien monedas</translation>
</message>
<message>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<source>&Cancel</source>
<translation>&Cancela</translation>
</message>
<message>
<source>default</source>
<translation>predeterminado</translation>
</message>
<message>
<source>Confirm options reset</source>
<translation>Confirmar reestablecimiento de las opciones</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<source>Form</source>
<translation>Formulario</translation>
</message>
<message>
<source>Total:</source>
<translation>Total:</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
</context>
<context>
<name>PeerTableModel</name>
</context>
<context>
<name>QObject</name>
<message>
<source>Amount</source>
<translation>Cantidad</translation>
</message>
<message>
<source>N/A</source>
<translation>N/A</translation>
</message>
<message>
<source>%1 and %2</source>
<translation>%1 y %2</translation>
</message>
</context>
<context>
<name>QObject::QObject</name>
</context>
<context>
<name>QRImageWidget</name>
</context>
<context>
<name>RPCConsole</name>
<message>
<source>N/A</source>
<translation>N/A</translation>
</message>
<message>
<source>Client version</source>
<translation>Versión del Cliente</translation>
</message>
<message>
<source>&Information</source>
<translation>&Información</translation>
</message>
<message>
<source>Debug window</source>
<translation>Ventana Debug</translation>
</message>
<message>
<source>General</source>
<translation>General</translation>
</message>
<message>
<source>Startup time</source>
<translation>Tiempo de inicio</translation>
</message>
<message>
<source>Network</source>
<translation>Red</translation>
</message>
<message>
<source>Name</source>
<translation>Nombre</translation>
</message>
<message>
<source>Number of connections</source>
<translation>Número de conexiones</translation>
</message>
<message>
<source>Block chain</source>
<translation>Bloquea cadena</translation>
</message>
<message>
<source>Version</source>
<translation>version
</translation>
</message>
<message>
<source>&Open</source>
<translation>&Abrir</translation>
</message>
<message>
<source>&Console</source>
<translation>&Consola</translation>
</message>
<message>
<source>Totals</source>
<translation>Total:</translation>
</message>
<message>
<source>Clear console</source>
<translation>Limpiar Consola</translation>
</message>
</context>
<context>
<name>ReceiveCoinsDialog</name>
<message>
<source>&Amount:</source>
<translation>Cantidad:</translation>
</message>
<message>
<source>&Label:</source>
<translation>&Etiqueta:</translation>
</message>
<message>
<source>&Message:</source>
<translation>&mensaje</translation>
</message>
</context>
<context>
<name>ReceiveRequestDialog</name>
<message>
<source>QR Code</source>
<translation>Código QR </translation>
</message>
<message>
<source>Copy &Address</source>
<translation>&Copia dirección</translation>
</message>
<message>
<source>&Save Image...</source>
<translation>Guardar imagen...</translation>
</message>
</context>
<context>
<name>RecentRequestsTableModel</name>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<source>Send Coins</source>
<translation>Enviar monedas</translation>
</message>
<message>
<source>Insufficient funds!</source>
<translation>Fondos insuficientes</translation>
</message>
<message>
<source>Amount:</source>
<translation>Cantidad:</translation>
</message>
<message>
<source>Fee:</source>
<translation>comisión:
</translation>
</message>
<message>
<source>Transaction Fee:</source>
<translation>Comisión transacción:</translation>
</message>
<message>
<source>normal</source>
<translation>normal</translation>
</message>
<message>
<source>fast</source>
<translation>rapido</translation>
</message>
<message>
<source>Send to multiple recipients at once</source>
<translation>Enviar a múltiples destinatarios</translation>
</message>
<message>
<source>Add &Recipient</source>
<translation>&Agrega destinatario</translation>
</message>
<message>
<source>Clear &All</source>
<translation>&Borra todos</translation>
</message>
<message>
<source>Balance:</source>
<translation>Balance:</translation>
</message>
<message>
<source>Confirm the send action</source>
<translation>Confirma el envio</translation>
</message>
<message>
<source>S&end</source>
<translation>&Envía</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<source>A&mount:</source>
<translation>Cantidad:</translation>
</message>
<message>
<source>Pay &To:</source>
<translation>&Pagar a:</translation>
</message>
<message>
<source>&Label:</source>
<translation>&Etiqueta:</translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<source>Paste address from clipboard</source>
<translation>Pega dirección desde portapapeles</translation>
</message>
<message>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<source>Message:</source>
<translation>Mensaje:</translation>
</message>
<message>
<source>Pay To:</source>
<translation>Pagar a:</translation>
</message>
</context>
<context>
<name>SendConfirmationDialog</name>
</context>
<context>
<name>ShutdownWindow</name>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<source>&Sign Message</source>
<translation>&Firmar Mensaje</translation>
</message>
<message>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<source>Paste address from clipboard</source>
<translation>Pega dirección desde portapapeles</translation>
</message>
<message>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<source>Enter the message you want to sign here</source>
<translation>Escriba el mensaje que desea firmar</translation>
</message>
<message>
<source>Signature</source>
<translation>Firma</translation>
</message>
<message>
<source>Sign the message to prove you own this Chancoin address</source>
<translation>Firmar un mensjage para probar que usted es dueño de esta dirección</translation>
</message>
<message>
<source>Sign &Message</source>
<translation>Firmar Mensaje</translation>
</message>
<message>
<source>Clear &All</source>
<translation>&Borra todos</translation>
</message>
<message>
<source>&Verify Message</source>
<translation>&Firmar Mensaje</translation>
</message>
<message>
<source>Verify &Message</source>
<translation>&Firmar Mensaje</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<source>[testnet]</source>
<translation>[red-de-pruebas]</translation>
</message>
</context>
<context>
<name>TrafficGraphWidget</name>
<message>
<source>KB/s</source>
<translation>KB/s</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<source>This pane shows a detailed description of the transaction</source>
<translation>Esta ventana muestra información detallada sobre la transacción</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
</context>
<context>
<name>TransactionView</name>
</context>
<context>
<name>UnitDisplayStatusBarControl</name>
</context>
<context>
<name>WalletFrame</name>
</context>
<context>
<name>WalletModel</name>
</context>
<context>
<name>WalletView</name>
</context>
<context>
<name>bitcoin-core</name>
<message>
<source>Options:</source>
<translation>Opciones:
</translation>
</message>
<message>
<source>Specify data directory</source>
<translation>Especifica directorio para los datos
</translation>
</message>
<message>
<source>Accept command line and JSON-RPC commands</source>
<translation>Aceptar comandos consola y JSON-RPC
</translation>
</message>
<message>
<source>Run in the background as a daemon and accept commands</source>
<translation>Correr como demonio y acepta comandos
</translation>
</message>
<message>
<source>Chancoin Core</source>
<translation>chancoin core</translation>
</message>
<message>
<source>Error loading block database</source>
<translation>Error cargando blkindex.dat</translation>
</message>
<message>
<source>Error: Disk space is low!</source>
<translation>Atención: Poco espacio en el disco duro</translation>
</message>
<message>
<source>Information</source>
<translation>Información</translation>
</message>
<message>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Enviar informacion de seguimiento a la consola en vez del archivo debug.log</translation>
</message>
<message>
<source>Username for JSON-RPC connections</source>
<translation>Usuario para las conexiones JSON-RPC
</translation>
</message>
<message>
<source>Warning</source>
<translation>Atención</translation>
</message>
<message>
<source>Password for JSON-RPC connections</source>
<translation>Contraseña para las conexiones JSON-RPC
</translation>
</message>
<message>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Permite búsqueda DNS para addnode y connect
</translation>
</message>
<message>
<source>Loading addresses...</source>
<translation>Cargando direcciónes...</translation>
</message>
<message>
<source>Invalid -proxy address: '%s'</source>
<translation>Dirección -proxy invalida: '%s'</translation>
</message>
<message>
<source>Insufficient funds</source>
<translation>Fondos insuficientes</translation>
</message>
<message>
<source>Loading block index...</source>
<translation>Cargando el index de bloques...</translation>
</message>
<message>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Agrega un nodo para conectarse and attempt to keep the connection open</translation>
</message>
<message>
<source>Loading wallet...</source>
<translation>Cargando cartera...</translation>
</message>
<message>
<source>Cannot downgrade wallet</source>
<translation>No es posible desactualizar la billetera</translation>
</message>
<message>
<source>Cannot write default address</source>
<translation>No se pudo escribir la dirección por defecto</translation>
</message>
<message>
<source>Rescanning...</source>
<translation>Rescaneando...</translation>
</message>
<message>
<source>Done loading</source>
<translation>Carga completa</translation>
</message>
<message>
<source>Error</source>
<translation>Error</translation>
</message>
</context>
</TS> | Chancoin-core/CHANCOIN | src/qt/locale/bitcoin_es_CL.ts | TypeScript | mit | 26,415 | [
30522,
1026,
24529,
2653,
1027,
1000,
9686,
1035,
18856,
1000,
2544,
1027,
1000,
1016,
1012,
1015,
1000,
1028,
1026,
6123,
1028,
1026,
2171,
1028,
4769,
8654,
13704,
1026,
1013,
2171,
1028,
1026,
4471,
1028,
1026,
3120,
1028,
2157,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2021 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.
*/
package com.google.cloud.compute.v1.stub;
import com.google.api.core.BetaApi;
import com.google.api.gax.httpjson.HttpJsonCallSettings;
import com.google.api.gax.httpjson.HttpJsonCallableFactory;
import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
import com.google.api.gax.rpc.BatchingCallSettings;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.ServerStreamingCallSettings;
import com.google.api.gax.rpc.ServerStreamingCallable;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.longrunning.Operation;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* REST callable factory implementation for the RegionDiskTypes service API.
*
* <p>This class is for advanced usage.
*/
@Generated("by gapic-generator-java")
@BetaApi
public class HttpJsonRegionDiskTypesCallableFactory
implements HttpJsonStubCallableFactory<Operation, OperationsStub> {
@Override
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
UnaryCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createUnaryCallable(
httpJsonCallSettings, callSettings, clientContext);
}
@Override
public <RequestT, ResponseT, PagedListResponseT>
UnaryCallable<RequestT, PagedListResponseT> createPagedCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
PagedCallSettings<RequestT, ResponseT, PagedListResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createPagedCallable(
httpJsonCallSettings, callSettings, clientContext);
}
@Override
public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
BatchingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createBatchingCallable(
httpJsonCallSettings, callSettings, clientContext);
}
@BetaApi(
"The surface for long-running operations is not stable yet and may change in the future.")
@Override
public <RequestT, ResponseT, MetadataT>
OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable(
HttpJsonCallSettings<RequestT, Operation> httpJsonCallSettings,
OperationCallSettings<RequestT, ResponseT, MetadataT> callSettings,
ClientContext clientContext,
OperationsStub operationsStub) {
UnaryCallable<RequestT, Operation> innerCallable =
HttpJsonCallableFactory.createBaseUnaryCallable(
httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
HttpJsonOperationSnapshotCallable<RequestT, Operation> initialCallable =
new HttpJsonOperationSnapshotCallable<RequestT, Operation>(
innerCallable,
httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
return HttpJsonCallableFactory.createOperationCallable(
callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
}
@Override
public <RequestT, ResponseT>
ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable(
HttpJsonCallSettings<RequestT, ResponseT> httpJsonCallSettings,
ServerStreamingCallSettings<RequestT, ResponseT> callSettings,
ClientContext clientContext) {
return HttpJsonCallableFactory.createServerStreamingCallable(
httpJsonCallSettings, callSettings, clientContext);
}
}
| googleapis/java-compute | google-cloud-compute/src/main/java/com/google/cloud/compute/v1/stub/HttpJsonRegionDiskTypesCallableFactory.java | Java | apache-2.0 | 4,644 | [
30522,
1013,
1008,
1008,
9385,
25682,
8224,
11775,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
return [
'title' => [
'dashboard' => 'Рабочий стол',
'widget_settings' => 'Настройки'
],
'messages' => [
'no_widgets' => 'Нет доступных виджетов'
],
'buttons' => [
'add_widget' => 'Добавить виджет',
'place_widget' => 'Установить',
'draggable' => [
'enabled' => 'Вкл.',
'disabled' => 'Выкл.'
]
]
]; | teodorsandu/kodicms-laravel | modules/Dashboard/resources/lang/ru/core.php | PHP | gpl-2.0 | 401 | [
30522,
1026,
1029,
25718,
2709,
1031,
1005,
2516,
1005,
1027,
1028,
1031,
1005,
24923,
1005,
1027,
1028,
1005,
1195,
10260,
29740,
14150,
29752,
15414,
1196,
22919,
14150,
29436,
1005,
1010,
1005,
15536,
24291,
1035,
10906,
1005,
1027,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
public class Conundrum {
public static void main(String[] args) {
Enigma e = new Enigma();
System.out.println(e.equals(e));
}
}
final class Enigma {
// Provide a class body that makes Conundrum print false.
// Do *not* override equals.
}
| passByReference/Algorithms | java-puzzlers/8-classier-puzzlers/puzzle-74/Conundrum.java | Java | gpl-2.0 | 282 | [
30522,
2270,
2465,
9530,
8630,
6824,
1063,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
26757,
1041,
1027,
2047,
26757,
1006,
1007,
1025,
2291,
1012,
2041,
1012,
6140,
19666,
1006,
1041,
1012,
19635,
1006,
1041... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* This file is part of the WeatherUndergroundBundle.
*
* (c) Nikolay Ivlev <nikolay.kotovsky@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SunCat\WeatherUndergroundBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* DI extension
*
* @author suncat2000 <nikolay.kotovsky@gmail.com>
*/
class WeatherUndergroundExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$container->setParameter('weather_underground.apikey', $config['apikey']);
$container->setParameter('weather_underground.format', $config['format']);
$container->setParameter('weather_underground.host_data_features', $config['host_data_features']);
$container->setParameter('weather_underground.host_autocomlete', $config['host_autocomlete']);
}
}
| suncat2000/WeatherUndergroundBundle | DependencyInjection/WeatherUndergroundExtension.php | PHP | mit | 1,429 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
4633,
20824,
16365,
27265,
2571,
1012,
1008,
1008,
1006,
1039,
1007,
28494,
4921,
20414,
1026,
28494,
1012,
12849,
26525,
5874,
1030,
20917,
4014,
1012,
4012,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?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_XmlConnect
* @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Review block
*
* @category Mage
* @package Mage_XmlConnect
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_XmlConnect_Block_Catalog_Product_Review_List extends Mage_XmlConnect_Block_Catalog_Product_Review
{
/**
* Store reviews collection
*
* @var Mage_Review_Model_Mysql4_Review_Collection
*/
protected $_reviewCollection = null;
/**
* Produce reviews list xml object
*
* @return Mage_XmlConnect_Model_Simplexml_Element
*/
public function getReviewsXmlObject()
{
$reviewsXmlObj = Mage::getModel('xmlconnect/simplexml_element', '<reviews></reviews>');
$collection = $this->_getReviewCollection();
if (!$collection) {
return $reviewsXmlObj;
}
foreach ($collection->getItems() as $review) {
$reviewXmlObj = $this->reviewToXmlObject($review);
if ($reviewXmlObj) {
$reviewsXmlObj->appendChild($reviewXmlObj);
}
}
return $reviewsXmlObj;
}
/**
* Retrieve reviews collection with all prepared data and limitations
*
* @return Mage_Eav_Model_Entity_Collection_Abstract
*/
protected function _getReviewCollection()
{
if (is_null($this->_reviewCollection)) {
$product = $this->getProduct();
$request = $this->getRequest();
if (!$product) {
return null;
}
/** @var $collection Mage_Review_Model_Mysql4_Review_Collection */
$collection = Mage::getResourceModel('review/review_collection')
->addEntityFilter('product', $product->getId())->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter('approved')->setDateOrder();
/**
* Apply offset and count
*/
$offset = (int)$request->getParam('offset', 0);
$count = (int)$request->getParam('count', 0);
$count = $count <= 0 ? 1 : $count;
$collection->getSelect()->limit($count, $offset);
$this->_reviewCollection = $collection;
}
return $this->_reviewCollection;
}
/**
* Render reviews list xml
*
* @return string
*/
protected function _toHtml()
{
$product = Mage::getModel('catalog/product')->load((int)$this->getRequest()->getParam('id', 0));
if ($product->getId()) {
$this->setProduct($product);
}
return $this->getReviewsXmlObject()->asNiceXml();
}
}
| rajanlamic/urbanart | files/homedir/public_html/OTTOSCHADE.NET/artist/app/code/core/Mage/XmlConnect/Block/Catalog/Product/Review/List.php | PHP | apache-2.0 | 3,566 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
17454,
13663,
1008,
1008,
5060,
1997,
6105,
1008,
1008,
2023,
3120,
5371,
2003,
3395,
2000,
1996,
2330,
4007,
6105,
1006,
9808,
2140,
1017,
1012,
1014,
1007,
1008,
2008,
2003,
24378,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLANN(log_level="warning")
################################################################################
# The typical
def test_nn_2d_10pt(self):
self.__nd_random_test_autotune(2, 2)
def test_nn_autotune_2d_1000pt(self):
self.__nd_random_test_autotune(2, 1000)
def test_nn_autotune_100d_1000pt(self):
self.__nd_random_test_autotune(100, 1000)
def test_nn_autotune_500d_100pt(self):
self.__nd_random_test_autotune(500, 100)
#
# ##########################################################################################
# # Stress it should handle
#
def test_nn_stress_1d_1pt_kmeans_autotune(self):
self.__nd_random_test_autotune(1, 1)
def __ensure_list(self,arg):
if type(arg)!=list:
return [arg]
else:
return arg
def __nd_random_test_autotune(self, dim, N, num_neighbors = 1, **kwargs):
"""
Make a set of random points, then pass the same ones to the
query points. Each point should be closest to itself.
"""
seed(0)
x = rand(N, dim)
xq = rand(N, dim)
perm = permutation(N)
# compute ground truth nearest neighbors
gt_idx, gt_dist = self.nn.nn(x,xq,
algorithm='linear',
num_neighbors=num_neighbors)
for tp in [0.70, 0.80, 0.90]:
nidx,ndist = self.nn.nn(x, xq,
algorithm='autotuned',
sample_fraction=1.0,
num_neighbors = num_neighbors,
target_precision = tp, checks=-2, **kwargs)
correctness = 0.0
for i in xrange(N):
l1 = self.__ensure_list(nidx[i])
l2 = self.__ensure_list(gt_idx[i])
correctness += float(len(set(l1).intersection(l2)))/num_neighbors
correctness /= N
self.assert_(correctness >= tp*0.9,
'failed #1: targ_prec=%f, N=%d,correctness=%f' % (tp, N, correctness))
if __name__ == '__main__':
unittest.main()
| piskvorky/flann | test/test_nn_autotune.py | Python | bsd-3-clause | 2,411 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
12324,
25353,
2015,
2013,
9808,
1012,
4130,
12324,
1008,
12324,
9808,
2013,
1052,
2100,
10258,
11639,
12324,
1008,
2013,
6100,
12324,
6100,
2013,
16371,
8737,
2100,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
\hypertarget{class_end}{\section{Référence de la classe End}
\label{class_end}\index{End@{End}}
}
{\ttfamily \#include $<$end.\-h$>$}
Graphe d'héritage de End\-:
Graphe de collaboration de End\-:
\subsection*{Fonctions membres publiques}
\begin{DoxyCompactItemize}
\item
bool \hyperlink{class_end_a5be9587f22c8eb23249513a7b5e6db92}{set\-Position} (int8\-\_\-t x, int8\-\_\-t y) override
\item
pair$<$ int8\-\_\-t, int8\-\_\-t $>$ \hyperlink{class_end_ac1365bd526e9ca1f5c8e9d80dc750a36}{get\-Position} () override
\item
string \hyperlink{class_end_a842b7c55b27248102aee289c1337275b}{to\-String} () override
\item
\hyperlink{class_end_aa3481cbe712c9cdef228786ffa7f0aad}{$\sim$\-End} ()
\end{DoxyCompactItemize}
\subsection*{Fonctions membres publiques statiques}
\begin{DoxyCompactItemize}
\item
static \hyperlink{class_end}{End} $\ast$ \hyperlink{class_end_a527baaf33dbb6431d94759f75e8b9f5a}{get\-Instance} ()
\end{DoxyCompactItemize}
\subsection*{Fonctions membres privées}
\begin{DoxyCompactItemize}
\item
\hyperlink{class_end_acd25fa8f481c50f5b8eaff4af1159942}{End} ()
\end{DoxyCompactItemize}
\subsection*{Attributs privés}
\begin{DoxyCompactItemize}
\item
pair$<$ int8\-\_\-t, int8\-\_\-t $>$ $\ast$ \hyperlink{class_end_a842874e9ed3602783ab323850621c060}{position}
\end{DoxyCompactItemize}
\subsection*{Attributs privés statiques}
\begin{DoxyCompactItemize}
\item
static \hyperlink{class_end}{End} $\ast$ \hyperlink{class_end_a2256d4cf9c23450dfb8f77c631d8a5b8}{instance} = nullptr
\end{DoxyCompactItemize}
\subsection{Description détaillée}
Définition à la ligne 16 du fichier end.\-h.
\subsection{Documentation des constructeurs et destructeur}
\hypertarget{class_end_aa3481cbe712c9cdef228786ffa7f0aad}{\index{End@{End}!$\sim$\-End@{$\sim$\-End}}
\index{$\sim$\-End@{$\sim$\-End}!End@{End}}
\subsubsection[{$\sim$\-End}]{\setlength{\rightskip}{0pt plus 5cm}End\-::$\sim$\-End (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}}}\label{class_end_aa3481cbe712c9cdef228786ffa7f0aad}
Définition à la ligne 38 du fichier end.\-h.
\hypertarget{class_end_acd25fa8f481c50f5b8eaff4af1159942}{\index{End@{End}!End@{End}}
\index{End@{End}!End@{End}}
\subsubsection[{End}]{\setlength{\rightskip}{0pt plus 5cm}End\-::\-End (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [private]}}}\label{class_end_acd25fa8f481c50f5b8eaff4af1159942}
Définition à la ligne 48 du fichier end.\-h.
Voici le graphe des appelants de cette fonction \-:
\subsection{Documentation des fonctions membres}
\hypertarget{class_end_a527baaf33dbb6431d94759f75e8b9f5a}{\index{End@{End}!get\-Instance@{get\-Instance}}
\index{get\-Instance@{get\-Instance}!End@{End}}
\subsubsection[{get\-Instance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf End} $\ast$ End\-::get\-Instance (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [static]}}}\label{class_end_a527baaf33dbb6431d94759f75e8b9f5a}
Définition à la ligne 9 du fichier end.\-cpp.
Voici le graphe d'appel pour cette fonction \-:
Voici le graphe des appelants de cette fonction \-:
\hypertarget{class_end_ac1365bd526e9ca1f5c8e9d80dc750a36}{\index{End@{End}!get\-Position@{get\-Position}}
\index{get\-Position@{get\-Position}!End@{End}}
\subsubsection[{get\-Position}]{\setlength{\rightskip}{0pt plus 5cm}pair$<$int8\-\_\-t, int8\-\_\-t$>$ End\-::get\-Position (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [override]}, {\ttfamily [virtual]}}}\label{class_end_ac1365bd526e9ca1f5c8e9d80dc750a36}
Implémente \hyperlink{class_simple_object_ae417f1a285ceab5a04130aba01bac856}{Simple\-Object}.
Définition à la ligne 34 du fichier end.\-h.
Voici le graphe des appelants de cette fonction \-:
\hypertarget{class_end_a5be9587f22c8eb23249513a7b5e6db92}{\index{End@{End}!set\-Position@{set\-Position}}
\index{set\-Position@{set\-Position}!End@{End}}
\subsubsection[{set\-Position}]{\setlength{\rightskip}{0pt plus 5cm}bool End\-::set\-Position (
\begin{DoxyParamCaption}
\item[{int8\-\_\-t}]{x, }
\item[{int8\-\_\-t}]{y}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [override]}, {\ttfamily [virtual]}}}\label{class_end_a5be9587f22c8eb23249513a7b5e6db92}
Implémente \hyperlink{class_simple_object_ae9ea1f7ffe6d4aaf18f24e937e6b60ab}{Simple\-Object}.
Définition à la ligne 29 du fichier end.\-h.
Voici le graphe des appelants de cette fonction \-:
\hypertarget{class_end_a842b7c55b27248102aee289c1337275b}{\index{End@{End}!to\-String@{to\-String}}
\index{to\-String@{to\-String}!End@{End}}
\subsubsection[{to\-String}]{\setlength{\rightskip}{0pt plus 5cm}std\-::string End\-::to\-String (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [override]}, {\ttfamily [virtual]}}}\label{class_end_a842b7c55b27248102aee289c1337275b}
Implémente \hyperlink{class_simple_object_aedf0ddcc119ab40623b5b69badc9531a}{Simple\-Object}.
Définition à la ligne 16 du fichier end.\-cpp.
Voici le graphe d'appel pour cette fonction \-:
Voici le graphe des appelants de cette fonction \-:
\subsection{Documentation des données membres}
\hypertarget{class_end_a2256d4cf9c23450dfb8f77c631d8a5b8}{\index{End@{End}!instance@{instance}}
\index{instance@{instance}!End@{End}}
\subsubsection[{instance}]{\setlength{\rightskip}{0pt plus 5cm}{\bf End} $\ast$ End\-::instance = nullptr\hspace{0.3cm}{\ttfamily [static]}, {\ttfamily [private]}}}\label{class_end_a2256d4cf9c23450dfb8f77c631d8a5b8}
Définition à la ligne 46 du fichier end.\-h.
\hypertarget{class_end_a842874e9ed3602783ab323850621c060}{\index{End@{End}!position@{position}}
\index{position@{position}!End@{End}}
\subsubsection[{position}]{\setlength{\rightskip}{0pt plus 5cm}pair$<$int8\-\_\-t, int8\-\_\-t$>$$\ast$ End\-::position\hspace{0.3cm}{\ttfamily [private]}}}\label{class_end_a842874e9ed3602783ab323850621c060}
Définition à la ligne 47 du fichier end.\-h.
La documentation de cette classe a été générée à partir des fichiers suivants \-:\begin{DoxyCompactItemize}
\item
headers/manager/\hyperlink{end_8h}{end.\-h}\item
sources/\hyperlink{end_8cpp}{end.\-cpp}\end{DoxyCompactItemize}
| LegallGuillaume/Robot-Car-Intelligent | docs/latex/class_end.tex | TeX | bsd-2-clause | 6,276 | [
30522,
1032,
23760,
7559,
18150,
1063,
2465,
1035,
2203,
1065,
1063,
1032,
2930,
1063,
4431,
2139,
2474,
2465,
2063,
2203,
1065,
1032,
3830,
1063,
2465,
1035,
2203,
1065,
1032,
5950,
1063,
2203,
1030,
1063,
2203,
1065,
1065,
1065,
1063,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!-- HTML header for doxygen 1.8.5-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>Fat-Free Framework: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Fat-Free Framework
 <span id="projectnumber">3.3.0</span>
 <span class="menu"><a href="index.html">Overview</a> <a href="annotated.html">Class List</a> <a href="hierarchy.html">Hierarchy</a></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>DB</b></li><li class="navelem"><a class="el" href="classDB_1_1SQL.html">SQL</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">DB\SQL Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classDB_1_1SQL.html">DB\SQL</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a9d54d723c3b9218b6068ef131b2def07">$dbname</a></td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a8a4a0eb6935bb0202f4acab135e214ed">$dsn</a></td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a19ed348edd0549a3f24bd462097f9e52">$engine</a></td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a95c93a06344cfdabd83824e38a527954">$log</a></td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a3deede01233c40789f837bca11dbd856">$rows</a></td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a9f1c991be6d0c09a2c58e6564cc657a2">$trans</a></td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a28eb5b9fdad772d69977b7251896fb9e">$uuid</a></td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"><span class="mlabel">protected</span></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a03e2d154e8308f8407f81ac04fa77261">__construct</a>($dsn, $user=NULL, $pw=NULL, array $options=NULL)</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a5f5ced00dfa005770876582222b4008b">begin</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a1c741bcdd850522bebe83ae9f3a89f8c">commit</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a2da7fa08b61795e9dfad255b6204c7f8">count</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a8a074032e56e1443e46b6f9470d58271">driver</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#aae9de7373718da0c28c9c70de287bbd5">exec</a>($cmds, $args=NULL, $ttl=0, $log=TRUE)</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a5bdb97cf5d6ac52c99d9ffe8a6f9e190">log</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a98fea91c80657442689dd19dc8050dec">name</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#aa4e387f439b8ce06a48ae57cdbb5af95">quote</a>($val, $type=\PDO::PARAM_STR)</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#ab23e1524e183a0d21f5e9a4c02dde037">quotekey</a>($key)</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a44c5c212a997fa1c51cd10bdf0981bfe">rollback</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#aceda87f3c9133d0ee03505f606422af4">schema</a>($table, $fields=NULL, $ttl=0)</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#a1cdbdcd5996d5b34e83ec1554ac2ded2">type</a>($val)</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a3d41d6d72944573251f74b086b6173bc">uuid</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="classDB_1_1SQL.html#ac7f7ef1e3c360dee9d17dd3dea1eb127">value</a>($type, $val)</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classDB_1_1SQL.html#a24b57a9967b47680e854dc2ea328ad1f">version</a>()</td><td class="entry"><a class="el" href="classDB_1_1SQL.html">DB\SQL</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
| ruslan2k/database-editor | public_html/vendors/fatfree/lib/api/classDB_1_1SQL-members.html | HTML | gpl-2.0 | 7,122 | [
30522,
1026,
999,
1011,
1011,
16129,
20346,
2005,
2079,
18037,
6914,
1015,
1012,
1022,
1012,
1019,
1011,
1011,
1028,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// LeftTableViewController.h
// WangYiNEWS
//
// Created by lanou3g on 15/11/22.
// Copyright © 2015年 lanou3g. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LeftTableViewController : UITableViewController
@end
| gavinqqq/WANGYiNEWS | WangYiNEWS/Classes/General/ViewControllers/LeftTableViewController.h | C | mit | 236 | [
30522,
1013,
1013,
1013,
1013,
2187,
10880,
8584,
8663,
13181,
10820,
1012,
1044,
1013,
1013,
7418,
25811,
7974,
2015,
1013,
1013,
1013,
1013,
2580,
2011,
17595,
7140,
2509,
2290,
2006,
2321,
1013,
2340,
1013,
2570,
1012,
1013,
1013,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import logging
import os
import os.path
import shutil
import sys
import tempfile
import unittest
import pytest
import fiona
from fiona.collection import supported_drivers
from fiona.errors import FionaValueError, DriverError, SchemaError, CRSError
from fiona.ogrext import calc_gdal_version_num, get_gdal_version_num
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
class ReadingTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
@pytest.mark.skipif(not os.path.exists('tests/data/coutwildrnp.gpkg'),
reason="Requires geopackage fixture")
def test_gpkg(self):
if get_gdal_version_num() < calc_gdal_version_num(1, 11, 0):
self.assertRaises(DriverError, fiona.open, 'tests/data/coutwildrnp.gpkg', 'r', driver="GPKG")
else:
with fiona.open('tests/data/coutwildrnp.gpkg', 'r', driver="GPKG") as c:
self.assertEquals(len(c), 48)
class WritingTest(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(self.tempdir)
@pytest.mark.skipif(not os.path.exists('tests/data/coutwildrnp.gpkg'),
reason="Requires geopackage fixture")
def test_gpkg(self):
schema = {'geometry': 'Point',
'properties': [('title', 'str')]}
crs = {
'a': 6370997,
'lon_0': -100,
'y_0': 0,
'no_defs': True,
'proj': 'laea',
'x_0': 0,
'units': 'm',
'b': 6370997,
'lat_0': 45}
path = os.path.join(self.tempdir, 'foo.gpkg')
if get_gdal_version_num() < calc_gdal_version_num(1, 11, 0):
self.assertRaises(DriverError,
fiona.open,
path,
'w',
driver='GPKG',
schema=schema,
crs=crs)
else:
with fiona.open(path, 'w',
driver='GPKG',
schema=schema,
crs=crs) as c:
c.writerecords([{
'geometry': {'type': 'Point', 'coordinates': [0.0, 0.0]},
'properties': {'title': 'One'}}])
c.writerecords([{
'geometry': {'type': 'Point', 'coordinates': [2.0, 3.0]},
'properties': {'title': 'Two'}}])
with fiona.open(path) as c:
self.assertEquals(c.schema['geometry'], 'Point')
self.assertEquals(len(c), 2)
| perrygeo/Fiona | tests/test_geopackage.py | Python | bsd-3-clause | 2,690 | [
30522,
12324,
15899,
12324,
9808,
12324,
9808,
1012,
4130,
12324,
3844,
4014,
12324,
25353,
2015,
12324,
8915,
8737,
8873,
2571,
12324,
3131,
22199,
12324,
1052,
17250,
3367,
12324,
13073,
2013,
13073,
1012,
3074,
12324,
3569,
1035,
6853,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright 2015-2017 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package zipkin.benchmarks;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import zipkin.Annotation;
import zipkin.BinaryAnnotation;
import zipkin.Constants;
import zipkin.Endpoint;
import zipkin.TraceKeys;
import zipkin2.Span;
import zipkin.internal.V2SpanConverter;
import zipkin.internal.Util;
@Measurement(iterations = 5, time = 1)
@Warmup(iterations = 10, time = 1)
@Fork(3)
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
@State(Scope.Thread)
@Threads(1)
public class Span2ConverterBenchmarks {
Endpoint frontend = Endpoint.create("frontend", 127 << 24 | 1);
Endpoint backend = Endpoint.builder()
.serviceName("backend")
.ipv4(192 << 24 | 168 << 16 | 99 << 8 | 101)
.port(9000)
.build();
zipkin.Span shared = zipkin.Span.builder()
.traceIdHigh(Util.lowerHexToUnsignedLong("7180c278b62e8f6a"))
.traceId(Util.lowerHexToUnsignedLong("216a2aea45d08fc9"))
.parentId(Util.lowerHexToUnsignedLong("6b221d5bc9e6496c"))
.id(Util.lowerHexToUnsignedLong("5b4185666d50f68b"))
.name("get")
.timestamp(1472470996199000L)
.duration(207000L)
.addAnnotation(Annotation.create(1472470996199000L, Constants.CLIENT_SEND, frontend))
.addAnnotation(Annotation.create(1472470996238000L, Constants.WIRE_SEND, frontend))
.addAnnotation(Annotation.create(1472470996250000L, Constants.SERVER_RECV, backend))
.addAnnotation(Annotation.create(1472470996350000L, Constants.SERVER_SEND, backend))
.addAnnotation(Annotation.create(1472470996403000L, Constants.WIRE_RECV, frontend))
.addAnnotation(Annotation.create(1472470996406000L, Constants.CLIENT_RECV, frontend))
.addBinaryAnnotation(BinaryAnnotation.create(TraceKeys.HTTP_PATH, "/api", frontend))
.addBinaryAnnotation(BinaryAnnotation.create(TraceKeys.HTTP_PATH, "/backend", backend))
.addBinaryAnnotation(BinaryAnnotation.create("clnt/finagle.version", "6.45.0", frontend))
.addBinaryAnnotation(BinaryAnnotation.create("srv/finagle.version", "6.44.0", backend))
.addBinaryAnnotation(BinaryAnnotation.address(Constants.CLIENT_ADDR, frontend))
.addBinaryAnnotation(BinaryAnnotation.address(Constants.SERVER_ADDR, backend))
.build();
zipkin.Span server = zipkin.Span.builder()
.traceIdHigh(Util.lowerHexToUnsignedLong("7180c278b62e8f6a"))
.traceId(Util.lowerHexToUnsignedLong("216a2aea45d08fc9"))
.parentId(Util.lowerHexToUnsignedLong("6b221d5bc9e6496c"))
.id(Util.lowerHexToUnsignedLong("5b4185666d50f68b"))
.name("get")
.addAnnotation(Annotation.create(1472470996250000L, Constants.SERVER_RECV, backend))
.addAnnotation(Annotation.create(1472470996350000L, Constants.SERVER_SEND, backend))
.addBinaryAnnotation(BinaryAnnotation.create(TraceKeys.HTTP_PATH, "/backend", backend))
.addBinaryAnnotation(BinaryAnnotation.create("srv/finagle.version", "6.44.0", backend))
.addBinaryAnnotation(BinaryAnnotation.address(Constants.CLIENT_ADDR, frontend))
.build();
Span server2 = Span.newBuilder()
.traceId("7180c278b62e8f6a216a2aea45d08fc9")
.parentId("6b221d5bc9e6496c")
.id("5b4185666d50f68b")
.name("get")
.kind(Span.Kind.SERVER)
.shared(true)
.localEndpoint(backend.toV2())
.remoteEndpoint(frontend.toV2())
.timestamp(1472470996250000L)
.duration(100000L)
.putTag(TraceKeys.HTTP_PATH, "/backend")
.putTag("srv/finagle.version", "6.44.0")
.build();
@Benchmark public List<Span> fromSpan_splitShared() {
return V2SpanConverter.fromSpan(shared);
}
@Benchmark public List<Span> fromSpan() {
return V2SpanConverter.fromSpan(server);
}
@Benchmark public zipkin.Span toSpan() {
return V2SpanConverter.toSpan(server2);
}
// Convenience main entry-point
public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(".*" + Span2ConverterBenchmarks.class.getSimpleName() + ".*")
.build();
new Runner(opt).run();
}
}
| soundcloud/zipkin | benchmarks/src/main/java/zipkin/benchmarks/Span2ConverterBenchmarks.java | Java | apache-2.0 | 5,211 | [
30522,
1013,
1008,
1008,
1008,
9385,
2325,
1011,
2418,
1996,
2330,
5831,
2361,
4939,
6048,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2023,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package main
import (
"fmt"
"log"
)
type ListCommand struct {
All bool `short:"a" long:"available" description:"also prints all available version for installation"`
}
type InitCommand struct{}
type InstallCommand struct {
Use bool `short:"u" long:"use" description:"force use of this new version after installation"`
}
type UseCommand struct{}
type Interactor struct {
archive WebotsArchive
manager WebotsInstanceManager
templates TemplateManager
}
func NewInteractor() (*Interactor, error) {
res := &Interactor{}
var err error
res.archive, err = NewWebotsHttpArchive("http://www.cyberbotics.com/archive/")
if err != nil {
return nil, err
}
manager, err := NewSymlinkManager(res.archive)
if err != nil {
return nil, err
}
res.manager = manager
res.templates = manager.templates
return res, nil
}
func (x *ListCommand) Execute(args []string) error {
xx, err := NewInteractor()
if err != nil {
return err
}
installed := xx.manager.Installed()
if len(installed) == 0 {
fmt.Printf("No webots version installed.\n")
} else {
for _, v := range installed {
if xx.manager.IsUsed(v) == true {
fmt.Printf(" -* %s\n", v)
} else {
fmt.Printf(" - %s\n", v)
}
}
}
if x.All {
fmt.Println("List of all available versions:")
for _, v := range xx.archive.AvailableVersions() {
fmt.Printf(" - %s\n", v)
}
} else {
vers := xx.archive.AvailableVersions()
if len(vers) == 0 {
return fmt.Errorf("No version are available")
}
fmt.Printf("Last available version is %s\n",
vers[len(vers)-1])
}
return nil
}
func (x *InitCommand) Execute(args []string) error {
return SymlinkManagerSystemInit()
}
func (x *InstallCommand) Execute(args []string) error {
if len(args) != 1 {
return fmt.Errorf("Missing version to install")
}
v, err := ParseWebotsVersion(args[0])
if err != nil {
return err
}
xx, err := NewInteractor()
if err != nil {
return err
}
err = xx.manager.Install(v)
if err != nil {
return err
}
notUsed := true
for _, vv := range xx.manager.Installed() {
if xx.manager.IsUsed(vv) {
notUsed = false
break
}
}
if notUsed || x.Use {
err = xx.manager.Use(v)
if err != nil {
return err
}
log.Printf("Using now version %s", v)
}
return nil
}
func (x *UseCommand) Execute(args []string) error {
if len(args) != 1 {
return fmt.Errorf("Missing version to use")
}
v, err := ParseWebotsVersion(args[0])
if err != nil {
return err
}
xx, err := NewInteractor()
if err != nil {
return err
}
return xx.manager.Use(v)
}
type AddTemplateCommand struct {
Only []string `short:"o" long:"only" description:"apply template only for these versions"`
Except []string `short:"e" long:"except" description:"do not apply template on these versions"`
}
func (x *AddTemplateCommand) Execute(args []string) error {
if len(args) != 2 {
return fmt.Errorf("Need file to read and where to install")
}
var white, black []WebotsVersion
for _, w := range x.Only {
v, err := ParseWebotsVersion(w)
if err != nil {
return err
}
white = append(white, v)
}
for _, w := range x.Except {
v, err := ParseWebotsVersion(w)
if err != nil {
return err
}
black = append(black, v)
}
xx, err := NewInteractor()
if err != nil {
return err
}
err = xx.templates.RegisterTemplate(args[0], args[1])
if err != nil {
return err
}
err = xx.templates.WhiteList(args[1], white)
if err != nil {
return err
}
err = xx.templates.BlackList(args[1], black)
if err != nil {
return err
}
return xx.manager.ApplyAllTemplates()
}
type RemoveTemplateCommand struct{}
func (x *RemoveTemplateCommand) Execute(args []string) error {
if len(args) != 1 {
return fmt.Errorf("Need install path to remove template from")
}
xx, err := NewInteractor()
if err != nil {
return err
}
err = xx.templates.RemoveTemplate(args[0])
if err != nil {
return err
}
return xx.manager.ApplyAllTemplates()
}
func init() {
parser.AddCommand("list",
"Prints all the available version of webots",
"Prints all installed version, and current version in use. Can also prinst all available version for installation",
&ListCommand{})
parser.AddCommand("init",
"Initialiaze the system for webots_manager",
"Initialiaze the system with all requirement for webots_manager",
&InitCommand{})
parser.AddCommand("install",
"Install a new webots version on the system",
"Installs a new webots version on the system",
&InstallCommand{})
parser.AddCommand("use",
"Use a webots version on the system",
"Use a webots version on the system. If it is not installed, it will first install it",
&UseCommand{})
parser.AddCommand("add-template",
"Adds a template file to all version",
"Install a file to all version of webots. -o and -e can be used to explicitely whitelist or blacklist a version",
&AddTemplateCommand{})
parser.AddCommand("remove-template",
"Removes a template file from all version",
"Removes a previously installed template from all version of webots.",
&RemoveTemplateCommand{})
}
| biorob/webots-manager | commands.go | GO | mit | 5,064 | [
30522,
7427,
2364,
12324,
1006,
1000,
4718,
2102,
1000,
1000,
8833,
1000,
1007,
2828,
2862,
9006,
2386,
2094,
2358,
6820,
6593,
1063,
2035,
22017,
2140,
1036,
2460,
1024,
1000,
1037,
1000,
2146,
1024,
1000,
2800,
1000,
6412,
1024,
1000,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015, MuChu Hsu
Contributed by Muchu Hsu (muchu1983@gmail.com)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
from selenium import webdriver
import os
import time
import logging
import re
import random
from cameo.utility import Utility
from cameo.localdb import LocalDbForTECHORANGE
"""
抓取 科技報橘 html 存放到 source_html
"""
class SpiderForTECHORANGE:
#建構子
def __init__(self):
self.SOURCE_HTML_BASE_FOLDER_PATH = u"cameo_res\\source_html"
self.PARSED_RESULT_BASE_FOLDER_PATH = u"cameo_res\\parsed_result"
self.strWebsiteDomain = u"http://buzzorange.com/techorange"
self.dicSubCommandHandler = {
"index":self.downloadIndexPage,
"tag":self.downloadTagPag,
"news":self.downloadNewsPage
}
self.utility = Utility()
self.db = LocalDbForTECHORANGE()
self.driver = None
#取得 spider 使用資訊
def getUseageMessage(self):
return ("- TECHORANGE -\n"
"useage:\n"
"index - download entry page of TECHORANGE \n"
"tag - download not obtained tag page \n"
"news [tag] - download not obtained news [of given tag] \n")
#取得 selenium driver 物件
def getDriver(self):
chromeDriverExeFilePath = "cameo_res\\chromedriver.exe"
driver = webdriver.Chrome(chromeDriverExeFilePath)
return driver
#初始化 selenium driver 物件
def initDriver(self):
if self.driver is None:
self.driver = self.getDriver()
#終止 selenium driver 物件
def quitDriver(self):
self.driver.quit()
self.driver = None
#執行 spider
def runSpider(self, lstSubcommand=None):
strSubcommand = lstSubcommand[0]
strArg1 = None
if len(lstSubcommand) == 2:
strArg1 = lstSubcommand[1]
self.initDriver() #init selenium driver
self.dicSubCommandHandler[strSubcommand](strArg1)
self.quitDriver() #quit selenium driver
#下載 index 頁面
def downloadIndexPage(self, uselessArg1=None):
logging.info("download index page")
strIndexHtmlFolderPath = self.SOURCE_HTML_BASE_FOLDER_PATH + u"\\TECHORANGE"
if not os.path.exists(strIndexHtmlFolderPath):
os.mkdir(strIndexHtmlFolderPath) #mkdir source_html/TECHORANGE/
#科技報橘首頁
self.driver.get("https://buzzorange.com/techorange/")
#儲存 html
strIndexHtmlFilePath = strIndexHtmlFolderPath + u"\\index.html"
self.utility.overwriteSaveAs(strFilePath=strIndexHtmlFilePath, unicodeData=self.driver.page_source)
#下載 tag 頁面
def downloadTagPag(self, uselessArg1=None):
logging.info("download tag page")
strTagHtmlFolderPath = self.SOURCE_HTML_BASE_FOLDER_PATH + u"\\TECHORANGE\\tag"
if not os.path.exists(strTagHtmlFolderPath):
os.mkdir(strTagHtmlFolderPath) #mkdir source_html/TECHORANGE/tag/
strTagWebsiteDomain = self.strWebsiteDomain + u"/tag"
#取得 Db 中尚未下載的 Tag 名稱
lstStrNotObtainedTagName = self.db.fetchallNotObtainedTagName()
for strNotObtainedTagName in lstStrNotObtainedTagName:
#略過名稱太長的 tag
if len(strNotObtainedTagName) > 60:
continue
strTagUrl = strTagWebsiteDomain + u"/" + strNotObtainedTagName
#tag 第0頁
intPageNum = 0
time.sleep(random.randint(2,5)) #sleep random time
self.driver.get(strTagUrl)
#儲存 html
strTagHtmlFilePath = strTagHtmlFolderPath + u"\\%d_%s_tag.html"%(intPageNum, strNotObtainedTagName)
self.utility.overwriteSaveAs(strFilePath=strTagHtmlFilePath, unicodeData=self.driver.page_source)
#tag 下一頁
elesNextPageA = self.driver.find_elements_by_css_selector("div.nav-links a.next.page-numbers")
while len(elesNextPageA) != 0:
time.sleep(random.randint(2,5)) #sleep random time
intPageNum = intPageNum+1
strTagUrl = elesNextPageA[0].get_attribute("href")
self.driver.get(strTagUrl)
#儲存 html
strTagHtmlFilePath = strTagHtmlFolderPath + u"\\%d_%s_tag.html"%(intPageNum, strNotObtainedTagName)
self.utility.overwriteSaveAs(strFilePath=strTagHtmlFilePath, unicodeData=self.driver.page_source)
#tag 再下一頁
elesNextPageA = self.driver.find_elements_by_css_selector("div.nav-links a.next.page-numbers")
#更新tag DB 為已抓取 (isGot = 1)
self.db.updateTagStatusIsGot(strTagName=strNotObtainedTagName)
logging.info("got tag %s"%strNotObtainedTagName)
#限縮 字串長度低於 128 字元
def limitStrLessThen128Char(self, strStr=None):
if len(strStr) > 128:
logging.info("limit str less then 128 char")
return strStr[:127] + u"_"
else:
return strStr
#下載 news 頁面 (strTagName == None 會自動找尋已下載完成之 tag,但若未先執行 parser tag 即使 tag 已下載完成亦無法下載 news)
def downloadNewsPage(self, strTagName=None):
if strTagName is None:
#未指定 tag
lstStrObtainedTagName = self.db.fetchallCompletedObtainedTagName()
for strObtainedTagName in lstStrObtainedTagName:
self.downloadNewsPageWithGivenTagName(strTagName=strObtainedTagName)
else:
#有指定 tag 名稱
self.downloadNewsPageWithGivenTagName(strTagName=strTagName)
#下載 news 頁面 (指定 tag 名稱)
def downloadNewsPageWithGivenTagName(self, strTagName=None):
logging.info("download news page with tag %s"%strTagName)
strNewsHtmlFolderPath = self.SOURCE_HTML_BASE_FOLDER_PATH + u"\\TECHORANGE\\news"
if not os.path.exists(strNewsHtmlFolderPath):
os.mkdir(strNewsHtmlFolderPath) #mkdir source_html/TECHORANGE/news/
#取得 DB 紀錄中,指定 strTagName tag 的 news url
lstStrNewsUrl = self.db.fetchallNewsUrlByTagName(strTagName=strTagName)
intDownloadedNewsCount = 0#紀錄下載 news 頁面數量
timeStart = time.time() #計時開始時間點
timeEnd = None #計時結束時間點
for strNewsUrl in lstStrNewsUrl:
#檢查是否已下載
if not self.db.checkNewsIsGot(strNewsUrl=strNewsUrl):
if intDownloadedNewsCount%10 == 0: #計算下載10筆news所需時間
timeEnd = time.time()
timeCost = timeEnd - timeStart
logging.info("download 10 news cost %f sec"%timeCost)
timeStart = timeEnd
intDownloadedNewsCount = intDownloadedNewsCount+1
time.sleep(random.randint(2,5)) #sleep random time
self.driver.get(strNewsUrl)
#儲存 html
strNewsName = re.match("^https://buzzorange.com/techorange/[\d]{4}/[\d]{2}/[\d]{2}/(.*)/$", strNewsUrl).group(1)
strNewsName = self.limitStrLessThen128Char(strStr=strNewsName) #將名稱縮短小於128字完
strNewsHtmlFilePath = strNewsHtmlFolderPath + u"\\%s_news.html"%strNewsName
self.utility.overwriteSaveAs(strFilePath=strNewsHtmlFilePath, unicodeData=self.driver.page_source)
#更新news DB 為已抓取 (isGot = 1)
self.db.updateNewsStatusIsGot(strNewsUrl=strNewsUrl)
| muchu1983/104_cameo | cameo/spiderForTECHORANGE.py | Python | bsd-3-clause | 7,806 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1000,
1000,
1000,
9385,
1006,
1039,
1007,
2325,
1010,
2172,
2226,
26236,
2226,
5201,
2011,
2172,
2226,
26236,
2226,
1006,
2172,
2226,
16147,
2620,
2509,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* This file is part of the Unit.js testing framework.
*
* (c) Nicolas Tallefourtane <dev@nicolab.net>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code
* or visit {@link http://unitjs.com|Unit.js}.
*
* @author Nicolas Tallefourtane <dev@nicolab.net>
*/
'use strict';
var test = require('../../../');
describe('Asserter object()', function(){
describe('object() behavior', function(){
it('Does not contains assertions from the assertions containers', function(){
test
.value(test.object({}).hasHeader)
.isUndefined()
.value(test.object({}).isError)
.isUndefined()
.value(test.object({}).hasMessage)
.isUndefined()
.value(test.object({}).isInfinite)
.isUndefined()
;
});
it('Assert that the tested value is an `object`', function(){
var Foo = function Foo(){};
test
.object({})
.object([])
.object(new Date())
.object(new RegExp())
.object(new Foo())
.case('Test failure', function(){
test
.exception(function(){
test.object('Foo');
})
.exception(function(){
test.object(Foo);
})
.exception(function(){
test.object(1);
})
.exception(function(){
test.object(undefined);
})
.exception(function(){
test.object(true);
})
.exception(function(){
test.object(false);
})
.exception(function(){
test.object(null);
})
.exception(function(){
test.object(function(){});
})
;
})
;
});
});
describe('Assertions of object()', function(){
it('is(expected)', function(){
test
.object({fluent: 'is awesome', deep: [0, 1]})
.is({fluent: 'is awesome', deep: [0, 1]})
.exception(function(){
test.object({fluent: 'is awesome', deep: [0, 1]})
.is({fluent: 'is awesome', deep: [0, 2]});
})
;
});
it('isNot(expected)', function(){
test
.object({fluent: 'is awesome', deep: [0, 1]})
.isNot({fluent: 'is awesome', deep: [0, '1']})
.exception(function(){
test.object({fluent: 'is awesome', deep: [0, 1]})
.isNot({fluent: 'is awesome', deep: [0, 1]});
})
;
});
it('isIdenticalTo(expected)', function(){
var
obj = {},
obj2 = obj
;
test
.object(obj)
.isIdenticalTo(obj2)
.exception(function(){
test.object(obj).isIdenticalTo({});
})
;
});
it('isNotIdenticalTo(expected)', function(){
var
obj = {},
obj2 = obj
;
test
.object(obj)
.isNotIdenticalTo({})
.exception(function(){
test.object(obj).isNotIdenticalTo(obj2);
})
;
});
it('isEqualTo(expected)', function(){
var
obj = {},
obj2 = obj
;
test
.object(obj)
.isEqualTo(obj2)
.exception(function(){
test.object(obj).isEqualTo({});
})
;
});
it('isNotEqualTo(expected)', function(){
var
obj = {foo: 'bar'},
obj2 = obj
;
test
.object(obj)
.isNotEqualTo({foo: 'bar', baz: 'bar'})
.exception(function(){
test.object(obj).isNotEqualTo(obj2);
})
;
});
it('match(expected)', function(){
test
.object({hello: 'world'})
.match(function(obj){
return obj.hello == 'world';
})
.exception(function(){
test.object({hello: 'world'})
.match(function(obj){
return obj.hello == 'foo';
});
})
;
});
it('notMatch(expected)', function(){
test
.object({hello: 'world'})
.notMatch(function(obj){
return obj.hello == 'E.T';
})
.exception(function(){
test.object({hello: 'world'})
.notMatch(function(obj){
return obj.hello == 'world';
})
})
;
});
it('isValid(expected)', function(){
test
.object({hello: 'world'})
.isValid(function(obj){
return obj.hello == 'world';
})
.exception(function(){
test.object({hello: 'world'})
.isValid(function(obj){
return obj.hello == 'foo';
});
})
;
});
it('isNotValid(expected)', function(){
test
.object({hello: 'world'})
.isNotValid(function(obj){
return obj.hello == 'E.T';
})
.exception(function(){
test.object({hello: 'world'})
.isNotValid(function(obj){
return obj.hello == 'world';
})
})
;
});
it('matchEach(expected)', function(){
test
.object({foo: 'bar', hey: 'you', joker:1})
.matchEach(function(it, key) {
if(key == 'joker'){
return (typeof it == 'number');
}
return (typeof it == 'string');
})
.exception(function(){
// error if one or several does not match
test.object({foo: 'bar', hey: 'you', joker:1})
.matchEach(function(it, key) {
return (typeof it == 'string');
})
})
;
});
it('notMatchEach(expected)', function(){
test
.object({foo: 'bar', hey: 'you', joker:1})
.notMatchEach(function(it, key) {
if(key == 'other'){
return true;
}
})
.exception(function(){
// error if one or several does not match
test.object({foo: 'bar', hey: 'you', joker:1})
.notMatchEach(function(it, key) {
if(key == 'foo'){
return true;
}
})
})
.exception(function(){
// error if one or several does not match
test.object({foo: 'bar', hey: 'you', joker:1})
.notMatchEach(function(it, key) {
return (typeof it == 'string');
})
})
;
});
it('isArray()', function(){
test
.object([])
.isArray()
.exception(function(){
test.object({}).isArray();
})
.exception(function(){
test.object(new Date()).isArray();
})
;
});
it('isRegExp()', function(){
test
.object(/[0-9]+/)
.isRegExp()
.exception(function(){
test.object({}).isRegExp();
})
.exception(function(){
test.object(new Date()).isRegExp();
})
;
});
it('isNotRegExp()', function(){
test
.object(new Date())
.isNotRegExp()
.exception(function(){
test.object(/[0-9]+/).isNotRegExp();
})
;
});
it('isDate()', function(){
test
.object(new Date())
.isDate()
.exception(function(){
test.object({}).isDate();
})
.exception(function(){
test.object(/[0-9]+/).isDate();
})
;
});
it('isNotDate()', function(){
test
.object(/[0-9]+/)
.isNotDate()
.exception(function(){
test.object(new Date()).isNotDate();
})
;
});
it('isArguments()', function(){
var fn = function(){
var args = arguments;
test.object(arguments).isArguments();
test.object(args).isArguments();
};
fn(1, 2, 3);
test.exception(function(){
test.object({0: 'a'}).isArguments();
});
});
it('isNotArguments()', function(){
var fn = function(){
test
.object(arguments)
.isArguments()
.object([1, 2, 3])
.isNotArguments()
.object({0:1, 1:2, 2:3})
.isNotArguments()
;
};
fn(1, 2, 3);
test.exception(function(){
test.object(arguments).isNotArguments();
});
});
it('isEmpty()', function(){
test
.object({})
.isEmpty()
.exception(function(){
test.object({0: 'a'}).isEmpty();
})
;
});
it('isNotEmpty()', function(){
test
.object({hello: 'Nico'})
.isNotEmpty()
.exception(function(){
test.object({}).isNotEmpty();
})
;
});
it('hasLength(expected)', function(){
test
.object({foo: 'bar', other: 'baz'})
.hasLength(2)
.exception(function(){
test.object({foo: 'bar', other: 'baz'})
.hasLength(3);
})
;
});
it('hasNotLength(expected)', function(){
test
.object({foo: 'bar', other: 'baz'})
.hasNotLength(4)
.exception(function(){
test.object({foo: 'bar', other: 'baz'})
.hasNotLength(2);
})
;
});
it('isEnumerable(property)', function(){
test
.object({prop: 'foobar'})
.isEnumerable('prop')
.exception(function(){
test.object({prop: 'foobar'})
.isEnumerable('length');
})
;
});
it('isNotEnumerable(property)', function(){
test
.object(Object.create({}, {prop: {enumerable: 0}}))
.isNotEnumerable('prop')
.exception(function(){
test.object({prop: 'foobar'})
.isNotEnumerable('prop');
})
;
});
it('isFrozen()', function(){
test
.object(Object.freeze({}))
.isFrozen()
.exception(function(){
test.object({})
.isFrozen();
})
;
});
it('isNotFrozen()', function(){
test
.object({})
.isNotFrozen()
.exception(function(){
test.object(Object.freeze({}))
.isNotFrozen();
})
;
});
it('isInstanceOf(expected)', function(){
test
.object(new Date())
.isInstanceOf(Date)
.exception(function(){
test.object(new Date())
.isInstanceOf(Error);
})
;
});
it('isNotInstanceOf(expected)', function(){
test
.object(new Date())
.isNotInstanceOf(RegExp)
.exception(function(){
test.object(new Date())
.isNotInstanceOf(Object);
})
.exception(function(){
test.object(new Date())
.isNotInstanceOf(Date);
})
;
});
it('hasProperty(property [, value])', function(){
test
.object({foo: 'bar'})
.hasProperty('foo')
.object({foo: 'bar'})
.hasProperty('foo', 'bar')
.exception(function(){
test.object({foo: 'bar'})
.hasProperty('bar');
})
.exception(function(){
test.object({foo: 'bar'})
.hasProperty('foo', 'ba');
})
;
});
it('hasNotProperty(property [, value])', function(){
test
.object({foo: 'bar'})
.hasNotProperty('bar')
.object({foo: 'bar'})
.hasNotProperty('foo', 'baz')
.exception(function(){
test.object({foo: 'bar'})
.hasNotProperty('foo');
})
.exception(function(){
test.object({foo: 'bar'})
.hasNotProperty('foo', 'bar');
})
;
});
it('hasOwnProperty(property [, value])', function(){
test
.object({foo: 'bar'})
.hasOwnProperty('foo')
.object({foo: 'bar'})
.hasOwnProperty('foo', 'bar')
.exception(function(){
test.object({foo: 'bar'})
.hasOwnProperty('bar');
})
.exception(function(){
test.object({foo: 'bar'})
.hasOwnProperty('foo', 'ba');
})
;
});
it('hasNotOwnProperty(property [, value])', function(){
test
.object({foo: 'bar'})
.hasNotOwnProperty('bar')
.object({foo: 'bar'})
.hasNotOwnProperty('foo', 'baz')
.exception(function(){
test.object({foo: 'bar'})
.hasNotOwnProperty('foo');
})
.exception(function(){
test.object({foo: 'bar'})
.hasNotOwnProperty('foo', 'bar');
})
;
});
it('hasProperties(properties)', function(){
test
.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasProperties(['other', 'bar', 'foo'])
.exception(function(){
test.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasProperties(['other', 'bar']);
})
;
});
it('hasNotProperties(properties)', function(){
test
.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasNotProperties(['other', 'foo'])
.exception(function(){
test.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasNotProperties(['bar', 'other', 'foo']);
})
;
});
it('hasOwnProperties(properties)', function(){
test
.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasOwnProperties(['other', 'bar', 'foo'])
.exception(function(){
test.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasOwnProperties(['other', 'bar']);
})
;
});
it('hasKey(key [, value])', function(){
test
.object({foo: 'bar'})
.hasKey('foo')
.object({foo: 'bar'})
.hasKey('foo', 'bar')
.exception(function(){
test.object({foo: 'bar'})
.hasKey('bar');
})
.exception(function(){
test.object({foo: 'bar'})
.hasKey('foo', 'ba');
})
;
});
it('notHasKey(key [, value])', function(){
test
.object({foo: 'bar'})
.notHasKey('bar')
.object({foo: 'bar'})
.notHasKey('foo', 'baz')
.exception(function(){
test.object({foo: 'bar'})
.notHasKey('foo');
})
.exception(function(){
test.object({foo: 'bar'})
.notHasKey('foo', 'bar');
})
;
});
it('hasKeys(keys)', function(){
test
.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasKeys(['other', 'bar', 'foo'])
.exception(function(){
test.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.hasKeys(['other', 'bar']);
})
;
});
it('notHasKeys(keys)', function(){
test
.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.notHasKeys(['other', 'foo'])
.exception(function(){
test.object({foo: 'bar', bar: 'huhu', other: 'vroom'})
.notHasKeys(['bar', 'other', 'foo']);
})
;
});
it('hasValue(expected)', function(){
test
.object({life: 42, love: 69})
.hasValue(42)
.exception(function(){
test.object({life: 42, love: 69})
.hasValue('42');
})
;
});
it('notHasValue(expected)', function(){
test
.object({life: 42, love: 69})
.notHasValue(4)
.exception(function(){
test.object({life: 42, love: 69})
.notHasValue(42);
})
;
});
it('hasValues(expected)', function(){
test
.object({life: 42, love: 69})
.hasValues([42, 69])
.exception(function(){
test.object([1, 42, 3])
.hasValues([42, 3.01]);
})
;
});
it('notHasValues(expected)', function(){
test
.object({life: 42, love: 69})
.notHasValues([43, 68])
.exception(function(){
test.object([1, 42, 3])
.notHasValues([1, 42, 3]);
})
;
});
it('contains(expected [, ...])', function(){
test
.object({ a: { b: 10 }, b: { c: 10, d: 11, a: { b: 10, c: 11} }})
.contains({ a: { b: 10 }, b: { c: 10, a: { c: 11 }}})
.object({a: 'a', b: {c: 'c'}})
.contains({b: {c: 'c'}})
.contains({b: {c: 'c'}}, {a: 'a'})
.exception(function(){
test.object({foo: {a: 'a'}, bar: {b: 'b', c: 'c'}})
.contains({foo: {a: 'a'}}, {bar: {b: 'c'}});
})
;
});
it('notContains(expected [, ...])', function(){
test
.object({a: 'a'}, {b: 'b', c: 'c'})
.notContains({c: 'b'})
.exception(function(){
test.object({foo: {a: 'a'}, bar: {b: 'b', c: 'c'}})
.notContains({foo: {a: 'a'}, bar: {c: 'c'}});
})
;
});
it('hasName(expected)', function(){
test
.object(new Date(2010, 5, 28))
.hasName('Date')
.exception(function(){
test.object(new Date(2010, 5, 28))
.hasName('date');
})
;
});
});
}); | johanasplund/coffeefuck | node_modules/unit.js/test/lib/asserters/object.js | JavaScript | mit | 17,594 | [
30522,
1013,
1008,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
3131,
1012,
1046,
2015,
5604,
7705,
1012,
1008,
1008,
1006,
1039,
1007,
9473,
4206,
12879,
8162,
5794,
2063,
1026,
16475,
1030,
17388,
2497,
1012,
5658,
1028,
1008,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package aws
import (
"fmt"
"strconv"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
func resourceAwsLoadBalancerBackendServerPolicies() *schema.Resource {
return &schema.Resource{
Create: resourceAwsLoadBalancerBackendServerPoliciesCreate,
Read: resourceAwsLoadBalancerBackendServerPoliciesRead,
Update: resourceAwsLoadBalancerBackendServerPoliciesCreate,
Delete: resourceAwsLoadBalancerBackendServerPoliciesDelete,
Schema: map[string]*schema.Schema{
"load_balancer_name": {
Type: schema.TypeString,
Required: true,
},
"policy_names": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Set: schema.HashString,
},
"instance_port": {
Type: schema.TypeInt,
Required: true,
},
},
}
}
func resourceAwsLoadBalancerBackendServerPoliciesCreate(d *schema.ResourceData, meta interface{}) error {
elbconn := meta.(*AWSClient).elbconn
loadBalancerName := d.Get("load_balancer_name")
policyNames := []*string{}
if v, ok := d.GetOk("policy_names"); ok {
policyNames = expandStringList(v.(*schema.Set).List())
}
setOpts := &elb.SetLoadBalancerPoliciesForBackendServerInput{
LoadBalancerName: aws.String(loadBalancerName.(string)),
InstancePort: aws.Int64(int64(d.Get("instance_port").(int))),
PolicyNames: policyNames,
}
if _, err := elbconn.SetLoadBalancerPoliciesForBackendServer(setOpts); err != nil {
return fmt.Errorf("Error setting LoadBalancerPoliciesForBackendServer: %s", err)
}
d.SetId(fmt.Sprintf("%s:%s", *setOpts.LoadBalancerName, strconv.FormatInt(*setOpts.InstancePort, 10)))
return resourceAwsLoadBalancerBackendServerPoliciesRead(d, meta)
}
func resourceAwsLoadBalancerBackendServerPoliciesRead(d *schema.ResourceData, meta interface{}) error {
elbconn := meta.(*AWSClient).elbconn
loadBalancerName, instancePort := resourceAwsLoadBalancerBackendServerPoliciesParseId(d.Id())
describeElbOpts := &elb.DescribeLoadBalancersInput{
LoadBalancerNames: []*string{aws.String(loadBalancerName)},
}
describeResp, err := elbconn.DescribeLoadBalancers(describeElbOpts)
if err != nil {
if ec2err, ok := err.(awserr.Error); ok {
if ec2err.Code() == "LoadBalancerNotFound" {
d.SetId("")
return fmt.Errorf("LoadBalancerNotFound: %s", err)
}
}
return fmt.Errorf("Error retrieving ELB description: %s", err)
}
if len(describeResp.LoadBalancerDescriptions) != 1 {
return fmt.Errorf("Unable to find ELB: %#v", describeResp.LoadBalancerDescriptions)
}
lb := describeResp.LoadBalancerDescriptions[0]
policyNames := []*string{}
for _, backendServer := range lb.BackendServerDescriptions {
if instancePort != strconv.Itoa(int(*backendServer.InstancePort)) {
continue
}
policyNames = append(policyNames, backendServer.PolicyNames...)
}
d.Set("load_balancer_name", loadBalancerName)
instancePortVal, err := strconv.ParseInt(instancePort, 10, 64)
if err != nil {
return fmt.Errorf("error parsing instance port: %s", err)
}
d.Set("instance_port", instancePortVal)
d.Set("policy_names", flattenStringList(policyNames))
return nil
}
func resourceAwsLoadBalancerBackendServerPoliciesDelete(d *schema.ResourceData, meta interface{}) error {
elbconn := meta.(*AWSClient).elbconn
loadBalancerName, instancePort := resourceAwsLoadBalancerBackendServerPoliciesParseId(d.Id())
instancePortInt, err := strconv.ParseInt(instancePort, 10, 64)
if err != nil {
return fmt.Errorf("Error parsing instancePort as integer: %s", err)
}
setOpts := &elb.SetLoadBalancerPoliciesForBackendServerInput{
LoadBalancerName: aws.String(loadBalancerName),
InstancePort: aws.Int64(instancePortInt),
PolicyNames: []*string{},
}
if _, err := elbconn.SetLoadBalancerPoliciesForBackendServer(setOpts); err != nil {
return fmt.Errorf("Error setting LoadBalancerPoliciesForBackendServer: %s", err)
}
return nil
}
func resourceAwsLoadBalancerBackendServerPoliciesParseId(id string) (string, string) {
parts := strings.SplitN(id, ":", 2)
return parts[0], parts[1]
}
| kjmkznr/terraform-provider-aws | aws/resource_aws_load_balancer_backend_server_policy.go | GO | mpl-2.0 | 4,213 | [
30522,
7427,
22091,
2015,
12324,
1006,
1000,
4718,
2102,
1000,
1000,
2358,
29566,
2078,
2615,
1000,
1000,
7817,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
22091,
2015,
1013,
22091,
2015,
1011,
17371,
2243,
1011,
2175,
1013,
22091,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "remotelinuxenvironmentaspect.h"
#include "remotelinuxenvironmentaspectwidget.h"
#include <utils/algorithm.h>
namespace RemoteLinux {
const char DISPLAY_KEY[] = "DISPLAY";
const char VERSION_KEY[] = "RemoteLinux.EnvironmentAspect.Version";
const int ENVIRONMENTASPECT_VERSION = 1; // Version was introduced in 4.3 with the value 1
static bool displayAlreadySet(const Utils::EnvironmentItems &changes)
{
return Utils::contains(changes, [](const Utils::EnvironmentItem &item) {
return item.name == DISPLAY_KEY;
});
}
RemoteLinuxEnvironmentAspect::RemoteLinuxEnvironmentAspect(ProjectExplorer::Target *target)
{
addSupportedBaseEnvironment(tr("Clean Environment"), {});
addPreferredBaseEnvironment(tr("System Environment"), [this] { return m_remoteEnvironment; });
setConfigWidgetCreator([this, target] {
return new RemoteLinuxEnvironmentAspectWidget(this, target);
});
}
void RemoteLinuxEnvironmentAspect::setRemoteEnvironment(const Utils::Environment &env)
{
if (env != m_remoteEnvironment) {
m_remoteEnvironment = env;
emit environmentChanged();
}
}
QString RemoteLinuxEnvironmentAspect::userEnvironmentChangesAsString() const
{
QString env;
QString placeHolder = QLatin1String("%1=%2 ");
foreach (const Utils::EnvironmentItem &item, userEnvironmentChanges())
env.append(placeHolder.arg(item.name, item.value));
return env.mid(0, env.size() - 1);
}
void RemoteLinuxEnvironmentAspect::fromMap(const QVariantMap &map)
{
ProjectExplorer::EnvironmentAspect::fromMap(map);
const auto version = map.value(QLatin1String(VERSION_KEY), 0).toInt();
if (version == 0) {
// In Qt Creator versions prior to 4.3 RemoteLinux included DISPLAY=:0.0 in the base
// environment, if DISPLAY was not set. In order to keep existing projects expecting
// that working, add the DISPLAY setting to user changes in them. New projects will
// have version 1 and will not get DISPLAY set.
auto changes = userEnvironmentChanges();
if (!displayAlreadySet(changes)) {
changes.append(Utils::EnvironmentItem(QLatin1String(DISPLAY_KEY), QLatin1String(":0.0")));
setUserEnvironmentChanges(changes);
}
}
}
void RemoteLinuxEnvironmentAspect::toMap(QVariantMap &map) const
{
ProjectExplorer::EnvironmentAspect::toMap(map);
map.insert(QLatin1String(VERSION_KEY), ENVIRONMENTASPECT_VERSION);
}
} // namespace RemoteLinux
| qtproject/qt-creator | src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp | C++ | gpl-3.0 | 3,689 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>autosubst: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.1+1 / autosubst - 1.7</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
autosubst
<small>
1.7
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-02-19 04:09:34 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-19 04:09:34 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.7.1+1 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "palmskog@gmail.com"
homepage: "https://github.com/coq-community/autosubst"
dev-repo: "git+https://github.com/coq-community/autosubst.git"
bug-reports: "https://github.com/coq-community/autosubst/issues"
license: "MIT"
synopsis: "Coq library for parallel de Bruijn substitutions"
description: """
Autosubst is a library for the Coq proof assistant which
provides automation for formalizing syntactic theories with
variable binders. Given an inductive definition of syntactic
objects in de Bruijn representation augmented with binding
annotations, Autosubst synthesizes the parallel substitution
operation and automatically proves the basic lemmas about
substitutions."""
build: [make "-j%{jobs}%"]
install: [make "install"]
depends: [
"coq" {(>= "8.10" & < "8.16~") | (= "dev")}
]
tags: [
"category:Computer Science/Lambda Calculi"
"keyword:abstract syntax"
"keyword:binders"
"keyword:de Bruijn indices"
"keyword:substitution"
"logpath:Autosubst"
]
authors: [
"Steven Schäfer"
"Tobias Tebbi"
]
url {
src: "https://github.com/coq-community/autosubst/archive/v1.7.tar.gz"
checksum: "sha512=6c118962618a0e770344e62f976826e742a16fc9206d1ea1d075c4579ad9db36985d13896787880d5dddc50cb387430328cd92c9974ccc53f8725cce46e515d5"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-autosubst.1.7 coq.8.7.1+1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1+1).
The following dependencies couldn't be met:
- coq-autosubst -> coq >= dev
no matching version
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-autosubst.1.7</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.05.0-2.0.1/released/8.7.1+1/autosubst/1.7.html | HTML | mit | 7,343 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
30524,
1027,
5080,
1011,
9381,
1010,
3988,
1011,
4094,
1027,
1015,
1000,
1028,
1026,
2516,
1028,
8285,
6342,
5910,
2102,
1024,
2025,
11892,
100,
1026,
1013,
2516,
1028,
1026,
4957,
2128,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_71) on Fri Jul 10 16:43:24 IST 2015 -->
<title>Uses of Class com.ephesoft.dcma.mail.domain.EmailData</title>
<meta name="date" content="2015-07-10">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.ephesoft.dcma.mail.domain.EmailData";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/ephesoft/dcma/mail/domain/class-use/EmailData.html" target="_top">Frames</a></li>
<li><a href="EmailData.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.ephesoft.dcma.mail.domain.EmailData" class="title">Uses of Class<br>com.ephesoft.dcma.mail.domain.EmailData</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">EmailData</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#com.ephesoft.dcma.mail.dao">com.ephesoft.dcma.mail.dao</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#com.ephesoft.dcma.mail.dao.hibernate">com.ephesoft.dcma.mail.dao.hibernate</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.ephesoft.dcma.mail.dao">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">EmailData</a> in <a href="../../../../../../com/ephesoft/dcma/mail/dao/package-summary.html">com.ephesoft.dcma.mail.dao</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../com/ephesoft/dcma/mail/dao/package-summary.html">com.ephesoft.dcma.mail.dao</a> that return types with arguments of type <a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">EmailData</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>java.util.List<<a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">EmailData</a>></code></td>
<td class="colLast"><span class="strong">EmailQueueDao.</span><code><strong><a href="../../../../../../com/ephesoft/dcma/mail/dao/EmailQueueDao.html#findReadyToSend(int)">findReadyToSend</a></strong>(int fetchMaxCount)</code>
<div class="block">Find ready to send</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="com.ephesoft.dcma.mail.dao.hibernate">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">EmailData</a> in <a href="../../../../../../com/ephesoft/dcma/mail/dao/hibernate/package-summary.html">com.ephesoft.dcma.mail.dao.hibernate</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../com/ephesoft/dcma/mail/dao/hibernate/package-summary.html">com.ephesoft.dcma.mail.dao.hibernate</a> that return types with arguments of type <a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">EmailData</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>java.util.List<<a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">EmailData</a>></code></td>
<td class="colLast"><span class="strong">EmailQueueDaoImpl.</span><code><strong><a href="../../../../../../com/ephesoft/dcma/mail/dao/hibernate/EmailQueueDaoImpl.html#findReadyToSend(int)">findReadyToSend</a></strong>(int fetchMaxCount)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/ephesoft/dcma/mail/domain/EmailData.html" title="class in com.ephesoft.dcma.mail.domain">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/ephesoft/dcma/mail/domain/class-use/EmailData.html" target="_top">Frames</a></li>
<li><a href="EmailData.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| ungerik/ephesoft | Ephesoft_Community_Release_4.0.2.0/javadocs/com/ephesoft/dcma/mail/domain/class-use/EmailData.html | HTML | agpl-3.0 | 8,216 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* php-sql-query
*
* @author Romain Bessuges <romainbessuges@gmail.com>
* @copyright 2013 Romain Bessuges
* @link http://github.com/romainbessugesmeusy/php-sql-query
* @license http://github.com/romainbessugesmeusy/php-sql-query
* @version 0.1
* @package php-sql-query
*
* MIT LICENSE
*
* 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.
*/
namespace RBM\SqlQuery;
class Insert extends AbstractQuery
{
/** @var array */
protected $_values;
/**
* @param array $values
*/
public function setValues($values)
{
$this->_values = $values;
}
/**
* @return array
*/
public function getValues()
{
return $this->_values;
}
/**
* @return Column[]
*/
public function getColumns()
{
return Helper::prepareColumns(array_keys($this->_values), $this->getTable());
}
}
| willoucom/php-sql-query | lib/RBM/SqlQuery/Insert.php | PHP | mit | 1,938 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
25718,
1011,
29296,
1011,
23032,
1008,
1008,
1030,
3166,
12836,
2378,
2022,
4757,
22890,
2015,
1026,
12836,
2378,
12681,
6342,
8449,
1030,
20917,
4014,
1012,
4012,
1028,
1008,
1030,
9385,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#region Apache License Version 2.0
/*----------------------------------------------------------------
Copyright 2017 Yang Chen (cy2000@gmail.com)
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.
Detail: https://github.com/etechi/ServiceFramework/blob/master/license.md
----------------------------------------------------------------*/
#endregion Apache License Version 2.0
using SF.Biz.Trades;
using SF.Biz.Trades.Managements;
using SF.Biz.Trades.StateProviders;
using SF.Sys.BackEndConsole;
namespace SF.Sys.Services
{
public static class TradeCartDIExtension
{
public static IServiceCollection AddTradeServices(this IServiceCollection sc, string TablePrefix = null)
{
//交易
sc.EntityServices(
"Trades",
"交易管理",
d => d.Add<ITradeManager, TradeManager>("Trade", "交易", typeof(SF.Biz.Trades.Trade))
.Add<ITradeItemManager, TradeItemManager>("TradeItem", "交易明细", typeof(SF.Biz.Trades.TradeItem))
);
sc.AddManagedScoped<IBuyerTradeService, BuyerTradeService>();
sc.AddManagedScoped<ISellerTradeService, SellerTradeService>();
sc.AddSingleton<ITradeSyncQueue, TradeSyncQueue>();
sc.AddManagedScoped<ITradeStateProvider, BuyerConfirmProvider>();
sc.AddManagedScoped<ITradeStateProvider, BuyerCompleteProvider>();
sc.AddManagedScoped<ITradeStateProvider, SellerConfirmProvider>();
sc.AddManagedScoped<ITradeStateProvider, SellerCompleteProvider>();
sc.AddManagedScoped<ITradeStateProvider, SellerSettlementProvider>();
sc.AddDataModules<
SF.Biz.Trades.DataModels.DataTrade,
SF.Biz.Trades.DataModels.DataTradeItem
>(TablePrefix ?? "Biz");
sc.AddRemindable<TradeRemindable>();
sc.InitServices("Trade", async (sp, sim, parent) =>
{
await sim.DefaultService<ITradeManager, TradeManager>(null)
.WithConsolePages("交易管理/交易管理")
.Ensure(sp, parent);
await sim.DefaultService<ITradeItemManager, TradeItemManager>(null)
.WithConsolePages("交易管理/交易明细管理")
.Ensure(sp, parent);
await sim.DefaultService<IBuyerTradeService, BuyerTradeService>(null)
.Ensure(sp, parent);
await sim.DefaultService<ISellerTradeService, SellerTradeService>(null)
.Ensure(sp, parent);
await sim.Service<ITradeStateProvider, BuyerConfirmProvider>(null)
.WithIdent(TradeState.BuyerConfirm.ToString())
.Ensure(sp, parent);
await sim.Service<ITradeStateProvider, BuyerCompleteProvider>(null)
.WithIdent(TradeState.BuyerComplete.ToString())
.Ensure(sp, parent);
await sim.Service<ITradeStateProvider, SellerConfirmProvider>(null)
.WithIdent(TradeState.SellerConfirm.ToString())
.Ensure(sp, parent);
await sim.Service<ITradeStateProvider, SellerCompleteProvider>(null)
.WithIdent(TradeState.SellerComplete.ToString())
.Ensure(sp, parent);
await sim.Service<ITradeStateProvider, SellerSettlementProvider>(null)
.WithIdent(TradeState.SellerSettlement.ToString())
.Ensure(sp, parent);
});
return sc;
}
}
}
| etechi/ServiceFramework | Projects/Server/Biz/SF.Biz.Trades.Implements/DIExtension.cs | C# | apache-2.0 | 3,996 | [
30522,
1001,
2555,
15895,
6105,
2544,
1016,
1012,
1014,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
30524,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* This file is part of "PCPIN Chat 6".
*
* "PCPIN Chat 6" is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* "PCPIN Chat 6" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Callback function to execute after confirm box receives "OK".
*/
var confirmboxCallback='';
/**
* Display confirm box
* @param string $text Text to display
* @param int top_offset Optional. How many pixels to add to the top position. Can be negative or positive.
* @param int left_offset Optional. How many pixels to add to the left position. Can be negative or positive.
* @param string callback Optional. Callback function to execute after confirm box receives "OK".
*/
function confirm(text, top_offset, left_offset, callback) {
if (typeof(text)!='undefined' && typeof(text)!='string') {
try {
text=text.toString();
} catch (e) {}
}
if (typeof(text)=='string') {
document.onkeyup_confirmbox=document.onkeyup;
document.onkeyup=function(e) {
switch (getKC(e)) {
case 27:
hideConfirmBox(false);
break;
}
};
if (typeof(top_offset)!='number') top_offset=0;
if (typeof(left_offset)!='number') left_offset=0;
$('confirmbox_text').innerHTML=nl2br(htmlspecialchars(text));
$('confirmbox').style.display='';
$('confirmbox_btn_ok').focus();
setTimeout("moveToCenter($('confirmbox'), "+top_offset+", "+left_offset+"); $('confirmbox_btn_ok').focus();", 25);
if (typeof(callback)=='string') {
confirmboxCallback=callback;
} else {
confirmboxCallback='';
}
setTimeout("$('confirmbox').style.display='none'; $('confirmbox').style.display='';", 200);
}
}
/**
* Hide confirm box
@param boolean ok TRUE, if "OK" button was clicked
*/
function hideConfirmBox(ok) {
document.onkeyup=document.onkeyup_confirmbox;
$('confirmbox').style.display='none';
if (typeof(ok)=='boolean' && ok && confirmboxCallback!='') {
eval('try { '+confirmboxCallback+' } catch(e) {}');
}
}
| Dark1revan/chat1 | js/base/confirmbox.js | JavaScript | gpl-3.0 | 2,595 | [
30522,
1013,
1008,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1000,
7473,
8091,
11834,
1020,
1000,
1012,
1008,
1008,
1000,
7473,
8091,
11834,
1020,
1000,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.core.facet.request;
import org.springframework.data.elasticsearch.core.facet.FacetRequest;
/**
* Basic range facet
*
* @author Artur Konczak
*/
@Deprecated
public class RangeFacetRequestBuilder {
RangeFacetRequest result;
public RangeFacetRequestBuilder(String name) {
result = new RangeFacetRequest(name);
}
public RangeFacetRequestBuilder field(String field) {
result.setField(field);
return this;
}
public RangeFacetRequestBuilder fields(String keyField, String valueField) {
result.setFields(keyField, valueField);
return this;
}
public RangeFacetRequestBuilder range(double from, double to) {
result.range(from, to);
return this;
}
public RangeFacetRequestBuilder range(String from, String to) {
result.range(from, to);
return this;
}
public RangeFacetRequestBuilder from(double from) {
result.range(from, null);
return this;
}
public RangeFacetRequestBuilder to(double to) {
result.range(null, to);
return this;
}
public RangeFacetRequestBuilder from(String from) {
result.range(from, null);
return this;
}
public RangeFacetRequestBuilder to(String to) {
result.range(null, to);
return this;
}
public RangeFacetRequestBuilder applyQueryFilter() {
result.setApplyQueryFilter(true);
return this;
}
public FacetRequest build() {
return result;
}
} | KiviMao/kivi | Java.Source/spring-data-elasticsearch/src/main/java/org/springframework/data/elasticsearch/core/facet/request/RangeFacetRequestBuilder.java | Java | apache-2.0 | 1,997 | [
30522,
1013,
1008,
1008,
9385,
2297,
1996,
2434,
3166,
2030,
6048,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "stdafx.h"
#include "Emu/System.h"
#include "Emu/ARMv7/PSVFuncList.h"
#include "sceAppUtil.h"
s32 sceAppUtilInit(vm::psv::ptr<const SceAppUtilInitParam> initParam, vm::psv::ptr<SceAppUtilBootParam> bootParam)
{
throw __FUNCTION__;
}
s32 sceAppUtilShutdown()
{
throw __FUNCTION__;
}
s32 sceAppUtilSaveDataSlotCreate(u32 slotId, vm::psv::ptr<const SceAppUtilSaveDataSlotParam> param, vm::psv::ptr<const SceAppUtilSaveDataMountPoint> mountPoint)
{
throw __FUNCTION__;
}
s32 sceAppUtilSaveDataSlotDelete(u32 slotId, vm::psv::ptr<const SceAppUtilSaveDataMountPoint> mountPoint)
{
throw __FUNCTION__;
}
s32 sceAppUtilSaveDataSlotSetParam(u32 slotId, vm::psv::ptr<const SceAppUtilSaveDataSlotParam> param, vm::psv::ptr<const SceAppUtilSaveDataMountPoint> mountPoint)
{
throw __FUNCTION__;
}
s32 sceAppUtilSaveDataSlotGetParam(u32 slotId, vm::psv::ptr<SceAppUtilSaveDataSlotParam> param, vm::psv::ptr<const SceAppUtilSaveDataMountPoint> mountPoint)
{
throw __FUNCTION__;
}
s32 sceAppUtilSaveDataFileSave(vm::psv::ptr<const SceAppUtilSaveDataFileSlot> slot, vm::psv::ptr<const SceAppUtilSaveDataFile> files, u32 fileNum, vm::psv::ptr<const SceAppUtilSaveDataMountPoint> mountPoint, vm::psv::ptr<u32> requiredSizeKB)
{
throw __FUNCTION__;
}
s32 sceAppUtilPhotoMount()
{
throw __FUNCTION__;
}
s32 sceAppUtilPhotoUmount()
{
throw __FUNCTION__;
}
s32 sceAppUtilSystemParamGetInt(u32 paramId, vm::psv::ptr<s32> value)
{
throw __FUNCTION__;
}
s32 sceAppUtilSystemParamGetString(u32 paramId, vm::psv::ptr<char> buf, u32 bufSize)
{
throw __FUNCTION__;
}
s32 sceAppUtilSaveSafeMemory(vm::psv::ptr<const void> buf, u32 bufSize, s64 offset)
{
throw __FUNCTION__;
}
s32 sceAppUtilLoadSafeMemory(vm::psv::ptr<void> buf, u32 bufSize, s64 offset)
{
throw __FUNCTION__;
}
#define REG_FUNC(nid, name) reg_psv_func(nid, &sceAppUtil, #name, name)
psv_log_base sceAppUtil("SceAppUtil", []()
{
sceAppUtil.on_load = nullptr;
sceAppUtil.on_unload = nullptr;
sceAppUtil.on_stop = nullptr;
REG_FUNC(0xDAFFE671, sceAppUtilInit);
REG_FUNC(0xB220B00B, sceAppUtilShutdown);
REG_FUNC(0x7E8FE96A, sceAppUtilSaveDataSlotCreate);
REG_FUNC(0x266A7646, sceAppUtilSaveDataSlotDelete);
REG_FUNC(0x98630136, sceAppUtilSaveDataSlotSetParam);
REG_FUNC(0x93F0D89F, sceAppUtilSaveDataSlotGetParam);
REG_FUNC(0x1E2A6158, sceAppUtilSaveDataFileSave);
REG_FUNC(0xEE85804D, sceAppUtilPhotoMount);
REG_FUNC(0x9651B941, sceAppUtilPhotoUmount);
REG_FUNC(0x5DFB9CA0, sceAppUtilSystemParamGetInt);
REG_FUNC(0x6E6AA267, sceAppUtilSystemParamGetString);
REG_FUNC(0x9D8AC677, sceAppUtilSaveSafeMemory);
REG_FUNC(0x3424D772, sceAppUtilLoadSafeMemory);
});
| Syphurith/rpcs3 | rpcs3/Emu/ARMv7/Modules/sceAppUtil.cpp | C++ | gpl-2.0 | 2,648 | [
30522,
1001,
2421,
1000,
2358,
2850,
2546,
2595,
1012,
1044,
1000,
1001,
2421,
1000,
7861,
2226,
1013,
2291,
1012,
1044,
1000,
1001,
2421,
1000,
7861,
2226,
1013,
2849,
2615,
2581,
1013,
8827,
2615,
11263,
12273,
9863,
1012,
1044,
1000,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
$home = null;
$application = null;
$employee = null;
$evaluation = null;
$message = null;
switch ($active) {
case 'home':
$home = '-active accent ';
break;
case 'employee':
$employee = '-active accent';
break;
case 'evaluation':
$evaluation = '-active accent';
break;
case 'message':
$message = '-active accent';
break;
default:
# code...
break;
}
?>
<div class="fixed-top">
<nav class="navbar navbar-expand-lg navbar-light bg-light border border-black pt-2 pb-2 pl-5">
<a class="navbar-brand open-sans pl-3 accent f-bold" href="#">
<img src="<?php echo base_url()?>assets/img/brand_logo.png">
Human Resource Management System
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse pr-5" id="navbarNavAltMarkup">
<div class="navbar-nav ml-auto">
<a href="#" class="nav-item nav-link active">
<i class="medium material-icons float-left text-lgray" style="font-size: 2rem;">notifications_none</i>
</a>
<li class="nav-item dropdown mr-1">
<a class="nav-item nav-link active dropdown-toggle" data-toggle="dropdown" href="#">
<img class="responsive-img pr-1" src="<?php echo base_url()?>assets/img/dp.png">
</a>
<!-- dropdown items here -->
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="/me">Profile</a>
<a class="dropdown-item" href="<?php echo base_url('/logout') ?>">Logout</a>
</div>
<!-- end of dropdown -->
</li>
</div>
</div>
</nav>
<ul class="nav navbar-menu shadow-light -twitter pt-2 pb-0 pl-5 m-0">
<li class="item <?php echo $home?>"><a class="link no-deco" href="<?php echo base_url() ?>">Home</a></li>
<!-- <li class="item <?php echo $employee?>"><a class="link no-deco " href='/employee'>Employee</a></li> -->
<li class="nav-item dropdown item <?php echo $employee?>">
<a class="nav-item nav-link active link no-deco" style="padding-top: 15px; padding-bottom: 16px;" data-toggle="dropdown" href="#">
Employee
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="<?php echo base_url('/preemployment') ?>">Job Postings</a>
<a class="dropdown-item" href="<?php echo base_url('/employee') ?>">Employment</a>
<a class="dropdown-item" href="<?php echo base_url('/postemployment') ?>">Downloadable Resources</a>
</div>
</li>
<li class="item <?php echo $evaluation?>"><a class="link no-deco" href="<?php echo base_url('/evaluation') ?>">Evaluation</a></li>
<li class="item <?php echo $message?>"><a class="link no-deco" href="<?php echo base_url('/message') ?>">Message</a></li>
</ul>
</div>
| alohajaycee/hris_development | application/views/include_navigation.php | PHP | mit | 2,878 | [
30522,
1026,
1029,
25718,
1002,
2188,
1027,
19701,
1025,
1002,
4646,
1027,
19701,
1025,
1002,
7904,
1027,
19701,
1025,
1002,
9312,
1027,
19701,
1025,
1002,
4471,
1027,
19701,
1025,
6942,
1006,
1002,
3161,
1007,
1063,
2553,
1005,
2188,
1005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Internet Exchange
An Internet exchange point, also known as IX or IXP, is an infrastructure
through which autonomous systems exchange traffic. An IX can be a single local
LAN or it can be spread across multiple locations.
## In Peering Manager
Inside Peering Manager, you create an Internet exchange to then create one or
more peering BGP sessions. Only Internet Exchange Peering Sessions can be
related to an Internet exchange. For each Internet exchange you create,
the following properties can be configured (n.b. some are optional):
* `Name`: human-readable name attached to the IX.
* `Slug`: unique configuration and URL friendly name; usually it is
automatically generated from the IXP's name.
* `Local Autonomous System`: your autonomous system connected to this IX.
* `Comments`: text to explain what the Internet exchange is for. Can use
Markdown formatting.
* `Check BGP Session States`: whether Peering Manager should poll the state
of BGP sessions at this IX.
* `Import Routing Policies`: a list of routing policies to apply when
receiving prefixes though BGP sessions at this IX.
* `Export Routing Policies`: a list of routing policies to apply when
advertising prefixes though BGP sessions at this IX.
* `PeeringDB ID`: an integer which is the ID of the IX LAN inside PeeringDB.
This setting is required for Peering Manager to discover potential
unconfigured BGP sessions.[^1]
* `IPv6 Address`: an IPv6 address used to connect to the Internet exchange
network. [^2]
* `IPv4 Address`: an IPv4 address used to connect to the Internet exchange
network. [^2]
* `Router`: a router connected to the Internet exchange. This is used to then
generate and install configurations.[^2]
* `Tags`: a list of tags to help identifying and searching for a group.
Please note that an Internet exchange is a kind of BGP group with more specific
properties aimed to match the purpose of an Internet exchange network. However
while a group can be configured on more than one router, an IX can only be
attached to a single router. This means that if you are connected more than
once to an IX, you'll have to create one IX object per connection.
[^1]: This is no longer user edible
[^2]: This moved to the [Connection](../../net/connection/) tab
| respawner/peering-manager | docs/models/peering/internetexchange.md | Markdown | apache-2.0 | 2,268 | [
30522,
1001,
4274,
3863,
2019,
4274,
3863,
2391,
1010,
2036,
2124,
2004,
11814,
2030,
11814,
2361,
1010,
2003,
2019,
6502,
2083,
2029,
8392,
3001,
3863,
4026,
1012,
2019,
11814,
2064,
2022,
1037,
2309,
2334,
17595,
2030,
2009,
2064,
2022,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
title: 구조의 일방향성
author: drkim
date: 2008-01-22 00:39:06 +0900
tags: [깨달음의대화]
---
**결정하기와 진행하기**
컵에 돌과 자갈과 모래와 물을 고루 채운다면 어떻게 해야할까? 먼저 큰 돌을 넣고 다음 크기 순서대로 자갈과 모래를 넣고 마지막에 물을 채우는 것이 바른 방법이다. 빈틈없이 채워넣을 수 있다. 그것이 구조다.
세상은 구조로 되어 있다. 누구도 이 말을 부정하지 않더라. 구조가 일상적으로 많은 도움을 주고 있기 때문이다. 당신이 무엇을 원하든, 또 당신이 어떤 문제에 부닥쳐 있든 상관없이 구조는 구체적인 문제의 해법을 알려준다.
맞닥들인 문제 앞에서 당신의 대응은 어떤 결정을 내리는 것이다. 그리고 그 결정은 당신의 나아갈 길에 대한 결정이다. 두 갈래 길이 있다면 어떤 결정을 내려야 할까? 어느 길로 가야 할까? 구조는 그 길을 결정하기다.
구조의 대의는 '그 길은 본래 정해져 있다'는 것이다. 당신이 임의로 바꿀 수 없다. 그릇에 돌과 자갈과 모래를 담는다면 크기 순으로 담아야 한다. 그 역의 방법은 원초적으로 가능하지 않다. 결단코 그러하다.
정답이 정해져 있다. 반드시 그것을 선택해야 한다. 그렇게 하지 않는다면 실패하고 만다. 그 경우 당신은 소기의 목적을 달성할 수 없다. 당신의 결정은 잘못된 결정이 된다. 구조를 따르지 않으면 안 된다.
구조가 있어서 정답을 알려준다. 그러므로 결정할 수 있다. 맞닥들인 문제 앞에서 지금 당장 무엇을 어떻게 해야하는지 답을 알려준다. 두 갈래 길 중에서 어느 쪽 길을 선택해야 하는지 알려준다. 구조를 알지 않으면 안 된다.
**구조의 일방향성**
둘 중 하나를 선택해야만 하는 상황이 있다. 이쪽과 저쪽이 있다. 이쪽에서 저쪽으로 건너갈 수는 있는데, 반대로 저쪽에서 이쪽으로 되돌아올 수는 없는 경우가 있다. 바로 그것이 구조다.
당신은 언제라도 이쪽에서 출발하여 저쪽으로 가는 길을 선택해야 한다. 이쪽에서 저쪽은 가능한데 저쪽에서 이쪽은 불가능하다는 것, 언제라도 일방향으로의 전개만 가능하다는 것, 바로 그것이 구조다.
역방향 진행은 물리적으로 불가능하다. 왜 불가능한가? 무에서 유가 생겨날 수는 없으므로 불가능하다. 아르키메데스가 다시 돌아와도 받침점 없이는 지구를 들 수 없기 때문에 불가능하다.
작은 그릇에 큰 그릇을 담을 수 없으므로 불가능하다. 활 없이는 화살을 쏘아보낼 수 없으므로 불가능하다. 한번 엎어진 물은 주워담을 수 없으므로 불가능하다. 세상에는 애초에 가능한 길이 있고 원초적으로 불가능한 길이 있다.
당신은 두갈래 길 중에서 하나를 선택해야 한다. 어느 쪽을 선택할 것인가? 그 그릇에 고루 채워넣되 돌과 자갈을 먼저 넣은 다음 모래와 물의 순서로 넣어야 한다. 그래야만 성공한다. 그렇게 결정해야 한다. 그것이 구조다.
구조원리에 따라 길은 정해져 있다. 정답은 정해져 있다. 당신이 어떤 문제에 부닥쳐 있든 정해져 있는 길을 따라 일방향으로 움직여야 한다. 그래야 문제가 해결된다. 처음부터 길을 알고 가는 것, 바로 그것이 구조다.
∑ | gujoron/gujoron.github.io | _posts/2008-01-22-구조의-일방향성.md | Markdown | apache-2.0 | 3,595 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
2516,
1024,
1455,
30014,
30000,
30011,
29999,
30018,
100,
3166,
1024,
2852,
21138,
3058,
1024,
2263,
1011,
5890,
1011,
2570,
4002,
1024,
4464,
1024,
5757,
1009,
5641,
8889,
22073,
1024,
1031,
100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'msl-client'
require 'test/unit'
require 'json'
require 'selenium-webdriver'
class MockapiTest < Test::Unit::TestCase
class << self
# Sets up the webdriver before before starting the tests.
def startup
ENV['HTTP_PROXY'] = ENV['http_proxy'] = nil
$driver = Selenium::WebDriver.for :chrome
$driver.navigate.to 'http://localhost:8001/msl-sample-app/index.html'
end
# Kills the webdriver instance when all tests are finished.
def shutdown
$driver.quit
end
end
# This is used to test the basic text response. A function is executed
# on the web-server to format the text.
def testTextResponse
# Clear the autocomplete to make sure this test starts from scratch.
autocomplete = $driver.find_element(:id => 'autocomplete')
autocomplete.clear()
# Take focus off of the autocomplete box to make sure the dropdown
# goes away.
$driver.find_element(:id => 'postRequest').click()
sleep(1)
# Setup all of the needed data like request path, the response, function
# for formatting, etc.
configurations = {}
configurations['requestPath'] = '/services/getlanguages'
configurations['responseText'] = '{"label":"Java"},{"label":"Perl"}'
configurations['contentType'] = 'application/json'
configurations['eval'] = 'function (req,responseText) { return "[" + responseText + "]"; }'
configurations['statusCode'] = '200'
configurations['delayTime'] = '0'
# Actually make the call to register this information.
setMockRespond('localhost', 8001,configurations.to_json)
# Trigger event that fires off request.
autocomplete.send_keys 'J'
# Grab the dropdown elements and validate the data against the registered response.
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until {$driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[1]').displayed?}
optionOne = $driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[1]')
optionTwo = $driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[2]')
assert_equal('Java',optionOne.text)
assert_equal('Perl',optionTwo.text)
end
# This tests using a template to generate a response.
def testTemplateResponse
# Clear the autocomplete to make sure this test starts from scratch.
autocomplete = $driver.find_element(:id => 'autocomplete')
autocomplete.clear()
# Take focus off of the autocomplete box to make sure the dropdown
# goes away.
$driver.find_element(:id => 'postRequest').click()
sleep(1)
# Register the template that will be used later with the key-value pairs.
registerTemplate('localhost', 8001,
'[{"label":"{{param1}}"},{"label":"{{param2}}"}]', 'example')
# Setup all of the needed data like request path, key-value pairs, and template id.
configurations = {}
configurations['requestPath'] = '/services/getlanguages'
configurations['contentType'] = 'application/json'
configurations['statusCode'] = '200'
configurations['delayTime'] = '0'
# The values that are to replace the keys in the registered template.
keyVals = {}
keyVals['param1'] = 'German'
keyVals['param2'] = 'English'
configurations['keyValues'] = keyVals
configurations['id'] = 'example'
# Actually make the call to register this information.
setMockRespond('localhost', 8001,configurations.to_json)
# Trigger event that fires off request.
autocomplete.send_keys 'J'
# Grab the dropdown elements and validate the data against the registered response.
wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds
wait.until {$driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[1]').displayed?}
optionOne = $driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[1]')
optionTwo = $driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[2]')
assert_equal('German',optionOne.text)
assert_equal('English',optionTwo.text)
end
# This tests the ability to intercept, and validate intercepted, get requests.
def test_getIntercepted
# Register the request path of the get request to be intercepted
setInterceptXHR('localhost', 8001, '/services/getservice')
# Put text into input box which will be added to get request
inputBox = $driver.find_element(:id => 'getInput')
inputBox.send_keys 'GET Example'
# Trigger the get request
postButton = $driver.find_element(:id =>'getRequest')
postButton.click()
sleep(1)
# Retrieve all request intercepted that have the provided request path
intercepted = JSON.parse(getInterceptedXHR('localhost', '8001', '/services/getservice'))
# Validate the method and url of the intercepted request
req1 = intercepted['xhr_1']
assert_equal('GET',req1['xhr']['method'])
assert_equal('/services/getservice?term=GET+Example', req1['xhr']['url'])
assert_equal(nil, req1['post'])
end
# This tests the ability to intercept, and validate intercepted, post requests.
def test_postIntercepted
# Register the request path of the post request to be intercepted
setInterceptXHR('localhost', 8001, '/services/postservice')
# Put text into input box which will be added to post request
inputBox = $driver.find_element(:id => 'output-box')
inputBox.send_keys 'POST Example'
# Trigger the post request
postButton = $driver.find_element(:id =>'postRequest')
postButton.click()
sleep(1)
# Retrieve all request intercepted that have the provided request path
intercepted = JSON.parse(getInterceptedXHR('localhost', '8001', '/services/postservice'))
# Validate the method and url of the intercepted request
req1 = intercepted['xhr_1']
assert_equal('POST',req1['xhr']['method'])
assert_equal('/services/postservice', req1['xhr']['url'])
assert_equal(req1['post'], req1['post'][/timestamp=\d*&text=POST\+Example/])
end
# This is used to test unregistering a request path.
def testUnRegisterMock
# Clear the autocomplete to make sure this test starts from scratch.
autocomplete = $driver.find_element(:id => 'autocomplete')
autocomplete.clear()
# Take focus off of the autocomplete box to make sure the dropdown
# goes away.
$driver.find_element(:id => 'postRequest').click()
sleep(1)
# Setup all of the needed data like request path, the response, function
# for formatting, etc.
configurations = {}
configurations['requestPath'] = '/services/getlanguages'
configurations['responseText'] = '[{"label":"Java"},{"label":"Perl"}]'
configurations['contentType'] = 'application/json'
configurations['statusCode'] = '200'
configurations['delayTime'] = '0'
# Actually make the call to register this information.
setMockRespond('localhost', 8001,configurations.to_json)
# Trigger event that fires off request.
element = $driver.find_element(:id => 'autocomplete')
element.send_keys 'J'
# Grab the dropdown elements and validate the data against the registered response to make sure
# it worked before unregistering.
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until {$driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[1]').displayed?}
optionOne = $driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[1]')
optionTwo = $driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[2]')
assert_equal('Java',optionOne.text)
assert_equal('Perl',optionTwo.text)
# Unregister the request path
unRegisterMock('localhost', 8001, '/services/getlanguages');
autocomplete.clear()
$driver.find_element(:id => 'postRequest').click()
element.send_keys 'J'
assert_true(!$driver.find_element(:xpath => './/ul[contains(@class, "ui-autocomplete")]/li[1]').displayed?)
end
end | smartpcr/MSL | msl-client-ruby/lib/msl-client-test.rb | Ruby | apache-2.0 | 8,039 | [
30522,
5478,
1005,
5796,
2140,
1011,
7396,
1005,
5478,
1005,
3231,
1013,
3131,
1005,
5478,
1005,
1046,
3385,
1005,
5478,
1005,
7367,
7770,
5007,
1011,
4773,
23663,
2099,
1005,
2465,
12934,
9331,
7616,
2102,
1026,
3231,
1024,
1024,
3131,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#
# Copyright (c) 1999, 2005, 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.
#
BUILDDIR = ../../../../../../..
PACKAGE = com.sun.corba.se.impl.oa.poa
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
#
# Files
#
CORBA_JMK_DIRECTORY=$(TOPDIR)/make/com/sun/corba/minclude/
include $(CORBA_JMK_DIRECTORY)com_sun_corba_se_impl_oa_poa.jmk
#
# Include
#
include $(BUILDDIR)/common/Classes.gmk
| ohpauleez/soymacchiato | src/corba/make/com/sun/corba/se/impl/oa/poa/Makefile | Makefile | gpl-2.0 | 1,500 | [
30522,
1001,
1001,
9385,
1006,
1039,
1007,
2639,
1010,
2384,
1010,
14721,
1998,
1013,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1001,
2079,
2025,
11477,
2030,
6366,
9385,
14444,
2030,
2023,
5371,
20346,
1012,
1001,
1001,
2023,
3642,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// GPDownloader.h
// test
//
// Created by mac on 15-2-3.
// Copyright (c) 2015年 gpr. All rights reserved.
//
#import <Foundation/Foundation.h>
@class GPDownloader;
typedef NS_ENUM(NSUInteger, GPDownloaderStatus) {
GPDownloaderStatusReady,
GPDownloaderStatusDownLoading,
GPDownloaderStatusPause,
GPDownloaderStatusFinish,
GPDownloaderStatusDestory,
GPDownloaderStatusError
};
// 这些block都不在主线程中执行
typedef void(^StartTaskBlock)(GPDownloader * downloader);
typedef void(^ProgressBlock)(unsigned long long currDownloadSize);
typedef void(^CompleteBlock)(GPDownloader *downloader);
typedef void(^ErrorBlock)(GPDownloader *mdownloader,NSError *error);
// 代理,注意代理方法运行在子线程中
@protocol GPDownloaderDelegate <NSObject>
- (void)downloaderDidStart:(GPDownloader *) downloader;
- (void)downloaderDidUpdateDataSize:(unsigned long long)currDownloadSize;
- (void)downloaderDidComplete:(GPDownloader *) downloader;
- (void)downloader:(GPDownloader *)downloader DidDownLoadFail:(NSError *)error;
@end
@interface GPDownloader : NSObject
#pragma mark - 初始化
+ (instancetype)downloaderWithURLString:(NSString *)urlString downloadRange:(NSRange)downloadRange fileName:(NSString *)fileName;
- (instancetype)initWithURLString:(NSString *)urlString downloadRange:(NSRange)downloadRange fileName:(NSString *)fileName;
+ (instancetype)downloaderWithURLString:(NSString *)urlString downloadRange:(NSRange)downloadRange startBlock:(StartTaskBlock)startBlock progressBlock:(ProgressBlock)progressBlock completeBlock:(CompleteBlock)completeBlock errorBlock:(ErrorBlock)errorBlock fileName:(NSString *)fileName;
- (instancetype)initWithURLString:(NSString *)urlString downloadRange:(NSRange)downloadRange startBlock:(StartTaskBlock)startBlock progressBlock:(ProgressBlock)progressBlock completeBlock:(CompleteBlock)completeBlock errorBlock:(ErrorBlock)errorBlock fileName:(NSString *)fileName;
@property (nonatomic,copy) NSString *urlString;
@property (nonatomic,assign) NSRange downloadRange;
@property (nonatomic,strong) NSString *fileName;
/** 用来标志下载文件的顺序,以便以后拼接文件方便 */
@property (nonatomic,assign) NSInteger fileIndex;
/** 当连接失败的时候会尝试重新连接,默认重新尝试连接次数为3 */
@property (nonatomic,assign) NSInteger maxRestartCount;
/** 已经下载的长度 */
@property (nonatomic,assign) unsigned long long currFileSize;
/** 代理 */
@property (nonatomic,weak) id<GPDownloaderDelegate> delegate;
/** 超时时间,默认为5秒*/
@property (nonatomic,assign) NSTimeInterval timeOut;
/** 临时文件的名字,用于标识一个 GPDownloader 的唯一标识 */
@property (nonatomic,copy,readonly) NSString *tempFilePath;
#pragma mark - 监听下载状态
//@property (nonatomic,assign) GPDownloaderStatus state;
@property (nonatomic,copy) StartTaskBlock startBlock;
@property (nonatomic,copy) ProgressBlock progressBlock;
@property (nonatomic,copy) CompleteBlock completeBlock;
@property (nonatomic,copy) ErrorBlock errorBlock;
#pragma mark - 下载器状态管理
- (void)startDownloadTask;
- (void)pause;
- (void)resume;
- (void)stop;
- (void)destoryDownloader;
@end
| gpr321/amusement | category/category/GPDownloader1/GPDownloader.h | C | mit | 3,235 | [
30522,
1013,
1013,
1013,
1013,
14246,
7698,
11066,
2121,
1012,
1044,
1013,
1013,
3231,
1013,
1013,
1013,
1013,
2580,
2011,
6097,
2006,
2321,
1011,
1016,
1011,
1017,
1012,
1013,
1013,
9385,
1006,
1039,
1007,
2325,
1840,
14246,
2099,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright 2011-2017 Asakusa Framework Team.
*
* 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.asakusafw.testdriver.core;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
import com.asakusafw.runtime.io.ModelOutput;
import com.asakusafw.vocabulary.external.ImporterDescription;
/**
* Composition of registered {@link ImporterPreparator} as {@link ServiceLoader services}.
* @since 0.2.0
* @version 0.2.2
*/
public class SpiImporterPreparator implements ImporterPreparator<ImporterDescription> {
@SuppressWarnings("rawtypes")
private final List<ImporterPreparator> elements;
/**
* Creates a new instance.
* @param serviceClassLoader the class loader to load the registered services
* @throws IllegalArgumentException if some parameters were {@code null}
*/
public SpiImporterPreparator(ClassLoader serviceClassLoader) {
if (serviceClassLoader == null) {
throw new IllegalArgumentException("serviceClassLoader must not be null"); //$NON-NLS-1$
}
this.elements = Util.loadService(ImporterPreparator.class, serviceClassLoader);
}
/**
* Creates a new instance.
* @param elements the elements to be composited
* @throws IllegalArgumentException if some parameters were {@code null}
*/
public SpiImporterPreparator(List<? extends ImporterPreparator<?>> elements) {
if (elements == null) {
throw new IllegalArgumentException("elements must not be null"); //$NON-NLS-1$
}
this.elements = new ArrayList<>(elements);
}
@Override
public Class<ImporterDescription> getDescriptionClass() {
return ImporterDescription.class;
}
@Override
public void truncate(ImporterDescription description, TestContext context) throws IOException {
for (ImporterPreparator<?> element : elements) {
if (element.getDescriptionClass().isAssignableFrom(description.getClass())) {
truncate0(element, description, context);
return;
}
}
throw new IOException(MessageFormat.format(
Messages.getString("SpiImporterPreparator.errorFailedToTruncate"), //$NON-NLS-1$
description));
}
private <T extends ImporterDescription> void truncate0(
ImporterPreparator<T> preparator,
ImporterDescription description,
TestContext context) throws IOException {
assert preparator != null;
assert description != null;
T desc = preparator.getDescriptionClass().cast(description);
preparator.truncate(desc, context);
}
@Override
public <V> ModelOutput<V> createOutput(
DataModelDefinition<V> definition,
ImporterDescription description,
TestContext context) throws IOException {
for (ImporterPreparator<?> element : elements) {
if (element.getDescriptionClass().isAssignableFrom(description.getClass())) {
return createOutput0(definition, element, description, context);
}
}
throw new IOException(MessageFormat.format(
Messages.getString("SpiImporterPreparator.errorFailedToCreateOutput"), //$NON-NLS-1$
description));
}
private <T extends ImporterDescription, V> ModelOutput<V> createOutput0(
DataModelDefinition<V> definition,
ImporterPreparator<T> preparator,
ImporterDescription description,
TestContext context) throws IOException {
assert definition != null;
assert preparator != null;
assert description != null;
T desc = preparator.getDescriptionClass().cast(description);
return preparator.createOutput(definition, desc, context);
}
}
| cocoatomo/asakusafw | testing-project/asakusa-test-moderator/src/main/java/com/asakusafw/testdriver/core/SpiImporterPreparator.java | Java | apache-2.0 | 4,428 | [
30522,
1013,
1008,
1008,
1008,
9385,
2249,
1011,
2418,
17306,
22332,
2050,
7705,
2136,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace LeadCommerce\Shopware\SDK\Query;
use LeadCommerce\Shopware\SDK\Util\Constants;
/**
* Class CustomerQuery
*
* @author Alexander Mahrt <amahrt@leadcommerce.de>
* @copyright 2016 LeadCommerce <amahrt@leadcommerce.de>
*/
class CustomerQuery extends Base
{
/**
* @var array
*/
protected $methodsAllowed = [
Constants::METHOD_CREATE,
Constants::METHOD_GET,
Constants::METHOD_GET_BATCH,
Constants::METHOD_UPDATE,
Constants::METHOD_DELETE,
];
/**
* @return mixed
*/
protected function getClass()
{
return 'LeadCommerce\\Shopware\\SDK\\Entity\\Customer';
}
/**
* Gets the query path to look for entities.
* E.G: 'variants' or 'articles'
*
* @return string
*/
protected function getQueryPath()
{
return 'customers';
}
}
| LeadCommerceDE/shopware-sdk | src/LeadCommerce/Shopware/SDK/Query/CustomerQuery.php | PHP | mit | 881 | [
30522,
1026,
1029,
25718,
3415,
15327,
2599,
9006,
5017,
3401,
1032,
4497,
8059,
1032,
17371,
2243,
1032,
23032,
1025,
2224,
2599,
9006,
5017,
3401,
1032,
4497,
8059,
1032,
17371,
30524,
1008,
1008,
1030,
3166,
3656,
5003,
8093,
2102,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
from django.db import models
import datetime
def get_choices(lst):
return [(i, i) for i in lst]
#
# Person
#
pprint_pan = lambda pan: "%s %s %s" % (pan[:5], pan[5:9], pan[9:])
class Person(models.Model):
name = models.CharField(max_length=255, db_index=True)
fathers_name = models.CharField(max_length=255, null=True, blank=True, db_index=True)
status = models.CharField(max_length=32, choices=get_choices([
'Individual',
'HUF',
'Partnership Firm',
'Domestic Company',
'LLP',
'Trust(ITR 7)',
]), default='Individual Salaried')
employer = models.CharField(max_length=64, null=True, blank=True)
self_occupied = models.BooleanField()
pan_number = models.CharField(max_length=32, unique=True)
user_id = models.CharField(max_length=32, null=True, blank=True)
password = models.CharField(max_length=32, null=True, blank=True)
bank_name = models.CharField(max_length=255, null=True, blank=True)
bank_branch = models.CharField(max_length=255, null=True, blank=True)
account_number = models.CharField(max_length=32, null=True, blank=True)
micr = models.CharField(max_length=32, blank=True, null=True)
ifsc_code = models.CharField(max_length=32, null=True, blank=True)
account_type = models.CharField(max_length=32, choices=get_choices(['SB', 'CA', 'CC']), default='SB')
contact_number = models.CharField(max_length=13, null=True, blank=True, db_index=True)
email = models.EmailField(null=True, blank=True, db_index=True)
address = models.TextField(max_length=32, null=True, blank=True)
city = models.CharField(max_length=64, null=True, blank=True, db_index=True)
pincode = models.CharField(max_length=10, null=True, blank=True, db_index=True)
date_of_birth_or_incarnation = models.DateField(null=True, blank=True)
def pan_number_pprint(self):
return pprint_pan(self.pan_number)
pan_number_pprint.admin_order_field = 'pan_number_pprint'
pan_number_pprint.short_description = 'Pan Number'
def _trim(self, *args):
for field in args:
value = getattr(self, field)
setattr(self, field, value.replace(' ', ''))
def save(self):
self._trim('pan_number')
super(Person, self).save()
def __unicode__(self):
return u'%s (%s)' % (self.name, self.pan_number)
class MetadataPerson(models.Model):
person = models.ForeignKey(Person)
key = models.CharField(max_length=250)
value = models.CharField(max_length=250)
#
# Report
#
class Report(models.Model):
finanyr = lambda yr: "%s - %s" % (yr, yr+1)
years = [(finanyr(i), finanyr(i)) for i in xrange(1980, 2020)]
person = models.ForeignKey(Person)
financial_year = models.CharField(max_length=11, choices=years, default=finanyr(datetime.datetime.now().year - 1))
assessment_year = models.CharField(max_length=11, choices=years, default=finanyr(datetime.datetime.now().year))
return_filed_on = models.DateField()
returned_income = models.DecimalField(max_digits=12, decimal_places=2)
#Advanced Tax
july = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
september = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
december = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
march = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
#Interest Detail
interest_234_a = models.DecimalField("Interest 234(a)", max_digits=12, decimal_places=2, null=True, blank=True)
interest_234_b = models.DecimalField("Interest 234(b)", max_digits=12, decimal_places=2, null=True, blank=True)
interest_234_c = models.DecimalField("Interest 234(c)", max_digits=12, decimal_places=2, null=True, blank=True)
#Tax detail
tds = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
self_assessment_tax = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
acknowledgement_number = models.CharField("Ack no.", max_length=64, null=True, blank=True)
#Bill Detail
bill_raised_on = models.DateField(null=True, blank=True)
bill_amount = models.DecimalField(max_digits=12, decimal_places=2, null=True, blank=True)
bill_received = models.BooleanField("Bill received ?")
mode_of_payment = models.CharField(max_length=16, choices=get_choices(['Cash', 'Cheque', 'DD', 'Bank Transfer']), null=True, blank=True)
payment_detail = models.CharField(max_length=16, null=True, blank=True)
#Order 143(1)
order_received_on_143_1 = models.DateField("143(1) Order received on", null=True, blank=True)
assessed_income_143_1 = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_143_1 = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
refund_amount_143_1 = models.DecimalField("Refund amount", max_digits=12, decimal_places=2, null=True, blank=True)
demand_raised_amount_143_1 = models.DecimalField("Demand raised for ", max_digits=12, decimal_places=2, null=True, blank=True)
refund_received_on_143_1 = models.DateField("Refund received on", null=True, blank=True)
#Order 143(2)
order_received_on_143_2 = models.DateField("Notice received on", null=True, blank=True)
#Order 143(3)
order_received_on_143_3 = models.DateField("Order received on", null=True, blank=True)
assessed_income_143_3 = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_143_3 = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
refund_amount_143_3 = models.DecimalField("Refund amount", max_digits=12, decimal_places=2, null=True, blank=True)
demand_raised_amount_143_3 = models.DecimalField("Demand raised for", max_digits=12, decimal_places=2, null=True, blank=True)
refund_received_on_143_3 = models.DateField("Refund received on", null=True, blank=True)
#Appeal before cit
filed_on_cit = models.DateField("Filed on", null=True, blank=True)
order_received_on_cit = models.DateField("Order received on", null=True, blank=True)
assessed_income_cit = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_cit = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
#Appeal before tribunal
filed_on_tribunal = models.DateField("Filed on", null=True, blank=True)
order_received_on_tribunal = models.DateField("Order received on", null=True, blank=True)
filed_by_tribunal = models.CharField("Filed by", max_length=16, choices=get_choices(['assessee', 'department']), null=True, blank=True)
assessed_income_tribunal = models.DecimalField("Assessed income", max_digits=12, decimal_places=2, null=True, blank=True)
assessed_tax_tribunal = models.DecimalField("Assessed tax", max_digits=12, decimal_places=2, null=True, blank=True)
def got_reimbursement(self):
return self.refund_amount_143_1 > 0
got_reimbursement.admin_order_field = 'got_reimbursement'
got_reimbursement.boolean = True
got_reimbursement.short_description = 'Got reimbursement ?'
def tax_paid(self):
tax = sum([i for i in (self.march, self.september, self.december, self.july) if i is not None])
if tax == 0 and self.tds is not None:
tax = self.tds
return tax
tax_paid.admin_order_field = 'tax_paid'
tax_paid.boolean = False
tax_paid.short_description = 'Tax Paid'
class Meta:
unique_together = ('person', 'financial_year')
def __unicode__(self):
return u'%s - %s' % (self.person, self.financial_year)
class MetadataReport(models.Model):
report = models.ForeignKey(Report)
key = models.CharField(max_length=250)
value = models.CharField(max_length=250)
| annual-client-report/Annual-Report | report/models.py | Python | mit | 8,050 | [
30522,
2013,
6520,
23422,
1012,
16962,
12324,
4275,
12324,
3058,
7292,
13366,
2131,
1035,
9804,
1006,
1048,
3367,
1007,
1024,
2709,
1031,
1006,
1045,
1010,
1045,
1007,
2005,
1045,
1999,
1048,
3367,
1033,
1001,
1001,
2711,
1001,
4903,
6657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.