text
stringlengths 2
1.04M
| meta
dict |
---|---|
package kg.jl.common;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("kg.jl.common.test", appContext.getPackageName());
}
}
| {
"content_hash": "91f446bb78faf3093f30e0586b5e78a4",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 78,
"avg_line_length": 28.192307692307693,
"alnum_prop": 0.7421555252387448,
"repo_name": "coca-cola33/CloudFilm",
"id": "585abba6f2aa05e68e870464ce47fbf0fbf3a35a",
"size": "733",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "common/src/androidTest/java/kg/jl/common/ExampleInstrumentedTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "887574"
}
],
"symlink_target": ""
} |
var path = require('path');
var aliasify = require('aliasify');
var common = require('./platforms/common');
var fs = require('fs');
var childProcess = require('child_process');
var events = require('cordova-common').events;
var bundle = require('cordova-js/tasks/lib/bundle-browserify');
var writeLicenseHeader = require('cordova-js/tasks/lib/write-license-header');
var Q = require('q');
var computeCommitId = require('cordova-js/tasks/lib/compute-commit-id');
var Readable = require('stream').Readable;
var PlatformJson = require('cordova-common').PlatformJson;
var PluginInfoProvider = require('cordova-common').PluginInfoProvider;
function generateFinalBundle (platform, libraryRelease, outReleaseFile, commitId, platformVersion) {
var deferred = Q.defer();
var outReleaseFileStream = fs.createWriteStream(outReleaseFile);
var time = new Date().valueOf();
writeLicenseHeader(outReleaseFileStream, platform, commitId, platformVersion);
var releaseBundle = libraryRelease.bundle();
releaseBundle.pipe(outReleaseFileStream);
outReleaseFileStream.on('finish', function () {
var newtime = new Date().valueOf() - time;
events.emit('verbose', 'generated cordova.' + platform + '.js @ ' + commitId + ' in ' + newtime + 'ms');
deferred.resolve();
// TODO clean up all the *.browserify files
});
outReleaseFileStream.on('error', function (err) {
events.emit('warn', 'Error while generating cordova.js');
deferred.reject(err);
});
return deferred.promise;
}
function computeCommitIdSync () {
var deferred = Q.defer();
computeCommitId(function (cId) {
deferred.resolve(cId);
});
return deferred.promise;
}
function getPlatformVersion (cId, project_dir) {
var deferred = Q.defer();
// run version script for each platform to get platformVersion
var versionPath = path.join(project_dir, '/cordova/version');
childProcess.exec('"' + versionPath + '"', function (err, stdout, stderr) {
if (err) {
err.message = 'Failed to get platform version (will use \'N/A\' instead).\n' + err.message;
events.emit('warn', err);
deferred.resolve('N/A');
} else {
deferred.resolve(stdout.trim());
}
});
return deferred.promise;
}
module.exports = function doBrowserify (project, platformApi, pluginInfoProvider) {
// Process:
// - Do config munging by calling into config-changes module
// - List all plugins in plugins_dir
// - Load and parse their plugin.xml files.
// - Skip those without support for this platform. (No <platform> tags means JS-only!)
// - Build a list of all their js-modules, including platform-specific js-modules.
// - For each js-module (general first, then platform) build up an object storing the path and any clobbers, merges and runs for it.
// Write this object into www/cordova_plugins.json.
// This file is not really used. Maybe cordova app harness
var platform = platformApi.platform;
events.emit('verbose', 'Preparing ' + platform + ' browserify project');
pluginInfoProvider = pluginInfoProvider || new PluginInfoProvider(); // Allow null for backwards-compat.
var platformJson = PlatformJson.load(project.locations.plugins, platform);
var wwwDir = platformApi.getPlatformInfo().locations.www;
var commitId;
return computeCommitIdSync()
.then(function (cId) {
commitId = cId;
return getPlatformVersion(commitId, platformApi.root);
}).then(function (platformVersion) {
var libraryRelease = bundle(platform, false, commitId, platformVersion, platformApi.getPlatformInfo().locations.platformWww);
var pluginMetadata = {};
var modulesMetadata = [];
var plugins = Object.keys(platformJson.root.installed_plugins).concat(Object.keys(platformJson.root.dependent_plugins));
events.emit('verbose', 'Iterating over plugins in project:', plugins);
plugins.forEach(function (plugin) {
var pluginDir = path.join(project.locations.plugins, plugin);
var pluginInfo = pluginInfoProvider.get(pluginDir);
// pluginMetadata is a mapping from plugin IDs to versions.
pluginMetadata[pluginInfo.id] = pluginInfo.version;
// Copy www assets described in <asset> tags.
pluginInfo.getAssets(platform)
.forEach(function (asset) {
common.asset.install(asset, pluginDir, wwwDir);
});
pluginInfo.getJsModules(platform)
.forEach(function (jsModule) {
var moduleName = jsModule.name ? jsModule.name : path.basename(jsModule.src, '.js');
var moduleId = pluginInfo.id + '.' + moduleName;
var moduleMetadata = {
file: jsModule.src,
id: moduleId,
name: moduleName,
pluginId: pluginInfo.id
};
if (jsModule.clobbers.length > 0) {
moduleMetadata.clobbers = jsModule.clobbers.map(function (o) { return o.target; });
}
if (jsModule.merges.length > 0) {
moduleMetadata.merges = jsModule.merges.map(function (o) { return o.target; });
}
if (jsModule.runs) {
moduleMetadata.runs = true;
}
modulesMetadata.push(moduleMetadata);
libraryRelease.require(path.join(pluginDir, jsModule.src), { expose: moduleId });
});
});
events.emit('verbose', 'Writing out cordova_plugins.js...');
// Create a stream and write plugin metadata into it
// instead of generating intermediate file on FS
var cordova_plugins = new Readable();
cordova_plugins.push(
'module.exports = ' + JSON.stringify(modulesMetadata, null, 2) + ';\n' +
'module.exports.metadata = ' + JSON.stringify(pluginMetadata, null, 2) + ';\n', 'utf8');
cordova_plugins.push(null);
var bootstrap = new Readable();
bootstrap.push('require(\'cordova/init\');\n', 'utf8');
bootstrap.push(null);
var moduleAliases = modulesMetadata
.reduce(function (accum, meta) {
accum['./' + meta.name] = meta.id;
return accum;
}, {});
libraryRelease
.add(cordova_plugins, {file: path.join(wwwDir, 'cordova_plugins.js'), expose: 'cordova/plugin_list'})
.add(bootstrap)
.transform(aliasify, {aliases: moduleAliases});
var outReleaseFile = path.join(wwwDir, 'cordova.js');
return generateFinalBundle(platform, libraryRelease, outReleaseFile, commitId, platformVersion);
});
};
| {
"content_hash": "b5787bd890456bdbc273644cf8b6746e",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 137,
"avg_line_length": 44.51851851851852,
"alnum_prop": 0.5990016638935108,
"repo_name": "purplecabbage/cordova-lib",
"id": "1a773711a9c51ebb0f80858be7f5f717fc7880d4",
"size": "8027",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "src/plugman/browserify.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "20076"
},
{
"name": "C",
"bytes": "1420"
},
{
"name": "CSS",
"bytes": "74380"
},
{
"name": "HTML",
"bytes": "82245"
},
{
"name": "Java",
"bytes": "278938"
},
{
"name": "JavaScript",
"bytes": "923328"
},
{
"name": "Matlab",
"bytes": "1411"
},
{
"name": "Objective-C",
"bytes": "1520"
},
{
"name": "Shell",
"bytes": "555"
},
{
"name": "Smalltalk",
"bytes": "332"
}
],
"symlink_target": ""
} |
#ifndef MBED_COMMON_OBJECTS_H
#define MBED_COMMON_OBJECTS_H
#include "cmsis.h"
#include "PortNames.h"
#include "PeripheralNames.h"
#include "PinNames.h"
#ifdef __cplusplus
extern "C" {
#endif
struct pwmout_s {
PWMName pwm;
PinName pin;
uint32_t prescaler;
uint32_t period;
uint32_t pulse;
uint8_t channel;
uint8_t inverted;
};
struct spi_s {
SPI_HandleTypeDef handle;
IRQn_Type spiIRQ;
SPIName spi;
PinName pin_miso;
PinName pin_mosi;
PinName pin_sclk;
PinName pin_ssel;
#ifdef DEVICE_SPI_ASYNCH
uint32_t event;
uint8_t transfer_type;
#endif
};
struct serial_s {
UARTName uart;
int index; // Used by irq
uint32_t baudrate;
uint32_t databits;
uint32_t stopbits;
uint32_t parity;
PinName pin_tx;
PinName pin_rx;
#if DEVICE_SERIAL_ASYNCH
uint32_t events;
#endif
#if DEVICE_SERIAL_FC
uint32_t hw_flow_ctl;
PinName pin_rts;
PinName pin_cts;
#endif
};
struct i2c_s {
/* The 1st 2 members I2CName i2c
* and I2C_HandleTypeDef handle should
* be kept as the first members of this struct
* to ensure i2c_get_obj to work as expected
*/
I2CName i2c;
I2C_HandleTypeDef handle;
uint8_t index;
int hz;
PinName sda;
PinName scl;
IRQn_Type event_i2cIRQ;
IRQn_Type error_i2cIRQ;
uint32_t XferOperation;
volatile uint8_t event;
volatile int pending_start;
#if DEVICE_I2CSLAVE
uint8_t slave;
volatile uint8_t pending_slave_tx_master_rx;
volatile uint8_t pending_slave_rx_maxter_tx;
#endif
#if DEVICE_I2C_ASYNCH
uint32_t address;
uint8_t stop;
uint8_t available_events;
#endif
};
#include "gpio_object.h"
#if DEVICE_ANALOGOUT
struct dac_s {
DACName dac;
PinName pin;
uint32_t channel;
DAC_HandleTypeDef handle;
};
#endif
#ifdef __cplusplus
}
#endif
/* STM32F0 HAL doesn't provide this API called in rtc_api.c */
#define __HAL_RCC_RTC_CLKPRESCALER(__RTCCLKSource__)
#define RTC_WKUP_IRQn RTC_IRQn
#endif
| {
"content_hash": "30388525dede4739bf38e0c4853a4318",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 62,
"avg_line_length": 19.228571428571428,
"alnum_prop": 0.6666666666666666,
"repo_name": "NXPmicro/mbed",
"id": "c0e1bc1dd451af953825c8414df6d5c5caacd83d",
"size": "3788",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "targets/TARGET_STM/TARGET_STM32F0/common_objects.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "6540059"
},
{
"name": "Batchfile",
"bytes": "22"
},
{
"name": "C",
"bytes": "286544888"
},
{
"name": "C++",
"bytes": "10170292"
},
{
"name": "CMake",
"bytes": "5285"
},
{
"name": "HTML",
"bytes": "2063156"
},
{
"name": "Makefile",
"bytes": "103452"
},
{
"name": "Objective-C",
"bytes": "434371"
},
{
"name": "Perl",
"bytes": "2589"
},
{
"name": "Python",
"bytes": "38809"
},
{
"name": "Shell",
"bytes": "16819"
},
{
"name": "XSLT",
"bytes": "5596"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>ARIA 1.0 Test Case 719</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>ARIA 1.0 Test Case 719</h1>
<div id="TEST_ID_1">
</div>
<h2>Description</h2>
<p>The aria-live attribute is added to an element in the document by a
script after the onload event completes with the value="polite" and
the element has a child DOM element node that contains text content.
After the aria-live attribute is added, the CSS 'visibility' property
of the child DOM element node is changed to visibility="hidden".</p>
<script type="text/javascript">
function hideElement() {
var node = document.getElementById('TEST_ID_2');
node.style.visibility = "hidden";
}
function addLiveRegion() {
var node = document.getElementById('TEST_ID_1');
var live_node = document.createElement('div');
live_node.setAttribute('aria-live', 'polite');
var element_node = document.createElement('div');
element_node.setAttribute('id', 'TEST_ID_2');
var text_node = document.createTextNode('TEST TEXT');
element_node.appendChild(text_node);
live_node.appendChild(element_node);
node.appendChild(live_node);
setTimeout(hideElement,500);
}
function onload() {
setTimeout(addLiveRegion,1000);
}
window.addEventListener('load', onload);
</script>
</body>
</html>
| {
"content_hash": "a046255aff4749bf00a4a8fd7d2928a4",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 76,
"avg_line_length": 29.92452830188679,
"alnum_prop": 0.6078184110970997,
"repo_name": "youtube/cobalt",
"id": "4fd10b746b761b2597fb45c66c3e24d6d5b39625",
"size": "1586",
"binary": false,
"copies": "215",
"ref": "refs/heads/master",
"path": "third_party/web_platform_tests/conformance-checkers/html-aria/accessible-name-updates/719.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package com.foc.formula.fucntion.old;
import com.foc.formula.FunctionFactory;
public class FunctionNot extends BooleanFunction {
private static final String FUNCTION_NAME = "NOT";
private static final String OPERATOR_SYMBOL = "!";
public Object compute() {
boolean res = false;
IOperand operand1 = getOperandAt(0);
if(operand1 != null){
String operandStr = String.valueOf(operand1.compute());
boolean operand1Boolean = Boolean.valueOf(operandStr);
res = !operand1Boolean;
}
return res;
}
public boolean needsManualNotificationToCompute() {
return false;
}
public static String getFunctionName(){
return FUNCTION_NAME;
}
public static String getOperatorSymbol(){
return OPERATOR_SYMBOL;
}
public static int getOperatorPriority(){
return FunctionFactory.PRIORITY_UNARY_SIGN_OPERATOR;
}
}
| {
"content_hash": "1d8119f7f8179c40bb844317a534ff21",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 58,
"avg_line_length": 23.756756756756758,
"alnum_prop": 0.7076222980659841,
"repo_name": "FOC-framework/framework",
"id": "4b5343f4bc606a56c094cf02bb1f75e8008e080c",
"size": "1656",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "foc/src/com/foc/formula/fucntion/old/FunctionNot.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "99"
},
{
"name": "Java",
"bytes": "9889245"
},
{
"name": "SCSS",
"bytes": "77175"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Login Page - Photon Admin Panel Theme</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="shortcut icon" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/favicon.ico" />
<link rel="apple-touch-icon" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/iosicon.png" />
<!-- DEVELOPMENT LESS -->
<!-- <link rel="stylesheet/less" href="css/photon.less" media="all" />
<link rel="stylesheet/less" href="css/photon-responsive.less" media="all" />
--> <!-- PRODUCTION CSS -->
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/css/css_compiled/photon-min.css?v1.1" media="all" />
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/css/css_compiled/photon-min-part2.css?v1.1" media="all" />
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/css/css_compiled/photon-responsive-min.css?v1.1" media="all" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/css_compiled/ie-only-min.css?v1.1" />
<![endif]-->
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="css/css_compiled/ie8-only-min.css?v1.1" />
<script type="text/javascript" src="js/plugins/excanvas.js"></script>
<script type="text/javascript" src="js/plugins/html5shiv.js"></script>
<script type="text/javascript" src="js/plugins/respond.min.js"></script>
<script type="text/javascript" src="js/plugins/fixFontIcons.js"></script>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/modernizr.custom.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.pnotify.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/less-1.3.1.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/xbreadcrumbs.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.maskedinput-1.3.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.autotab-1.1b.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/charCount.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.textareaCounter.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/elrte.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/elrte.en.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/select2.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery-picklist.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/additional-methods.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.form.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.metadata.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.mockjax.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.uniform.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.rating.pack.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/farbtastic.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.jstree.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.mCustomScrollbar.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.stack.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.pie.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.flot.resize.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/raphael.2.1.0.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/justgage.1.0.1.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.qrcode.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.clock.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.countdown.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.jqtweet.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/jquery.cookie.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/bootstrap-fileupload.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/prettify/prettify.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/bootstrapSwitch.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/plugins/mfupload.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/js/common.js"></script>
</head>
<body class="body-login">
<div class="nav-fixed-topright" style="visibility: hidden">
<ul class="nav nav-user-menu">
<li class="user-sub-menu-container">
<a href="javascript:;">
<i class="user-icon"></i><span class="nav-user-selection">Theme Options</span><i class="icon-menu-arrow"></i>
</a>
<ul class="nav user-sub-menu">
<li class="light">
<a href="javascript:;">
<i class='icon-photon stop'></i>Light Version
</a>
</li>
<li class="dark">
<a href="javascript:;">
<i class='icon-photon stop'></i>Dark Version
</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-photon mail"></i>
</a>
</li>
<li>
<a href="javascript:;">
<i class="icon-photon comment_alt2_stroke"></i>
<div class="notification-count">12</div>
</a>
</li>
</ul>
</div>
<script>
$(function(){
setTimeout(function(){
$('.nav-fixed-topright').removeAttr('style');
}, 300);
$(window).scroll(function(){
if($('.breadcrumb-container').length){
var scrollState = $(window).scrollTop();
if (scrollState > 0) $('.nav-fixed-topright').addClass('nav-released');
else $('.nav-fixed-topright').removeClass('nav-released')
}
});
$('.user-sub-menu-container').on('click', function(){
$(this).toggleClass('active-user-menu');
});
$('.user-sub-menu .light').on('click', function(){
if ($('body').is('.light-version')) return;
$('body').addClass('light-version');
setTimeout(function() {
$.cookie('themeColor', 'light', {
expires: 7,
path: '/'
});
}, 500);
});
$('.user-sub-menu .dark').on('click', function(){
if ($('body').is('.light-version')) {
$('body').removeClass('light-version');
$.cookie('themeColor', 'dark', {
expires: 7,
path: '/'
});
}
});
});
</script>
<div class="container-login">
<div class="form-centering-wrapper">
<div class="form-window-login">
<div class="form-window-login-logo">
<div class="login-logo">
<img src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/images/photon/login-logo@2x.png" alt="Photon UI"/>
</div>
<h2 class="login-title">Welcome to Photon UI!</h2>
<div class="login-member">Not a Member? <a href="elrte.min.js.html#">Sign Up »</a>
<a href="elrte.min.js.html#" class="btn btn-facebook"><i class="icon-fb"></i>Login with Facebook<i class="icon-fb-arrow"></i></a>
</div>
<div class="login-or">Or</div>
<div class="login-input-area">
<form method="POST" action="dashboard.php">
<span class="help-block">Login With Your Photon Account</span>
<input type="text" name="email" placeholder="Email">
<input type="password" name="password" placeholder="Password">
<button type="submit" class="btn btn-large btn-success btn-login">Login</button>
</form>
<a href="elrte.min.js.html#" class="forgot-pass">Forgot Your Password?</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1936460-27']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
| {
"content_hash": "ff022b4967017444ebe9712896d520dd",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 246,
"avg_line_length": 86.89795918367346,
"alnum_prop": 0.6914044152184124,
"repo_name": "user-tony/photon-rails",
"id": "6dd96ee5d70f2e2d06eeb34ccd8b4b06e5514025",
"size": "17032",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/assets/css/css_compiled/@{photonImagePath}plugins/elrte/js/plugins/css/css_compiled/js/plugins/prettify/js/plugins/elrte.min.js.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "291750913"
},
{
"name": "JavaScript",
"bytes": "59305"
},
{
"name": "Ruby",
"bytes": "203"
},
{
"name": "Shell",
"bytes": "99"
}
],
"symlink_target": ""
} |
package B;
import A.ParentClass;
class ChildClass extends ParentClass {
} | {
"content_hash": "f854eaca524e1e3325d43afc0062bb47",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 38,
"avg_line_length": 10.857142857142858,
"alnum_prop": 0.7763157894736842,
"repo_name": "theScratchLad/Algorithms",
"id": "fe265353952b844b2904533f74e03a4c4ae2638c",
"size": "76",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hackerrank/personal hacks/B/ChildClass.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "41889"
},
{
"name": "Python",
"bytes": "526"
}
],
"symlink_target": ""
} |
package com.panoramagl.opengl;
import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import javax.microedition.khronos.opengles.GL;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL10Ext;
import javax.microedition.khronos.opengles.GL11;
import javax.microedition.khronos.opengles.GL11Ext;
import javax.microedition.khronos.opengles.GL11ExtensionPack;
import android.opengl.GLSurfaceView;
public class GLWrapper implements IGLWrapper, GL11ExtensionPack
{
/**member variables*/
private GL10 mGL;
private GL10Ext mGL10Ext;
private GL11 mGL11;
private GL11Ext mGL11Ext;
private GL11ExtensionPack mGL11ExtPack;
private GLSurfaceView mGLSurfaceView;
/**init methods*/
public GLWrapper(GL gl, GLSurfaceView glSurfaceView)
{
mGL = (GL10)gl;
if(gl instanceof GL10Ext)
{
mGL10Ext = (GL10Ext)gl;
}
if(gl instanceof GL11)
{
mGL11 = (GL11)gl;
}
if(gl instanceof GL11Ext)
{
mGL11Ext = (GL11Ext)gl;
}
if(gl instanceof GL11ExtensionPack)
{
mGL11ExtPack = (GL11ExtensionPack)gl;
}
mGLSurfaceView = glSurfaceView;
}
/**property methods*/
@Override
public GLSurfaceView getGLSurfaceView()
{
return mGLSurfaceView;
}
/**GL10 methods*/
@Override
public void glActiveTexture(int texture)
{
mGL.glActiveTexture(texture);
}
@Override
public void glAlphaFunc(int func, float ref)
{
mGL.glAlphaFunc(func, ref);
}
@Override
public void glAlphaFuncx(int func, int ref)
{
mGL.glAlphaFuncx(func, ref);
}
@Override
public void glBindTexture(int target, int texture)
{
mGL.glBindTexture(target, texture);
}
@Override
public void glBlendFunc(int sfactor, int dfactor)
{
mGL.glBlendFunc(sfactor, dfactor);
}
@Override
public void glClear(int mask)
{
mGL.glClear(mask);
}
@Override
public void glClearColor(float red, float green, float blue, float alpha)
{
mGL.glClearColor(red, green, blue, alpha);
}
@Override
public void glClearColorx(int red, int green, int blue, int alpha)
{
mGL.glClearColorx(red, green, blue, alpha);
}
@Override
public void glClearDepthf(float depth)
{
mGL.glClearDepthf(depth);
}
@Override
public void glClearDepthx(int depth)
{
mGL.glClearDepthx(depth);
}
@Override
public void glClearStencil(int s)
{
mGL.glClearStencil(s);
}
@Override
public void glClientActiveTexture(int texture)
{
mGL.glClientActiveTexture(texture);
}
@Override
public void glColor4f(float red, float green, float blue, float alpha)
{
mGL.glColor4f(red, green, blue, alpha);
}
@Override
public void glColor4x(int red, int green, int blue, int alpha)
{
mGL.glColor4x(red, green, blue, alpha);
}
@Override
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha)
{
mGL.glColorMask(red, green, blue, alpha);
}
@Override
public void glColorPointer(int size, int type, int stride, Buffer pointer)
{
mGL.glColorPointer(size, type, stride, pointer);
}
@Override
public void glCompressedTexImage2D(int target, int level,
int internalformat, int width, int height, int border,
int imageSize, Buffer data)
{
mGL.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
}
@Override
public void glCompressedTexSubImage2D(int target, int level, int xoffset,
int yoffset, int width, int height, int format, int imageSize,
Buffer data)
{
mGL.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
}
@Override
public void glCopyTexImage2D(int target, int level, int internalformat,
int x, int y, int width, int height, int border)
{
mGL.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}
@Override
public void glCopyTexSubImage2D(int target, int level, int xoffset,
int yoffset, int x, int y, int width, int height)
{
mGL.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}
@Override
public void glCullFace(int mode)
{
mGL.glCullFace(mode);
}
@Override
public void glDeleteTextures(int n, IntBuffer textures)
{
mGL.glDeleteTextures(n, textures);
}
@Override
public void glDeleteTextures(int n, int[] textures, int offset)
{
mGL.glDeleteTextures(n, textures, offset);
}
@Override
public void glDepthFunc(int func)
{
mGL.glDepthFunc(func);
}
@Override
public void glDepthMask(boolean flag)
{
mGL.glDepthMask(flag);
}
@Override
public void glDepthRangef(float zNear, float zFar)
{
mGL.glDepthRangef(zNear, zFar);
}
@Override
public void glDepthRangex(int zNear, int zFar)
{
mGL.glDepthRangex(zNear, zFar);
}
@Override
public void glDisable(int cap)
{
mGL.glDisable(cap);
}
@Override
public void glDisableClientState(int array)
{
mGL.glDisableClientState(array);
}
@Override
public void glDrawArrays(int mode, int first, int count)
{
mGL.glDrawArrays(mode, first, count);
}
@Override
public void glDrawElements(int mode, int count, int type, Buffer indices)
{
mGL.glDrawElements(mode, count, type, indices);
}
@Override
public void glEnable(int cap)
{
mGL.glEnable(cap);
}
@Override
public void glEnableClientState(int array)
{
mGL.glEnableClientState(array);
}
@Override
public void glFinish()
{
mGL.glFinish();
}
@Override
public void glFlush()
{
mGL.glFlush();
}
@Override
public void glFogf(int pname, float param)
{
mGL.glFogf(pname, param);
}
@Override
public void glFogfv(int pname, FloatBuffer params)
{
mGL.glFogfv(pname, params);
}
@Override
public void glFogfv(int pname, float[] params, int offset)
{
mGL.glFogfv(pname, params, offset);
}
@Override
public void glFogx(int pname, int param)
{
mGL.glFogx(pname, param);
}
@Override
public void glFogxv(int pname, IntBuffer params)
{
mGL.glFogxv(pname, params);
}
@Override
public void glFogxv(int pname, int[] params, int offset)
{
mGL.glFogxv(pname, params, offset);
}
@Override
public void glFrontFace(int mode)
{
mGL.glFrontFace(mode);
}
@Override
public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar)
{
mGL.glFrustumf(left, right, bottom, top, zNear, zFar);
}
@Override
public void glFrustumx(int left, int right, int bottom, int top, int zNear, int zFar)
{
mGL.glFrustumx(left, right, bottom, top, zNear, zFar);
}
@Override
public void glGenTextures(int n, IntBuffer textures)
{
mGL.glGenTextures(n, textures);
}
@Override
public void glGenTextures(int n, int[] textures, int offset)
{
mGL.glGenTextures(n, textures, offset);
}
@Override
public int glGetError()
{
return mGL.glGetError();
}
@Override
public void glGetIntegerv(int pname, IntBuffer params)
{
mGL.glGetIntegerv(pname, params);
}
@Override
public void glGetIntegerv(int pname, int[] params, int offset)
{
mGL.glGetIntegerv(pname, params, offset);
}
@Override
public String glGetString(int name)
{
return mGL.glGetString(name);
}
@Override
public void glHint(int target, int mode)
{
mGL.glHint(target, mode);
}
@Override
public void glLightModelf(int pname, float param)
{
mGL.glLightModelf(pname, param);
}
@Override
public void glLightModelfv(int pname, FloatBuffer params)
{
mGL.glLightModelfv(pname, params);
}
@Override
public void glLightModelfv(int pname, float[] params, int offset)
{
mGL.glLightModelfv(pname, params, offset);
}
@Override
public void glLightModelx(int pname, int param)
{
mGL.glLightModelx(pname, param);
}
@Override
public void glLightModelxv(int pname, IntBuffer params)
{
mGL.glLightModelxv(pname, params);
}
@Override
public void glLightModelxv(int pname, int[] params, int offset)
{
mGL.glLightModelxv(pname, params, offset);
}
@Override
public void glLightf(int light, int pname, float param)
{
mGL.glLightf(light, pname, param);
}
@Override
public void glLightfv(int light, int pname, FloatBuffer params)
{
mGL.glLightfv(light, pname, params);
}
@Override
public void glLightfv(int light, int pname, float[] params, int offset)
{
mGL.glLightfv(light, pname, params, offset);
}
@Override
public void glLightx(int light, int pname, int param)
{
mGL.glLightx(light, pname, param);
}
@Override
public void glLightxv(int light, int pname, IntBuffer params)
{
mGL.glLightxv(light, pname, params);
}
@Override
public void glLightxv(int light, int pname, int[] params, int offset)
{
mGL.glLightxv(light, pname, params, offset);
}
@Override
public void glLineWidth(float width)
{
mGL.glLineWidth(width);
}
@Override
public void glLineWidthx(int width)
{
mGL.glLineWidthx(width);
}
@Override
public void glLoadIdentity()
{
mGL.glLoadIdentity();
}
@Override
public void glLoadMatrixf(FloatBuffer m)
{
mGL.glLoadMatrixf(m);
}
@Override
public void glLoadMatrixf(float[] m, int offset)
{
mGL.glLoadMatrixf(m, offset);
}
@Override
public void glLoadMatrixx(IntBuffer m)
{
mGL.glLoadMatrixx(m);
}
@Override
public void glLoadMatrixx(int[] m, int offset)
{
mGL.glLoadMatrixx(m, offset);
}
@Override
public void glLogicOp(int opcode)
{
mGL.glLogicOp(opcode);
}
@Override
public void glMaterialf(int face, int pname, float param)
{
mGL.glMaterialf(face, pname, param);
}
@Override
public void glMaterialfv(int face, int pname, FloatBuffer params)
{
mGL.glMaterialfv(face, pname, params);
}
@Override
public void glMaterialfv(int face, int pname, float[] params, int offset)
{
mGL.glMaterialfv(face, pname, params, offset);
}
@Override
public void glMaterialx(int face, int pname, int param)
{
mGL.glMaterialx(face, pname, param);
}
@Override
public void glMaterialxv(int face, int pname, IntBuffer params)
{
mGL.glMaterialxv(face, pname, params);
}
@Override
public void glMaterialxv(int face, int pname, int[] params, int offset)
{
mGL.glMaterialxv(face, pname, params, offset);
}
@Override
public void glMatrixMode(int mode)
{
mGL.glMatrixMode(mode);
}
@Override
public void glMultMatrixf(FloatBuffer m)
{
mGL.glMultMatrixf(m);
}
@Override
public void glMultMatrixf(float[] m, int offset)
{
mGL.glMultMatrixf(m, offset);
}
@Override
public void glMultMatrixx(IntBuffer m)
{
mGL.glMultMatrixx(m);
}
@Override
public void glMultMatrixx(int[] m, int offset)
{
mGL.glMultMatrixx(m, offset);
}
@Override
public void glMultiTexCoord4f(int target, float s, float t, float r, float q)
{
mGL.glMultiTexCoord4f(target, s, t, r, q);
}
@Override
public void glMultiTexCoord4x(int target, int s, int t, int r, int q)
{
mGL.glMultiTexCoord4x(target, s, t, r, q);
}
@Override
public void glNormal3f(float nx, float ny, float nz)
{
mGL.glNormal3f(nx, ny, nz);
}
@Override
public void glNormal3x(int nx, int ny, int nz)
{
mGL.glNormal3x(nx, ny, nz);
}
@Override
public void glNormalPointer(int type, int stride, Buffer pointer)
{
mGL.glNormalPointer(type, stride, pointer);
}
@Override
public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar)
{
mGL.glOrthof(left, right, bottom, top, zNear, zFar);
}
@Override
public void glOrthox(int left, int right, int bottom, int top, int zNear, int zFar)
{
mGL.glOrthox(left, right, bottom, top, zNear, zFar);
}
@Override
public void glPixelStorei(int pname, int param)
{
mGL.glPixelStorei(pname, param);
}
@Override
public void glPointSize(float size)
{
mGL.glPointSize(size);
}
@Override
public void glPointSizex(int size)
{
mGL.glPointSizex(size);
}
@Override
public void glPolygonOffset(float factor, float units)
{
mGL.glPolygonOffset(factor, units);
}
@Override
public void glPolygonOffsetx(int factor, int units)
{
mGL.glPolygonOffsetx(factor, units);
}
@Override
public void glPopMatrix()
{
mGL.glPopMatrix();
}
@Override
public void glPushMatrix()
{
mGL.glPushMatrix();
}
@Override
public void glReadPixels(int x, int y, int width, int height, int format, int type, Buffer pixels)
{
mGL.glReadPixels(x, y, width, height, format, type, pixels);
}
@Override
public void glRotatef(float angle, float x, float y, float z)
{
mGL.glRotatef(angle, x, y, z);
}
@Override
public void glRotatex(int angle, int x, int y, int z)
{
mGL.glRotatex(angle, x, y, z);
}
@Override
public void glSampleCoverage(float value, boolean invert)
{
mGL.glSampleCoverage(value, invert);
}
@Override
public void glSampleCoveragex(int value, boolean invert)
{
mGL.glSampleCoveragex(value, invert);
}
@Override
public void glScalef(float x, float y, float z)
{
mGL.glScalef(x, y, z);
}
@Override
public void glScalex(int x, int y, int z)
{
mGL.glScalex(x, y, z);
}
@Override
public void glScissor(int x, int y, int width, int height)
{
mGL.glScissor(x, y, width, height);
}
@Override
public void glShadeModel(int mode)
{
mGL.glShadeModel(mode);
}
@Override
public void glStencilFunc(int func, int ref, int mask)
{
mGL.glStencilFunc(func, ref, mask);
}
@Override
public void glStencilMask(int mask)
{
mGL.glStencilMask(mask);
}
@Override
public void glStencilOp(int fail, int zfail, int zpass)
{
mGL.glStencilOp(fail, zfail, zpass);
}
@Override
public void glTexCoordPointer(int size, int type, int stride, Buffer pointer)
{
mGL.glTexCoordPointer(size, type, stride, pointer);
}
@Override
public void glTexEnvf(int target, int pname, float param)
{
mGL.glTexEnvf(target, pname, param);
}
@Override
public void glTexEnvfv(int target, int pname, FloatBuffer params)
{
mGL.glTexEnvfv(target, pname, params);
}
@Override
public void glTexEnvfv(int target, int pname, float[] params, int offset)
{
mGL.glTexEnvfv(target, pname, params, offset);
}
@Override
public void glTexEnvx(int target, int pname, int param)
{
mGL.glTexEnvx(target, pname, param);
}
@Override
public void glTexEnvxv(int target, int pname, IntBuffer params)
{
mGL.glTexEnvxv(target, pname, params);
}
@Override
public void glTexEnvxv(int target, int pname, int[] params, int offset)
{
mGL.glTexEnvxv(target, pname, params, offset);
}
@Override
public void glTexImage2D(int target, int level, int internalformat,
int width, int height, int border, int format, int type,
Buffer pixels)
{
mGL.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
}
@Override
public void glTexParameterf(int target, int pname, float param)
{
mGL.glTexParameterf(target, pname, param);
}
@Override
public void glTexParameterx(int target, int pname, int param)
{
mGL.glTexParameterx(target, pname, param);
}
@Override
public void glTexSubImage2D(int target, int level, int xoffset,
int yoffset, int width, int height, int format, int type,
Buffer pixels)
{
mGL.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
}
@Override
public void glTranslatef(float x, float y, float z)
{
mGL.glTranslatef(x, y, z);
}
@Override
public void glTranslatex(int x, int y, int z)
{
mGL.glTranslatex(x, y, z);
}
@Override
public void glVertexPointer(int size, int type, int stride, Buffer pointer)
{
mGL.glVertexPointer(size, type, stride, pointer);
}
@Override
public void glViewport(int x, int y, int width, int height)
{
mGL.glViewport(x, y, width, height);
}
/**GL10Ext methods*/
@Override
public int glQueryMatrixxOES(IntBuffer mantissa, IntBuffer exponent)
{
return mGL10Ext.glQueryMatrixxOES(mantissa, exponent);
}
@Override
public int glQueryMatrixxOES(int[] mantissa, int mantissaOffset, int[] exponent, int exponentOffset)
{
return mGL10Ext.glQueryMatrixxOES(mantissa, mantissaOffset, exponent, exponentOffset);
}
/**GL11 methods*/
@Override
public void glBindBuffer(int target, int buffer)
{
mGL11.glBindBuffer(target, buffer);
}
@Override
public void glBufferData(int target, int size, Buffer data, int usage)
{
mGL11.glBufferData(target, size, data, usage);
}
@Override
public void glBufferSubData(int target, int offset, int size, Buffer data)
{
mGL11.glBufferSubData(target, offset, size, data);
}
@Override
public void glClipPlanef(int plane, FloatBuffer equation)
{
mGL11.glClipPlanef(plane, equation);
}
@Override
public void glClipPlanef(int plane, float[] equation, int offset)
{
mGL11.glClipPlanef(plane, equation, offset);
}
@Override
public void glClipPlanex(int plane, IntBuffer equation)
{
mGL11.glClipPlanex(plane, equation);
}
@Override
public void glClipPlanex(int plane, int[] equation, int offset)
{
mGL11.glClipPlanex(plane, equation, offset);
}
@Override
public void glColor4ub(byte red, byte green, byte blue, byte alpha)
{
mGL11.glColor4ub(red, green, blue, alpha);
}
@Override
public void glColorPointer(int size, int type, int stride, int offset)
{
mGL11.glColorPointer(size, type, stride, offset);
}
@Override
public void glDeleteBuffers(int n, IntBuffer buffers)
{
mGL11.glDeleteBuffers(n, buffers);
}
@Override
public void glDeleteBuffers(int n, int[] buffers, int offset)
{
mGL11.glDeleteBuffers(n, buffers, offset);
}
@Override
public void glDrawElements(int mode, int count, int type, int offset)
{
mGL11.glDrawElements(mode, count, type, offset);
}
@Override
public void glGenBuffers(int n, IntBuffer buffers)
{
mGL11.glGenBuffers(n, buffers);
}
@Override
public void glGenBuffers(int n, int[] buffers, int offset)
{
mGL11.glGenBuffers(n, buffers, offset);
}
@Override
public void glGetBooleanv(int pname, IntBuffer params)
{
mGL11.glGetBooleanv(pname, params);
}
@Override
public void glGetBooleanv(int pname, boolean[] params, int offset)
{
mGL11.glGetBooleanv(pname, params, offset);
}
@Override
public void glGetBufferParameteriv(int target, int pname, IntBuffer params)
{
mGL11.glGetBufferParameteriv(target, pname, params);
}
@Override
public void glGetBufferParameteriv(int target, int pname, int[] params, int offset)
{
mGL11.glGetBufferParameteriv(target, pname, params, offset);
}
@Override
public void glGetClipPlanef(int pname, FloatBuffer eqn)
{
mGL11.glGetClipPlanef(pname, eqn);
}
@Override
public void glGetClipPlanef(int pname, float[] eqn, int offset)
{
mGL11.glGetClipPlanef(pname, eqn, offset);
}
@Override
public void glGetClipPlanex(int pname, IntBuffer eqn)
{
mGL11.glGetClipPlanex(pname, eqn);
}
@Override
public void glGetClipPlanex(int pname, int[] eqn, int offset)
{
mGL11.glGetClipPlanex(pname, eqn, offset);
}
@Override
public void glGetFixedv(int pname, IntBuffer params)
{
mGL11.glGetFixedv(pname, params);
}
@Override
public void glGetFixedv(int pname, int[] params, int offset)
{
mGL11.glGetFixedv(pname, params, offset);
}
@Override
public void glGetFloatv(int pname, FloatBuffer params)
{
mGL11.glGetFloatv(pname, params);
}
@Override
public void glGetFloatv(int pname, float[] params, int offset)
{
mGL11.glGetFloatv(pname, params, offset);
}
@Override
public void glGetLightfv(int light, int pname, FloatBuffer params)
{
mGL11.glGetLightfv(light, pname, params);
}
@Override
public void glGetLightfv(int light, int pname, float[] params, int offset)
{
mGL11.glGetLightfv(light, pname, params, offset);
}
@Override
public void glGetLightxv(int light, int pname, IntBuffer params)
{
mGL11.glGetLightxv(light, pname, params);
}
@Override
public void glGetLightxv(int light, int pname, int[] params, int offset)
{
mGL11.glGetLightxv(light, pname, params, offset);
}
@Override
public void glGetMaterialfv(int face, int pname, FloatBuffer params)
{
mGL11.glGetMaterialfv(face, pname, params);
}
@Override
public void glGetMaterialfv(int face, int pname, float[] params, int offset)
{
mGL11.glGetMaterialfv(face, pname, params, offset);
}
@Override
public void glGetMaterialxv(int face, int pname, IntBuffer params)
{
mGL11.glGetMaterialxv(face, pname, params);
}
@Override
public void glGetMaterialxv(int face, int pname, int[] params, int offset)
{
mGL11.glGetMaterialxv(face, pname, params, offset);
}
@Override
public void glGetPointerv(int pname, Buffer[] params)
{
mGL11.glGetPointerv(pname, params);
}
@Override
public void glGetTexEnviv(int env, int pname, IntBuffer params)
{
mGL11.glGetTexEnviv(env, pname, params);
}
@Override
public void glGetTexEnviv(int env, int pname, int[] params, int offset)
{
mGL11.glGetTexEnviv(env, pname, params, offset);
}
@Override
public void glGetTexEnvxv(int env, int pname, IntBuffer params)
{
mGL11.glGetTexEnvxv(env, pname, params);
}
@Override
public void glGetTexEnvxv(int env, int pname, int[] params, int offset)
{
mGL11.glGetTexEnvxv(env, pname, params, offset);
}
@Override
public void glGetTexParameterfv(int target, int pname, FloatBuffer params)
{
mGL11.glGetTexParameterfv(target, pname, params);
}
@Override
public void glGetTexParameterfv(int target, int pname, float[] params, int offset)
{
mGL11.glGetTexParameterfv(target, pname, params, offset);
}
@Override
public void glGetTexParameteriv(int target, int pname, IntBuffer params)
{
mGL11.glGetTexParameteriv(target, pname, params);
}
@Override
public void glGetTexParameteriv(int target, int pname, int[] params, int offset)
{
mGL11.glGetTexParameteriv(target, pname, params, offset);
}
@Override
public void glGetTexParameterxv(int target, int pname, IntBuffer params)
{
mGL11.glGetTexParameterxv(target, pname, params);
}
@Override
public void glGetTexParameterxv(int target, int pname, int[] params, int offset)
{
mGL11.glGetTexParameterxv(target, pname, params, offset);
}
@Override
public boolean glIsBuffer(int buffer)
{
return mGL11.glIsBuffer(buffer);
}
@Override
public boolean glIsEnabled(int cap)
{
return mGL11.glIsEnabled(cap);
}
@Override
public boolean glIsTexture(int texture)
{
return mGL11.glIsTexture(texture);
}
@Override
public void glNormalPointer(int type, int stride, int offset)
{
mGL11.glNormalPointer(type, stride, offset);
}
@Override
public void glPointParameterf(int pname, float param)
{
mGL11.glPointParameterf(pname, param);
}
@Override
public void glPointParameterfv(int pname, FloatBuffer params)
{
mGL11.glPointParameterfv(pname, params);
}
@Override
public void glPointParameterfv(int pname, float[] params, int offset)
{
mGL11.glPointParameterfv(pname, params, offset);
}
@Override
public void glPointParameterx(int pname, int param)
{
mGL11.glPointParameterx(pname, param);
}
@Override
public void glPointParameterxv(int pname, IntBuffer params)
{
mGL11.glPointParameterxv(pname, params);
}
@Override
public void glPointParameterxv(int pname, int[] params, int offset)
{
mGL11.glPointParameterxv(pname, params, offset);
}
@Override
public void glPointSizePointerOES(int type, int stride, Buffer pointer)
{
mGL11.glPointSizePointerOES(type, stride, pointer);
}
@Override
public void glTexCoordPointer(int size, int type, int stride, int offset)
{
mGL11.glTexCoordPointer(size, type, stride, offset);
}
@Override
public void glTexEnvi(int target, int pname, int param)
{
mGL11.glTexEnvi(target, pname, param);
}
@Override
public void glTexEnviv(int target, int pname, IntBuffer params)
{
mGL11.glTexEnviv(target, pname, params);
}
@Override
public void glTexEnviv(int target, int pname, int[] params, int offset)
{
mGL11.glTexEnviv(target, pname, params, offset);
}
@Override
public void glTexParameterfv(int target, int pname, FloatBuffer params)
{
mGL11.glTexParameterfv(target, pname, params);
}
@Override
public void glTexParameterfv(int target, int pname, float[] params, int offset)
{
mGL11.glTexParameterfv(target, pname, params, offset);
}
@Override
public void glTexParameteri(int target, int pname, int param)
{
mGL11.glTexParameteri(target, pname, param);
}
@Override
public void glTexParameteriv(int target, int pname, IntBuffer params)
{
mGL11.glTexParameteriv(target, pname, params);
}
@Override
public void glTexParameteriv(int target, int pname, int[] params, int offset)
{
mGL11.glTexParameteriv(target, pname, params, offset);
}
@Override
public void glTexParameterxv(int target, int pname, IntBuffer params)
{
mGL11.glTexParameterxv(target, pname, params);
}
@Override
public void glTexParameterxv(int target, int pname, int[] params, int offset)
{
mGL11.glTexParameterxv(target, pname, params, offset);
}
@Override
public void glVertexPointer(int size, int type, int stride, int offset)
{
mGL11.glVertexPointer(size, type, stride, offset);
}
/**GL11Ext methods*/
@Override
public void glCurrentPaletteMatrixOES(int matrixpaletteindex)
{
mGL11Ext.glCurrentPaletteMatrixOES(matrixpaletteindex);
}
@Override
public void glDrawTexfOES(float x, float y, float z, float width, float height)
{
mGL11Ext.glDrawTexfOES(x, y, z, width, height);
}
@Override
public void glDrawTexfvOES(FloatBuffer coords)
{
mGL11Ext.glDrawTexfvOES(coords);
}
@Override
public void glDrawTexfvOES(float[] coords, int offset)
{
mGL11Ext.glDrawTexfvOES(coords, offset);
}
@Override
public void glDrawTexiOES(int x, int y, int z, int width, int height)
{
mGL11Ext.glDrawTexiOES(x, y, z, width, height);
}
@Override
public void glDrawTexivOES(IntBuffer coords)
{
mGL11Ext.glDrawTexivOES(coords);
}
@Override
public void glDrawTexivOES(int[] coords, int offset)
{
mGL11Ext.glDrawTexivOES(coords, offset);
}
@Override
public void glDrawTexsOES(short x, short y, short z, short width, short height)
{
mGL11Ext.glDrawTexsOES(x, y, z, width, height);
}
@Override
public void glDrawTexsvOES(ShortBuffer coords)
{
mGL11Ext.glDrawTexsvOES(coords);
}
@Override
public void glDrawTexsvOES(short[] coords, int offset)
{
mGL11Ext.glDrawTexsvOES(coords, offset);
}
@Override
public void glDrawTexxOES(int x, int y, int z, int width, int height)
{
mGL11Ext.glDrawTexxOES(x, y, z, width, height);
}
@Override
public void glDrawTexxvOES(IntBuffer coords)
{
mGL11Ext.glDrawTexxvOES(coords);
}
@Override
public void glDrawTexxvOES(int[] coords, int offset)
{
mGL11Ext.glDrawTexxvOES(coords, offset);
}
@Override
public void glLoadPaletteFromModelViewMatrixOES()
{
mGL11Ext.glLoadPaletteFromModelViewMatrixOES();
}
@Override
public void glMatrixIndexPointerOES(int size, int type, int stride, Buffer pointer)
{
mGL11Ext.glMatrixIndexPointerOES(size, type, stride, pointer);
}
@Override
public void glMatrixIndexPointerOES(int size, int type, int stride, int offset)
{
mGL11Ext.glMatrixIndexPointerOES(size, type, stride, offset);
}
@Override
public void glWeightPointerOES(int size, int type, int stride, Buffer pointer)
{
mGL11Ext.glWeightPointerOES(size, type, stride, pointer);
}
@Override
public void glWeightPointerOES(int size, int type, int stride, int offset)
{
mGL11Ext.glWeightPointerOES(size, type, stride, offset);
}
/**GL11ExtensionPack methods*/
@Override
public void glBindFramebufferOES(int target, int framebuffer)
{
mGL11ExtPack.glBindFramebufferOES(target, framebuffer);
}
@Override
public void glBindRenderbufferOES(int target, int renderbuffer)
{
mGL11ExtPack.glBindRenderbufferOES(target, renderbuffer);
}
@Override
public void glBlendEquation(int mode)
{
mGL11ExtPack.glBlendEquation(mode);
}
@Override
public void glBlendEquationSeparate(int modeRGB, int modeAlpha)
{
mGL11ExtPack.glBlendEquationSeparate(modeRGB, modeAlpha);
}
@Override
public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha)
{
mGL11ExtPack.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
}
@Override
public int glCheckFramebufferStatusOES(int target)
{
return mGL11ExtPack.glCheckFramebufferStatusOES(target);
}
@Override
public void glDeleteFramebuffersOES(int n, IntBuffer framebuffers)
{
mGL11ExtPack.glDeleteFramebuffersOES(n, framebuffers);
}
@Override
public void glDeleteFramebuffersOES(int n, int[] framebuffers, int offset)
{
mGL11ExtPack.glDeleteFramebuffersOES(n, framebuffers, offset);
}
@Override
public void glDeleteRenderbuffersOES(int n, IntBuffer renderbuffers)
{
mGL11ExtPack.glDeleteRenderbuffersOES(n, renderbuffers);
}
@Override
public void glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset)
{
mGL11ExtPack.glDeleteRenderbuffersOES(n, renderbuffers, offset);
}
@Override
public void glFramebufferRenderbufferOES(int target, int attachment, int renderbuffertarget, int renderbuffer)
{
mGL11ExtPack.glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
}
@Override
public void glFramebufferTexture2DOES(int target, int attachment, int textarget, int texture, int level)
{
mGL11ExtPack.glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
}
@Override
public void glGenFramebuffersOES(int n, IntBuffer framebuffers)
{
mGL11ExtPack.glGenFramebuffersOES(n, framebuffers);
}
@Override
public void glGenFramebuffersOES(int n, int[] framebuffers, int offset)
{
mGL11ExtPack.glGenFramebuffersOES(n, framebuffers, offset);
}
@Override
public void glGenRenderbuffersOES(int n, IntBuffer renderbuffers)
{
mGL11ExtPack.glGenRenderbuffersOES(n, renderbuffers);
}
@Override
public void glGenRenderbuffersOES(int n, int[] renderbuffers, int offset)
{
mGL11ExtPack.glGenRenderbuffersOES(n, renderbuffers, offset);
}
@Override
public void glGenerateMipmapOES(int target)
{
mGL11ExtPack.glGenerateMipmapOES(target);
}
@Override
public void glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, IntBuffer params)
{
mGL11ExtPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
}
@Override
public void glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, int[] params, int offset)
{
mGL11ExtPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params, offset);
}
@Override
public void glGetRenderbufferParameterivOES(int target, int pname, IntBuffer params)
{
mGL11ExtPack.glGetRenderbufferParameterivOES(target, pname, params);
}
@Override
public void glGetRenderbufferParameterivOES(int target, int pname, int[] params, int offset)
{
mGL11ExtPack.glGetRenderbufferParameterivOES(target, pname, params, offset);
}
@Override
public void glGetTexGenfv(int coord, int pname, FloatBuffer params)
{
mGL11ExtPack.glGetTexGenfv(coord, pname, params);
}
@Override
public void glGetTexGenfv(int coord, int pname, float[] params, int offset)
{
mGL11ExtPack.glGetTexGenfv(coord, pname, params, offset);
}
@Override
public void glGetTexGeniv(int coord, int pname, IntBuffer params)
{
mGL11ExtPack.glGetTexGeniv(coord, pname, params);
}
@Override
public void glGetTexGeniv(int coord, int pname, int[] params, int offset)
{
mGL11ExtPack.glGetTexGeniv(coord, pname, params, offset);
}
@Override
public void glGetTexGenxv(int coord, int pname, IntBuffer params)
{
mGL11ExtPack.glGetTexGenxv(coord, pname, params);
}
@Override
public void glGetTexGenxv(int coord, int pname, int[] params, int offset)
{
mGL11ExtPack.glGetTexGenxv(coord, pname, params, offset);
}
@Override
public boolean glIsFramebufferOES(int framebuffer)
{
return mGL11ExtPack.glIsFramebufferOES(framebuffer);
}
@Override
public boolean glIsRenderbufferOES(int renderbuffer)
{
return mGL11ExtPack.glIsRenderbufferOES(renderbuffer);
}
@Override
public void glRenderbufferStorageOES(int target, int internalformat, int width, int height)
{
mGL11ExtPack.glRenderbufferStorageOES(target, internalformat, width, height);
}
@Override
public void glTexGenf(int coord, int pname, float param)
{
mGL11ExtPack.glTexGenf(coord, pname, param);
}
@Override
public void glTexGenfv(int coord, int pname, FloatBuffer params)
{
mGL11ExtPack.glTexGenfv(coord, pname, params);
}
@Override
public void glTexGenfv(int coord, int pname, float[] params, int offset)
{
mGL11ExtPack.glTexGenfv(coord, pname, params, offset);
}
@Override
public void glTexGeni(int coord, int pname, int param)
{
mGL11ExtPack.glTexGeni(coord, pname, param);
}
@Override
public void glTexGeniv(int coord, int pname, IntBuffer params)
{
mGL11ExtPack.glTexGeniv(coord, pname, params);
}
@Override
public void glTexGeniv(int coord, int pname, int[] params, int offset)
{
mGL11ExtPack.glTexGeniv(coord, pname, params, offset);
}
@Override
public void glTexGenx(int coord, int pname, int param)
{
mGL11ExtPack.glTexGenx(coord, pname, param);
}
@Override
public void glTexGenxv(int coord, int pname, IntBuffer params)
{
mGL11ExtPack.glTexGenxv(coord, pname, params);
}
@Override
public void glTexGenxv(int coord, int pname, int[] params, int offset)
{
mGL11ExtPack.glTexGenxv(coord, pname, params, offset);
}
/**dealloc methods*/
@Override
protected void finalize() throws Throwable
{
mGLSurfaceView = null;
mGL = null;
mGL10Ext = null;
mGL11 = null;
mGL11Ext = null;
mGL11ExtPack = null;
super.finalize();
}
} | {
"content_hash": "ff78b915c150292f2baaf037f0c0215b",
"timestamp": "",
"source": "github",
"line_count": 1595,
"max_line_length": 118,
"avg_line_length": 22.118495297805644,
"alnum_prop": 0.6907792170979903,
"repo_name": "RBWare/PanoramaGL",
"id": "38e2f448859b6b74207be58a139a7b87b5298435",
"size": "35956",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/com/panoramagl/opengl/GLWrapper.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "230917"
},
{
"name": "Groovy",
"bytes": "640"
},
{
"name": "Java",
"bytes": "573717"
}
],
"symlink_target": ""
} |
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit8f16b403b0d43826f0a178ba6de457f8
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit8f16b403b0d43826f0a178ba6de457f8', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit8f16b403b0d43826f0a178ba6de457f8', 'loadClassLoader'));
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire8f16b403b0d43826f0a178ba6de457f8($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire8f16b403b0d43826f0a178ba6de457f8($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}
| {
"content_hash": "0ed8506a105e4e70709fccca31d6b440",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 126,
"avg_line_length": 30.389830508474578,
"alnum_prop": 0.6129392080312326,
"repo_name": "yodathedark/moltis-tickets",
"id": "5b745182012452d665e9ac29dec7572d72ac9189",
"size": "1793",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/stripe-php-3.9.0/vendor/composer/autoload_real.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "231"
},
{
"name": "Batchfile",
"bytes": "1030"
},
{
"name": "CSS",
"bytes": "349176"
},
{
"name": "JavaScript",
"bytes": "138264"
},
{
"name": "PHP",
"bytes": "367011"
}
],
"symlink_target": ""
} |
package org.bitcoinj.store;
import org.bitcoinj.core.BlockChain;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.core.Sha256Hash;
import org.bitcoinj.core.StoredBlock;
/**
* An implementor of BlockStore saves StoredBlock objects to disk. Different implementations store them in
* different ways. An in-memory implementation (MemoryBlockStore) exists for unit testing but real apps will want to
* use implementations that save to disk.<p>
*
* A BlockStore is a map of hashes to StoredBlock. The hash is the double digest of the Bitcoin serialization
* of the block header, <b>not</b> the header with the extra data as well.<p>
*
* BlockStores are thread safe.
*/
public interface BlockStore {
/**
* Saves the given block header+extra data. The key isn't specified explicitly as it can be calculated from the
* StoredBlock directly. Can throw if there is a problem with the underlying storage layer such as running out of
* disk space.
*/
void put(StoredBlock block) throws BlockStoreException;
/**
* Returns the StoredBlock given a hash. The returned values block.getHash() method will be equal to the
* parameter. If no such block is found, returns null.
*/
StoredBlock get(Sha256Hash hash) throws BlockStoreException;
/**
* Returns the {@link StoredBlock} that represents the top of the chain of greatest total work. Note that this
* can be arbitrarily expensive, you probably should use {@link BlockChain#getChainHead()}
* or perhaps {@link BlockChain#getBestChainHeight()} which will run in constant time and
* not take any heavyweight locks.
*/
StoredBlock getChainHead() throws BlockStoreException;
/**
* Sets the {@link StoredBlock} that represents the top of the chain of greatest total work.
*/
void setChainHead(StoredBlock chainHead) throws BlockStoreException;
/** Closes the store. */
void close() throws BlockStoreException;
/**
* Get the {@link NetworkParameters} of this store.
* @return The network params.
*/
NetworkParameters getParams();
}
| {
"content_hash": "0d81bf79d6b233fa3d6b98349aed0d32",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 117,
"avg_line_length": 38.72727272727273,
"alnum_prop": 0.7220657276995305,
"repo_name": "peterdettman/bitcoinj",
"id": "26bd41b7897331d6aa09a8e5445bcf7d6a180686",
"size": "2723",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/bitcoinj/store/BlockStore.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1838"
},
{
"name": "Java",
"bytes": "3797433"
},
{
"name": "Shell",
"bytes": "1390"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "801cf1a87672d1dd819a1fff2e1d3e80",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "537ef4e4a51459ab46225f66348332a19a4e7e17",
"size": "191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Chrysobalanaceae/Licania/Licania subarachnophylla/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace Cosmos.HAL {
static public class Globals {
static public DeviceMgr DeviceMgr;
}
}
| {
"content_hash": "b09e12f5402075cbaa5b96a91fa67366",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 42,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.7175141242937854,
"repo_name": "trivalik/Cosmos",
"id": "ac97ca51dd4329ab385f451992a6c01909376cc9",
"size": "179",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "source/Kernel-X86/30-HAL/Cosmos.HAL/Globals.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "35450"
},
{
"name": "AutoIt",
"bytes": "782"
},
{
"name": "Batchfile",
"bytes": "1472"
},
{
"name": "C",
"bytes": "17776"
},
{
"name": "C#",
"bytes": "12950609"
},
{
"name": "F#",
"bytes": "378"
},
{
"name": "HTML",
"bytes": "34140"
},
{
"name": "Inno Setup",
"bytes": "15855"
},
{
"name": "Visual Basic",
"bytes": "1148"
},
{
"name": "XS",
"bytes": "31499"
}
],
"symlink_target": ""
} |
% function [Lval,Cval] = samplef(X,b)
% Sample function for bayesopt.m
% To use bayesopt.m you need an opt struct (see demo.m or the readme) and a function handle to a function like this.
% The function should return two arguments, the objective function value and the constraint function value.
%
% The function handle should ultimately have only one argument, a vector of parameters X.
% The function itself can have additional parameters that are passed in as constants. For example:
% b = 1;
% F = @(X)samplef(X,b);
%
% This lets you, for example, pass in datasets when tuning ML algorithm parameters.
function [Lval,Cval] = samplef2(x,y,b)
L = @(x,y) cos(2.*x).*cos(y) + sin(b.*x);
C = @(x,y) -(-cos(x).*cos(y)+sin(x).*sin(y));
Lval = L(x,y) + 1e-4*randn(1,size(x,2));
Cval = C(x,y) + 1e-4*randn(1,size(y,2));
end
| {
"content_hash": "1397fa329cee92db8216f24898de9711",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 116,
"avg_line_length": 49.76470588235294,
"alnum_prop": 0.6725768321513003,
"repo_name": "mathieulagrange/lmnn4sol",
"id": "a4441ec9d17fc2c6c9f248b5d045bd5e7bd8b4ff",
"size": "846",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "experiments/timbralSimilaritySol/libs/lmnn-fun/lmnn2/autoLMNN/bayesopt.m/demo/samplef.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "45631"
},
{
"name": "C++",
"bytes": "156539"
},
{
"name": "CSS",
"bytes": "154"
},
{
"name": "Fortran",
"bytes": "570508"
},
{
"name": "HTML",
"bytes": "118622"
},
{
"name": "M",
"bytes": "455"
},
{
"name": "Makefile",
"bytes": "7096"
},
{
"name": "Matlab",
"bytes": "1784839"
},
{
"name": "Objective-C",
"bytes": "567"
},
{
"name": "TeX",
"bytes": "113590"
}
],
"symlink_target": ""
} |
package org.jbpm.console.ng.gc.client.experimental.grid.base;
import java.util.Collection;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
import com.google.gwt.view.client.ProvidesKey;
import org.jbpm.console.ng.ga.model.GenericSummary;
import org.uberfire.ext.services.shared.preferences.GridGlobalPreferences;
import org.uberfire.ext.widgets.common.client.tables.ColumnMeta;
import org.uberfire.ext.widgets.common.client.tables.PagedTable;
/**
* @author salaboy
*/
public class ExtendedPagedTable<T extends GenericSummary> extends PagedTable<T> {
public ExtendedPagedTable( int pageSize,
GridGlobalPreferences gridPreferences ) {
super( pageSize, new ProvidesKey<T>() {
@Override
public Object getKey( T item ) {
return ( item == null ) ? null : item.getId();
}
}, gridPreferences, true );
dataGrid.addColumnSortHandler( new AsyncHandler( dataGrid ) );
}
public void setTooltip( int row,
int column,
String description ) {
dataGrid.getRowElement( row ).getCells().getItem( column ).setTitle( description );
}
public int getKeyboardSelectedColumn() {
return dataGrid.getKeyboardSelectedColumn();
}
public int getKeyboardSelectedRow() {
return dataGrid.getKeyboardSelectedRow();
}
public int getColumnCount() {
return dataGrid.getColumnCount();
}
public void removeColumn( Column<T, ?> col ) {
dataGrid.removeColumn( col );
}
public void removeColumnMeta( ColumnMeta<T> columnMeta ) {
columnPicker.removeColumn( columnMeta );
}
public Collection<ColumnMeta<T>> getColumnMetaList() {
return columnPicker.getColumnMetaList();
}
}
| {
"content_hash": "fba5d3a8cd20cd84ca2073da3577dad1",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 91,
"avg_line_length": 30.725806451612904,
"alnum_prop": 0.6661417322834645,
"repo_name": "emilianoandre/jbpm-console-ng",
"id": "2290dc36783664cdc7d01996efdaadbb661fd937",
"size": "2506",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "jbpm-console-ng-generic/jbpm-console-ng-generic-client/src/main/java/org/jbpm/console/ng/gc/client/experimental/grid/base/ExtendedPagedTable.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "26031"
},
{
"name": "HTML",
"bytes": "38443"
},
{
"name": "Java",
"bytes": "2082516"
}
],
"symlink_target": ""
} |
namespace tsk { namsespace task {
enum task_state {
TASK_CREATED,
TASK_WAITING,
TASK_STARTED,
TASK_COMPLETED
};
typedef error_code int;
class base_task {
protected :
task_state state;
error_code err;
public :
base_task():state(task_state::TASK_CREATED) {}
void start() {
state = task_state::TASK_STARTED;
err = performTask();
state = task_state::TASK_COMPLETED;
taskCompleted();
}
virtual error_code performTask() = 0;
virtual void taskCompleted() = 0;
};
class sync_task : public base_task {
private :
std::mutex _mutex;
std::condition_variable _cond;
public :
void wait() {
std::unique_lock<std::mutex> lck(_mutex);
while (state != task_state::TASK_COMPLETED)
wait(_lck);
}
}
template<typename T>
task_queue : cqueue<T*> {
protrected :
tsk::tpool::ThreadPool *p;
private:
task_queue() {
p = new ThreadPool(10);
}
task_queue::pushTask(T *task) {
add(task);
}
void wait() {
p->wait();
}
}
} // namespace task
} // namespace tsk
| {
"content_hash": "516456686845efe3d1e5cdbc1780683b",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 50,
"avg_line_length": 18.06451612903226,
"alnum_prop": 0.5767857142857142,
"repo_name": "tushargosavi/cpp-learn",
"id": "aab893e2b7785a89ac51d90eb0f43c50ff50016b",
"size": "1151",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "multithreading/tp/task.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "4913"
},
{
"name": "C++",
"bytes": "96491"
}
],
"symlink_target": ""
} |
API Reference
=============
.. _client_api:
Client API
----------
Endpoints for communicating with Orchestra.
All requests must be signed using `HTTP signatures <http://tools.ietf.org/html/draft-cavage-http-signatures-03>`_:
.. sourcecode:: python
from httpsig.requests_auth import HTTPSignatureAuth
auth = HTTPSignatureAuth(key_id=settings.ORCHESTRA_PROJECT_API_KEY,
secret=settings.ORCHESTRA_PROJECT_API_SECRET,
algorithm='hmac-sha256')
response = requests.get('https://www.example.com/orchestra/api/project/create_project', auth=auth)
.. http:post:: /orchestra/api/project/create_project
Creates a project with the given data and returns its ID.
:query task_class: One of `real` or `training` to specify the task class type.
:query workflow_slug: The slug corresponding to the desired project's workflow.
:query workflow_version_slug: The slug corresponding to the desired version of the workflow.
:query description: A short description of the project.
:query priority: An integer describing the priority of the project, with higher numbers describing a greater priority.
:query project_data: Other miscellaneous data with which to initialize the project.
**Example response**:
.. sourcecode:: json
{
"project_id": 123,
}
.. http:post:: /orchestra/api/project/project_information
Retrieve detailed information about a given project.
:query project_id: The ID for the desired project.
**Example response**:
.. sourcecode:: json
{
"project": {
"id": 123,
"short_description": "Project Description",
"priority": 10,
"scratchpad_url": "http://review.document.url",
"task_class": 1,
"project_data": {
"sample_data_item": "sample_data_value_new"
},
"workflow_slug": "sample_workflow_slug",
"workflow_version_slug": "v1",
"start_datetime": "2015-09-23T20:16:02.667288Z"
},
"steps": [
["sample_step_slug", "Sample step description"]
],
"tasks": {
"sample_step_slug": {
"id": 456,
"project": 123,
"status": "Processing",
"step_slug": "sample_step_slug",
"latest_data": {
"sample_data_item": "sample_data_value_new"
},
"assignments": [
{
"id": 558,
"iterations": [
{
"id": 92134,
"start_datetime": "2015-09-20T12:02:14.214553",
"end_datetime": "2015-09-23T20:16:15.821171",
"submitted_data": {
"sample_data_item": "sample_data_value_old",
},
"status": 'Requested Review'
}
],
"worker": "sample_worker_username",
"task": 456,
"in_progress_task_data": {
"sample_data_item": "sample_data_value_new"
},
"status": "Processing",
"start_datetime": "2015-09-23T20:16:17.355291Z"
}
]
}
}
}
.. http:get:: /orchestra/api/project/workflow_types
Return all stored workflows and their versions.
**Example response**:
.. sourcecode:: json
{
"workflows": {
"journalism": {
"name": "Journalism Workflow",
"versions": {
"v1": {
"name": "Journalism Workflow Version 1",
"description": "Create polished newspaper articles from scratch."
},
"v2": {
"name": "Journalism Workflow Version 2",
"description": "Create polished newspaper articles from scratch."
}
}
},
"simple_workflow": {
"name": "Simple Workflow",
"versions": {
"v1": {
"name": "Simple Workflow Version 1",
"description": "Crawl a web page for an image and rate it."
}
}
}
}
}
| {
"content_hash": "483080f90738b4c2bb7ada45282baeb1",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 121,
"avg_line_length": 32.76086956521739,
"alnum_prop": 0.49236894492368943,
"repo_name": "b12io/orchestra",
"id": "22f6d99d540efb2d7d0dd41d0a2c8a7ddc4b8fe8",
"size": "4521",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "docs/source/api.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "50496"
},
{
"name": "HTML",
"bytes": "101830"
},
{
"name": "JavaScript",
"bytes": "353673"
},
{
"name": "Makefile",
"bytes": "1234"
},
{
"name": "Python",
"bytes": "975395"
},
{
"name": "SCSS",
"bytes": "32860"
},
{
"name": "Shell",
"bytes": "26"
},
{
"name": "TypeScript",
"bytes": "20983"
}
],
"symlink_target": ""
} |
package ProGAL.geom3d.complex;
import java.awt.Color;
import ProGAL.geom3d.LineSegment;
import ProGAL.geom3d.Plane;
import ProGAL.geom3d.Point;
import ProGAL.geom3d.viewer.J3DScene;
import ProGAL.geom3d.complex.delaunayComplex.RegularComplex;
import ProGAL.geom3d.kineticDelaunay.Tet;
import ProGAL.geom3d.volumes.Tetrahedron;
/**
* An extension of the normal Tetrahedron that is used in complexes. In addition to the four
* corner-points, pointers to the triangular faces (of the type CTriangle) and the four
* neighboring tetrahedra are maintained.
*
* @author R.Fonseca
*/
public class CTetrahedron extends Tetrahedron{
private CTetrahedron[] neighbours = new CTetrahedron[4];
private CTriangle[] triangles = new CTriangle[4];
private boolean modified = false;
private boolean flat = false;
public CTetrahedron(CVertex p0, CVertex p1, CVertex p2, CVertex p3) {
super(p0,p1,p2,p3);
}
protected CTetrahedron(){
this(null,null,null,null);
}
public void setFlat(boolean flat) { this.flat = flat; }
public void setModified(boolean modified) { this.modified = modified; }
public void setPoint(CVertex p, int i){ super.corners[i] = p; }
public void setNeighbour(int index, CTetrahedron t){ neighbours[index] = t; }
public void setTriangle(int index, CTriangle t){ triangles[index] = t; }
public CVertex getPoint(int i){ return (CVertex)corners[i]; }
public CTetrahedron getNeighbour(int index) { return neighbours[index]; }
public CTriangle getTriangle(int index){ return triangles[index]; }
public boolean isModified() { return modified; }
public boolean isFlat() { return flat; }
/**
* For computational convenience, the representation of a complex is based on a big tetrahedron
* that encloses all vertices. It has 4 so-called 'big points' as corners. This method indicates
* if this tetrahedron has one of these 'big points' as corners.
* @see RegularComplex
*/
public boolean containsBigPoint() {
if(getPoint(0).isBigpoint() || getPoint(1).isBigpoint() || getPoint(2).isBigpoint() || getPoint(3).isBigpoint()) return true;
return false;
}
public int getNumberBigPoints() {
int count = 0;
for (int i = 0; i < 4; i++) { if (getPoint(i).isBigpoint()) count++; }
return count;
}
/** returns neighbour tetrahedron containing specified vertex */
public CTetrahedron getNeighbour(CVertex v) {
for (int i = 0; i < 4; i++) {
CTetrahedron tetr = getNeighbour(i);
if (tetr.containsPoint(v)) return tetr;
}
return null;
}
public boolean hasNeighbor(CTetrahedron t) {
for (int i = 0; i < 4; i++) if (neighbours[i] == t) return true;
return false;
}
public int getID(CVertex v) {
if (v == getPoint(0)) return 0;
else {
if (v == getPoint(1)) return 1;
else {
if (v == getPoint(2)) return 2;
else {
if (v == getPoint(3)) return 3; else return -1;
}
}
}
}
/** returns the vertices shared by two tetrahedra. */
public CVertex[] getCommonVertices(CTetrahedron tetr) {
CVertex[] points = new CVertex[4];
int n = 0;
for (int i = 0; i < 4; i++) {
if (tetr.containsPoint(getPoint(i))) {
points[n] = new CVertex(getPoint(i), getPoint(i).idx);
for (int k = 0; k < 3; k++) if (Math.abs(points[n].get(k)) > 100.0) points[n].set(k, points[n].get(k)/1);
n++;
}
}
return points;
}
/** returns plane through common triangle of this and another tetrahedron. The apex of this tetrahedron
* is below the plane. */
public Plane getPlane(CTetrahedron tetr) {
CVertex[] points = new CVertex[3];
CVertex v = null;
int i = 0; int j = 0;
while ( i < 3) {
if (tetr.containsPoint(getPoint(j))) {
points[i] = getPoint(j);
i++;
}
else v = getPoint(j);
j++;
}
Plane plane;
if (!points[0].isBigpoint()) plane = new Plane(points[0], points[1], points[2]);
else {
if (!points[1].isBigpoint()) plane = new Plane(points[1], points[2], points[0]);
else plane = new Plane(points[2], points[0], points[1]);
}
if (plane.above(v) == 1) plane.setNormal(plane.getNormal().multiplyThis(-1));
return plane;
}
public void updateNeighbour(CTetrahedron lookfor, CTetrahedron replacement){
for(int i=0; i<4;i++){
if(neighbours[i]==lookfor){
neighbours[i]=replacement;
break;
}
}
}
//find id of point
public int findpoint(CVertex p){
for(int i = 0; i<4; i++){
if(getPoint(i)==p) {
return i;
}
}
System.out.println("Problemer med findpoint\n");
//never happens:
return -1;
}
/** returns neighbouring tetrahedron containing v as the oppposite vertex */
public CTetrahedron findNeighbour(CVertex v) {
for (int i = 0; i < 4; i++) {
if (getNeighbour(i).containsPoint(v)) return getNeighbour(i);
}
return null;
}
/* this tetrahedron and tetr must be neighbours. Return the vertex of this tetrahedron not in tetr */
public CVertex findVertex(CTetrahedron tetr) {
CVertex p;
for (int i = 0; i < 4; i++) {
p = getPoint(i);
if (!tetr.containsPoint(p)) return p;
}
return null;
}
public boolean containsPoint(CVertex p) {
for (int i = 0; i < 4; i++) {
if (getPoint(i) == p) return true;
}
return false;
}
public boolean containsTriangle(CTriangle t){
for(int tp=0;tp<3;tp++){
boolean found = false;
for(int p=0;p<4;p++) if(this.getPoint(p)==t.getPoint(tp)) { found=true; break; }
if(!found) return false;
}
return true;
}
/** TODO: Copy to Tetrahedron */
public CVertex oppositeVertex(CTriangle base){
for(int p=0;p<4;p++){
if(!base.containsPoint(getPoint(p))) return getPoint(p);
}
throw new RuntimeException("The triangle is not part of this tetrahedron");
}
public CTriangle oppositeTriangle(CVertex v) {
for(CTriangle t: triangles){
if(t!=null && !t.containsPoint(v)) return t;
}
throw new RuntimeException("The vertex is not part of this tetrahedron");
}
//given a point index this method finds the index of the apex - meaning the opposite point id that is in
//the tetrahedron opposite the given point id
//input: point index
//output: point index of the point opposite
public int apexid(int index){
//Point ap0,ap1,ap2,ap3;
CTetrahedron apex_tet= getNeighbour(index);
if(apex_tet!= null){
for(int i=0;i<4;i++){
if(apex_tet.getNeighbour(i)== this){
return i;
}
}
}
//never happens:
return -1;
}
public void toScene(J3DScene scene, double rad, Color clr) {
double newRad = rad;
Color newClr = clr;
// if (containsBigPoint()) { newRad = 0.005; newClr = Color.red; }
for (int i = 0; i < 3; i++) {
Point u = getPoint(i).clone();
for (int k = 0; k < 3; k++) if (Math.abs(u.get(k)) > 100.0) u.set(k, u.get(k)/1);
for (int j = i+1; j < 4; j++) {
Point v = getPoint(j).clone();
for (int k = 0; k < 3; k++) if (Math.abs(v.get(k)) > 100.0) v.set(k, v.get(k)/1);
LineSegment seg = new LineSegment(u, v);
seg.toScene(scene, newRad, newClr);
}
}
}
}
| {
"content_hash": "37fb299c31f8fc34c1b44ed5b3fc02bb",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 127,
"avg_line_length": 29.1255230125523,
"alnum_prop": 0.6543600057463008,
"repo_name": "DIKU-Steiner/ProGAL",
"id": "6536dc614429e89ed8d2f1e6f63a6e862cdbe3b9",
"size": "6961",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ProGAL/geom3d/complex/CTetrahedron.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "189314"
},
{
"name": "HTML",
"bytes": "5710"
},
{
"name": "Java",
"bytes": "2150908"
},
{
"name": "Makefile",
"bytes": "529"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>relative_humidity_from_mixing_ratio — MetPy 0.7</title>
<link rel="shortcut icon" href="../../_static/metpy_32x32.ico"/>
<link rel="canonical" href="https://unidata.github.io/MetPy/latest/api/generated/metpy.calc.relative_humidity_from_mixing_ratio.html"/>
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
<link rel="stylesheet" href="../../_static/theme_override.css" type="text/css" />
<link rel="index" title="Index"
href="../../genindex.html"/>
<link rel="search" title="Search" href="../../search.html"/>
<link rel="top" title="MetPy 0.7" href="../../index.html"/>
<link rel="up" title="calc" href="metpy.calc.html"/>
<link rel="next" title="relative_humidity_from_specific_humidity" href="metpy.calc.relative_humidity_from_specific_humidity.html"/>
<link rel="prev" title="relative_humidity_from_dewpoint" href="metpy.calc.relative_humidity_from_dewpoint.html"/>
<script src="../../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../../index.html" class="icon icon-home"> MetPy
<img src="../../_static/metpy_150x150.png" class="logo" />
</a>
<div class="version">
<div class="version-dropdown">
<select class="version-list" id="version-list">
<option value=''>0.7</option>
<option value="../latest">latest</option>
<option value="../dev">dev</option>
</select>
</div>
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../installguide.html">Installation Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../units.html">Unit Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../examples/index.html">MetPy Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tutorials/index.html">MetPy Tutorials</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../index.html">The MetPy API</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="metpy.constants.html">constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.units.html">units</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.io.html">io</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.io.cdm.html">cdm</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="metpy.calc.html">calc</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.add_height_to_pressure.html">add_height_to_pressure</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.add_pressure_to_height.html">add_pressure_to_height</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.advection.html">advection</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.bulk_shear.html">bulk_shear</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.bunkers_storm_motion.html">bunkers_storm_motion</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.cape_cin.html">cape_cin</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.convergence_vorticity.html">convergence_vorticity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.coriolis_parameter.html">coriolis_parameter</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.density.html">density</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.dewpoint.html">dewpoint</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.dewpoint_rh.html">dewpoint_rh</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.divergence.html">divergence</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.dry_lapse.html">dry_lapse</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.dry_static_energy.html">dry_static_energy</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.el.html">el</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.equivalent_potential_temperature.html">equivalent_potential_temperature</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.find_intersections.html">find_intersections</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.first_derivative.html">first_derivative</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.friction_velocity.html">friction_velocity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.frontogenesis.html">frontogenesis</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.geopotential_to_height.html">geopotential_to_height</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.geostrophic_wind.html">geostrophic_wind</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.get_layer.html">get_layer</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.get_layer_heights.html">get_layer_heights</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.get_perturbation.html">get_perturbation</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.get_wind_components.html">get_wind_components</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.get_wind_dir.html">get_wind_dir</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.get_wind_speed.html">get_wind_speed</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.h_convergence.html">h_convergence</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.heat_index.html">heat_index</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.height_to_geopotential.html">height_to_geopotential</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.height_to_pressure_std.html">height_to_pressure_std</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.interp.html">interp</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.interpolate_nans.html">interpolate_nans</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.isentropic_interpolation.html">isentropic_interpolation</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.kinematic_flux.html">kinematic_flux</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.laplacian.html">laplacian</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.lat_lon_grid_spacing.html">lat_lon_grid_spacing</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.lcl.html">lcl</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.lfc.html">lfc</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.log_interp.html">log_interp</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.mean_pressure_weighted.html">mean_pressure_weighted</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.mixed_layer.html">mixed_layer</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.mixed_parcel.html">mixed_parcel</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.mixing_ratio.html">mixing_ratio</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.mixing_ratio_from_relative_humidity.html">mixing_ratio_from_relative_humidity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.mixing_ratio_from_specific_humidity.html">mixing_ratio_from_specific_humidity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.moist_lapse.html">moist_lapse</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.moist_static_energy.html">moist_static_energy</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.montgomery_streamfunction.html">montgomery_streamfunction</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.most_unstable_cape_cin.html">most_unstable_cape_cin</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.most_unstable_parcel.html">most_unstable_parcel</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.nearest_intersection_idx.html">nearest_intersection_idx</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.parcel_profile.html">parcel_profile</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.potential_temperature.html">potential_temperature</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.precipitable_water.html">precipitable_water</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.pressure_to_height_std.html">pressure_to_height_std</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.psychrometric_vapor_pressure_wet.html">psychrometric_vapor_pressure_wet</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.reduce_point_density.html">reduce_point_density</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.relative_humidity_from_dewpoint.html">relative_humidity_from_dewpoint</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">relative_humidity_from_mixing_ratio</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.relative_humidity_from_specific_humidity.html">relative_humidity_from_specific_humidity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.relative_humidity_wet_psychrometric.html">relative_humidity_wet_psychrometric</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.resample_nn_1d.html">resample_nn_1d</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.saturation_mixing_ratio.html">saturation_mixing_ratio</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.saturation_vapor_pressure.html">saturation_vapor_pressure</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.second_derivative.html">second_derivative</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.shearing_deformation.html">shearing_deformation</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.shearing_stretching_deformation.html">shearing_stretching_deformation</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.sigma_to_pressure.html">sigma_to_pressure</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.significant_tornado.html">significant_tornado</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.specific_humidity_from_mixing_ratio.html">specific_humidity_from_mixing_ratio</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.storm_relative_helicity.html">storm_relative_helicity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.stretching_deformation.html">stretching_deformation</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.supercell_composite.html">supercell_composite</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.surface_based_cape_cin.html">surface_based_cape_cin</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.thickness_hydrostatic.html">thickness_hydrostatic</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.thickness_hydrostatic_from_relative_humidity.html">thickness_hydrostatic_from_relative_humidity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.tke.html">tke</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.total_deformation.html">total_deformation</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.v_vorticity.html">v_vorticity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.vapor_pressure.html">vapor_pressure</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.virtual_potential_temperature.html">virtual_potential_temperature</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.virtual_temperature.html">virtual_temperature</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.vorticity.html">vorticity</a></li>
<li class="toctree-l3"><a class="reference internal" href="metpy.calc.windchill.html">windchill</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="metpy.plots.html">plots</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.plots.ctables.html">ctables</a></li>
<li class="toctree-l2"><a class="reference internal" href="metpy.gridding.html">gridding</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../gempak.html">GEMPAK Conversion Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../developerguide.html">Developer’s Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../CONTRIBUTING.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../citing.html">Citing MetPy</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../references.html">References</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">MetPy</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html">Docs</a> »</li>
<li><a href="../index.html">The MetPy API</a> »</li>
<li><a href="metpy.calc.html">calc</a> »</li>
<li>relative_humidity_from_mixing_ratio</li>
<li class="source-link">
<a href="https://github.com/Unidata/MetPy/issues/new?title=Suggested%20improvement%20for%20api/generated/metpy.calc.relative_humidity_from_mixing_ratio&body=Please%20describe%20what%20could%20be%20improved%20about%20this%20page%20or%20the%20typo/mistake%20that%20you%20found%3A"
class="fa fa-github"> Improve this page</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="relative-humidity-from-mixing-ratio">
<h1>relative_humidity_from_mixing_ratio<a class="headerlink" href="#relative-humidity-from-mixing-ratio" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="metpy.calc.relative_humidity_from_mixing_ratio">
<code class="descclassname">metpy.calc.</code><code class="descname">relative_humidity_from_mixing_ratio</code><span class="sig-paren">(</span><em>mixing_ratio</em>, <em>temperature</em>, <em>pressure</em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/metpy/calc/thermo.html#relative_humidity_from_mixing_ratio"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#metpy.calc.relative_humidity_from_mixing_ratio" title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate the relative humidity from mixing ratio, temperature, and pressure.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mixing_ratio</strong> (<em class="xref py py-obj">pint.Quantity</em>) – Dimensionless mass mixing ratio</li>
<li><strong>temperature</strong> (<em class="xref py py-obj">pint.Quantity</em>) – Air temperature</li>
<li><strong>pressure</strong> (<em class="xref py py-obj">pint.Quantity</em>) – Total atmospheric pressure</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><em class="xref py py-obj">pint.Quantity</em> – Relative humidity</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>Formula based on that from <a class="reference internal" href="../../references.html#hobbs1977" id="id1">[Hobbs1977]</a> pg. 74.</p>
<div class="math">
\[RH = \frac{w}{w_s}\]</div>
<ul class="simple">
<li><span class="math">\(RH\)</span> is relative humidity as a unitless ratio</li>
<li><span class="math">\(w\)</span> is mixing ratio</li>
<li><span class="math">\(w_s\)</span> is the saturation mixing ratio</li>
</ul>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="metpy.calc.mixing_ratio_from_relative_humidity.html#metpy.calc.mixing_ratio_from_relative_humidity" title="metpy.calc.mixing_ratio_from_relative_humidity"><code class="xref py py-func docutils literal"><span class="pre">mixing_ratio_from_relative_humidity()</span></code></a>, <a class="reference internal" href="metpy.calc.saturation_mixing_ratio.html#metpy.calc.saturation_mixing_ratio" title="metpy.calc.saturation_mixing_ratio"><code class="xref py py-func docutils literal"><span class="pre">saturation_mixing_ratio()</span></code></a></p>
</div>
</dd></dl>
<div style='clear:both'></div></div>
</div>
<div class="articleComments">
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="metpy.calc.relative_humidity_from_specific_humidity.html" class="btn btn-neutral float-right" title="relative_humidity_from_specific_humidity" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="metpy.calc.relative_humidity_from_dewpoint.html" class="btn btn-neutral" title="relative_humidity_from_dewpoint" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2017, MetPy Developers.
Last updated on Jan 04, 2018 at 19:56:08.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-92978945-1', 'auto');
ga('send', 'pageview');
</script>
<script>var version_json_loc = "../../../versions.json";</script>
<p>Do you enjoy using MetPy?
<a href="https://saythanks.io/to/unidata" class="btn btn-neutral" title="Say Thanks!" accesskey="n">Say Thanks!</a>
</p>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../../',
VERSION:'0.7.0',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../_static/pop_ver.js"></script>
<script type="text/javascript" src="../../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html> | {
"content_hash": "9a5999cf62ad3213425f77e6f246d819",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 596,
"avg_line_length": 53.38084112149533,
"alnum_prop": 0.6684028537663588,
"repo_name": "metpy/MetPy",
"id": "f944120103990bfceb62de05e0b0be823d602731",
"size": "22861",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v0.7/api/generated/metpy.calc.relative_humidity_from_mixing_ratio.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "989941"
},
{
"name": "Python",
"bytes": "551868"
}
],
"symlink_target": ""
} |
/* pkcs1-rsa-sha256.c
*
* PKCS stuff for rsa-sha256.
*/
/* nettle, low-level cryptographics library
*
* Copyright (C) 2001, 2003, 2006 Niels Möller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02111-1301, USA.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
#include "nettle-internal.h"
/* From RFC 3447, Public-Key Cryptography Standards (PKCS) #1: RSA
* Cryptography Specifications Version 2.1.
*
* id-sha256 OBJECT IDENTIFIER ::=
* {joint-iso-itu-t(2) country(16) us(840) organization(1)
* gov(101) csor(3) nistalgorithm(4) hashalgs(2) 1}
*/
static const uint8_t
sha256_prefix[] =
{
/* 19 octets prefix, 32 octets hash, total 51 */
0x30, 49, /* SEQUENCE */
0x30, 13, /* SEQUENCE */
0x06, 9, /* OBJECT IDENTIFIER */
0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01,
0x05, 0, /* NULL */
0x04, 32 /* OCTET STRING */
/* Here comes the raw hash value */
};
int
pkcs1_rsa_sha256_encode(mpz_t m, unsigned key_size, struct sha256_ctx *hash)
{
uint8_t *p;
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha256_prefix),
sha256_prefix,
SHA256_DIGEST_SIZE);
if (p)
{
sha256_digest(hash, SHA256_DIGEST_SIZE, p);
nettle_mpz_set_str_256_u(m, key_size, em);
return 1;
}
else
return 0;
}
int
pkcs1_rsa_sha256_encode_digest(mpz_t m, unsigned key_size, const uint8_t *digest)
{
uint8_t *p;
TMP_DECL(em, uint8_t, NETTLE_MAX_BIGNUM_SIZE);
TMP_ALLOC(em, key_size);
p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha256_prefix),
sha256_prefix,
SHA256_DIGEST_SIZE);
if (p)
{
memcpy(p, digest, SHA256_DIGEST_SIZE);
nettle_mpz_set_str_256_u(m, key_size, em);
return 1;
}
else
return 0;
}
| {
"content_hash": "c179a27aebb65df8c0e61ce38be59463",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 81,
"avg_line_length": 26.80392156862745,
"alnum_prop": 0.6485003657644477,
"repo_name": "GaloisInc/hacrypto",
"id": "cb07375535d0876a4e114268f5ac700fa12559d2",
"size": "2735",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "src/C/nettle/nettle-2.7.1/pkcs1-rsa-sha256.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AGS Script",
"bytes": "62991"
},
{
"name": "Ada",
"bytes": "443"
},
{
"name": "AppleScript",
"bytes": "4518"
},
{
"name": "Assembly",
"bytes": "25398957"
},
{
"name": "Awk",
"bytes": "36188"
},
{
"name": "Batchfile",
"bytes": "530568"
},
{
"name": "C",
"bytes": "344517599"
},
{
"name": "C#",
"bytes": "7553169"
},
{
"name": "C++",
"bytes": "36635617"
},
{
"name": "CMake",
"bytes": "213895"
},
{
"name": "CSS",
"bytes": "139462"
},
{
"name": "Coq",
"bytes": "320964"
},
{
"name": "Cuda",
"bytes": "103316"
},
{
"name": "DIGITAL Command Language",
"bytes": "1545539"
},
{
"name": "DTrace",
"bytes": "33228"
},
{
"name": "Emacs Lisp",
"bytes": "22827"
},
{
"name": "GDB",
"bytes": "93449"
},
{
"name": "Gnuplot",
"bytes": "7195"
},
{
"name": "Go",
"bytes": "393057"
},
{
"name": "HTML",
"bytes": "41466430"
},
{
"name": "Hack",
"bytes": "22842"
},
{
"name": "Haskell",
"bytes": "64053"
},
{
"name": "IDL",
"bytes": "3205"
},
{
"name": "Java",
"bytes": "49060925"
},
{
"name": "JavaScript",
"bytes": "3476841"
},
{
"name": "Jolie",
"bytes": "412"
},
{
"name": "Lex",
"bytes": "26290"
},
{
"name": "Logos",
"bytes": "108920"
},
{
"name": "Lua",
"bytes": "427"
},
{
"name": "M4",
"bytes": "2508986"
},
{
"name": "Makefile",
"bytes": "29393197"
},
{
"name": "Mathematica",
"bytes": "48978"
},
{
"name": "Mercury",
"bytes": "2053"
},
{
"name": "Module Management System",
"bytes": "1313"
},
{
"name": "NSIS",
"bytes": "19051"
},
{
"name": "OCaml",
"bytes": "981255"
},
{
"name": "Objective-C",
"bytes": "4099236"
},
{
"name": "Objective-C++",
"bytes": "243505"
},
{
"name": "PHP",
"bytes": "22677635"
},
{
"name": "Pascal",
"bytes": "99565"
},
{
"name": "Perl",
"bytes": "35079773"
},
{
"name": "Prolog",
"bytes": "350124"
},
{
"name": "Python",
"bytes": "1242241"
},
{
"name": "Rebol",
"bytes": "106436"
},
{
"name": "Roff",
"bytes": "16457446"
},
{
"name": "Ruby",
"bytes": "49694"
},
{
"name": "Scheme",
"bytes": "138999"
},
{
"name": "Shell",
"bytes": "10192290"
},
{
"name": "Smalltalk",
"bytes": "22630"
},
{
"name": "Smarty",
"bytes": "51246"
},
{
"name": "SourcePawn",
"bytes": "542790"
},
{
"name": "SystemVerilog",
"bytes": "95379"
},
{
"name": "Tcl",
"bytes": "35696"
},
{
"name": "TeX",
"bytes": "2351627"
},
{
"name": "Verilog",
"bytes": "91541"
},
{
"name": "Visual Basic",
"bytes": "88541"
},
{
"name": "XS",
"bytes": "38300"
},
{
"name": "Yacc",
"bytes": "132970"
},
{
"name": "eC",
"bytes": "33673"
},
{
"name": "q",
"bytes": "145272"
},
{
"name": "sed",
"bytes": "1196"
}
],
"symlink_target": ""
} |
import React, { Component } from 'react';
export default class Counter extends Component {
constructor(props) {
super(props);
this.state = { count: 0 };
this.update = this.update.bind(this);
this.increment = this.increment.bind(this);
this.decrement = this.decrement.bind(this);
}
update(value) {
this.setState({ count: this.state.count + value });
}
increment() {
return this.update(1);
}
decrement() {
return this.update(-1);
}
render() {
return (
<div>
<p>{this.state.count}</p>
<button onClick={this.increment}>+1</button>
<button onClick={this.decrement}>-1</button>
</div>
);
}
}
| {
"content_hash": "9743ca2db2a2de7ac74d93ee80e4d413",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 55,
"avg_line_length": 23.2,
"alnum_prop": 0.5833333333333334,
"repo_name": "timReynolds/react-library-boilerplate",
"id": "7dde85757178661a28ec4b168231a32cd6f898f8",
"size": "696",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/index.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "2759"
}
],
"symlink_target": ""
} |
class SubscribeWorker
include Sidekiq::Worker
def perform(email, name=nil)
if Rails.env == 'production' || Rails.env == 'test'
JiscMailer.subscribe(email).deliver
end
end
end
| {
"content_hash": "7f8cd7343afb9405db2592d7f4d31a76",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 55,
"avg_line_length": 21.77777777777778,
"alnum_prop": 0.6836734693877551,
"repo_name": "edpaget/Panoptes",
"id": "d934c25583d70a773403f94d33ae3b7f4096b358",
"size": "196",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/workers/subscribe_worker.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "API Blueprint",
"bytes": "170309"
},
{
"name": "CSS",
"bytes": "5843"
},
{
"name": "HTML",
"bytes": "51862"
},
{
"name": "JavaScript",
"bytes": "641"
},
{
"name": "Ruby",
"bytes": "948030"
},
{
"name": "Shell",
"bytes": "685"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "106fe5d2a968614ff2224d2031fb030b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "8e7dabc735d8b692d6aee57f5a35ce73faa7ed41",
"size": "182",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Adesmia/Adesmia trifoliata/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
require 'test/unit'
require 'test/helper'
class TC_Process_Abort_ModuleMethod < Test::Unit::TestCase
include Test::Helper
def setup
@stderr = STDERR.clone
@file = File.join(Dir.pwd, 'tc_abort.txt')
@fh = File.open(@file, "w")
STDERR.reopen(@fh)
end
def test_abort_basic
assert_respond_to(Process, :abort)
end
unless WINDOWS
# def test_abort
# fork{ Process.abort }
# pid, status = Process.wait2
# assert_equal(1, status.exitstatus)
# end
# def test_abort_with_error_message
# fork{ Process.abort("hello world") }
# pid, status = Process.wait2
#
# assert_equal(1, status.exitstatus)
# assert_equal("hello world", IO.read(@file).chomp)
# end
end
def teardown
@fh.close if @fh && !@fh.closed?
STDERR.reopen(@stderr)
File.delete(@file) if File.exists?(@file)
end
end
| {
"content_hash": "a7ffb9f2a2ecba80db053288cfcf6c04",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 59,
"avg_line_length": 24.025641025641026,
"alnum_prop": 0.5869797225186766,
"repo_name": "google-code/android-scripting",
"id": "fb8404a19fc4fa9b3b979efeffc35dbec82c0661",
"size": "1226",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jruby/src/test/externals/ruby_test/test/core/Process/class/tc_abort.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "145847"
},
{
"name": "Assembly",
"bytes": "310373"
},
{
"name": "Bison",
"bytes": "162176"
},
{
"name": "C",
"bytes": "14282640"
},
{
"name": "C++",
"bytes": "105675"
},
{
"name": "CSS",
"bytes": "24124"
},
{
"name": "Cucumber",
"bytes": "11401"
},
{
"name": "Diff",
"bytes": "13415"
},
{
"name": "Emacs Lisp",
"bytes": "146938"
},
{
"name": "GAP",
"bytes": "129009"
},
{
"name": "Groff",
"bytes": "26385"
},
{
"name": "HTML",
"bytes": "12203390"
},
{
"name": "Inno Setup",
"bytes": "18796"
},
{
"name": "Java",
"bytes": "9869454"
},
{
"name": "JavaScript",
"bytes": "148"
},
{
"name": "Lua",
"bytes": "178639"
},
{
"name": "Makefile",
"bytes": "228172"
},
{
"name": "Objective-C",
"bytes": "1384162"
},
{
"name": "OpenEdge ABL",
"bytes": "125979"
},
{
"name": "Perl",
"bytes": "3610"
},
{
"name": "Prolog",
"bytes": "66"
},
{
"name": "Python",
"bytes": "22184025"
},
{
"name": "R",
"bytes": "697"
},
{
"name": "Ruby",
"bytes": "12237045"
},
{
"name": "Shell",
"bytes": "152111"
},
{
"name": "Tcl",
"bytes": "1262"
},
{
"name": "VimL",
"bytes": "9547"
},
{
"name": "Visual Basic",
"bytes": "481"
},
{
"name": "XSLT",
"bytes": "14806"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Bot. Mitt. Trop. 8: 44 (1895)
#### Original name
Henningsia Möller
### Remarks
null | {
"content_hash": "44449571d0dd688d1560fbf10b1af178",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 13.23076923076923,
"alnum_prop": 0.6918604651162791,
"repo_name": "mdoering/backbone",
"id": "54cc37d789404e60f0762f26bbe40c051fb567ad",
"size": "213",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Polyporales/Meripilaceae/Henningsia/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
member's Area
<?php
echo anchor('login/logout','Logout');
?> | {
"content_hash": "09ffac83c04ddb12c67f883f4bb90015",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 37,
"avg_line_length": 12.4,
"alnum_prop": 0.6612903225806451,
"repo_name": "Rashed-BUET/Online_shopping",
"id": "049547068b52c228d146e35ff7757a5c84526a71",
"size": "62",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/members_area.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "240"
},
{
"name": "CSS",
"bytes": "33636"
},
{
"name": "HTML",
"bytes": "5633"
},
{
"name": "JavaScript",
"bytes": "2577"
},
{
"name": "PHP",
"bytes": "1839664"
}
],
"symlink_target": ""
} |
package org.dmfs.android.syncstate.test;
import java.io.IOException;
import org.dmfs.android.syncstate.ContactsSyncState;
import org.dmfs.android.syncstate.SyncState;
import org.dmfs.xmlobjects.ElementDescriptor;
import org.dmfs.xmlobjects.QualifiedName;
import org.dmfs.xmlobjects.XmlContext;
import org.dmfs.xmlobjects.builder.StringObjectBuilder;
import android.accounts.Account;
import android.os.RemoteException;
import android.test.AndroidTestCase;
/**
* Test {@link ContactsSyncState}.
*
* @author Marten Gajda <marten@dmfs.org>
*/
public class ContactsSyncStateTest extends AndroidTestCase
{
/**
* Test descriptor that we add to the sync state.
*/
private final static ElementDescriptor<String> ELEMENT1 = ElementDescriptor.register(QualifiedName.get("http://dmfs.org/ns/1", "element1"),
StringObjectBuilder.INSTANCE);
/**
* Another Test descriptor that we add to the sync state.
*/
private final static ElementDescriptor<String> ELEMENT2 = ElementDescriptor.register(QualifiedName.get("http://dmfs.org/ns/2", "element2"),
StringObjectBuilder.INSTANCE);
/**
* An {@link XmlContext}.
*/
private final static XmlContext CONTEXT = new XmlContext();
/**
* Test descriptor that we add to the sync state. This element is not in the default context.
*/
private final static ElementDescriptor<String> CONTEXT_ELEMENT1 = ElementDescriptor.register(QualifiedName.get("http://dmfs.org/ns/1", "context_element1"),
StringObjectBuilder.INSTANCE, CONTEXT);
/**
* Another Test descriptor that we add to the sync state. This element is not in the default context.
*/
private final static ElementDescriptor<String> CONTEXT_ELEMENT2 = ElementDescriptor.register(QualifiedName.get("http://dmfs.org/ns/2", "context_element2"),
StringObjectBuilder.INSTANCE, CONTEXT);
public void testContactsSyncState() throws IOException, RemoteException
{
Account testAccount = new Account("test", "local" /* there is no "local account" for contacts */);
// create a new ContactsSyncState for the test account
SyncState s = new ContactsSyncState(getContext().getContentResolver(), testAccount)
{
};
// the values must not exist yet
assertNull(s.get(ELEMENT1));
assertNull(s.get(ELEMENT2));
// add two values
s.set(ELEMENT1, "some string value");
s.set(ELEMENT2, "some other string value");
// check that the values are returned
assertEquals("some string value", s.get(ELEMENT1));
assertEquals("some other string value", s.get(ELEMENT2));
// store the sync state
s.store();
// make sure that the values are still returned correctly
assertEquals("some string value", s.get(ELEMENT1));
assertEquals("some other string value", s.get(ELEMENT2));
// create a new ContactsSyncState
SyncState s2 = new ContactsSyncState(getContext().getContentResolver(), testAccount)
{
};
// ensure it doesn't contain any values yet
assertNull(s2.get(ELEMENT1));
assertNull(s2.get(ELEMENT2));
// load the sync state
s2.load();
// make sure that the values are still returned correctly
assertEquals("some string value", s2.get(ELEMENT1));
assertEquals("some other string value", s2.get(ELEMENT2));
}
public void testContactsSyncStateWithContext() throws IOException, RemoteException
{
Account testAccount = new Account("test2", "local" /* there is no "local account" for contacts */);
// create a new ContactsSyncState for the test account
SyncState s = new ContactsSyncState(getContext().getContentResolver(), testAccount)
{
};
// the values must not exist yet
assertNull(s.get(CONTEXT_ELEMENT1));
assertNull(s.get(CONTEXT_ELEMENT2));
// add two values
s.set(CONTEXT_ELEMENT1, "some string value");
s.set(CONTEXT_ELEMENT2, "some other string value");
// check that the values are returned
assertEquals("some string value", s.get(CONTEXT_ELEMENT1));
assertEquals("some other string value", s.get(CONTEXT_ELEMENT2));
// store the sync state
s.store(CONTEXT);
// make sure that the values are still returned correctly
assertEquals("some string value", s.get(CONTEXT_ELEMENT1));
assertEquals("some other string value", s.get(CONTEXT_ELEMENT2));
// create a new ContactsSyncState
SyncState s2 = new ContactsSyncState(getContext().getContentResolver(), testAccount)
{
};
// ensure it doesn't contain any values yet
assertNull(s2.get(CONTEXT_ELEMENT1));
assertNull(s2.get(CONTEXT_ELEMENT2));
// load the sync state
s2.load(CONTEXT);
// make sure that the values are still returned correctly
assertEquals("some string value", s2.get(CONTEXT_ELEMENT1));
assertEquals("some other string value", s2.get(CONTEXT_ELEMENT2));
}
}
| {
"content_hash": "def83a8bf722ff7e588dc6187570c592",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 156,
"avg_line_length": 32.213793103448275,
"alnum_prop": 0.7398843930635838,
"repo_name": "dmfs/android-syncstate",
"id": "519248f043dba4d8caf5eba4655561ed22dbd7e6",
"size": "4671",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android-syncstate-test-test/src/org/dmfs/android/syncstate/test/ContactsSyncStateTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "24352"
}
],
"symlink_target": ""
} |
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_HAL_NAND_H
#define __STM32F4xx_HAL_NAND_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
#include "stm32f4xx_ll_fsmc.h"
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
#include "stm32f4xx_ll_fmc.h"
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
/** @addtogroup STM32F4xx_HAL_Driver
* @{
*/
/** @addtogroup NAND
* @{
*/
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
/* Exported typedef ----------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup NAND_Exported_Types NAND Exported Types
* @{
*/
/**
* @brief HAL NAND State structures definition
*/
typedef enum
{
HAL_NAND_STATE_RESET = 0x00, /*!< NAND not yet initialized or disabled */
HAL_NAND_STATE_READY = 0x01, /*!< NAND initialized and ready for use */
HAL_NAND_STATE_BUSY = 0x02, /*!< NAND internal process is ongoing */
HAL_NAND_STATE_ERROR = 0x03 /*!< NAND error state */
}HAL_NAND_StateTypeDef;
/**
* @brief NAND Memory electronic signature Structure definition
*/
typedef struct
{
/*<! NAND memory electronic signature maker and device IDs */
uint8_t Maker_Id;
uint8_t Device_Id;
uint8_t Third_Id;
uint8_t Fourth_Id;
}NAND_IDTypeDef;
/**
* @brief NAND Memory address Structure definition
*/
typedef struct
{
uint16_t Page; /*!< NAND memory Page address */
uint16_t Zone; /*!< NAND memory Zone address */
uint16_t Block; /*!< NAND memory Block address */
}NAND_AddressTypeDef;
/**
* @brief NAND Memory info Structure definition
*/
typedef struct
{
uint32_t PageSize; /*!< NAND memory page (without spare area) size measured in K. bytes */
uint32_t SpareAreaSize; /*!< NAND memory spare area size measured in K. bytes */
uint32_t BlockSize; /*!< NAND memory block size number of pages */
uint32_t BlockNbr; /*!< NAND memory number of blocks */
uint32_t ZoneSize; /*!< NAND memory zone size measured in number of blocks */
}NAND_InfoTypeDef;
/**
* @brief NAND handle Structure definition
*/
typedef struct
{
FMC_NAND_TypeDef *Instance; /*!< Register base address */
FMC_NAND_InitTypeDef Init; /*!< NAND device control configuration parameters */
HAL_LockTypeDef Lock; /*!< NAND locking object */
__IO HAL_NAND_StateTypeDef State; /*!< NAND device access state */
NAND_InfoTypeDef Info; /*!< NAND characteristic information structure */
}NAND_HandleTypeDef;
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup NAND_Exported_Macros NAND Exported Macros
* @{
*/
/** @brief Reset NAND handle state
* @param __HANDLE__: specifies the NAND handle.
* @retval None
*/
#define __HAL_NAND_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NAND_STATE_RESET)
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup NAND_Exported_Functions NAND Exported Functions
* @{
*/
/** @addtogroup NAND_Exported_Functions_Group1 Initialization and de-initialization functions
* @{
*/
/* Initialization/de-initialization functions ********************************/
HAL_StatusTypeDef HAL_NAND_Init(NAND_HandleTypeDef *hnand, FMC_NAND_PCC_TimingTypeDef *ComSpace_Timing, FMC_NAND_PCC_TimingTypeDef *AttSpace_Timing);
HAL_StatusTypeDef HAL_NAND_DeInit(NAND_HandleTypeDef *hnand);
void HAL_NAND_MspInit(NAND_HandleTypeDef *hnand);
void HAL_NAND_MspDeInit(NAND_HandleTypeDef *hnand);
void HAL_NAND_IRQHandler(NAND_HandleTypeDef *hnand);
void HAL_NAND_ITCallback(NAND_HandleTypeDef *hnand);
/**
* @}
*/
/** @addtogroup NAND_Exported_Functions_Group2 Input and Output functions
* @{
*/
/* IO operation functions ****************************************************/
HAL_StatusTypeDef HAL_NAND_Read_ID(NAND_HandleTypeDef *hnand, NAND_IDTypeDef *pNAND_ID);
HAL_StatusTypeDef HAL_NAND_Reset(NAND_HandleTypeDef *hnand);
HAL_StatusTypeDef HAL_NAND_Read_Page(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToRead);
HAL_StatusTypeDef HAL_NAND_Write_Page(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumPageToWrite);
HAL_StatusTypeDef HAL_NAND_Read_SpareArea(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaToRead);
HAL_StatusTypeDef HAL_NAND_Write_SpareArea(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress, uint8_t *pBuffer, uint32_t NumSpareAreaTowrite);
HAL_StatusTypeDef HAL_NAND_Erase_Block(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress);
uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand);
uint32_t HAL_NAND_Address_Inc(NAND_HandleTypeDef *hnand, NAND_AddressTypeDef *pAddress);
/**
* @}
*/
/** @addtogroup NAND_Exported_Functions_Group3 Peripheral Control functions
* @{
*/
/* NAND Control functions ****************************************************/
HAL_StatusTypeDef HAL_NAND_ECC_Enable(NAND_HandleTypeDef *hnand);
HAL_StatusTypeDef HAL_NAND_ECC_Disable(NAND_HandleTypeDef *hnand);
HAL_StatusTypeDef HAL_NAND_GetECC(NAND_HandleTypeDef *hnand, uint32_t *ECCval, uint32_t Timeout);
/**
* @}
*/
/** @addtogroup NAND_Exported_Functions_Group4 Peripheral State functions
* @{
*/
/* NAND State functions *******************************************************/
HAL_NAND_StateTypeDef HAL_NAND_GetState(NAND_HandleTypeDef *hnand);
uint32_t HAL_NAND_Read_Status(NAND_HandleTypeDef *hnand);
/**
* @}
*/
/**
* @}
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup NAND_Private_Constants NAND Private Constants
* @{
*/
#define NAND_DEVICE1 ((uint32_t)0x70000000)
#define NAND_DEVICE2 ((uint32_t)0x80000000)
#define NAND_WRITE_TIMEOUT ((uint32_t)0x01000000)
#define CMD_AREA ((uint32_t)(1<<16)) /* A16 = CLE high */
#define ADDR_AREA ((uint32_t)(1<<17)) /* A17 = ALE high */
#define NAND_CMD_AREA_A ((uint8_t)0x00)
#define NAND_CMD_AREA_B ((uint8_t)0x01)
#define NAND_CMD_AREA_C ((uint8_t)0x50)
#define NAND_CMD_AREA_TRUE1 ((uint8_t)0x30)
#define NAND_CMD_WRITE0 ((uint8_t)0x80)
#define NAND_CMD_WRITE_TRUE1 ((uint8_t)0x10)
#define NAND_CMD_ERASE0 ((uint8_t)0x60)
#define NAND_CMD_ERASE1 ((uint8_t)0xD0)
#define NAND_CMD_READID ((uint8_t)0x90)
#define NAND_CMD_STATUS ((uint8_t)0x70)
#define NAND_CMD_LOCK_STATUS ((uint8_t)0x7A)
#define NAND_CMD_RESET ((uint8_t)0xFF)
/* NAND memory status */
#define NAND_VALID_ADDRESS ((uint32_t)0x00000100)
#define NAND_INVALID_ADDRESS ((uint32_t)0x00000200)
#define NAND_TIMEOUT_ERROR ((uint32_t)0x00000400)
#define NAND_BUSY ((uint32_t)0x00000000)
#define NAND_ERROR ((uint32_t)0x00000001)
#define NAND_READY ((uint32_t)0x00000040)
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup NAND_Private_Macros NAND Private Macros
* @{
*/
/**
* @brief NAND memory address computation.
* @param __ADDRESS__: NAND memory address.
* @param __HANDLE__ : NAND handle.
* @retval NAND Raw address value
*/
#define ARRAY_ADDRESS(__ADDRESS__ , __HANDLE__) ((__ADDRESS__)->Page + \
(((__ADDRESS__)->Block + (((__ADDRESS__)->Zone) * ((__HANDLE__)->Info.ZoneSize)))* ((__HANDLE__)->Info.BlockSize)))
/**
* @brief NAND memory address cycling.
* @param __ADDRESS__: NAND memory address.
* @retval NAND address cycling value.
*/
#define ADDR_1ST_CYCLE(__ADDRESS__) (uint8_t)(__ADDRESS__) /* 1st addressing cycle */
#define ADDR_2ND_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 8) /* 2nd addressing cycle */
#define ADDR_3RD_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 16) /* 3rd addressing cycle */
#define ADDR_4TH_CYCLE(__ADDRESS__) (uint8_t)((__ADDRESS__) >> 24) /* 4th addressing cycle */
/**
* @}
*/
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_HAL_NAND_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| {
"content_hash": "3b377a495672ffc0325f093bdd2343d6",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 192,
"avg_line_length": 34.981884057971016,
"alnum_prop": 0.5761781460383221,
"repo_name": "redfern314/uplink",
"id": "61346950ad658c968497aaf81d7c2c17770d1bbc",
"size": "11707",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "device/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_nand.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "943956"
},
{
"name": "C",
"bytes": "34250844"
},
{
"name": "C++",
"bytes": "663798"
},
{
"name": "CSS",
"bytes": "139339"
},
{
"name": "JavaScript",
"bytes": "503263"
},
{
"name": "Makefile",
"bytes": "22045"
},
{
"name": "Objective-C",
"bytes": "1804"
},
{
"name": "Perl",
"bytes": "22806"
},
{
"name": "Prolog",
"bytes": "1856"
},
{
"name": "Python",
"bytes": "798"
},
{
"name": "Shell",
"bytes": "23522"
},
{
"name": "Tcl",
"bytes": "72"
}
],
"symlink_target": ""
} |
Person.prototype.age = {
get = function (self)
print("get age = ", self._age);
return self._age;
end,
set = function (self, value)
print("set age = ", value);
self._age = value;
end
};
local p = Person(); p.age = 12; print (p.age); | {
"content_hash": "c37c3fe5827b897638db96c705158579",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 47,
"avg_line_length": 17.785714285714285,
"alnum_prop": 0.5823293172690763,
"repo_name": "vimfung/LuaScriptCore",
"id": "cd6f59c9e93fef4804c237372a95ccfe69faed6d",
"size": "249",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Unity3D/UnityProject/Assets/StreamingAssets/defineProperty.lua",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1084638"
},
{
"name": "C#",
"bytes": "241847"
},
{
"name": "C++",
"bytes": "499881"
},
{
"name": "CMake",
"bytes": "5379"
},
{
"name": "CSS",
"bytes": "2143"
},
{
"name": "HTML",
"bytes": "285074"
},
{
"name": "Java",
"bytes": "77006"
},
{
"name": "Lua",
"bytes": "29866"
},
{
"name": "Makefile",
"bytes": "20155"
},
{
"name": "Objective-C",
"bytes": "282310"
},
{
"name": "Objective-C++",
"bytes": "6679"
},
{
"name": "Roff",
"bytes": "10307"
},
{
"name": "Ruby",
"bytes": "6510"
},
{
"name": "Swift",
"bytes": "23727"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "1a97f23499c0e692710fc139262dbc43",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "922dfc39c38040697c91ffc9cb0d6fa03b1a4ede",
"size": "186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Liliales/Melanthiaceae/Chamaelirium/Chamaelirium luteum/ Syn. Ophiostachys virginica/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Rational Synergy/Change scripts
The perl folder contains an example PM which has a few methods that proivde some useful synegry functions. It's main aim though is to show how to use the CSAPI to dump CR attachments.
The CLI folder has a demo script which shows you how to do the same thing from the Linux CLI. It does NOT use the CSAPI, but uses the CLI synergy interface.
In the end, most of my heavy-lifting was done from the CLI end, as it's more completley implemented, or was at the time.
(c) KC 2009
| {
"content_hash": "1b6506ba25bf1aac2312f45c32a4290e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 184,
"avg_line_length": 56.888888888888886,
"alnum_prop": 0.7734375,
"repo_name": "saint-kev/rat-syn-change",
"id": "5e025ce4fdabd92075aa502b0fb11b5dea0e13d0",
"size": "529",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Perl",
"bytes": "10073"
},
{
"name": "Shell",
"bytes": "6076"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Xemio.GameLibrary.Common.Collections.DictionaryActions
{
internal interface IDictionaryAction<TKey, TValue>
{
/// <summary>
/// Applies the action to the specified dictionary.
/// </summary>
/// <param name="dictionary">The dictionary.</param>
void Apply(Dictionary<TKey, TValue> dictionary);
}
}
| {
"content_hash": "e8d40f0fe31b06a35c6468137380ab67",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 64,
"avg_line_length": 27.294117647058822,
"alnum_prop": 0.6810344827586207,
"repo_name": "XemioNetwork/GameLibrary",
"id": "f4a85ba8b6fe325011f6e3b6377a0f03c5b24bf2",
"size": "466",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GameLibrary/Common/Collections/DictionaryActions/IDictionaryAction.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1238521"
}
],
"symlink_target": ""
} |
package org.jf.dexlib2.dexbacked.util;
import com.google.common.collect.ImmutableSet;
import org.jf.dexlib2.base.BaseMethodParameter;
import org.jf.dexlib2.iface.Annotation;
import org.jf.dexlib2.iface.MethodParameter;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ParameterIterator implements Iterator<MethodParameter> {
private final Iterator<? extends CharSequence> parameterTypes;
private final Iterator<? extends Set<? extends Annotation>> parameterAnnotations;
private final Iterator<String> parameterNames;
public ParameterIterator(@Nonnull List<? extends CharSequence> parameterTypes,
@Nonnull List<? extends Set<? extends Annotation>> parameterAnnotations,
@Nonnull Iterator<String> parameterNames) {
this.parameterTypes = parameterTypes.iterator();
this.parameterAnnotations = parameterAnnotations.iterator();
this.parameterNames = parameterNames;
}
@Override
public boolean hasNext() {
return parameterTypes.hasNext();
}
@Override
public MethodParameter next() {
@Nonnull final String type = parameterTypes.next().toString();
@Nonnull final Set<? extends Annotation> annotations;
@Nullable final String name;
if (parameterAnnotations.hasNext()) {
annotations = parameterAnnotations.next();
} else {
annotations = ImmutableSet.of();
}
if (parameterNames.hasNext()) {
name = parameterNames.next();
} else {
name = null;
}
return new BaseMethodParameter() {
@Nonnull
@Override
public Set<? extends Annotation> getAnnotations() {
return annotations;
}
@Nullable
@Override
public String getName() {
return name;
}
@Nonnull
@Override
public String getType() {
return type;
}
};
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
| {
"content_hash": "3b367f431e9efd79b445dc0c293dcf5a",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 101,
"avg_line_length": 28.72151898734177,
"alnum_prop": 0.619215513442045,
"repo_name": "aliebrahimi1781/show-java",
"id": "e62cbd938ec50d385114dadb76d0f70acc90ac06",
"size": "3831",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "app/src/main/java/org/jf/dexlib2/dexbacked/util/ParameterIterator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3339027"
}
],
"symlink_target": ""
} |
package com.mayurbhangale.sknsitstechtonic;
import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.AbsListView;
import android.widget.ListView;
import android.widget.Toast;
import com.twitter.sdk.android.core.Callback;
import com.twitter.sdk.android.core.Result;
import com.twitter.sdk.android.core.TwitterAuthException;
import com.twitter.sdk.android.core.TwitterException;
import com.twitter.sdk.android.core.models.Tweet;
import com.twitter.sdk.android.tweetui.SearchTimeline;
import com.twitter.sdk.android.tweetui.TimelineResult;
import com.twitter.sdk.android.tweetui.TweetTimelineListAdapter;
import com.twitter.sdk.android.tweetui.UserTimeline;
import java.lang.ref.WeakReference;
public class TimelineActivity extends AppCompatActivity {
final String TAG = "Loading tweets";
final WeakReference<Activity> activityRef = new WeakReference<Activity>(TimelineActivity.this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timeline);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(R.string.refresh_timeline_title);
}
final SwipeRefreshLayout swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
final View emptyView = findViewById(android.R.id.empty);
final ListView listView = (ListView) findViewById(android.R.id.list);
listView.setEmptyView(emptyView);
final SearchTimeline searchTimeline = new SearchTimeline.Builder()
.query("#techtonic")
.build();
Log.i(TAG,"Timeline Built");
/*final UserTimeline userTimeline = new UserTimeline.Builder()
.screenName("fabric")
.build();*/
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
.setTimeline(searchTimeline)
.setViewStyle(R.style.tw__TweetLightWithActionsStyle)
.build();
listView.setAdapter(adapter);
Log.i(TAG, "let");
// set custom scroll listener to enable swipe refresh layout only when at list top
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
boolean enableRefresh = false;
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
int totalItemCount) {
if (listView != null && listView.getChildCount() > 0) {
// check that the first item is visible and that its top matches the parent
enableRefresh = listView.getFirstVisiblePosition() == 0 &&
listView.getChildAt(0).getTop() >= 0;
} else {
enableRefresh = false;
}
swipeLayout.setEnabled(enableRefresh);
}
});
// specify action to take on swipe refresh
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
swipeLayout.setRefreshing(true);
adapter.refresh(new Callback<TimelineResult<Tweet>>() {
@Override
public void success(Result<TimelineResult<Tweet>> result) {
swipeLayout.setRefreshing(false);
}
@Override
public void failure(TwitterException exception) {
swipeLayout.setRefreshing(false);
final Activity activity = activityRef.get();
if (activity != null && !activity.isFinishing()) {
Toast.makeText(activity, exception.getMessage(),
Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
}
| {
"content_hash": "c541d1bfa589689aa15fad37658f20a2",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 100,
"avg_line_length": 41.018691588785046,
"alnum_prop": 0.6258828890407838,
"repo_name": "mayurbhangale/SKNSITS-Techtonic-2016",
"id": "5d126e3d787f9d46a32a6f4de3902834aff6c054",
"size": "4389",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/mayurbhangale/sknsitstechtonic/TimelineActivity.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "8179"
},
{
"name": "Java",
"bytes": "22071"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60-ea) on Mon Jun 27 14:13:43 EDT 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.wildfly.swarm.messaging.EnhancedServerConsumer (WildFly Swarm: Public javadocs 1.0.0.Final API)</title>
<meta name="date" content="2016-06-27">
<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="Uses of Interface org.wildfly.swarm.messaging.EnhancedServerConsumer (WildFly Swarm: Public javadocs 1.0.0.Final API)";
}
}
catch(err) {
}
//-->
</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><a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-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 class="aboutLanguage">WildFly Swarm API, 1.0.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/messaging/class-use/EnhancedServerConsumer.html" target="_top">Frames</a></li>
<li><a href="EnhancedServerConsumer.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 Interface org.wildfly.swarm.messaging.EnhancedServerConsumer" class="title">Uses of Interface<br>org.wildfly.swarm.messaging.EnhancedServerConsumer</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</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="#org.wildfly.swarm.messaging">org.wildfly.swarm.messaging</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.wildfly.swarm.messaging">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a> in <a href="../../../../../org/wildfly/swarm/messaging/package-summary.html">org.wildfly.swarm.messaging</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/wildfly/swarm/messaging/package-summary.html">org.wildfly.swarm.messaging</a> that return <a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</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>default <a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a></code></td>
<td class="colLast"><span class="typeNameLabel">EnhancedServerConsumer.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html#then-org.wildfly.swarm.messaging.EnhancedServerConsumer-">then</a></span>(<a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a> after)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../org/wildfly/swarm/messaging/package-summary.html">org.wildfly.swarm.messaging</a> with parameters of type <a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</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>static <a href="../../../../../org/wildfly/swarm/messaging/MessagingFraction.html" title="class in org.wildfly.swarm.messaging">MessagingFraction</a></code></td>
<td class="colLast"><span class="typeNameLabel">MessagingFraction.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/messaging/MessagingFraction.html#createDefaultFraction-org.wildfly.swarm.messaging.EnhancedServerConsumer-">createDefaultFraction</a></span>(<a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a> config)</code>
<div class="block">Create a fraction and configure the default local server.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../org/wildfly/swarm/messaging/MessagingFraction.html" title="class in org.wildfly.swarm.messaging">MessagingFraction</a></code></td>
<td class="colLast"><span class="typeNameLabel">MessagingFraction.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/messaging/MessagingFraction.html#defaultServer-org.wildfly.swarm.messaging.EnhancedServerConsumer-">defaultServer</a></span>(<a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a> config)</code>
<div class="block">Configure the default local server, creating it first if required.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/wildfly/swarm/messaging/MessagingFraction.html" title="class in org.wildfly.swarm.messaging">MessagingFraction</a></code></td>
<td class="colLast"><span class="typeNameLabel">MessagingFraction.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/messaging/MessagingFraction.html#server-java.lang.String-org.wildfly.swarm.messaging.EnhancedServerConsumer-">server</a></span>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> childKey,
<a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a> config)</code>
<div class="block">Configure a named server.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>default <a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a></code></td>
<td class="colLast"><span class="typeNameLabel">EnhancedServerConsumer.</span><code><span class="memberNameLink"><a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html#then-org.wildfly.swarm.messaging.EnhancedServerConsumer-">then</a></span>(<a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">EnhancedServerConsumer</a> after)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= 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><a href="../../../../../org/wildfly/swarm/messaging/EnhancedServerConsumer.html" title="interface in org.wildfly.swarm.messaging">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../overview-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 class="aboutLanguage">WildFly Swarm API, 1.0.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/wildfly/swarm/messaging/class-use/EnhancedServerConsumer.html" target="_top">Frames</a></li>
<li><a href="EnhancedServerConsumer.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 ======= -->
<p class="legalCopy"><small>Copyright © 2016 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "df9388ce9b4443ee568585809aac46d9",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 467,
"avg_line_length": 55.69,
"alnum_prop": 0.6819895852038068,
"repo_name": "wildfly-swarm/wildfly-swarm-javadocs",
"id": "46168ef123ca60a63c04e5533c913ceaa0f41fca",
"size": "11138",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "1.0.0.Final/apidocs/org/wildfly/swarm/messaging/class-use/EnhancedServerConsumer.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import React, { useRef } from 'react';
import {
Box,
Button,
Menu,
MenuButton,
MenuList,
Tooltip,
} from '@chakra-ui/react';
import { getTimeZones } from '@vvo/tzdb';
import Select from 'components/MultiSelect';
import { useDateContext } from 'providers/DateProvider';
interface Option { value: string, label: string }
const TimezoneDropdown: React.FC = () => {
const { timezone, setTimezone, formatDate } = useDateContext();
const menuRef = useRef<HTMLButtonElement>(null);
const timezones = getTimeZones();
let currentTimezone;
const options = timezones.map(({ name, currentTimeFormat, group }) => {
const label = `${currentTimeFormat.substring(0, 6)} ${name.replace(/_/g, ' ')}`;
if (name === timezone || group.includes(timezone)) currentTimezone = { label, value: name };
return { label, value: name };
});
const onChangeTimezone = (newTimezone: Option | null) => {
if (newTimezone) {
setTimezone(newTimezone.value);
// Close the dropdown on a successful change
menuRef?.current?.click();
}
};
return (
<Menu isLazy>
<Tooltip label="Change time zone" hasArrow>
<MenuButton as={Button} variant="ghost" mr="4" ref={menuRef}>
<Box
as="time"
dateTime={formatDate()}
fontSize="md"
>
{formatDate()}
</Box>
</MenuButton>
</Tooltip>
<MenuList placement="top-end" minWidth="350px" px="3" pb="1">
<Select
autoFocus
options={options}
value={currentTimezone}
onChange={onChangeTimezone}
/>
</MenuList>
</Menu>
);
};
export default TimezoneDropdown;
| {
"content_hash": "4dc8ca99335ca4a66424781491985fbf",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 96,
"avg_line_length": 25.818181818181817,
"alnum_prop": 0.6044600938967136,
"repo_name": "lyft/incubator-airflow",
"id": "cb829f0370fe3eb69d2453ddcccb41e1e8662469",
"size": "2512",
"binary": false,
"copies": "8",
"ref": "refs/heads/main",
"path": "airflow/ui/src/components/AppContainer/TimezoneDropdown.tsx",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "13715"
},
{
"name": "Dockerfile",
"bytes": "17280"
},
{
"name": "HTML",
"bytes": "161328"
},
{
"name": "JavaScript",
"bytes": "25360"
},
{
"name": "Jinja",
"bytes": "8565"
},
{
"name": "Jupyter Notebook",
"bytes": "2933"
},
{
"name": "Mako",
"bytes": "1339"
},
{
"name": "Python",
"bytes": "10019710"
},
{
"name": "Shell",
"bytes": "220780"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tag: MySQL | wdpm's blog | Actions speak louder than words.</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="undefined">
<meta name="description" content="wdpm's blog | front end| java | android | php">
<meta property="og:type" content="website">
<meta property="og:title" content="wdpm's blog">
<meta property="og:url" content="http://www.imwdpm.me/tags/MySQL/index.html">
<meta property="og:site_name" content="wdpm's blog">
<meta property="og:description" content="wdpm's blog | front end| java | android | php">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="wdpm's blog">
<meta name="twitter:description" content="wdpm's blog | front end| java | android | php">
<link rel="alternative" href="/atom.xml" title="wdpm's blog" type="application/atom+xml">
<meta name="summary" content="wdpm's blog | front end| java | android | php">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div id="loading" class="active"></div>
<nav id="menu" >
<div class="inner">
<a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
<i class="icon icon-lg icon-close"></i>
</a>
<div class="brand-wrap">
<div class="brand">
<a href="/" class="avatar"><img src="/img/logo.jpg"></a>
<hgroup class="introduce">
<h5 class="nickname">wdpm</h5>
<a href="mailto:undefined" title="1137299673@qq.com" class="mail">1137299673@qq.com</a>
</hgroup>
</div>
</div>
<ul class="nav">
<li class="waves-block waves-effect">
<a href="/" >
<i class="icon icon-lg icon-home"></i>
Home
</a>
</li>
<li class="waves-block waves-effect">
<a href="/archives" >
<i class="icon icon-lg icon-archives"></i>
Archives
</a>
</li>
<li class="waves-block waves-effect active">
<a href="/tags" >
<i class="icon icon-lg icon-tags"></i>
Tags
</a>
</li>
<li class="waves-block waves-effect">
<a href="https://github.com/wdpm" target="_blank" >
<i class="icon icon-lg icon-github"></i>
Github
</a>
</li>
</ul>
<footer class="footer">
<p><a rel="license" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0;vertical-align:middle;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAAAPCAMAAABEF7i9AAAAllBMVEUAAAD///+rsapERER3d3eIiIjMzMzu7u4iIiKUmZO6v7rKzsoODg4RERFVVVUNDQ0NDg0PEA8zMzNLTEtbXltmZmZydnF9gn2AgICPkI+ZmZmqqqq7u7vFxsXIzMgNDQwZGRkgICAhISEkJSMnKCcuMC4xMzE5Ozk7PTtBQkFCQkJDQ0Nna2eGhoaHh4ezuLLGysbd3d1wVGpAAAAA4UlEQVR42q2T1xqCMAyFk7QsBQeKA9x7j/d/OSm22CpX0nzcpA1/T05aAOuBVkMAScQFHLnEwoCo2f1TnQIGoVMewjZEjVFN4GH1Ue1Cn2jWqwfsOOj6wDwGvotsl/c8lv7KIq1eLOsT0HMFHMIE/RZyHnlphryT9zyV+8WH5e8yQw3wnQvgAFxPTKUVi555SHR/lOfLMgVTeDlSfN+TaoUsiTyeIm+bCkHvCA2FUKG48LDtYBZBknsYP/G8NTw0gaaHyuQf4H5pecrB/FYCT2sL9zAfy1Xyjou6L8X2W7YcLyBZCRtnq/zfAAAAAElFTkSuQmCC" /></a></p>
<p>wdpm's blog © 2016</p>
<p>Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme
<a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a></p>
<a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-2x icon-rss-square"></i></a>
<!--不蒜子 极简网页计数器,采用pv计数方式:单个用户连续点击n篇文章,记录n次访问量
<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span><br/>
您是第<span id="busuanzi_value_site_uv"></span>位访客
-->
<!--cnzz-->
<script type="text/javascript">
var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
<!--style='display:none'-->
document.write(unescape("%3Cspan id='cnzz_stat_icon_1258141698' %3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s95.cnzz.com/z_stat.php%3Fid%3D1258141698%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));
</script>
</footer>
</div>
</nav>
<main id="main">
<header class="header" id="header">
<div class="flex-row">
<a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
<i class="icon icon-lg icon-navicon"></i>
</a>
<div class="flex-col header-title ellipsis">wdpm's blog</div>
<div class="search-wrap" id="search-wrap">
<a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
<i class="icon icon-lg icon-chevron-left"></i>
</a>
<input type="text" id="key" class="search-input " autocomplete="off" placeholder="输入感兴趣的关键字">
<a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
<i class="icon icon-lg icon-search"></i>
</a>
</div>
<a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-share">
<i class="icon icon-lg icon-share-alt"></i>
</a>
</div>
</header>
<header class="content-header">
<div class="container">
<h1 class="author">wdpm's blog</h1>
<h5 class="subtitle">Actions speak louder than words.</h5>
</div>
</header>
<div class="container body-wrap">
<section class="archives-wrap flex-row">
<div class="archive-year-wrap">
<a href="/archives/2016" class="archive-year waves-effect waves-circle waves-light">2016</a>
</div>
<div class="archives flex-col">
<article class="archive-article archive-type-post">
<div class="archive-article-inner">
<header class="archive-article-header flex-row flex-middle">
<div class="flex-col">
<h3 class="post-title" itemprop="name">
<a class="post-title-link" href="/20160602/mysql-tips/">MySQL小知识</a>
</h3>
</div>
<time datetime="2016-06-02T10:18:57.133Z" itemprop="datePublished" class="post-tiem">
6月 2
</time>
</header>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/MySQL/">MySQL</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/tips/">tips</a></li></ul>
</div>
</article>
</div>
</section>
</div>
</main>
<div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>
<script>
var BLOG_SHARE = {
title: "wdpm's blog",
pic: "/img/logo.jpg",
summary: document.getElementsByName('summary')[0].content,
url: "http://www.imwdpm.me/tags/MySQL/index.html"
};
</script>
<div class="global-share" id="global-share">
<div class="tit">分享到:</div>
<ul class="reset share-icons">
<li>
<a class="weibo share-sns" href="javascript:;" data-title="微博" data-service="tsina">
<i class="icon icon-weibo"></i>
</a>
</li>
<li>
<a class="weixin share-sns" href="javascript:;" data-title="微信" data-service="weixin">
<i class="icon icon-weixin"></i>
</a>
</li>
<li>
<a class="qq share-sns" href="javascript:;" data-title=" QQ" data-service="cqq">
<i class="icon icon-qq"></i>
</a>
</li>
<li>
<a class="facebook share-sns" href="javascript:;" data-title=" Facebook" data-service="fb">
<i class="icon icon-facebook"></i>
</a>
</li>
<li>
<a class="twitter share-sns" href="javascript:;" data-title=" Twitter" data-service="twitter">
<i class="icon icon-twitter"></i>
</a>
</li>
<li>
<a class="douban share-sns" href="javascript:;" data-title="豆瓣" data-service="douban">
豆
</a>
</li>
</ul>
</div>
<script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script src="/js/main.js"></script>
<div class="search-panel" id="search-panel">
<ul class="search-result" id="search-result"></ul>
</div>
<script type="text/template" id="search-tpl">
<li class="item">
<a href="/{path}" class="waves-block waves-effect">
<div class="title ellipsis" title="{title}">{title}</div>
<div class="flex-row flex-middle">
<div class="tags ellipsis">
{tags}
</div>
<time class="flex-col time">{date}</time>
</div>
</a>
</li>
</script>
<script src="/js/search.js"></script>
<script src="http://s95.cnzz.com/z_stat.php?id=1258141698&web_id=1258141698"></script>
</body>
</html>
| {
"content_hash": "a1d6edddff52a98b63389385a49ff384",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 808,
"avg_line_length": 34.39622641509434,
"alnum_prop": 0.6103126714207351,
"repo_name": "wdpm/wdpm.github.io",
"id": "2d5f49b4a0c36b7a66c13551cb553a0c0c9e7bf2",
"size": "9259",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tags/MySQL/index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "37640"
},
{
"name": "HTML",
"bytes": "1353043"
},
{
"name": "JavaScript",
"bytes": "10058"
}
],
"symlink_target": ""
} |
using ::testing::NotNull;
using ::testing::Return;
using ::testing::InSequence;
extern peloton::LoggingType peloton_logging_mode;
namespace peloton {
namespace test {
//===--------------------------------------------------------------------===//
// Logging Tests
//===--------------------------------------------------------------------===//
class LoggingTests : public PelotonTest {};
TEST_F(LoggingTests, BasicLoggingTest) {
std::unique_ptr<storage::DataTable> table(TestingExecutorUtil::CreateTable(1));
auto &log_manager = logging::LogManager::GetInstance();
LoggingScheduler scheduler(2, 1, &log_manager, table.get());
scheduler.Init();
// The first txn to commit starts with cid 2
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(2);
scheduler.BackendLogger(0, 0).Insert(2);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(3);
scheduler.BackendLogger(0, 0).Commit(2);
scheduler.BackendLogger(0, 1).Insert(3);
scheduler.BackendLogger(0, 1).Commit(3);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.Run();
auto results = scheduler.frontend_threads[0].results;
EXPECT_EQ(3, results[0]);
scheduler.Cleanup();
}
TEST_F(LoggingTests, AllCommittedTest) {
std::unique_ptr<storage::DataTable> table(TestingExecutorUtil::CreateTable(1));
auto &log_manager = logging::LogManager::GetInstance();
LoggingScheduler scheduler(2, 1, &log_manager, table.get());
scheduler.Init();
// Logger 0 is always the front end logger
// The first txn to commit starts with cid 2
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(2);
scheduler.BackendLogger(0, 0).Insert(2);
scheduler.BackendLogger(0, 0).Commit(2);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(3);
scheduler.BackendLogger(0, 1).Insert(3);
scheduler.BackendLogger(0, 1).Commit(3);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.BackendLogger(0, 1).Done(1);
scheduler.Run();
auto results = scheduler.frontend_threads[0].results;
EXPECT_EQ(3, results[0]);
scheduler.Cleanup();
}
TEST_F(LoggingTests, LaggardTest) {
std::unique_ptr<storage::DataTable> table(TestingExecutorUtil::CreateTable(1));
auto &log_manager = logging::LogManager::GetInstance();
LoggingScheduler scheduler(2, 1, &log_manager, table.get());
scheduler.Init();
// Logger 0 is always the front end logger
// The first txn to commit starts with cid 2
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(2);
scheduler.BackendLogger(0, 0).Insert(2);
scheduler.BackendLogger(0, 0).Commit(2);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(3);
scheduler.BackendLogger(0, 1).Insert(3);
scheduler.BackendLogger(0, 1).Commit(3);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
// at this point everyone should be updated to 3
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(4);
scheduler.BackendLogger(0, 0).Insert(4);
scheduler.BackendLogger(0, 0).Commit(4);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.BackendLogger(0, 1).Done(1);
scheduler.Run();
auto results = scheduler.frontend_threads[0].results;
EXPECT_EQ(3, results[0]);
EXPECT_EQ(3, results[1]);
scheduler.Cleanup();
}
TEST_F(LoggingTests, FastLoggerTest) {
std::unique_ptr<storage::DataTable> table(TestingExecutorUtil::CreateTable(1));
auto &log_manager = logging::LogManager::GetInstance();
LoggingScheduler scheduler(2, 1, &log_manager, table.get());
scheduler.Init();
// Logger 0 is always the front end logger
// The first txn to commit starts with cid 2
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(2);
scheduler.BackendLogger(0, 0).Insert(2);
scheduler.BackendLogger(0, 0).Commit(2);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(3);
scheduler.BackendLogger(0, 1).Insert(3);
scheduler.BackendLogger(0, 1).Commit(3);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.BackendLogger(0, 1).Done(1);
// at this point everyone should be updated to 3
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(4);
scheduler.BackendLogger(0, 0).Insert(4);
scheduler.BackendLogger(0, 0).Commit(4);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Insert(5);
scheduler.BackendLogger(0, 1).Commit(5);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.BackendLogger(0, 1).Done(1);
scheduler.Run();
auto results = scheduler.frontend_threads[0].results;
EXPECT_EQ(3, results[0]);
EXPECT_EQ(3, results[1]);
scheduler.Cleanup();
}
TEST_F(LoggingTests, BothPreparingTest) {
std::unique_ptr<storage::DataTable> table(TestingExecutorUtil::CreateTable(1));
auto &log_manager = logging::LogManager::GetInstance();
LoggingScheduler scheduler(2, 1, &log_manager, table.get());
scheduler.Init();
// Logger 0 is always the front end logger
// The first txn to commit starts with cid 2
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(2);
scheduler.BackendLogger(0, 0).Insert(2);
scheduler.BackendLogger(0, 0).Commit(2);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(3);
scheduler.BackendLogger(0, 1).Insert(3);
scheduler.BackendLogger(0, 1).Commit(3);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
// at this point everyone should be updated to 3
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(4);
scheduler.BackendLogger(0, 0).Insert(4);
scheduler.BackendLogger(0, 0).Commit(4);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(5);
scheduler.BackendLogger(0, 1).Insert(5);
scheduler.BackendLogger(0, 1).Commit(5);
// this prepare should still get a may commit of 3
scheduler.BackendLogger(0, 1).Prepare();
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 1).Begin(6);
scheduler.BackendLogger(0, 1).Insert(6);
scheduler.BackendLogger(0, 1).Commit(6);
// this call should get a may commit of 4
scheduler.BackendLogger(0, 0).Prepare();
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.BackendLogger(0, 1).Done(1);
scheduler.Run();
auto results = scheduler.frontend_threads[0].results;
EXPECT_EQ(3, results[0]);
EXPECT_EQ(3, results[1]);
EXPECT_EQ(4, results[2]);
scheduler.Cleanup();
}
TEST_F(LoggingTests, TwoRoundTest) {
std::unique_ptr<storage::DataTable> table(TestingExecutorUtil::CreateTable(1));
auto &log_manager = logging::LogManager::GetInstance();
LoggingScheduler scheduler(2, 1, &log_manager, table.get());
scheduler.Init();
// Logger 0 is always the front end logger
// The first txn to commit starts with cid 2
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(2);
scheduler.BackendLogger(0, 0).Insert(2);
scheduler.BackendLogger(0, 0).Commit(2);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(3);
scheduler.BackendLogger(0, 1).Insert(3);
scheduler.BackendLogger(0, 1).Commit(3);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
// at this point everyone should be updated to 3
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(4);
scheduler.BackendLogger(0, 0).Insert(4);
scheduler.BackendLogger(0, 0).Commit(4);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(5);
scheduler.BackendLogger(0, 1).Insert(5);
scheduler.BackendLogger(0, 1).Commit(5);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.BackendLogger(0, 1).Done(1);
scheduler.Run();
auto results = scheduler.frontend_threads[0].results;
EXPECT_EQ(5, results[1]);
scheduler.Cleanup();
}
TEST_F(LoggingTests, InsertUpdateDeleteTest) {
std::unique_ptr<storage::DataTable> table(TestingExecutorUtil::CreateTable(1));
auto &log_manager = logging::LogManager::GetInstance();
LoggingScheduler scheduler(2, 1, &log_manager, table.get());
scheduler.Init();
// Logger 0 is always the front end logger
// The first txn to commit starts with cid 2
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(2);
scheduler.BackendLogger(0, 0).Insert(2);
scheduler.BackendLogger(0, 0).Commit(2);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(3);
scheduler.BackendLogger(0, 1).Update(3);
scheduler.BackendLogger(0, 1).Commit(3);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
// at this point everyone should be updated to 3
scheduler.BackendLogger(0, 0).Prepare();
scheduler.BackendLogger(0, 0).Begin(4);
scheduler.BackendLogger(0, 0).Delete(4);
scheduler.BackendLogger(0, 0).Commit(4);
scheduler.BackendLogger(0, 1).Prepare();
scheduler.BackendLogger(0, 1).Begin(5);
scheduler.BackendLogger(0, 1).Delete(5);
scheduler.BackendLogger(0, 1).Commit(5);
scheduler.FrontendLogger(0).Collect();
scheduler.FrontendLogger(0).Flush();
scheduler.BackendLogger(0, 0).Done(1);
scheduler.BackendLogger(0, 1).Done(1);
scheduler.Run();
auto results = scheduler.frontend_threads[0].results;
EXPECT_EQ(5, results[1]);
scheduler.Cleanup();
}
TEST_F(LoggingTests, BasicLogManagerTest) {
peloton_logging_mode = LoggingType::INVALID;
auto &log_manager = logging::LogManager::GetInstance();
log_manager.DropFrontendLoggers();
log_manager.SetLoggingStatus(LoggingStatusType::INVALID);
// just start, write a few records and exit
catalog::Schema *table_schema = new catalog::Schema(
{TestingExecutorUtil::GetColumnInfo(0), TestingExecutorUtil::GetColumnInfo(1),
TestingExecutorUtil::GetColumnInfo(2),
TestingExecutorUtil::GetColumnInfo(3)});
std::string table_name("TEST_TABLE");
// Create table.
bool own_schema = true;
bool adapt_table = false;
storage::DataTable *table = storage::TableFactory::GetDataTable(
12345, 123456, table_schema, table_name, 1, own_schema, adapt_table);
storage::Database test_db(12345);
test_db.AddTable(table);
auto catalog = catalog::Catalog::GetInstance();
catalog->AddDatabase(&test_db);
concurrency::TransactionManager &txn_manager =
concurrency::TransactionManagerFactory::GetInstance();
auto txn = txn_manager.BeginTransaction();
TestingExecutorUtil::PopulateTable(table, 5, true, false, false, txn);
txn_manager.CommitTransaction(txn);
peloton_logging_mode = LoggingType::NVM_WAL;
log_manager.SetSyncCommit(true);
EXPECT_FALSE(log_manager.ContainsFrontendLogger());
log_manager.StartStandbyMode();
log_manager.GetFrontendLogger(0)->SetTestMode(true);
log_manager.StartRecoveryMode();
log_manager.WaitForModeTransition(LoggingStatusType::LOGGING, true);
EXPECT_TRUE(log_manager.ContainsFrontendLogger());
log_manager.SetGlobalMaxFlushedCommitId(4);
concurrency::Transaction test_txn;
cid_t commit_id = 5;
log_manager.PrepareLogging();
log_manager.LogBeginTransaction(commit_id);
ItemPointer insert_loc(table->GetTileGroup(1)->GetTileGroupId(), 0);
ItemPointer delete_loc(table->GetTileGroup(2)->GetTileGroupId(), 0);
ItemPointer update_old(table->GetTileGroup(3)->GetTileGroupId(), 0);
ItemPointer update_new(table->GetTileGroup(4)->GetTileGroupId(), 0);
log_manager.LogInsert(commit_id, insert_loc);
log_manager.LogUpdate(commit_id, update_old, update_new);
log_manager.LogInsert(commit_id, delete_loc);
log_manager.LogCommitTransaction(commit_id);
// since we are doing sync commit we should have reached 5 already
EXPECT_EQ(commit_id, log_manager.GetPersistentFlushedCommitId());
log_manager.EndLogging();
}
} // End test namespace
} // End peloton namespace
| {
"content_hash": "3b69584f2f675e7ed24d082387c03358",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 84,
"avg_line_length": 36.18731988472622,
"alnum_prop": 0.7163335191526639,
"repo_name": "wangziqi2016/peloton",
"id": "9a91257de7358859d0802e2876906fc16bde122f",
"size": "13391",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "test/logging/logging_test.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1836"
},
{
"name": "C++",
"bytes": "3894442"
},
{
"name": "CMake",
"bytes": "103878"
},
{
"name": "Java",
"bytes": "44383"
},
{
"name": "Lex",
"bytes": "5259"
},
{
"name": "PLpgSQL",
"bytes": "5855"
},
{
"name": "Protocol Buffer",
"bytes": "74081"
},
{
"name": "Python",
"bytes": "53820"
},
{
"name": "Ruby",
"bytes": "1035"
},
{
"name": "Shell",
"bytes": "13158"
},
{
"name": "Yacc",
"bytes": "27540"
}
],
"symlink_target": ""
} |
module Network.Telegram.Bot.Requests.Yesod
( TelegramRequest
, TelegramException (..)
, getMeRequest
, sendChatActionRequest
, sendMessageRequest
, forwardMessageRequest
, answerCallbackQueryRequest
, sendPhotoRequest
, sendAudioRequest
, sendDocumentRequest
, sendStickerRequest
, sendVideoRequest
, sendVoiceRequest
, sendLocationRequest
, sendVenueRequest
, sendContactRequest
, getUserProfilePhotosRequest
, getFileRequest
, downloadFileRequestToDisk
, kickChatMemberRequest
, leaveChatRequest
, unbanChatMemberRequest
, getChatRequest
, getChatAdministratorsRequest
, getChatMembersCountRequest
, getChatMemberRequest
, editMessageTextRequest
, editMessageCaptionRequest
, editMessageReplyMarkupRequest
, answerInlineQueryRequest
, sendGameRequest
, setGameScoreRequest
, getGameHighScoresRequest
, getUpdatesRequest
, setWebhookRequest
, deleteWebhookRequest
, getWebhookInfoRequest
, sendPhotoFileRequest
, sendAudioFileRequest
, sendDocumentFileRequest
, sendStickerFileRequest
, sendVideoFileRequest
, sendVoiceFileRequest
, setWebhookFileRequest
, inputFileFields
) where
import Control.Exception
import Control.Monad.Catch (MonadThrow)
import Control.Monad.Reader (MonadReader,asks)
import Control.Monad.IO.Class (MonadIO,liftIO)
import Data.Aeson
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as LB
import qualified Data.HashMap.Strict as HM
import Data.Monoid ((<>))
import Data.Scientific (floatingOrInteger)
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import Data.Typeable
import qualified Network.HTTP.Client as CLIENT
import Network.HTTP.Client.MultipartFormData
import Network.HTTP.Client.Conduit
import Network.HTTP.Types (hContentType)
import qualified Web.Telegram.Bot as TG
import Network.Telegram.Bot.Types
type TelegramRequest a m b = Token -> a -> m (Either TelegramBadResponse (TG.Response b))
tshow :: Show a => a -> Text
tshow = T.pack . show
----------------------------
-- SEND AND GET FUNCTIONS --
----------------------------
getMeRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => Token -> m (Either TelegramBadResponse (TG.Response TG.User))
getMeRequest = telegramGetRequest "getMe" []
sendChatActionRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendChatActionRequest m TG.Message
sendChatActionRequest = telegramPostJSONRequest "sendChatAction" []
sendMessageRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendMessageRequest m TG.Message
sendMessageRequest = telegramPostJSONRequest "sendMessage" []
forwardMessageRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.ForwardMessageRequest m TG.Message
forwardMessageRequest = telegramPostJSONRequest "forwardMessage" []
answerCallbackQueryRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.AnswerCallbackQueryRequest m Bool
answerCallbackQueryRequest = telegramPostJSONRequest "answerCallbackQuery" []
sendPhotoRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendPhotoRequest m TG.Message
sendPhotoRequest = telegramPostJSONRequest "sendPhoto" []
sendAudioRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendAudioRequest m TG.Message
sendAudioRequest = telegramPostJSONRequest "sendAudio" []
sendDocumentRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendDocumentRequest m TG.Message
sendDocumentRequest = telegramPostJSONRequest "sendDocument" []
sendStickerRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendStickerRequest m TG.Message
sendStickerRequest = telegramPostJSONRequest "sendSticker" []
sendVideoRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendVideoRequest m TG.Message
sendVideoRequest = telegramPostJSONRequest "sendVideo" []
sendVoiceRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendVoiceRequest m TG.Message
sendVoiceRequest = telegramPostJSONRequest "sendVoice" []
sendLocationRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendLocationRequest m TG.Message
sendLocationRequest = telegramPostJSONRequest "sendLocation" []
sendVenueRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendVenueRequest m TG.Message
sendVenueRequest = telegramPostJSONRequest "sendVenue" []
sendContactRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendContactRequest m TG.Message
sendContactRequest = telegramPostJSONRequest "sendContact" []
getUserProfilePhotosRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) =>
TelegramRequest TG.UserProfilePhotosRequest m TG.UserProfilePhotos
getUserProfilePhotosRequest = telegramPostJSONRequest "getUserProfilePhotos" []
getFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.FileRequest m TG.File
getFileRequest = telegramPostJSONRequest "getFile" []
-- | Returns Nothing on success and a tuple with the error message and maybe
-- Response Parameters to maybe automatically handle certain errors on failure
downloadFileRequestToDisk :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) =>
Token -> FilePath -> TG.FileRequest -> m (Maybe (Text,Maybe TG.ResponseParameters))
downloadFileRequestToDisk token saveTo req = do
tgFile <- getFileRequest token req
case tgFile of
Right (TG.OKResponse (TG.File _ _ (Just urlpath)) _) -> do
request <- parseRequest $ "https://api.telegram.org/file/bot" <> T.unpack token <> "/" <> T.unpack urlpath
mngr <- asks getHttpManager
liftIO $ CLIENT.withResponse request mngr go
Right (TG.OKResponse (TG.File _ _ Nothing) mdesc) -> return $ Just
("downloadFileRequestToDisk: NO URL GIVEN" <> maybe "" (" WITH DESC: " <>) mdesc,Nothing)
Right (TG.ErrorResponse desc mcode mrp) -> return $ Just $
("downloadFileRequestToDisk: ERROR: " <> desc <> maybe "" (mappend " - CODE: " . tshow) mcode,mrp)
Left (TelegramBadResponse parsefail _) -> return $ Just $ ("downloadFileRequestToDisk: BAD RESPONSE: " <> parsefail,Nothing)
where
go res = do
b <- CLIENT.brRead bodyReader
case b of
"" -> return $ Just ("downloadFileRequestToDisk: EMPTY FILE",Nothing)
_ -> B.writeFile saveTo b >> loop bodyReader
where bodyReader = responseBody res
loop breader = do
br <- CLIENT.brRead breader
case br of
"" -> return $ Nothing
_ -> B.appendFile saveTo br >> loop breader
-------------------
-- CHAT REQUESTS --
-------------------
kickChatMemberRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.KickChatMemberRequest m Bool
kickChatMemberRequest = telegramPostJSONRequest "kickChatMember" []
leaveChatRequest ::(MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.LeaveChatRequest m Bool
leaveChatRequest = telegramPostJSONRequest "leaveChat" []
unbanChatMemberRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.UnbanChatMemberRequest m Bool
unbanChatMemberRequest = telegramPostJSONRequest "unbanChatMember" []
getChatRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.GetChatRequest m TG.Chat
getChatRequest = telegramPostJSONRequest "getChat" []
getChatAdministratorsRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) =>
TelegramRequest TG.GetChatAdministratorsRequest m [TG.ChatMember]
getChatAdministratorsRequest = telegramPostJSONRequest "getChatAdministrators" []
getChatMembersCountRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.GetChatMembersCountRequest m Int
getChatMembersCountRequest = telegramPostJSONRequest "getChatMembersCount" []
getChatMemberRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.GetChatMemberRequest m TG.ChatMember
getChatMemberRequest = telegramPostJSONRequest "getChatMember" []
---------------------
-- UPDATE REQUESTS --
---------------------
editMessageTextRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.EditMessageTextRequest m Bool
editMessageTextRequest = telegramPostJSONRequest "editMessageText" []
editMessageCaptionRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.EditMessageCaptionRequest m Bool
editMessageCaptionRequest = telegramPostJSONRequest "editMessageCaption" []
editMessageReplyMarkupRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.EditMessageReplyMarkupRequest m Bool
editMessageReplyMarkupRequest = telegramPostJSONRequest "editMessageReplyMarkupRequest" []
---------------------
-- INLINE REQUESTS --
---------------------
answerInlineQueryRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.EditMessageTextRequest m (Either Bool TG.Message)
answerInlineQueryRequest = telegramPostJSONRequest "answerInlineQuery" []
-------------------
-- GAME REQUESTS --
-------------------
sendGameRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendGameRequest m TG.Message
sendGameRequest = telegramPostJSONRequest "sendGame" []
setGameScoreRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SetGameScoreRequest m (Either Bool TG.Message)
setGameScoreRequest = telegramPostJSONRequest "setGameScore" []
getGameHighScoresRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.GetGameHighScoresRequest m [TG.GameHighScore]
getGameHighScoresRequest = telegramPostJSONRequest "getGameHighScores" []
-------------------
-- UTIL REQUESTS --
-------------------
getUpdatesRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.UpdatesRequest m [TG.Update]
getUpdatesRequest = telegramPostJSONRequest "getUpdates" []
-- | DON'T USE THIS IF YOU WANT TO SEND A CERTIFICATE, USE setWebhookFileRequest IN THAT CASE
setWebhookRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.WebhookRequest m Bool
setWebhookRequest = telegramPostJSONRequest "setWebhook" []
deleteWebhookRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => Token -> m (Either TelegramBadResponse (TG.Response Bool))
deleteWebhookRequest = telegramGetRequest "deleteWebhook" []
getWebhookInfoRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => Token -> m (Either TelegramBadResponse (TG.Response TG.WebhookInfo))
getWebhookInfoRequest = telegramGetRequest "getWebhookInfo" []
---------------------------------
-- MULTIPART/FORMDATA VERSIONS --
---------------------------------
sendPhotoFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendPhotoRequest m TG.Message
sendPhotoFileRequest = telegramPostFileRequest "sendPhoto"
sendAudioFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendAudioRequest m TG.Message
sendAudioFileRequest = telegramPostFileRequest "sendAudio"
sendDocumentFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendDocumentRequest m TG.Message
sendDocumentFileRequest = telegramPostFileRequest "sendDocument"
sendStickerFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendStickerRequest m TG.Message
sendStickerFileRequest = telegramPostFileRequest "sendSticker"
sendVideoFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendVideoRequest m TG.Message
sendVideoFileRequest = telegramPostFileRequest "sendVideo"
sendVoiceFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.SendVoiceRequest m TG.Message
sendVoiceFileRequest = telegramPostFileRequest "sendVoice"
setWebhookFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => TelegramRequest TG.WebhookRequest m Bool
setWebhookFileRequest = telegramPostFileRequest "setWebhook"
----------------------
-- HELPER FUNCTIONS --
----------------------
-- | This function checks if the string in the to-be-sent-file argument is a path or url
-- and will send the file itself, or download the file and send it then.
-- It will also keep anything else intact but I don't know if Telegram will accept it if
-- there's no actual file in this `multipart/formdata`
-- | Please use the `telegramPostJSONRequest` if you want to send a url or a file_id
telegramPostFileRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m, ToJSON a, FromJSON b) =>
String -> Token -> a -> m (Either TelegramBadResponse (TG.Response b))
telegramPostFileRequest url token a = do
request <- goPR token url
case toJSON a of
Object o -> do
partlist <- mapM valueToPart $ HM.toList o
goHTTP =<< formDataBody partlist request
_ -> liftIO $ throwIO NotMultipartable
where
valueToPart :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => (Text,Value) -> m Part
valueToPart (t,Number n) | Right i <- (floatingOrInteger n :: Either Double Integer) = return . partBS t . TE.encodeUtf8 $ tshow i
| otherwise = return . partBS t . TE.encodeUtf8 $ tshow n
valueToPart (t,Bool True) = return $ partBS t "true"
valueToPart (t,Bool False) = return $ partBS t "false"
valueToPart (t,String s) | t `elem` inputFileFields
, T.take 1 s == "/"
= return $ fileFromPath t $ T.unpack s
| t `elem` inputFileFields
, (T.take 7 s == "http://" || T.take 8 s == "https://")
= return . fileFromUrl t (T.unpack s) =<< asks getHttpManager
| otherwise = return $ partBS t $ TE.encodeUtf8 s
valueToPart (t,v) = return $ partLBS t $ encode v
fileFromPath name path' = part { partFilename = getNameFromPath <$> partFilename part }
where part = (partFileSource name path')
fileFromUrl name urlpath mngr = partFileRequestBodyM name (getNameFromPath urlpath) $ do
fmap (RequestBodyLBS . responseBody) . flip CLIENT.httpLbs mngr =<< parseRequest urlpath
getNameFromPath s = if mlastpart == []
then s
else getNameFromPath $ drop 1 mlastpart
where mlastpart = dropWhile (/= '/') s
inputFileFields :: [Text]
inputFileFields = ["audio","photo","document","sticker","video","voice","certificate"]
data TelegramException = NotMultipartable deriving (Show, Typeable)
instance Exception TelegramException
telegramPostJSONRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m, ToJSON a, FromJSON b) =>
String -> [(ByteString,Maybe ByteString)] -> Token -> a -> m (Either TelegramBadResponse (TG.Response b))
telegramPostJSONRequest url querystring token a = do
req' <- goPR token url
let req = req' { method = "POST"
, requestBody = RequestBodyLBS $ encode a
, requestHeaders = [(hContentType,"application/json")]
}
request = flip setQueryString req querystring
goHTTP request
telegramGetRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m, FromJSON a) =>
String -> [(ByteString,Maybe ByteString)] -> Token -> m (Either TelegramBadResponse (TG.Response a))
telegramGetRequest url querystring token = do
req <- goPR token url
let request = flip setQueryString req querystring
goHTTP request
goPR :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => Token -> String -> m Request
goPR token url = parseRequest $ "https://api.telegram.org/bot" <> T.unpack token <> "/" <> url
goHTTP :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m, FromJSON b) => Request -> m (Either TelegramBadResponse (TG.Response b))
goHTTP req = do
res <- httpLbs req
let response = responseBody res
case eitherDecode' response of
Right res2 -> return $ Right res2
Left firsterr -> return $ Left $ TelegramBadResponse (T.pack firsterr) $ LB.toStrict response
| {
"content_hash": "cbd7345f7133c8ffaa58ca46a69b2477",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 164,
"avg_line_length": 49.14325842696629,
"alnum_prop": 0.7215204344098314,
"repo_name": "Vlix/telegram-bot-http",
"id": "d00c35504005ccf107298d412313f9f3150746c7",
"size": "17495",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Network/Telegram/Bot/Requests/Yesod.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Haskell",
"bytes": "33937"
}
],
"symlink_target": ""
} |
---
license: 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.
---
# iOS WebViews
Ce guide montre comment intégrer un composant WebView Cordova-activée dans une application iOS plus grande. Pour plus d'informations sur la façon dont ces composants peuvent communiquer entre eux, voir Application Plugins.
Soutien à WebViews pour iOS a commencé avec Cordova version 1.4, en utilisant un composant `Cleaver` , dont le modèle de Xcode est une implémentation de référence. Cordova 2.0 et versions ultérieures ne prennent en charge l'implémentation Cleaver sous-projet.
Ces instructions exigent au moins Cordova 3.x et Xcode 6.0, le long avec un `config.xml` fichier à partir d'un projet d'iOS nouvellement créé. Vous pouvez utiliser la procédure dans l'Interface de ligne de commande pour créer un nouveau projet, puis obtenir le `config.xml` dans le sous-répertoire de l'application nommé au sein du fichier de`platforms/ios`.
Pour suivre ces instructions, vérifiez que vous avez la dernière distribution de Cordova. Téléchargez-le sur [cordova.apache.org][1] et décompressez le paquet de son iOS.
[1]: http://cordova.apache.org
## Ajout de Cleaver au projet Xcode (sous-projet CordovaLib)
1. Quittez Xcode s'exécute.
2. Ouvrez un terminal et accédez au répertoire source pour iOS Cordova.
3. Copie le `config.xml` fichier mentionné ci-dessus dans le répertoire du projet.
4. Ouvrez Xcode et utilisez le Finder pour copier le `config.xml` fichier dans sa fenêtre de **Navigateur du projet** .
5. Choisir de **créer des groupes pour tous les dossiers ajoutés** , puis appuyez sur **Terminer**.
6. Utilisez le Finder pour copier le `CordovaLib/CordovaLib.xcodeproj` fichier dans de Xcode **Projet Navigator**
7. Sélectionnez `CordovaLib.xcodeproj` dans le **navigateur de projet**.
8. Tapez la combinaison de touches **Commande-Option-1** pour afficher **Fichier inspecteur**.
9. Choisissez **Relative au groupe** dans **Fichier inspecteur** pour le menu déroulant ci-bas pour **emplacement**.
10. Sélectionnez l' **icône du projet** dans le **Navigateur du projet**, sélectionnez la **cible**, puis sélectionnez l'onglet **Paramètres de génération** .
11. Ajouter `-force_load` et `-Obj-C` pour la valeur **d'Autres indicateurs de Linker** .
12. Cliquez sur l' **icône du projet** dans le projet de navigation, sélectionnez la **cible**, puis sélectionnez l'onglet **Générer des Phases** .
13. Développez **les binaires de lien avec les bibliothèques**.
14. Sélectionnez le **+** bouton et ajoutez le suivant **les cadres**. Éventuellement dans le **Navigateur du projet**, déplacez-les dans le groupe des **cadres** :
AssetsLibrary.framework
CoreLocation.framework
CoreGraphics.framework
MobileCoreServices.framework
15. Développez les **Dépendances de la cible**, la zone supérieure avec cette étiquette s'il y a plusieurs cases.
16. Sélectionnez le **+** bouton et ajoutez le `CordovaLib` construire le produit.
17. Développez **Les binaires de lien avec les bibliothèques**, la top box avec cette étiquette s'il y a plusieurs cases.
18. Sélectionnez le **+** bouton et ajoutez`libCordova.a`.
19. Définir la **Xcode préférences → lieux → dérivée données → avancé...** à **Unique**.
20. Sélectionnez l' **icône du projet** dans le projet de navigation, sélectionnez votre **cible**, puis sélectionnez l'onglet **Paramètres de génération** .
21. Recherche de **chemins de recherche de Header**. Pour ce paramètre, ajoutez ces trois valeurs inférieures, y compris les guillemets :
"$(TARGET_BUILD_DIR)/usr/local/lib/include"
"$(OBJROOT)/UninstalledProducts/include"
"$(BUILT_PRODUCTS_DIR)"
À partir de Cordova 2.1.0, `CordovaLib` a été mis à niveau pour utiliser le **Comptage de référence automatique (ARC)**. Vous n'avez pas besoin de passer à l' **ARC** à utiliser `CordovaLib` , mais si vous souhaitez mettre à niveau votre projet pour utiliser un **ARC**, vous devez utiliser l'Assistant de migration de Xcode de la **édition → Refactoriser → convertir en Objective-C ARC...** menu, **désélectionnez libCordova.a**, puis exécutez l'Assistant jusqu'à la fin.
## À l'aide de CDVViewController
1. Ajoutez l'en-tête suivant :
#import <Cordova/CDVViewController.h>
2. Instancier un nouveau `CDVViewController` et le conserver quelque part, par exemple, à une propriété de classe :
CDVViewController* viewController = [CDVViewController new];
3. Vous pouvez définir la `wwwFolderName` propriété, qui est par défaut à `www` :
viewController.wwwFolderName = @"myfolder";
4. Vous pouvez définir la page de démarrage le `config.xml` du fichier `<content>` tag, soit un fichier local :
< src="index.html de contenu" / >
.. .ou un site distant :
<content src="http://apache.org" />
5. Vous pouvez définir la `useSplashScreen` propriété, qui est par défaut à `NO` :
viewController.useSplashScreen = YES;
6. Définir le **cadre de l'avis**. Toujours définir cela comme la dernière propriété :
viewController.view.frame = CGRectMake(0, 0, 320, 480);
7. Ajoutez Cleaver à l'affichage :
[myView addSubview:viewController.view];
## Ajout de HTML, CSS et JavaScript actif
1. Créez un nouveau répertoire dans le cadre du projet, `www` par exemple.
2. Placer les éléments HTML, CSS et JavaScript dans ce répertoire.
3. Utilisez le Finder pour copier le répertoire dans la fenêtre **Projet Navigator** de Xcode.
4. Sélectionnez **créer dossier Références pour tous les dossiers ajoutés**.
5. Définir le cas échéant `wwwFolderName` et `startPage` Propriétés du répertoire que vous avez initialement créé, ou utiliser les valeurs par défaut (spécifiées dans la section précédente) lors de l'instanciation du`CDVViewController`.
/*
if you created a folder called 'myfolder' and
you want the file 'mypage.html' in it to be
the startPage
*/
viewController.wwwFolderName = @"myfolder";
viewController.startPage = @"mypage.html" | {
"content_hash": "5588c56d1af1d13479b955cd8a4b73b1",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 476,
"avg_line_length": 47.214765100671144,
"alnum_prop": 0.7131485429992893,
"repo_name": "rakatyal/cordova-docs",
"id": "5319d8c580c32e1e76f289b612d13de903bf26a7",
"size": "7183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/fr/edge/guide/platforms/ios/webview.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5116"
},
{
"name": "CSS",
"bytes": "10962"
},
{
"name": "HTML",
"bytes": "111295"
},
{
"name": "JavaScript",
"bytes": "62647"
}
],
"symlink_target": ""
} |
.oo-ui-indicator-alert {
background-image: url('themes/apex/images/indicators/alert.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/alert.svg');
}
.oo-ui-indicator-clear {
background-image: url('themes/apex/images/indicators/clear.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/clear.svg');
}
.oo-ui-indicator-up {
background-image: url('themes/apex/images/indicators/arrow-up.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/arrow-up.svg');
}
.oo-ui-indicator-down {
background-image: url('themes/apex/images/indicators/arrow-down.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/arrow-down.svg');
}
.oo-ui-indicator-next {
background-image: url('themes/apex/images/indicators/arrow-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/arrow-rtl.svg');
}
.oo-ui-indicator-previous {
background-image: url('themes/apex/images/indicators/arrow-ltr.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/arrow-ltr.svg');
}
.oo-ui-indicator-required {
background-image: url('themes/apex/images/indicators/required.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/required.svg');
}
.oo-ui-indicator-search {
background-image: url('themes/apex/images/indicators/search-rtl.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/indicators/search-rtl.svg');
}
.oo-ui-texture-pending {
background-image: url('themes/apex/images/textures/pending.gif');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/textures/pending.gif');
}
.oo-ui-texture-transparency {
background-image: url('themes/apex/images/textures/transparency.png');
background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/apex/images/textures/transparency.svg');
}
| {
"content_hash": "c2daa993a1c1259ef19b4c42d7b2c4e4",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 128,
"avg_line_length": 53.73809523809524,
"alnum_prop": 0.7465662383695171,
"repo_name": "jonobr1/cdnjs",
"id": "b4d5f32aba36e0272b7817565759f287294e09bb",
"size": "2479",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "ajax/libs/oojs-ui/0.25.1/oojs-ui-images-apex.rtl.css",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?php
namespace Drupal\address\Plugin\EntityReferenceSelection;
use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;
/**
* Provides en entity reference selection plugin for zones.
*
* @EntityReferenceSelection(
* id = "default:zone",
* label = @Translation("Zone selection"),
* entity_types = {"zone"},
* group = "default",
* weight = 1
* )
*/
class ZoneSelection extends DefaultSelection {
/**
* {@inheritdoc}
*/
protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
$query = parent::buildEntityQuery($match, $match_operator);
// The 'zone' zone member needs to be able to exclude the parent zone
// from selection. It does this by passing a custom skip_id parameter
// to the entity_autocomplete form element via #handler_settings.
$handler_settings = $this->configuration['handler_settings'];
if (!empty($handler_settings['skip_id'])) {
$query->condition('id', $handler_settings['skip_id'], '<>');
}
return $query;
}
}
| {
"content_hash": "9751e349e1e02cc72ea67cf1b6eb33b9",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 29.083333333333332,
"alnum_prop": 0.6762177650429799,
"repo_name": "lammensj/tfs",
"id": "65e0246c4ea4555001bd41337aec330ac6fcf4c6",
"size": "1047",
"binary": false,
"copies": "31",
"ref": "refs/heads/master",
"path": "htdocs/modules/contrib/address/src/Plugin/EntityReferenceSelection/ZoneSelection.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "685"
},
{
"name": "CSS",
"bytes": "551785"
},
{
"name": "HTML",
"bytes": "619384"
},
{
"name": "JavaScript",
"bytes": "963712"
},
{
"name": "PHP",
"bytes": "33350874"
},
{
"name": "Ruby",
"bytes": "582"
},
{
"name": "Shell",
"bytes": "18417"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<theme>
<name>panakeia</name>
<version>1.0.0</version>
<requirements>
<minimum_version>3.0.0</minimum_version>
</requirements>
<thumbnail>thumbnail.png</thumbnail>
<description>
<![CDATA[
In Greek mythology, Panacea (Greek Πανάκεια, Panakeia) was a goddess of Universal remedy. She was said to have a poultice or potion with which she healed the sick, a substance meant to cure all diseases.
]]>
</description>
<authors>
<author>
<name>Dieter Peirs</name>
<url>http://www.dieterpeirs.com</url>
</author>
</authors>
<metanavigation supported="false" />
<templates>
<template label="Default (warm)" path="core/layout/templates/default_warm.tpl">
<positions>
<position name="main" />
<position name="search">
<defaults>
<widget module="search" action="form" />
</defaults>
</position>
<position name="leftfooter">
<defaults>
<widget module="blog" action="recent_comments" />
</defaults>
</position>
<position name="rightfooter" />
<position name="social" />
</positions>
<format>
[/,/,/,/],[main,main,main,main],[/,search,search,/],[leftfooter,leftfooter,rightfooter,social]
</format>
</template>
<template label="Home (warm)" path="core/layout/templates/home_warm.tpl">
<positions>
<position name="top" />
<position name="main">
<defaults>
<widget module="blog" action="recent_articles_full" />
</defaults>
</position>
<position name="search">
<defaults>
<widget module="search" action="form" />
</defaults>
</position>
<position name="leftfooter">
<defaults>
<widget module="blog" action="recent_comments" />
</defaults>
</position>
<position name="rightfooter" />
<position name="social" />
</positions>
<format>
[/,top,top,/],[main,main,main,main],[/,search,search,/],[leftfooter,leftfooter,rightfooter,social]
</format>
</template>
<template label="Default (cold)" path="core/layout/templates/default_cold.tpl">
<positions>
<position name="main" />
<position name="search">
<defaults>
<widget module="search" action="form" />
</defaults>
</position>
<position name="leftfooter">
<defaults>
<widget module="blog" action="recent_comments" />
</defaults>
</position>
<position name="rightfooter" />
<position name="social" />
</positions>
<format>
[/,/,/,/],[main,main,main,main],[/,search,search,/],[leftfooter,leftfooter,rightfooter,social]
</format>
</template>
<template label="Home (cold)" path="core/layout/templates/home_cold.tpl">
<positions>
<position name="top" />
<position name="main">
<defaults>
<widget module="blog" action="recent_articles_full" />
</defaults>
</position>
<position name="search">
<defaults>
<widget module="search" action="form" />
</defaults>
</position>
<position name="leftfooter">
<defaults>
<widget module="blog" action="recent_comments" />
</defaults>
</position>
<position name="rightfooter" />
<position name="social" />
</positions>
<format>
[/,top,top,/],[main,main,main,main],[/,search,search,/],[leftfooter,leftfooter,rightfooter,social]
</format>
</template>
<template label="Default (neutral)" path="core/layout/templates/default_neutral.tpl">
<positions>
<position name="main" />
<position name="search">
<defaults>
<widget module="search" action="form" />
</defaults>
</position>
<position name="leftfooter">
<defaults>
<widget module="blog" action="recent_comments" />
</defaults>
</position>
<position name="rightfooter" />
<position name="social" />
</positions>
<format>
[/,/,/,/],[main,main,main,main],[/,search,search,/],[leftfooter,leftfooter,rightfooter,social]
</format>
</template>
<template label="Home (neutral)" path="core/layout/templates/home_neutral.tpl">
<positions>
<position name="top" />
<position name="main">
<defaults>
<widget module="blog" action="recent_articles_full" />
</defaults>
</position>
<position name="search">
<defaults>
<widget module="search" action="form" />
</defaults>
</position>
<position name="leftfooter">
<defaults>
<widget module="blog" action="recent_comments" />
</defaults>
</position>
<position name="rightfooter" />
<position name="social" />
</positions>
<format>
[/,top,top,/],[main,main,main,main],[/,search,search,/],[leftfooter,leftfooter,rightfooter,social]
</format>
</template>
</templates>
</theme>
| {
"content_hash": "b0cb77eaa32a4bfe14d68c5775c99285",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 206,
"avg_line_length": 28.70909090909091,
"alnum_prop": 0.6219126029132362,
"repo_name": "jonasgoderis/jonaz",
"id": "3ae871c48c34dc776a97ce273e1f78d194d44ae0",
"size": "4745",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "frontend/themes/panakeia/info.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "869281"
},
{
"name": "PHP",
"bytes": "2628636"
},
{
"name": "Perl",
"bytes": "4639"
},
{
"name": "Ruby",
"bytes": "15923"
},
{
"name": "Shell",
"bytes": "290"
}
],
"symlink_target": ""
} |
<?php namespace CodeIgniter\Filters;
use CodeIgniter\Config\Services;
require __DIR__.'/fixtures/InvalidClass.php';
require __DIR__.'/fixtures/GoogleMe.php';
/**
* @backupGlobals enabled
*/
class FiltersTest extends \CIUnitTestCase
{
protected $request;
protected $response;
public function __construct()
{
parent::__construct();
$this->request = Services::request();
$this->response = Services::response();
}
//--------------------------------------------------------------------
public function setUp()
{
}
//--------------------------------------------------------------------
public function tearDown()
{
}
//--------------------------------------------------------------------
public function testProcessMethodDetectsCLI()
{
$config = [
'methods' => [
'cli' => ['foo']
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$expected = [
'before' => ['foo'],
'after' => []
];
$this->assertEquals($expected, $filters->initialize()->getFilters());
}
//--------------------------------------------------------------------
public function testProcessMethodDetectsGetRequests()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'methods' => [
'get' => ['foo']
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$expected = [
'before' => ['foo'],
'after' => []
];
$this->assertEquals($expected, $filters->initialize()->getFilters());
}
//--------------------------------------------------------------------
public function testProcessMethodRespectsMethod()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'methods' => [
'post' => ['foo'],
'get' => ['bar']
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$expected = [
'before' => ['bar'],
'after' => []
];
$this->assertEquals($expected, $filters->initialize()->getFilters());
}
//--------------------------------------------------------------------
public function testProcessMethodProcessGlobals()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'globals' => [
'before' => [
'foo' => ['bar'],
'bar'
],
'after' => [
'baz'
]
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$expected = [
'before' => [
'foo' => ['bar'],
'bar'
],
'after' => ['baz']
];
$this->assertEquals($expected, $filters->initialize()->getFilters());
}
//--------------------------------------------------------------------
public function testProcessMethodProcessGlobalsWithExcept()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'globals' => [
'before' => [
'foo' => ['except' => ['admin/*']],
'bar'
],
'after' => [
'baz'
]
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$uri = 'admin/foo/bar';
$expected = [
'before' => [
'bar'
],
'after' => ['baz']
];
$this->assertEquals($expected, $filters->initialize($uri)->getFilters());
}
//--------------------------------------------------------------------
public function testProcessMethodProcessesFiltersBefore()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'filters' => [
'foo' => ['before' => ['admin/*'], 'after' => ['/users/*']]
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$uri = 'admin/foo/bar';
$expected = [
'before' => ['foo'],
'after' => []
];
$this->assertEquals($expected, $filters->initialize($uri)->getFilters());
}
//--------------------------------------------------------------------
public function testProcessMethodProcessesFiltersAfter()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'filters' => [
'foo' => ['before' => ['admin/*'], 'after' => ['/users/*']]
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$uri = 'users/foo/bar';
$expected = [
'before' => [],
'after' => ['foo']
];
$this->assertEquals($expected, $filters->initialize($uri)->getFilters());
}
//--------------------------------------------------------------------
public function testProcessMethodProcessesCombined()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'globals' => [
'before' => [
'foog' => ['except' => ['admin/*']],
'barg'
],
'after' => [
'bazg'
]
],
'methods' => [
'post' => ['foo'],
'get' => ['bar']
],
'filters' => [
'foof' => ['before' => ['admin/*'], 'after' => ['/users/*']]
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$uri = 'admin/foo/bar';
$expected = [
'before' => ['barg', 'bar', 'foof'],
'after' => ['bazg']
];
$this->assertEquals($expected, $filters->initialize($uri)->getFilters());
}
//--------------------------------------------------------------------
public function testRunThrowsWithInvalidAlias()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'aliases' => [],
'globals' => [
'before' => ['invalid'],
'after' => []
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$this->expectException('InvalidArgumentException');
$uri = 'admin/foo/bar';
$filters->run($uri);
}
//--------------------------------------------------------------------
public function testRunThrowsWithInvalidClassType()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'aliases' => ['invalid' => 'CodeIgniter\Filters\fixtures\InvalidClass'],
'globals' => [
'before' => ['invalid'],
'after' => []
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$this->expectException('RuntimeException');
$uri = 'admin/foo/bar';
$filters->run($uri);
}
//--------------------------------------------------------------------
public function testRunDoesBefore()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'aliases' => ['google' => 'CodeIgniter\Filters\fixtures\GoogleMe'],
'globals' => [
'before' => ['google'],
'after' => []
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$uri = 'admin/foo/bar';
$request = $filters->run($uri, 'before');
$this->assertEquals('http://google.com', $request->url);
}
//--------------------------------------------------------------------
public function testRunDoesAfter()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$config = [
'aliases' => ['google' => 'CodeIgniter\Filters\fixtures\GoogleMe'],
'globals' => [
'before' => [],
'after' => ['google']
]
];
$filters = new Filters((object)$config, $this->request, $this->response);
$uri = 'admin/foo/bar';
$response = $filters->run($uri, 'after');
$this->assertEquals('http://google.com', $response->csp);
}
//--------------------------------------------------------------------
}
| {
"content_hash": "4eaa7c8e3a2ef8536c6585599d0ef5fa",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 75,
"avg_line_length": 21.36890243902439,
"alnum_prop": 0.4718219432158653,
"repo_name": "JakeAi/Dashboard",
"id": "3efc9838c662a9457a0b1e380d05d7ffed5396ca",
"size": "7009",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "tests/system/Filters/FiltersTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "144082"
},
{
"name": "HTML",
"bytes": "36040"
},
{
"name": "JavaScript",
"bytes": "438041"
},
{
"name": "Makefile",
"bytes": "4808"
},
{
"name": "PHP",
"bytes": "2781285"
},
{
"name": "Python",
"bytes": "11560"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.hbase.zookeeper;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.testclassification.ZKTests;
import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category({ ZKTests.class, SmallTests.class })
public class TestInstancePending {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestInstancePending.class);
@Test
public void test() throws Exception {
final InstancePending<String> pending = new InstancePending<>();
final AtomicReference<String> getResultRef = new AtomicReference<>();
new Thread() {
@Override
public void run() {
getResultRef.set(pending.get());
}
}.start();
Thread.sleep(100);
Assert.assertNull(getResultRef.get());
pending.prepare("abc");
Thread.sleep(100);
Assert.assertEquals("abc", getResultRef.get());
}
}
| {
"content_hash": "14def6d407c3c1f69261f8db2cf8ef30",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 73,
"avg_line_length": 28.307692307692307,
"alnum_prop": 0.7382246376811594,
"repo_name": "francisliu/hbase",
"id": "caa0beb116bd4d01ebdc364e508cd91057fbade9",
"size": "1910",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestInstancePending.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "25343"
},
{
"name": "C",
"bytes": "28534"
},
{
"name": "C++",
"bytes": "56085"
},
{
"name": "CMake",
"bytes": "13186"
},
{
"name": "CSS",
"bytes": "37063"
},
{
"name": "Dockerfile",
"bytes": "15673"
},
{
"name": "Groovy",
"bytes": "42572"
},
{
"name": "HTML",
"bytes": "17275"
},
{
"name": "Java",
"bytes": "36671577"
},
{
"name": "JavaScript",
"bytes": "9342"
},
{
"name": "Makefile",
"bytes": "1359"
},
{
"name": "PHP",
"bytes": "8385"
},
{
"name": "Perl",
"bytes": "383739"
},
{
"name": "Python",
"bytes": "127994"
},
{
"name": "Ruby",
"bytes": "696921"
},
{
"name": "Shell",
"bytes": "305875"
},
{
"name": "Thrift",
"bytes": "55223"
},
{
"name": "XSLT",
"bytes": "6764"
}
],
"symlink_target": ""
} |
<!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_91) on Tue Dec 29 12:43:45 AEDT 2015 -->
<title>McElieceCCA2Parameters (Bouncy Castle Library 1.54 API Specification)</title>
<meta name="date" content="2015-12-29">
<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="McElieceCCA2Parameters (Bouncy Castle Library 1.54 API Specification)";
}
//-->
</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 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 class="aboutLanguage"><em><b>Bouncy Castle Cryptography Library 1.54</b></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2KeyParameters.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Primitives.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html" target="_top">Frames</a></li>
<li><a href="McElieceCCA2Parameters.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><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </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">org.bouncycastle.pqc.crypto.mceliece</div>
<h2 title="Class McElieceCCA2Parameters" class="title">Class McElieceCCA2Parameters</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html" title="class in org.bouncycastle.pqc.crypto.mceliece">org.bouncycastle.pqc.crypto.mceliece.McElieceParameters</a></li>
<li>
<ul class="inheritance">
<li>org.bouncycastle.pqc.crypto.mceliece.McElieceCCA2Parameters</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../org/bouncycastle/crypto/CipherParameters.html" title="interface in org.bouncycastle.crypto">CipherParameters</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">McElieceCCA2Parameters</span>
extends <a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html" title="class in org.bouncycastle.pqc.crypto.mceliece">McElieceParameters</a></pre>
<div class="block">This class provides a specification for the parameters of the CCA2-secure
variants of the McEliece PKCS that are used with
<a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceFujisakiCipher.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><code>McElieceFujisakiCipher</code></a>, <a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceKobaraImaiCipher.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><code>McElieceKobaraImaiCipher</code></a>, and
<a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McEliecePointchevalCipher.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><code>McEliecePointchevalCipher</code></a>.</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceFujisakiCipher.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><code>McElieceFujisakiCipher</code></a>,
<a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceKobaraImaiCipher.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><code>McElieceKobaraImaiCipher</code></a>,
<a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McEliecePointchevalCipher.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><code>McEliecePointchevalCipher</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/bouncycastle/crypto/Digest.html" title="interface in org.bouncycastle.crypto">Digest</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html#digest">digest</a></strong></code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="fields_inherited_from_class_org.bouncycastle.pqc.crypto.mceliece.McElieceParameters">
<!-- -->
</a>
<h3>Fields inherited from class org.bouncycastle.pqc.crypto.mceliece.<a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html" title="class in org.bouncycastle.pqc.crypto.mceliece">McElieceParameters</a></h3>
<code><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html#DEFAULT_M">DEFAULT_M</a>, <a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html#DEFAULT_T">DEFAULT_T</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html#McElieceCCA2Parameters()">McElieceCCA2Parameters</a></strong>()</code>
<div class="block">Construct the default parameters.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html#McElieceCCA2Parameters(org.bouncycastle.crypto.Digest)">McElieceCCA2Parameters</a></strong>(<a href="../../../../../org/bouncycastle/crypto/Digest.html" title="interface in org.bouncycastle.crypto">Digest</a> digest)</code> </td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html#McElieceCCA2Parameters(int,%20int)">McElieceCCA2Parameters</a></strong>(int m,
int t)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</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>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/bouncycastle/crypto/Digest.html" title="interface in org.bouncycastle.crypto">Digest</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html#getDigest()">getDigest</a></strong>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.bouncycastle.pqc.crypto.mceliece.McElieceParameters">
<!-- -->
</a>
<h3>Methods inherited from class org.bouncycastle.pqc.crypto.mceliece.<a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html" title="class in org.bouncycastle.pqc.crypto.mceliece">McElieceParameters</a></h3>
<code><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html#getFieldPoly()">getFieldPoly</a>, <a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html#getM()">getM</a>, <a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html#getN()">getN</a>, <a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceParameters.html#getT()">getT</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="digest">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>digest</h4>
<pre>public <a href="../../../../../org/bouncycastle/crypto/Digest.html" title="interface in org.bouncycastle.crypto">Digest</a> digest</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="McElieceCCA2Parameters()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>McElieceCCA2Parameters</h4>
<pre>public McElieceCCA2Parameters()</pre>
<div class="block">Construct the default parameters.
The default message digest is SHA256.</div>
</li>
</ul>
<a name="McElieceCCA2Parameters(int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>McElieceCCA2Parameters</h4>
<pre>public McElieceCCA2Parameters(int m,
int t)</pre>
</li>
</ul>
<a name="McElieceCCA2Parameters(org.bouncycastle.crypto.Digest)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>McElieceCCA2Parameters</h4>
<pre>public McElieceCCA2Parameters(<a href="../../../../../org/bouncycastle/crypto/Digest.html" title="interface in org.bouncycastle.crypto">Digest</a> digest)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getDigest()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getDigest</h4>
<pre>public <a href="../../../../../org/bouncycastle/crypto/Digest.html" title="interface in org.bouncycastle.crypto">Digest</a> getDigest()</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= 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 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 class="aboutLanguage"><em><b>Bouncy Castle Cryptography Library 1.54</b></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2KeyParameters.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Primitives.html" title="class in org.bouncycastle.pqc.crypto.mceliece"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html" target="_top">Frames</a></li>
<li><a href="McElieceCCA2Parameters.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><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "ccba485faff1944a70aa21a6fb94c6dd",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 444,
"avg_line_length": 43.45170454545455,
"alnum_prop": 0.6631578947368421,
"repo_name": "GaloisInc/hacrypto",
"id": "0af9e85879e22b4543130e3bdea655ff9e390cf7",
"size": "15295",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Java/BouncyCastle/BouncyCastle-1.54/bcprov-jdk15on-154/javadoc/org/bouncycastle/pqc/crypto/mceliece/McElieceCCA2Parameters.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "AGS Script",
"bytes": "62991"
},
{
"name": "Ada",
"bytes": "443"
},
{
"name": "AppleScript",
"bytes": "4518"
},
{
"name": "Assembly",
"bytes": "25398957"
},
{
"name": "Awk",
"bytes": "36188"
},
{
"name": "Batchfile",
"bytes": "530568"
},
{
"name": "C",
"bytes": "344517599"
},
{
"name": "C#",
"bytes": "7553169"
},
{
"name": "C++",
"bytes": "36635617"
},
{
"name": "CMake",
"bytes": "213895"
},
{
"name": "CSS",
"bytes": "139462"
},
{
"name": "Coq",
"bytes": "320964"
},
{
"name": "Cuda",
"bytes": "103316"
},
{
"name": "DIGITAL Command Language",
"bytes": "1545539"
},
{
"name": "DTrace",
"bytes": "33228"
},
{
"name": "Emacs Lisp",
"bytes": "22827"
},
{
"name": "GDB",
"bytes": "93449"
},
{
"name": "Gnuplot",
"bytes": "7195"
},
{
"name": "Go",
"bytes": "393057"
},
{
"name": "HTML",
"bytes": "41466430"
},
{
"name": "Hack",
"bytes": "22842"
},
{
"name": "Haskell",
"bytes": "64053"
},
{
"name": "IDL",
"bytes": "3205"
},
{
"name": "Java",
"bytes": "49060925"
},
{
"name": "JavaScript",
"bytes": "3476841"
},
{
"name": "Jolie",
"bytes": "412"
},
{
"name": "Lex",
"bytes": "26290"
},
{
"name": "Logos",
"bytes": "108920"
},
{
"name": "Lua",
"bytes": "427"
},
{
"name": "M4",
"bytes": "2508986"
},
{
"name": "Makefile",
"bytes": "29393197"
},
{
"name": "Mathematica",
"bytes": "48978"
},
{
"name": "Mercury",
"bytes": "2053"
},
{
"name": "Module Management System",
"bytes": "1313"
},
{
"name": "NSIS",
"bytes": "19051"
},
{
"name": "OCaml",
"bytes": "981255"
},
{
"name": "Objective-C",
"bytes": "4099236"
},
{
"name": "Objective-C++",
"bytes": "243505"
},
{
"name": "PHP",
"bytes": "22677635"
},
{
"name": "Pascal",
"bytes": "99565"
},
{
"name": "Perl",
"bytes": "35079773"
},
{
"name": "Prolog",
"bytes": "350124"
},
{
"name": "Python",
"bytes": "1242241"
},
{
"name": "Rebol",
"bytes": "106436"
},
{
"name": "Roff",
"bytes": "16457446"
},
{
"name": "Ruby",
"bytes": "49694"
},
{
"name": "Scheme",
"bytes": "138999"
},
{
"name": "Shell",
"bytes": "10192290"
},
{
"name": "Smalltalk",
"bytes": "22630"
},
{
"name": "Smarty",
"bytes": "51246"
},
{
"name": "SourcePawn",
"bytes": "542790"
},
{
"name": "SystemVerilog",
"bytes": "95379"
},
{
"name": "Tcl",
"bytes": "35696"
},
{
"name": "TeX",
"bytes": "2351627"
},
{
"name": "Verilog",
"bytes": "91541"
},
{
"name": "Visual Basic",
"bytes": "88541"
},
{
"name": "XS",
"bytes": "38300"
},
{
"name": "Yacc",
"bytes": "132970"
},
{
"name": "eC",
"bytes": "33673"
},
{
"name": "q",
"bytes": "145272"
},
{
"name": "sed",
"bytes": "1196"
}
],
"symlink_target": ""
} |
/*
* This class is deprecated. not sure if it functions well.
* */
package itri.u9lab.towolf.ratiofixer;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout.LayoutParams;
public class RatioActivity extends Activity {
private RatioRelativeLayout mRatioLayout;
private RatioFixer mRatioFixer;
public int mVWidth = 0, mVHeight = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.getActionBar().hide();
onInitialize();
if (mVWidth != 0 && mVHeight != 0)
mRatioLayout = new RatioRelativeLayout(this, mVWidth, mVHeight);
else
mRatioLayout = new RatioRelativeLayout(this);
mRatioFixer = mRatioLayout.getRatioFixer();
mRatioLayout.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
onLayoutCreated();
}
});
mRatioLayout.setBackgroundColor(Color.WHITE);
LayoutParams layoutParams = new LayoutParams(
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.MATCH_PARENT);
layoutParams.gravity = Gravity.CENTER;
setContentView(mRatioLayout, layoutParams);
// getWindow().getDecorView().findViewById(android.R.id.content)
// .setBackgroundColor(Color.RED);
}
/*
* Initialize function, executes before RatioFixer initialize. Set virtual
* size or default virtual size here
*/
public void onInitialize() {
}
/*
* This function will invoke after the layout is drawn
*/
public void onLayoutCreated() {
}
public RatioRelativeLayout getMainLayout() {
return mRatioLayout;
}
/**
* Add view with width, height and (x,y) position
*
* @param v
* @param width
* @param height
* @param x
* @param y
*/
public void addView(View v, int width, int height, int x, int y) {
mRatioLayout
.addView(v, mRatioFixer.getLayoutParam(width, height, x, y));
}
/**
* Get real pixel size by passing in virtual size
*
* @param v
* @return
*/
public int getRealValue(int v) {
return mRatioFixer.getRealValue(v);
}
public RatioFixer getRatioFixer() {
return mRatioFixer;
}
public void setVirtualSize(int width, int height) {
// mRatioFixer.setVirtualSize(width, height);
mVWidth = width;
mVHeight = height;
}
}
| {
"content_hash": "57941be29e5c398d4d86adac0de722ac",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 75,
"avg_line_length": 22.155963302752294,
"alnum_prop": 0.7159420289855073,
"repo_name": "e98877331/RatioFixer",
"id": "244b4f59143e0b2a47c34525c946cbf60da1adf6",
"size": "3196",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/itri/u9lab/towolf/ratiofixer/RatioActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "14228"
}
],
"symlink_target": ""
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S7.9_A6.2_T8;
* @section: 7.9, 12.6.3;
* @assertion: Check For Statement for automatic semicolon insertion.
* If automatic insertion semicolon would become one of the two semicolons in the header of a For Statement.
* Use one semicolon;
* @description: For header is (false \n semicolon false \n);
* @negative
*/
//CHECK#1
for(false
;false
) {
break;
}
| {
"content_hash": "1e03ac4013e341b1b27c7caede1b8b36",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 108,
"avg_line_length": 28.05263157894737,
"alnum_prop": 0.6735459662288931,
"repo_name": "Diullei/Storm",
"id": "003005428c2eca3ad991d59797b7bf86135627f4",
"size": "533",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Storm.Test/SputnikV1/07_Lexical_Conventions/7.9_Automatic_Semicolon_Insertion/S7.9_A6.2_T8.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1269235"
},
{
"name": "C++",
"bytes": "399"
},
{
"name": "JavaScript",
"bytes": "4348364"
},
{
"name": "Visual Basic",
"bytes": "280"
}
],
"symlink_target": ""
} |
package com.actinarium.kinetic.ui;
import android.content.Context;
import android.text.Layout;
import android.util.AttributeSet;
import com.actinarium.aligned.TextView;
/**
* Blockquote limits TextView's width to the longest line
*
* @author Paul Danyliuk
*/
public class BlockquoteTextView extends TextView {
public BlockquoteTextView(Context context) {
super(context);
}
public BlockquoteTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BlockquoteTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// Now fix width
float max = 0;
Layout layout = getLayout();
for (int i = 0, size = layout.getLineCount(); i < size; i++) {
final float lineWidth = layout.getLineMax(i);
if (lineWidth > max) {
max = lineWidth;
}
}
final int height = getMeasuredHeight();
final int width = (int) Math.ceil(max) + getCompoundPaddingLeft() + getCompoundPaddingRight();
setMeasuredDimension(width, height);
}
}
| {
"content_hash": "1eca5bbc7181c7b3bbff34b859fa78d2",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 102,
"avg_line_length": 27.851063829787233,
"alnum_prop": 0.6569900687547746,
"repo_name": "Actinarium/Kinetic",
"id": "de48a360735c771c018d00717a1a12f2f31e1f22",
"size": "1906",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/actinarium/kinetic/ui/BlockquoteTextView.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "79217"
}
],
"symlink_target": ""
} |
class UdfTimeHelpers
UDFS = [
{
type: :function,
name: :now,
description: "Returns the current time as a timestamp in UTC",
params: nil,
return_type: "timestamp",
body: %~
from datetime import datetime
datetime.utcnow()
~,
tests: [
{query: "select ?()", expect: '2015-03-30 21:32:15.553489+00', example: true, skip: true},
]
}, {
type: :function,
name: :posix_timestamp,
description: "Returns the number of seconds from 1970-01-01 for this timestamp",
params: "ts timestamp",
return_type: "real",
body: %~
from datetime import datetime
if not ts:
return None
return (ts - datetime(1970, 1, 1)).total_seconds()
~,
tests: [
{query: "select ?('2015-03-30 21:32:15'::timestamp)", expect: '1427751521.107629', example: true, skip: true},
]
},
{
type: :function,
name: :is_last_day_of_month,
description: "Detects if a given date is on the last day of the month",
params: "ts timestamp",
return_type: "boolean",
body: %~
from datetime import datetime
import calendar
if ts is None:
return False
return calendar.monthrange(ts.year,ts.month)[1] == ts.day
~,
tests: [
{query: "select ?('2015-10-01')", expect: 'f', example: true},
{query: "select ?('2015-10-31')", expect: 't', example: true}
]
},
{
type: :function,
name: :days_left_in_month,
description: "For a given date, calculates how many days are left in the month",
params: "ts timestamp",
return_type: "int",
body: %~
from datetime import datetime
import calendar
if ts is None:
return None
return calendar.monthrange(ts.year,ts.month)[1] - ts.day
~,
tests: [
{query: "select ?('2015-11-01')", expect: 29, example: true},
{query: "select ?('2015-12-28')", expect: 3, example: true},
{query: "select ?(NULL)", expect: nil, example: true}
]
}
]
end
| {
"content_hash": "0a50db66767c8ecef7e4b61c435dcff0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 137,
"avg_line_length": 38.214285714285715,
"alnum_prop": 0.43626168224299067,
"repo_name": "michael-erasmus/redshift-udfs",
"id": "14bd6585bd4a85e27bac63deb65a82072f45b4a4",
"size": "2675",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/udf_time_helpers.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PLpgSQL",
"bytes": "22252"
},
{
"name": "Ruby",
"bytes": "51576"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "8da651276a1497898bf4aef71f6cc5a0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 23,
"avg_line_length": 9.076923076923077,
"alnum_prop": 0.6779661016949152,
"repo_name": "mdoering/backbone",
"id": "b44d1f1a44cc52405dca0fd6cd2d6930e5018d25",
"size": "178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Solanales/Solanaceae/Cestrum/Cestrum tenuiflorum/Cestrum tenuiflorum tenuiflorum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.chargebee.models;
import com.chargebee.*;
import com.chargebee.internal.*;
import com.chargebee.filters.*;
import com.chargebee.filters.enums.SortOrder;
import com.chargebee.internal.HttpUtil.Method;
import com.chargebee.models.enums.*;
import org.json.*;
import java.io.*;
import java.sql.Timestamp;
import java.util.*;
public class Feature extends Resource<Feature> {
public enum Status {
ACTIVE,
ARCHIVED,
DRAFT,
_UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a
java-client version incompatibility. We suggest you to upgrade to the latest version */
}
public enum Type {
SWITCH,
CUSTOM,
QUANTITY,
RANGE,
_UNKNOWN; /*Indicates unexpected value for this enum. You can get this when there is a
java-client version incompatibility. We suggest you to upgrade to the latest version */
}
public static class Level extends Resource<Level> {
public Level(JSONObject jsonObj) {
super(jsonObj);
}
public String name() {
return optString("name");
}
public String value() {
return reqString("value");
}
public Integer level() {
return reqInteger("level");
}
public Boolean isUnlimited() {
return reqBoolean("is_unlimited");
}
}
//Constructors
//============
public Feature(String jsonStr) {
super(jsonStr);
}
public Feature(JSONObject jsonObj) {
super(jsonObj);
}
// Fields
//=======
public String id() {
return reqString("id");
}
public String name() {
return reqString("name");
}
public String description() {
return optString("description");
}
public Status status() {
return optEnum("status", Status.class);
}
public Type type() {
return optEnum("type", Type.class);
}
public String unit() {
return optString("unit");
}
public Long resourceVersion() {
return optLong("resource_version");
}
public Timestamp updatedAt() {
return optTimestamp("updated_at");
}
public Timestamp createdAt() {
return reqTimestamp("created_at");
}
public List<Feature.Level> levels() {
return optList("levels", Feature.Level.class);
}
// Operations
//===========
public static FeatureListRequest list() {
String uri = uri("features");
return new FeatureListRequest(uri);
}
public static CreateRequest create() {
String uri = uri("features");
return new CreateRequest(Method.POST, uri);
}
public static UpdateRequest update(String id) {
String uri = uri("features", nullCheck(id));
return new UpdateRequest(Method.POST, uri);
}
public static Request retrieve(String id) {
String uri = uri("features", nullCheck(id));
return new Request(Method.GET, uri);
}
public static Request delete(String id) {
String uri = uri("features", nullCheck(id), "delete");
return new Request(Method.POST, uri);
}
public static Request activate(String id) {
String uri = uri("features", nullCheck(id), "activate_command");
return new Request(Method.POST, uri);
}
public static Request archive(String id) {
String uri = uri("features", nullCheck(id), "archive_command");
return new Request(Method.POST, uri);
}
public static Request reactivate(String id) {
String uri = uri("features", nullCheck(id), "reactivate_command");
return new Request(Method.POST, uri);
}
// Operation Request Classes
//==========================
public static class FeatureListRequest extends ListRequest<FeatureListRequest> {
private FeatureListRequest(String uri) {
super(uri);
}
public StringFilter<FeatureListRequest> name() {
return new StringFilter<FeatureListRequest>("name",this).supportsMultiOperators(true);
}
public StringFilter<FeatureListRequest> id() {
return new StringFilter<FeatureListRequest>("id",this).supportsMultiOperators(true);
}
public EnumFilter<Feature.Status, FeatureListRequest> status() {
return new EnumFilter<Feature.Status, FeatureListRequest>("status",this);
}
public EnumFilter<Feature.Type, FeatureListRequest> type() {
return new EnumFilter<Feature.Type, FeatureListRequest>("type",this);
}
@Override
public Params params() {
return params;
}
}
public static class CreateRequest extends Request<CreateRequest> {
private CreateRequest(Method httpMeth, String uri) {
super(httpMeth, uri);
}
public CreateRequest id(String id) {
params.addOpt("id", id);
return this;
}
public CreateRequest name(String name) {
params.add("name", name);
return this;
}
public CreateRequest description(String description) {
params.addOpt("description", description);
return this;
}
public CreateRequest type(Feature.Type type) {
params.addOpt("type", type);
return this;
}
public CreateRequest status(Status status) {
params.addOpt("status", status);
return this;
}
public CreateRequest unit(String unit) {
params.addOpt("unit", unit);
return this;
}
public CreateRequest levelName(int index, String levelName) {
params.addOpt("levels[name][" + index + "]", levelName);
return this;
}
public CreateRequest levelValue(int index, String levelValue) {
params.addOpt("levels[value][" + index + "]", levelValue);
return this;
}
public CreateRequest levelIsUnlimited(int index, Boolean levelIsUnlimited) {
params.addOpt("levels[is_unlimited][" + index + "]", levelIsUnlimited);
return this;
}
public CreateRequest levelLevel(int index, Integer levelLevel) {
params.addOpt("levels[level][" + index + "]", levelLevel);
return this;
}
@Override
public Params params() {
return params;
}
}
public static class UpdateRequest extends Request<UpdateRequest> {
private UpdateRequest(Method httpMeth, String uri) {
super(httpMeth, uri);
}
public UpdateRequest name(String name) {
params.addOpt("name", name);
return this;
}
public UpdateRequest description(String description) {
params.addOpt("description", description);
return this;
}
public UpdateRequest status(Status status) {
params.addOpt("status", status);
return this;
}
public UpdateRequest unit(String unit) {
params.addOpt("unit", unit);
return this;
}
public UpdateRequest levelName(int index, String levelName) {
params.addOpt("levels[name][" + index + "]", levelName);
return this;
}
public UpdateRequest levelValue(int index, String levelValue) {
params.addOpt("levels[value][" + index + "]", levelValue);
return this;
}
public UpdateRequest levelIsUnlimited(int index, Boolean levelIsUnlimited) {
params.addOpt("levels[is_unlimited][" + index + "]", levelIsUnlimited);
return this;
}
public UpdateRequest levelLevel(int index, Integer levelLevel) {
params.addOpt("levels[level][" + index + "]", levelLevel);
return this;
}
@Override
public Params params() {
return params;
}
}
}
| {
"content_hash": "ec915d1e2df59deda0b3f2644c997c8a",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 106,
"avg_line_length": 26.737704918032787,
"alnum_prop": 0.5802575107296137,
"repo_name": "chargebee/chargebee-java",
"id": "f04d22a2ec535946334b6630d289332d28f9bfaf",
"size": "8155",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/chargebee/models/Feature.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1691006"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Material SAMPLE DARK colors -->
<!--
<color name="material_drawer_primary">#4BAE4F</color>
<color name="material_drawer_primary_dark">#378D3B</color>
<color name="material_drawer_primary_light">#C8E5C9</color>
<color name="material_drawer_accent">#FE5621</color>
-->
<color name="material_drawer_background">#303030</color>
<!-- Material SAMPLE DARK text / items colors -->
<color name="material_drawer_icons">#000</color>
<color name="material_drawer_primary_text">#FFF</color>
<color name="material_drawer_secondary_text">#DEDEDE</color>
<color name="material_drawer_hint_text">#ABABAB</color>
<color name="material_drawer_contrast_text">#000</color>
<color name="material_drawer_divider">#555555</color>
<!-- Material SAMPLE DARK drawer colors -->
<color name="material_drawer_selected">#262626</color>
<!-- AboutLibraries colors -->
<color name="theme_window_background">#303030</color>
<color name="about_libraries_card">#666666</color>
<color name="about_libraries_title_openSource">#ffffffff</color>
<color name="about_libraries_text_openSource">#DEDEDE</color>
<color name="about_libraries_dividerDark_openSource">#303030</color>
<color name="about_libraries_dividerLight_openSource">#303030</color>
</resources> | {
"content_hash": "911f000473faa5e48f4171b5826f72b0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 45.833333333333336,
"alnum_prop": 0.6887272727272727,
"repo_name": "furballwear/MaterialDrawer",
"id": "98dea2c3b94f68f51f6c930ed8e97be428b3bf02",
"size": "1375",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/values/colors.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "81965"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>waterproof: 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.5.2 / waterproof - 1.1.2</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
waterproof
<small>
1.1.2
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-11-15 13:24:57 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-15 13:24:57 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.5.2 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.04.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.04.2 Official 4.04.2 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
synopsis: "Waterproof library"
description: """
The Waterproof library provides tactics, notations, and mathematical theories geared towards use in Mathematics educational environments. It aims to provide syntax such that proof scripts mimic handwritten mathematical proofs.
"""
homepage: "https://github.com/impermeable/coq-waterproof"
dev-repo: "git+https://github.com/impermeable/coq-waterproof.git"
bug-reports: "https://github.com/impermeable/coq-waterproof/issues"
maintainer: "j.w.portegies@tue.nl"
authors: [
"Jelle Wemmenhove"
"Cosmin Manea"
"Lulof Pirée"
"Adrian Vrămuleţ"
"Tudor Voicu"
"Jim Portegies"
]
license: "LGPL 3.0"
depends: [
"coq" {>= "8.13" & < "8.16"}
]
build: [
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
url {
src: "https://github.com/impermeable/coq-waterproof/archive/1.1.2.tar.gz"
checksum: "sha256=aac7996c3b40804e6c4db78ef6c8d2ceed2783774a859af8452cc680d1dc79bc"
}
tags: [
"keyword:mathematics education"
"category:Mathematics/Education"
"date:2022-02-03"
"logpath:Waterproof"
]
</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-waterproof.1.1.2 coq.8.5.2</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.2).
The following dependencies couldn't be met:
- coq-waterproof -> coq >= 8.13 -> ocaml >= 4.05.0
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-waterproof.1.1.2</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>
| {
"content_hash": "9f50dce18b24fbfb8a6f6ea416679ca2",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 228,
"avg_line_length": 39.75706214689266,
"alnum_prop": 0.5469660366633509,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "4718e487f003ff653b4329259db1d3a515a3feb6",
"size": "7065",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.04.2-2.0.5/released/8.5.2/waterproof/1.1.2.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
layout: default
title: Quartz.NET Quick Start Guide
---
# Welcome to the Docs
Welcome to the Quick Start Guide for Quartz.NET. As you read this guide, expect to see details of:
* Downloading Quartz.NET
* Installing Quartz.NET
* Configuring Quartz to your own particular needs
* Starting a sample application
## Download and Install
You can either download the zip file or use the NuGet package.
NuGet package contains only the binaries needed to run Quartz.NET, zip file comes with source code, samples and Quartz.NET server sample application.
## NuGet Package
Couldn't get any simpler than this. Just fire up Visual Studio (with NuGet installed) and add reference to package **Quartz** from package manager extension:
* Right-click on your project's References and choose **Manage NuGet Packages...**
* Choose **Online** category from the left
* Enter **Quartz** to the top right search and hit enter
* Choose **Quartz.NET** from search results and hit install
* Done!
or from NuGet Command-Line:
Install-Package Quartz
If you want to add JSON Serialization, just add the [Quartz.Serialization.Json](packages/json-serialization) package the same way.
### Zip Archive
**Short version**: Once you've downloaded Quartz.NET, unzip it somewhere, grab the `Quartz.dll` from bin directory and start to use it.
Quartz core library does not have any hard binary dependencies. You can opt-in to more dependencies when you choose to use JSON serialization package, which requires JSON.NET.
You need to have at least `Quartz.dll` beside your app binaries to successfully run Quartz.NET. So just add it as a references to your Visual Studio project that uses them.
You can find these dlls from extracted archive from path **bin\your-target-framework-version\release\Quartz**.
## Configuration
This is the big bit! Quartz.NET is a very configurable library. There are two main ways (which are not mutually exclusive) to supply Quartz.NET configuration information:
### Fluent Scheduler Builder API
You can configure scheduler using C# fluent API, or via providing `NameValueCollection` parameter to scheduler factory
which contains configuration keys and values.
```csharp
// you can have base properties
var properties = new NameValueCollection();
// and override values via builder
IScheduler scheduler = await SchedulerBuilder.Create(properties)
// default max concurrency is 10
.UseDefaultThreadPool(x => x.MaxConcurrency = 5)
// this is the default
// .WithMisfireThreshold(TimeSpan.FromSeconds(60))
.UsePersistentStore(x =>
{
// force job data map values to be considered as strings
// prevents nasty surprises if object is accidentally serialized and then
// serialization format breaks, defaults to false
x.UseProperties = true;
x.UseClustering();
// there are other SQL providers supported too
x.UseSqlServer("my connection string");
// this requires Quartz.Serialization.Json NuGet package
x.UseJsonSerializer();
})
// job initialization plugin handles our xml reading, without it defaults are used
// requires Quartz.Plugins NuGet package
.UseXmlSchedulingConfiguration(x =>
{
x.Files = new[] { "~/quartz_jobs.xml" };
// this is the default
x.FailOnFileNotFound = true;
// this is not the default
x.FailOnSchedulingError = true;
})
.BuildScheduler();
await scheduler.Start();
```
### Configuration files
Following files are searched for known configuration properties:
* `YourApplication.exe.config` configuration file using quartz-element (full .NET framework only)
* `appsettings.json` (.NET Core/NET5 onwards)
* `quartz.config` file in your application's root directory (works both with .NET Core and full .NET Framework)
Full documentation of available properties is available in the [Quartz Configuration Reference](configuration/reference).
To get up and running quickly, a basic quartz.config looks something like this:
quartz.scheduler.instanceName = MyScheduler
quartz.jobStore.type = Quartz.Simpl.RAMJobStore, Quartz
quartz.threadPool.maxConcurrency = 3
Remember to set the **Copy to Output Directory** on Visual Studio's file property pages to have value **Copy always**. Otherwise the config will not be seen if it's not in build directory.
The scheduler created by this configuration has the following characteristics:
* `quartz.scheduler.instanceName` - This scheduler's name will be "MyScheduler".
* `quartz.threadPool.maxConcurrency` - Maximum of 3 jobs can be run simultaneously (default is 10).
* `quartz.jobStore.type` - All of Quartz's data, such as details of jobs and triggers, is held in memory (rather than in a database).
* Even if you have a database and want to use it with Quartz, I suggest you get Quartz working with the RamJobStore before you open up a whole new dimension by working with a database.
::: tip
Actually you don't need to define these properties if you don't want to, Quartz.NET comes with sane defaults
:::
## Starting a Sample Application
Now you've downloaded and installed Quartz, it's time to get a sample application up and running. The following code obtains an instance of the scheduler, starts it, then shuts it down:
**Program.cs**
```csharp
using System;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
namespace QuartzSampleApp
{
public class Program
{
private static async Task Main(string[] args)
{
// Grab the Scheduler instance from the Factory
StdSchedulerFactory factory = new StdSchedulerFactory();
IScheduler scheduler = await factory.GetScheduler();
// and start it off
await scheduler.Start();
// some sleep to show what's happening
await Task.Delay(TimeSpan.FromSeconds(10));
// and last shut down the scheduler when you are ready to close your program
await scheduler.Shutdown();
}
}
}
```
As of Quartz 3.0 your application will terminate when there's no code left to execute after `scheduler.Shutdown()`, because there won't be any active threads. You should manually block exiting of application if you want scheduler to keep running also after the Task.Delay and Shutdown has been processed.
Now running the program will not show anything. When 10 seconds have passed the program will just terminate. Lets add some logging to console.
## Adding logging
[LibLog](https://github.com/damianh/LibLog/wiki) can be configured to use different logging frameworks under the hood; namely Log4Net, NLog and Serilog.
When LibLog does not detect any other logging framework to be present, it will be silent. We can configure a custom logger provider that just logs to console show the output
if you don't have logging framework setup ready yet.
```csharp
LogProvider.SetCurrentLogProvider(new ConsoleLogProvider());
private class ConsoleLogProvider : ILogProvider
{
public Logger GetLogger(string name)
{
return (level, func, exception, parameters) =>
{
if (level >= LogLevel.Info && func != null)
{
Console.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] [" + level + "] " + func(), parameters);
}
return true;
};
}
public IDisposable OpenNestedContext(string message)
{
throw new NotImplementedException();
}
public IDisposable OpenMappedContext(string key, object value, bool destructure = false)
{
throw new NotImplementedException();
}
}
```
## Trying out the application
Now we should get a lot more information when we start the application.
```
[12.51.10] [Info] Quartz.NET properties loaded from configuration file 'C:\QuartzSampleApp\quartz.config'
[12.51.10] [Info] Initialized Scheduler Signaller of type: Quartz.Core.SchedulerSignalerImpl
[12.51.10] [Info] Quartz Scheduler created
[12.51.10] [Info] RAMJobStore initialized.
[12.51.10] [Info] Scheduler meta-data: Quartz Scheduler (v3.0.0.0) 'MyScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'Quartz.Core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'Quartz.Simpl.DefaultThreadPool' - with 3 threads.
Using job-store 'Quartz.Simpl.RAMJobStore' - which does not support persistence. and is not clustered.
[12.51.10] [Info] Quartz scheduler 'MyScheduler' initialized
[12.51.10] [Info] Quartz scheduler version: 3.0.0.0
[12.51.10] [Info] Scheduler MyScheduler_$_NON_CLUSTERED started.
```
We need a simple test job to test the functionality, lets create HelloJob that outputs greetings to console.
```csharp
public class HelloJob : IJob
{
public async Task Execute(IJobExecutionContext context)
{
await Console.Out.WriteLineAsync("Greetings from HelloJob!");
}
}
```
To do something interesting, you need code just after Start() method, before the Task.Delay.
```csharp
// define the job and tie it to our HelloJob class
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("job1", "group1")
.Build();
// Trigger the job to run now, and then repeat every 10 seconds
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.StartNow()
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(10)
.RepeatForever())
.Build();
// Tell Quartz to schedule the job using our trigger
await scheduler.ScheduleJob(job, trigger);
// You could also schedule multiple triggers for the same job with
// await scheduler.ScheduleJob(job, new List<ITrigger>() { trigger1, trigger2 }, replace: true);
```
The complete console application will now look like this
```csharp
using System;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
using Quartz.Logging;
namespace QuartzSampleApp
{
public class Program
{
private static async Task Main(string[] args)
{
LogProvider.SetCurrentLogProvider(new ConsoleLogProvider());
// Grab the Scheduler instance from the Factory
StdSchedulerFactory factory = new StdSchedulerFactory();
IScheduler scheduler = await factory.GetScheduler();
// and start it off
await scheduler.Start();
// define the job and tie it to our HelloJob class
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("job1", "group1")
.Build();
// Trigger the job to run now, and then repeat every 10 seconds
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.StartNow()
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(10)
.RepeatForever())
.Build();
// Tell Quartz to schedule the job using our trigger
await scheduler.ScheduleJob(job, trigger);
// some sleep to show what's happening
await Task.Delay(TimeSpan.FromSeconds(60));
// and last shut down the scheduler when you are ready to close your program
await scheduler.Shutdown();
Console.WriteLine("Press any key to close the application");
Console.ReadKey();
}
// simple log provider to get something to the console
private class ConsoleLogProvider : ILogProvider
{
public Logger GetLogger(string name)
{
return (level, func, exception, parameters) =>
{
if (level >= LogLevel.Info && func != null)
{
Console.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] [" + level + "] " + func(), parameters);
}
return true;
};
}
public IDisposable OpenNestedContext(string message)
{
throw new NotImplementedException();
}
public IDisposable OpenMappedContext(string key, object value, bool destructure = false)
{
throw new NotImplementedException();
}
}
}
public class HelloJob : IJob
{
public async Task Execute(IJobExecutionContext context)
{
await Console.Out.WriteLineAsync("Greetings from HelloJob!");
}
}
}
```
## Creating and initializing database
In order to use SQL persistence storage for Quartz and enabling features like clustering, you need to create a database and initialize the schema objects using SQL scripts.
First you need to create a database and credentials for Quartz. After you have a database that Quartz will be able to connect to, you also need to create database tables and indexes
that Quartz needs for successful operation.
You can find latest DDL scripts in [Quartz's GitHub repository](https://github.com/quartznet/quartznet/tree/main/database/tables) and they are also contained in the ZIP archive distribution.
There are also thirty party additions to Quartz that enable other types of storage, like NoSQL databases. You can search for them on NuGet.
Now go have some fun exploring Quartz.NET! You can continue by reading [the tutorial](tutorial/index.html).
| {
"content_hash": "e61eb8181707b1a3e5f7ae8fb4260967",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 304,
"avg_line_length": 37.667605633802815,
"alnum_prop": 0.7001196530062818,
"repo_name": "quartznet/quartznet",
"id": "7277b9d05c77d7fac2e0d6ba0039a5205c84a498",
"size": "13376",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "docs/documentation/quartz-3.x/quick-start.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "207"
},
{
"name": "C#",
"bytes": "3750341"
},
{
"name": "CSS",
"bytes": "9403"
},
{
"name": "Dockerfile",
"bytes": "2663"
},
{
"name": "HTML",
"bytes": "23289"
},
{
"name": "JavaScript",
"bytes": "2077184"
},
{
"name": "Less",
"bytes": "6623"
},
{
"name": "PowerShell",
"bytes": "2953"
},
{
"name": "SCSS",
"bytes": "6883"
},
{
"name": "Shell",
"bytes": "2838"
},
{
"name": "TSQL",
"bytes": "74851"
},
{
"name": "TypeScript",
"bytes": "17242"
}
],
"symlink_target": ""
} |
angular.module('open311.controllers')
.controller('CategoryCtrl', ['$scope', '$ionicHistory', '$ionicPlatform', 'API', 'App',
function($scope, $ionicHistory, $ionicPlatform, API, App) {
var coords = { lat: 37.339244, lng: -121.883638 };
var data;
$ionicPlatform.ready(function() {
API.getCategories(coords.lat, coords.lng).then(function(response) {
data = response.data;
$scope.filteredData = _.clone(response.data);
});
});
$scope.searchList = function (ev) {
var items = data;
var val = ev.target.value.toLowerCase();
$scope.filteredData = items.filter(function(item) {
var selection = item.service_name.toLowerCase();
return (_.includes(selection, val));
});
}
$scope.selectItem = function (category) {
var requestObj = App.getIssue();
requestObj.category = category;
App.setIssue(requestObj);
$ionicHistory.goBack();
}
}]);
| {
"content_hash": "82517c0a64ae3c96ab76b4c419a262e2",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 87,
"avg_line_length": 28.242424242424242,
"alnum_prop": 0.6362660944206009,
"repo_name": "codeforsanjose/open311-ionic",
"id": "564a1b4fb483a57f317ff877c9a50e63efea2bdb",
"size": "934",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "www/js/controllers/category.controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "564806"
},
{
"name": "HTML",
"bytes": "50233"
},
{
"name": "JavaScript",
"bytes": "5694684"
}
],
"symlink_target": ""
} |
declare module Data {
export interface IDataService<T> {
getData(): Promise<T>
getDataSynchronously(): T
}
}
| {
"content_hash": "d907b5fcbae06c938ee532ab0c8ce5e2",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 22.166666666666668,
"alnum_prop": 0.6090225563909775,
"repo_name": "mys3lf/angularjsbootstrapstart",
"id": "6b6f95a7faff1806106d061c9b893d0dc1935b29",
"size": "133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/_models/data/IDataServive.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10717"
},
{
"name": "HTML",
"bytes": "6293"
},
{
"name": "JavaScript",
"bytes": "11128"
},
{
"name": "TypeScript",
"bytes": "17159"
}
],
"symlink_target": ""
} |
Component which expands any content on title click.
## [Online demo](http://eigenmethod.github.io/mol/#demo=mol_expander)
## Usage example
```
<= Spoiler $mol_expander
label / \Murder is..
content / \majordomo
```
## Properties
**`label(): []`**
Returns button content.
**`content(): any`**
Returns expandable content.
**`expanded( next? : boolean ): boolean`**
Returns showing state of content.
| {
"content_hash": "9614a782d9c35320f4e4c9afd91bf6da",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 16.52,
"alnum_prop": 0.6682808716707022,
"repo_name": "nin-jin/mol",
"id": "42c9123d4cd8143296818cddfc011db435669d91",
"size": "430",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "expander/readme.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "53856"
},
{
"name": "HTML",
"bytes": "61161"
},
{
"name": "JavaScript",
"bytes": "12110"
},
{
"name": "TypeScript",
"bytes": "424536"
}
],
"symlink_target": ""
} |
package com.vikingbrain.nmt.operations.playback;
import com.vikingbrain.nmt.operations.ModuleType;
import com.vikingbrain.nmt.operations.OperationType;
import com.vikingbrain.nmt.operations.TheDavidboxOperationFactory;
import com.vikingbrain.nmt.responses.ResponseSimple;
/**
* Operation that repeat VOD playback. Toggles the repeat mode.
* Execution example:
* http://popcorn:8008/playback?arg0=repeat_vod
*
* @author vikingBrain
*/
public class RepeatVodOperation extends AbstractPlayblackOperation<ResponseSimple> {
/** Operation type. */
private static final OperationType operationType = ModuleType.PLAYBACK.repeat_vod;
/** Response target class. */
private static final Class<ResponseSimple> responseTargetClass = ResponseSimple.class;
/**
* Constructor.
* @param operationFactory the operation factory
*/
public RepeatVodOperation(TheDavidboxOperationFactory operationFactory) {
super(operationFactory, operationType, responseTargetClass);
}
@Override
public String toString() {
return "RepeatVodOperation [getOperationType()=" + getOperationType()
+ "]";
}
}
| {
"content_hash": "75141c38903f4ed0248ae43885dd78bd",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 87,
"avg_line_length": 30.13157894736842,
"alnum_prop": 0.7554585152838428,
"repo_name": "vikingbrain/thedavidbox-client4j",
"id": "a09cccaf7d3fff48ea1d48876f0544f1194a9712",
"size": "1758",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/vikingbrain/nmt/operations/playback/RepeatVodOperation.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "776084"
}
],
"symlink_target": ""
} |
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <jni.h>
#include <math.h>
#include "openjpeg.h"
#include "opj_includes.h"
#include "opj_getopt.h"
#include "convert.h"
#include "dirent.h"
#include "org_openJpeg_OpenJPEGJavaDecoder.h"
#ifndef _WIN32
#define stricmp strcasecmp
#define strnicmp strncasecmp
#endif
#include "format_defs.h"
typedef struct callback_variables {
JNIEnv *env;
/** 'jclass' object used to call a Java method from the C */
jobject *jobj;
/** 'jclass' object used to call a Java method from the C */
jmethodID message_mid;
jmethodID error_mid;
} callback_variables_t;
typedef struct dircnt{
/** Buffer for holding images read from Directory*/
char *filename_buf;
/** Pointer to the buffer*/
char **filename;
}dircnt_t;
typedef struct img_folder{
/** The directory path of the folder containing input images*/
char *imgdirpath;
/** Output format*/
char *out_format;
/** Enable option*/
char set_imgdir;
/** Enable Cod Format for output*/
char set_out_format;
}img_fol_t;
void decode_help_display() {
fprintf(stdout,"HELP\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
/* UniPG>> */
fprintf(stdout,"List of parameters for the JPEG 2000 "
#ifdef USE_JPWL
"+ JPWL "
#endif /* USE_JPWL */
"decoder:\n");
/* <<UniPG */
fprintf(stdout,"\n");
fprintf(stdout,"\n");
fprintf(stdout," -ImgDir \n");
fprintf(stdout," Image file Directory path \n");
fprintf(stdout," -OutFor \n");
fprintf(stdout," REQUIRED only if -ImgDir is used\n");
fprintf(stdout," Need to specify only format without filename <BMP> \n");
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, BMP format\n");
fprintf(stdout," -i <compressed file>\n");
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
fprintf(stdout," is identified based on its suffix.\n");
fprintf(stdout," -o <decompressed file>\n");
fprintf(stdout," REQUIRED\n");
fprintf(stdout," Currently accepts PGM-files, PPM-files, PNM-files, PGX-files and\n");
fprintf(stdout," BMP-files. Binary data is written to the file (not ascii). If a PGX\n");
fprintf(stdout," filename is given, there will be as many output files as there are\n");
fprintf(stdout," components: an indice starting from 0 will then be appended to the\n");
fprintf(stdout," output filename, just before the \"pgx\" extension. If a PGM filename\n");
fprintf(stdout," is given and there are more than one component, only the first component\n");
fprintf(stdout," will be written to the file.\n");
fprintf(stdout," -r <reduce factor>\n");
fprintf(stdout," Set the number of highest resolution levels to be discarded. The\n");
fprintf(stdout," image resolution is effectively divided by 2 to the power of the\n");
fprintf(stdout," number of discarded levels. The reduce factor is limited by the\n");
fprintf(stdout," smallest total number of decomposition levels among tiles.\n");
fprintf(stdout," -l <number of quality layers to decode>\n");
fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n");
fprintf(stdout," less quality layers than the specified number, all the quality layers\n");
fprintf(stdout," are decoded.\n");
/* UniPG>> */
#ifdef USE_JPWL
fprintf(stdout," -W <options>\n");
fprintf(stdout," Activates the JPWL correction capability, if the codestream complies.\n");
fprintf(stdout," Options can be a comma separated list of <param=val> tokens:\n");
fprintf(stdout," c, c=numcomps\n");
fprintf(stdout," numcomps is the number of expected components in the codestream\n");
fprintf(stdout," (search of first EPB rely upon this, default is %d)\n", JPWL_EXPECTED_COMPONENTS);
#endif /* USE_JPWL */
/* <<UniPG */
fprintf(stdout,"\n");
}
/* -------------------------------------------------------------------------- */
int get_num_images(char *imgdirpath){
DIR *dir;
struct dirent* content;
int num_images = 0;
/*Reading the input images from given input directory*/
dir= opendir(imgdirpath);
if(!dir){
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
return 0;
}
while((content=readdir(dir))!=NULL){
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
continue;
num_images++;
}
return num_images;
}
int load_images(dircnt_t *dirptr, char *imgdirpath){
DIR *dir;
struct dirent* content;
int i = 0;
/*Reading the input images from given input directory*/
dir= opendir(imgdirpath);
if(!dir){
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
return 1;
}else {
fprintf(stderr,"Folder opened successfully\n");
}
while((content=readdir(dir))!=NULL){
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
continue;
strcpy(dirptr->filename[i],content->d_name);
i++;
}
return 0;
}
int get_file_format(char *filename) {
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "j2k", "jp2", "jpt", "j2c" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT };
char * ext = strrchr(filename, '.');
if (ext == NULL)
return -1;
ext++;
if(ext) {
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
if(strnicmp(ext, extension[i], 3) == 0) {
return format[i];
}
}
}
return -1;
}
/* -------------------------------------------------------------------------- */
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
/* parse the command line */
int totlen;
opj_option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
{"OutFor",REQ_ARG, NULL ,'O'},
};
/* UniPG>> */
const char optlist[] = "i:o:r:l:hx:"
#ifdef USE_JPWL
"W:"
#endif /* USE_JPWL */
;
/*for (i=0; i<argc; i++) {
printf("[%s]",argv[i]);
}
printf("\n");*/
/* <<UniPG */
totlen=sizeof(long_option);
img_fol->set_out_format = 0;
reset_options_reading();
while (1) {
int c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
case 'i': /* input file */
{
char *infile = opj_optarg;
parameters->decod_format = get_file_format(infile);
switch(parameters->decod_format) {
case J2K_CFMT:
case JP2_CFMT:
case JPT_CFMT:
break;
default:
fprintf(stderr,
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
infile);
return 1;
}
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
}
break;
/* ----------------------------------------------------- */
case 'o': /* output file */
{
char *outfile = opj_optarg;
parameters->cod_format = get_file_format(outfile);
switch(parameters->cod_format) {
case PGX_DFMT:
case PXM_DFMT:
case BMP_DFMT:
case TIF_DFMT:
case RAW_DFMT:
case TGA_DFMT:
break;
default:
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outfile);
return 1;
}
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
}
break;
/* ----------------------------------------------------- */
case 'O': /* output format */
{
char outformat[50];
char *of = opj_optarg;
sprintf(outformat,".%s",of);
img_fol->set_out_format = 1;
parameters->cod_format = get_file_format(outformat);
switch(parameters->cod_format) {
case PGX_DFMT:
img_fol->out_format = "pgx";
break;
case PXM_DFMT:
img_fol->out_format = "ppm";
break;
case BMP_DFMT:
img_fol->out_format = "bmp";
break;
case TIF_DFMT:
img_fol->out_format = "tif";
break;
case RAW_DFMT:
img_fol->out_format = "raw";
break;
case TGA_DFMT:
img_fol->out_format = "raw";
break;
default:
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outformat);
return 1;
break;
}
}
break;
/* ----------------------------------------------------- */
case 'r': /* reduce option */
{
sscanf(opj_optarg, "%d", ¶meters->cp_reduce);
}
break;
/* ----------------------------------------------------- */
case 'l': /* layering option */
{
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
}
break;
/* ----------------------------------------------------- */
case 'h': /* display an help description */
decode_help_display();
return 1;
/* ------------------------------------------------------ */
case 'y': /* Image Directory path */
{
img_fol->imgdirpath = (char*)opj_malloc(strlen(opj_optarg) + 1);
strcpy(img_fol->imgdirpath,opj_optarg);
img_fol->set_imgdir=1;
}
break;
/* ----------------------------------------------------- */
/* UniPG>> */
#ifdef USE_JPWL
case 'W': /* activate JPWL correction */
{
char *token = NULL;
token = strtok(opj_optarg, ",");
while(token != NULL) {
/* search expected number of components */
if (*token == 'c') {
static int compno;
compno = JPWL_EXPECTED_COMPONENTS; /* predefined no. of components */
if(sscanf(token, "c=%d", &compno) == 1) {
/* Specified */
if ((compno < 1) || (compno > 256)) {
fprintf(stderr, "ERROR -> invalid number of components c = %d\n", compno);
return 1;
}
parameters->jpwl_exp_comps = compno;
} else if (!strcmp(token, "c")) {
/* default */
parameters->jpwl_exp_comps = compno; /* auto for default size */
} else {
fprintf(stderr, "ERROR -> invalid components specified = %s\n", token);
return 1;
};
}
/* search maximum number of tiles */
if (*token == 't') {
static int tileno;
tileno = JPWL_MAXIMUM_TILES; /* maximum no. of tiles */
if(sscanf(token, "t=%d", &tileno) == 1) {
/* Specified */
if ((tileno < 1) || (tileno > JPWL_MAXIMUM_TILES)) {
fprintf(stderr, "ERROR -> invalid number of tiles t = %d\n", tileno);
return 1;
}
parameters->jpwl_max_tiles = tileno;
} else if (!strcmp(token, "t")) {
/* default */
parameters->jpwl_max_tiles = tileno; /* auto for default size */
} else {
fprintf(stderr, "ERROR -> invalid tiles specified = %s\n", token);
return 1;
};
}
/* next token or bust */
token = strtok(NULL, ",");
};
parameters->jpwl_correct = true;
fprintf(stdout, "JPWL correction capability activated\n");
fprintf(stdout, "- expecting %d components\n", parameters->jpwl_exp_comps);
}
break;
#endif /* USE_JPWL */
/* <<UniPG */
/* ----------------------------------------------------- */
default:
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
break;
}
}
/* No check for possible errors before the -i and -o options are of course not mandatory*/
return 0;
}
/* -------------------------------------------------------------------------- */
/**
error callback returning the message to Java andexpecting a callback_variables_t client object
*/
void error_callback(const char *msg, void *client_data) {
callback_variables_t* vars = (callback_variables_t*) client_data;
JNIEnv *env = vars->env;
jstring jbuffer;
jbuffer = (*env)->NewStringUTF(env, msg);
(*env)->ExceptionClear(env);
(*env)->CallVoidMethod(env, *(vars->jobj), vars->error_mid, jbuffer);
if ((*env)->ExceptionOccurred(env)) {
fprintf(stderr,"C: Exception during call back method\n");
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
}
(*env)->DeleteLocalRef(env, jbuffer);
}
/**
warning callback returning the message to Java andexpecting a callback_variables_t client object
*/
void warning_callback(const char *msg, void *client_data) {
callback_variables_t* vars = (callback_variables_t*) client_data;
JNIEnv *env = vars->env;
jstring jbuffer;
jbuffer = (*env)->NewStringUTF(env, msg);
(*env)->ExceptionClear(env);
(*env)->CallVoidMethod(env, *(vars->jobj), vars->message_mid, jbuffer);
if ((*env)->ExceptionOccurred(env)) {
fprintf(stderr,"C: Exception during call back method\n");
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
}
(*env)->DeleteLocalRef(env, jbuffer);
}
/**
information callback returning the message to Java andexpecting a callback_variables_t client object
*/
void info_callback(const char *msg, void *client_data) {
callback_variables_t* vars = (callback_variables_t*) client_data;
JNIEnv *env = vars->env;
jstring jbuffer;
jbuffer = (*env)->NewStringUTF(env, msg);
(*env)->ExceptionClear(env);
(*env)->CallVoidMethod(env, *(vars->jobj), vars->message_mid, jbuffer);
if ((*env)->ExceptionOccurred(env)) {
fprintf(stderr,"C: Exception during call back method\n");
(*env)->ExceptionDescribe(env);
(*env)->ExceptionClear(env);
}
(*env)->DeleteLocalRef(env, jbuffer);
}
/* --------------------------------------------------------------------------
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
opj_dparameters_t parameters; /* decompression parameters */
img_fol_t img_fol;
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *image = NULL;
FILE *fsrc = NULL;
unsigned char *src = NULL;
int file_length;
int num_images;
int i,j,imageno;
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
opj_cio_t *cio = NULL;
int w,h;
long min_value, max_value;
short tempS; unsigned char tempUC, tempUC1, tempUC2;
/* ==> Access variables to the Java member variables*/
jsize arraySize;
jclass cls;
jobject object;
jboolean isCopy;
jfieldID fid;
jbyteArray jba;
jshortArray jsa;
jintArray jia;
jbyte *jbBody, *ptrBBody;
jshort *jsBody, *ptrSBody;
jint *jiBody, *ptrIBody;
callback_variables_t msgErrorCallback_vars;
/* <=== access variable to Java member variables */
int *ptr, *ptr1, *ptr2; /* <== To transfer the decoded image to Java*/
/* configure the event callbacks */
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
event_mgr.warning_handler = warning_callback;
event_mgr.info_handler = info_callback;
/* JNI reference to the calling class*/
cls = (*env)->GetObjectClass(env, obj);
/* Pointers to be able to call a Java method for all the info and error messages*/
msgErrorCallback_vars.env = env;
msgErrorCallback_vars.jobj = &obj;
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V");
/* Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.*/
arraySize = (*env)->GetArrayLength(env, javaParameters);
argc = (int) arraySize +1;
argv = opj_malloc(argc*sizeof(char*));
argv[0] = "ProgramName.exe"; /* The program name: useless*/
j=0;
for (i=1; i<argc; i++) {
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
argv[i] = (char*)(*env)->GetStringUTFChars(env, object, &isCopy);
}
/*printf("C: decoder params = ");
for (i=0; i<argc; i++) {
printf("[%s]",argv[i]);
}
printf("\n");*/
/* set decoding parameters to default values */
opj_set_default_decoder_parameters(¶meters);
parameters.decod_format = J2K_CFMT;
/* parse input and get user encoding parameters */
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
/* Release the Java arguments array*/
for (i=1; i<argc; i++)
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
return -1;
}
/* Release the Java arguments array*/
for (i=1; i<argc; i++)
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
num_images=1;
/* Get additional information from the Java object variables*/
fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I");
parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid);
/*Decoding image one by one*/
for(imageno = 0; imageno < num_images ; imageno++)
{
image = NULL;
fprintf(stderr,"\n");
/* read the input file and put it in memory into the 'src' object, if the -i option is given in JavaParameters.
Implemented for debug purpose. */
/* -------------------------------------------------------------- */
if (parameters.infile && parameters.infile[0]!='\0') {
/*printf("C: opening [%s]\n", parameters.infile);*/
fsrc = fopen(parameters.infile, "rb");
if (!fsrc) {
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
return 1;
}
fseek(fsrc, 0, SEEK_END);
file_length = ftell(fsrc);
fseek(fsrc, 0, SEEK_SET);
src = (unsigned char *) opj_malloc(file_length);
fread(src, 1, file_length, fsrc);
fclose(fsrc);
/*printf("C: %d bytes read from file\n",file_length);*/
} else {
/* Preparing the transfer of the codestream from Java to C*/
/*printf("C: before transfering codestream\n");*/
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
jba = (*env)->GetObjectField(env, obj, fid);
file_length = (*env)->GetArrayLength(env, jba);
jbBody = (*env)->GetByteArrayElements(env, jba, &isCopy);
src = (unsigned char*)jbBody;
}
/* decode the code-stream */
/* ---------------------- */
switch(parameters.decod_format) {
case J2K_CFMT:
{
/* JPEG-2000 codestream */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_J2K);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, &msgErrorCallback_vars);
/* setup the decoder decoding parameters using user parameters */
opj_setup_decoder(dinfo, ¶meters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
image = opj_decode(dinfo, cio);
if(!image) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
return 1;
}
/* close the byte stream */
opj_cio_close(cio);
}
break;
case JP2_CFMT:
{
/* JPEG 2000 compressed image data */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_JP2);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, &msgErrorCallback_vars);
/* setup the decoder decoding parameters using the current image and user parameters */
opj_setup_decoder(dinfo, ¶meters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
image = opj_decode(dinfo, cio);
if(!image) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
return 1;
}
/* close the byte stream */
opj_cio_close(cio);
}
break;
case JPT_CFMT:
{
/* JPEG 2000, JPIP */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_JPT);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, &msgErrorCallback_vars);
/* setup the decoder decoding parameters using user parameters */
opj_setup_decoder(dinfo, ¶meters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
image = opj_decode(dinfo, cio);
if(!image) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
return 1;
}
/* close the byte stream */
opj_cio_close(cio);
}
break;
default:
fprintf(stderr, "skipping file..\n");
continue;
}
/* free the memory containing the code-stream */
if (parameters.infile && parameters.infile[0]!='\0') {
opj_free(src);
} else {
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
}
src = NULL;
/* create output image.
If the -o parameter is given in the JavaParameters, write the decoded version into a file.
Implemented for debug purpose. */
/* ---------------------------------- */
switch (parameters.cod_format) {
case PXM_DFMT: /* PNM PGM PPM */
if (imagetopnm(image, parameters.outfile)) {
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
}
else {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
}
break;
case PGX_DFMT: /* PGX */
if(imagetopgx(image, parameters.outfile)){
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
}
else {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
}
break;
case BMP_DFMT: /* BMP */
if(imagetobmp(image, parameters.outfile)){
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
}
else {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
}
break;
}
/* ========= Return the image to the Java structure ===============*/
#ifdef CHECK_THRESHOLDS
printf("C: checking thresholds\n");
#endif
/* First compute the real with and height, in function of the resolutions decoded.*/
/*wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
/*hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
w = image->comps[0].w;
h = image->comps[0].h;
if (image->numcomps==3) { /* 3 components color image*/
ptr = image->comps[0].data;
ptr1 = image->comps[1].data;
ptr2 = image->comps[2].data;
#ifdef CHECK_THRESHOLDS
if (image->comps[0].sgnd) {
min_value = -128;
max_value = 127;
} else {
min_value = 0;
max_value = 255;
}
#endif
/* Get the pointer to the Java structure where the data must be copied*/
fid = (*env)->GetFieldID(env, cls,"image24", "[I");
jia = (*env)->GetObjectField(env, obj, fid);
jiBody = (*env)->GetIntArrayElements(env, jia, 0);
ptrIBody = jiBody;
printf("C: transfering image24: %d int to Java pointer=%d\n",image->numcomps*w*h, ptrIBody);
for (i=0; i<w*h; i++) {
tempUC = (unsigned char)(ptr[i]);
tempUC1 = (unsigned char)(ptr1[i]);
tempUC2 = (unsigned char)(ptr2[i]);
#ifdef CHECK_THRESHOLDS
if (tempUC < min_value)
tempUC=min_value;
else if (tempUC > max_value)
tempUC=max_value;
if (tempUC1 < min_value)
tempUC1=min_value;
else if (tempUC1 > max_value)
tempUC1=max_value;
if (tempUC2 < min_value)
tempUC2=min_value;
else if (tempUC2 > max_value)
tempUC2=max_value;
#endif
*(ptrIBody++) = (int) ( (tempUC2<<16) + (tempUC1<<8) + tempUC );
}
(*env)->ReleaseIntArrayElements(env, jia, jiBody, 0);
} else { /* 1 component 8 or 16 bpp image*/
ptr = image->comps[0].data;
printf("C: before transfering a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
if (image->comps[0].prec<=8) {
fid = (*env)->GetFieldID(env, cls,"image8", "[B");
jba = (*env)->GetObjectField(env, obj, fid);
jbBody = (*env)->GetByteArrayElements(env, jba, 0);
ptrBBody = jbBody;
#ifdef CHECK_THRESHOLDS
if (image->comps[0].sgnd) {
min_value = -128;
max_value = 127;
} else {
min_value = 0;
max_value = 255;
}
#endif
/*printf("C: transfering %d shorts to Java image8 pointer = %d\n", wr*hr,ptrSBody);*/
for (i=0; i<w*h; i++) {
tempUC = (unsigned char) (ptr[i]);
#ifdef CHECK_THRESHOLDS
if (tempUC<min_value)
tempUC = min_value;
else if (tempUC > max_value)
tempUC = max_value;
#endif
*(ptrBBody++) = tempUC;
}
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
printf("C: image8 transfered to Java\n");
} else {
fid = (*env)->GetFieldID(env, cls,"image16", "[S");
jsa = (*env)->GetObjectField(env, obj, fid);
jsBody = (*env)->GetShortArrayElements(env, jsa, 0);
ptrSBody = jsBody;
#ifdef CHECK_THRESHOLDS
if (image->comps[0].sgnd) {
min_value = -32768;
max_value = 32767;
} else {
min_value = 0;
max_value = 65535;
}
printf("C: minValue = %d, maxValue = %d\n", min_value, max_value);
#endif
printf("C: transfering %d shorts to Java image16 pointer = %d\n", w*h,ptrSBody);
for (i=0; i<w*h; i++) {
tempS = (short) (ptr[i]);
#ifdef CHECK_THRESHOLDS
if (tempS<min_value) {
printf("C: value %d truncated to %d\n", tempS, min_value);
tempS = min_value;
} else if (tempS > max_value) {
printf("C: value %d truncated to %d\n", tempS, max_value);
tempS = max_value;
}
#endif
*(ptrSBody++) = tempS;
}
(*env)->ReleaseShortArrayElements(env, jsa, jsBody, 0);
printf("C: image16 completely filled\n");
}
}
/* free remaining structures */
if(dinfo) {
opj_destroy_decompress(dinfo);
}
/* free image data structure */
opj_image_destroy(image);
}
return 1; /* OK */
}
/*end main*/
| {
"content_hash": "8b3eb40c93427116250929410b57fef3",
"timestamp": "",
"source": "github",
"line_count": 853,
"max_line_length": 152,
"avg_line_length": 30.29308323563892,
"alnum_prop": 0.6093266253869969,
"repo_name": "bluegum/PegDF",
"id": "c040d9ddea597059449cc9a02ae744794bed25de",
"size": "27639",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "pkgs/openjpeg/wrapping/java/openjp2/JavaOpenJPEGDecoder.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ada",
"bytes": "89080"
},
{
"name": "Assembly",
"bytes": "934623"
},
{
"name": "C",
"bytes": "8126621"
},
{
"name": "C#",
"bytes": "54011"
},
{
"name": "C++",
"bytes": "457937"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CSS",
"bytes": "18771"
},
{
"name": "Java",
"bytes": "255662"
},
{
"name": "JavaScript",
"bytes": "20464"
},
{
"name": "Objective-C",
"bytes": "34518"
},
{
"name": "PHP",
"bytes": "490"
},
{
"name": "Pascal",
"bytes": "42411"
},
{
"name": "Perl",
"bytes": "6409"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Shell",
"bytes": "225791"
},
{
"name": "Tcl",
"bytes": "28284"
}
],
"symlink_target": ""
} |
<!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>com.centurylink.mdw.workflow.activity (MDW 6 API JavaDocs)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<h1 class="bar"><a href="../../../../../com/centurylink/mdw/workflow/activity/package-summary.html" target="classFrame">com.centurylink.mdw.workflow.activity</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="AbstractEvaluator.html" title="class in com.centurylink.mdw.workflow.activity" target="classFrame">AbstractEvaluator</a></li>
<li><a href="AbstractWait.html" title="class in com.centurylink.mdw.workflow.activity" target="classFrame">AbstractWait</a></li>
<li><a href="DefaultActivityImpl.html" title="class in com.centurylink.mdw.workflow.activity" target="classFrame">DefaultActivityImpl</a></li>
</ul>
</div>
</body>
</html>
| {
"content_hash": "851e3ccdda06295ec8006fbcb79ebe9e",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 166,
"avg_line_length": 53.142857142857146,
"alnum_prop": 0.7016129032258065,
"repo_name": "CenturyLinkCloud/mdw",
"id": "ff8e832a021dc93664efbc1ec7cc8508ae6c95ae",
"size": "1116",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/_docs/javadoc/com/centurylink/mdw/workflow/activity/package-frame.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "213"
},
{
"name": "CSS",
"bytes": "360257"
},
{
"name": "Dockerfile",
"bytes": "1606"
},
{
"name": "Groovy",
"bytes": "1370"
},
{
"name": "HTML",
"bytes": "253602"
},
{
"name": "Java",
"bytes": "4874323"
},
{
"name": "JavaScript",
"bytes": "1588812"
},
{
"name": "Kotlin",
"bytes": "49698"
},
{
"name": "PLSQL",
"bytes": "34878"
},
{
"name": "Python",
"bytes": "1790"
},
{
"name": "Shell",
"bytes": "24146"
},
{
"name": "XSLT",
"bytes": "15751"
}
],
"symlink_target": ""
} |
<?php
namespace AppBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints\DateTime;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Course
*
* @ORM\Table(name="courses")
* @ORM\Entity(repositoryClass="AppBundle\Repository\CourseRepository")
*/
class Course
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="description", type="string", length=255)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="price", type="string", length=255)
*/
private $price;
/**
* @var \DateTime
*
* @ORM\Column(name="start", type="date")
*/
private $start;
/**
* @var \DateTime
*
* @ORM\Column(name="end", type="date")
*/
private $end;
/**
* @var \DateTime
*
* @ORM\Column(name="displayOf", type="date")
*/
private $displayOf;
/**
* @var \DateTime
*
* @ORM\Column(name="displayUp", type="date")
*/
private $displayUp;
/**
* @var string
*
* @ORM\Column(name="info", type="string", length=255)
*/
private $info;
/**
* @Gedmo\Slug(fields={"name"})
* @ORM\Column(name="slug",type="string")
*/
private $slug;
/**
* @ORM\ManyToOne(targetEntity="Provider", inversedBy="courses")
*@ORM\JoinColumn(onDelete="SET NULL")
*/
private $provider;
/**
* @ORM\ManyToOne(targetEntity="ServiceCategory", inversedBy="courses")
* @ORM\JoinColumn(onDelete="SET NULL")
*/
private $serviceCategory;
/**
* @var Image
* @ORM\ManyToOne(targetEntity="Image",cascade={"persist"})
*/
private $image;
/**
* Constructor
*/
public function __construct()
{
$this->images=new ArrayCollection();
$this->displayOf=new DateTime();
$this->displayUp=new DateTime();
$this->end=new DateTime();
$this->start=new DateTime();
}
/**
* @return mixed
*/
public function getServiceCategory()
{
return $this->serviceCategory;
}
/**
* @param mixed $serviceCategory
*/
public function setServiceCategory($serviceCategory)
{
$this->serviceCategory = $serviceCategory;
}
/**
* @param Image $image
*/
public function setImage(Image $image): void
{
$this->image = $image;
}
/**
* @return Image
*/
public function getImage(): Image
{
return $this->image;
}
/**
* @return mixed
*/
public function getProvider()
{
return $this->provider;
}
/**
* @param mixed $provider
*/
public function setProvider(Provider $provider)
{
$this->provider = $provider;
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Course
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set description
*
* @param string $description
*
* @return Course
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set price
*
* @param string $price
*
* @return Course
*/
public function setPrice($price)
{
$this->price = $price;
return $this;
}
/**
* Get price
*
* @return string
*/
public function getPrice()
{
return $this->price;
}
/**
* Set start
*
* @param \DateTime $start
*
* @return Course
*/
public function setStart($start)
{
$this->start = $start;
return $this;
}
/**
* Get start
*
* @return \DateTime
*/
public function getStart()
{
return $this->start;
}
/**
* Set end
*
* @param \DateTime $end
*
* @return Course
*/
public function setEnd($end)
{
$this->end = $end;
return $this;
}
/**
* Get end
*
* @return \DateTime
*/
public function getEnd()
{
return $this->end;
}
/**
* Set displayOf
*
* @param \DateTime $displayOf
*
* @return Course
*/
public function setDisplayOf($displayOf)
{
$this->displayOf = $displayOf;
return $this;
}
/**
* Get displayOf
*
* @return \DateTime
*/
public function getDisplayOf()
{
return $this->displayOf;
}
/**
* Set displayUp
*
* @param \DateTime $displayUp
*
* @return Course
*/
public function setDisplayUp($displayUp)
{
$this->displayUp = $displayUp;
return $this;
}
/**
* Get displayUp
*
* @return \DateTime
*/
public function getDisplayUp()
{
return $this->displayUp;
}
/**
* Set info
*
* @param string $info
*
* @return Course
*/
public function setInfo($info)
{
$this->info = $info;
return $this;
}
/**
* Get info
*
* @return string
*/
public function getInfo()
{
return $this->info;
}
/**
* @return mixed
*/
public function getSlug()
{
return $this->slug;
}
/**
* @param mixed $slug
*/
public function setSlug($slug)
{
$this->slug = $slug;
}
}
| {
"content_hash": "bcc2b73134d57f68b4a8c83e8ddace6b",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 75,
"avg_line_length": 16.248062015503876,
"alnum_prop": 0.4904580152671756,
"repo_name": "persfrancobe/AnnBienEtre",
"id": "7daca359a54d0ec1936e816091517e4698538c76",
"size": "6288",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/AppBundle/Entity/Course.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "449227"
},
{
"name": "HTML",
"bytes": "133203"
},
{
"name": "JavaScript",
"bytes": "143520"
},
{
"name": "PHP",
"bytes": "204978"
}
],
"symlink_target": ""
} |
Ext.define('Ext.rtl.grid.plugin.HeaderResizer', {
override: 'Ext.grid.plugin.HeaderResizer',
onBeforeStart : function(e) {
var me = this;
if (this.headerCt.isOppositeRootDirection()) {
// cache the activeHd because it will be cleared.
me.dragHd = me.activeHd;
if (!!me.dragHd && !me.headerCt.dragging) {
// Calculate how far off the right marker line the mouse pointer is.
// This will be the xDelta during the following drag operation.
me.xDelta = me.dragHd.getX() - me.tracker.getXY()[0];
this.tracker.constrainTo = this.getConstrainRegion();
return true;
} else {
me.headerCt.dragging = false;
return false;
}
} else {
return this.callParent(arguments);
}
},
adjustColumnWidth: function(offsetX) {
if (this.headerCt.isOppositeRootDirection()) {
offsetX = -offsetX;
}
this.callParent([offsetX]);
},
adjustConstrainRegion: function(region, t, r, b, l) {
return this.headerCt.isOppositeRootDirection() ?
region.adjust(t, -l, b, -r) : this.callParent(arguments);
},
calculateDragX: function(gridSection) {
var gridX = gridSection.getX(),
mouseX = this.tracker.getXY('point')[0];
if (this.headerCt.isOppositeRootDirection()) {
return mouseX - gridX + this.xDelta;
} else {
return this.callParent(arguments);
}
},
getMovingMarker: function(markerOwner){
if (this.headerCt.isOppositeRootDirection()) {
return markerOwner.getLhsMarker();
} else {
return markerOwner.getRhsMarker();
}
},
setMarkerX: function(marker, x) {
var headerCt = this.headerCt;
if (headerCt.getInherited().rtl && !headerCt.isOppositeRootDirection()) {
marker.rtlSetLocalX(x);
} else {
this.callParent(arguments);
}
}
});
| {
"content_hash": "ade061dd20b2429c598599ac1afb4279",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 84,
"avg_line_length": 32.507462686567166,
"alnum_prop": 0.5390266299357208,
"repo_name": "juxiangwu/SimpleSales",
"id": "a3e9c61e565ec4736ba3a8c5dba528cd86a0452f",
"size": "2178",
"binary": false,
"copies": "15",
"ref": "refs/heads/master",
"path": "PCClient/ext/classic/classic/src/rtl/grid/plugin/HeaderResizer.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4491286"
},
{
"name": "HTML",
"bytes": "165734"
},
{
"name": "JavaScript",
"bytes": "61221523"
},
{
"name": "Ruby",
"bytes": "18184"
},
{
"name": "Shell",
"bytes": "222"
}
],
"symlink_target": ""
} |
struct Telegram;
struct Vector2D;
template <class entity_type>
class Trigger : public BaseGameEntity
{
private:
//Every trigger owns a trigger region. If an entity comes within this
//region the trigger is activated
TriggerRegion* m_pRegionOfInfluence;
//if this is true the trigger will be removed from the game
bool m_bRemoveFromGame;
//it's convenient to be able to deactivate certain types of triggers
//on an event. Therefore a trigger can only be triggered when this
//value is true (respawning triggers make good use of this facility)
bool m_bActive;
//some types of trigger are twinned with a graph node. This enables
//the pathfinding component of an AI to search a navgraph for a specific
//type of trigger.
int m_iGraphNodeIndex;
protected:
void SetGraphNodeIndex(int idx){m_iGraphNodeIndex = idx;}
void SetToBeRemovedFromGame(){m_bRemoveFromGame = true;}
void SetInactive(){m_bActive = false;}
void SetActive(){m_bActive = true;}
//returns true if the entity given by a position and bounding radius is
//overlapping the trigger region
bool isTouchingTrigger(Vector2D EntityPos, double EntityRadius)const;
//child classes use one of these methods to initialize the trigger region
void AddCircularTriggerRegion(Vector2D center, double radius);
void AddRectangularTriggerRegion(Vector2D TopLeft, Vector2D BottomRight);
public:
Trigger(unsigned int id):BaseGameEntity(id),
m_bRemoveFromGame(false),
m_bActive(true),
m_iGraphNodeIndex(-1),
m_pRegionOfInfluence(NULL)
{}
virtual ~Trigger(){delete m_pRegionOfInfluence;}
//when this is called the trigger determines if the entity is within the
//trigger's region of influence. If it is then the trigger will be
//triggered and the appropriate action will be taken.
virtual void Try(entity_type*) = 0;
//called each update-step of the game. This methods updates any internal
//state the trigger may have
virtual void Update() = 0;
int GraphNodeIndex()const{return m_iGraphNodeIndex;}
bool isToBeRemoved()const{return m_bRemoveFromGame;}
bool isActive(){return m_bActive;}
};
//------------------------ AddCircularTriggerRegion ---------------------------
//-----------------------------------------------------------------------------
template <class entity_type>
void Trigger<entity_type>::AddCircularTriggerRegion(Vector2D center,
double radius)
{
//if this replaces an existing region, tidy up memory
if (m_pRegionOfInfluence) delete m_pRegionOfInfluence;
m_pRegionOfInfluence = new TriggerRegion_Circle(center, radius);
}
//--------------------- AddRectangularTriggerRegion ---------------------------
//-----------------------------------------------------------------------------
template <class entity_type>
void Trigger<entity_type>::AddRectangularTriggerRegion(Vector2D TopLeft,
Vector2D BottomRight)
{
//if this replaces an existing region, tidy up memory
if (m_pRegionOfInfluence) delete m_pRegionOfInfluence;
m_pRegionOfInfluence = new TriggerRegion_Rectangle(TopLeft, BottomRight);
}
//--------------------- isTouchingTrigger -------------------------------------
//-----------------------------------------------------------------------------
template <class entity_type>
bool Trigger<entity_type>::isTouchingTrigger(Vector2D EntityPos,
double EntityRadius)const
{
if (m_pRegionOfInfluence)
{
return m_pRegionOfInfluence->isTouching(EntityPos, EntityRadius);
}
return false;
}
#endif | {
"content_hash": "bafabfea2295adfeeda78574f116e92c",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 35.31481481481482,
"alnum_prop": 0.6185107498689041,
"repo_name": "jjuiddong/Dx3D-Study",
"id": "cb1a8ab3d9e7804c909435df7884ef0e79a363a1",
"size": "4294",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Evos2D/Common/Triggers/Trigger.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "585468"
},
{
"name": "C++",
"bytes": "2780333"
},
{
"name": "CSS",
"bytes": "5051"
},
{
"name": "FLUX",
"bytes": "47970"
},
{
"name": "Lua",
"bytes": "6631"
},
{
"name": "Objective-C",
"bytes": "9817"
},
{
"name": "Shell",
"bytes": "125"
}
],
"symlink_target": ""
} |
void foo() {
}
bool foobool(int argc) {
return argc;
}
struct S1; // expected-note 2 {{declared here}}
extern S1 a;
class S2 {
mutable int a;
public:
S2():a(0) { }
S2(S2 &s2):a(s2.a) { }
static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
};
const float S2::S2sc = 0;
const S2 b;
const S2 ba[5];
class S3 {
int a;
public:
S3():a(0) { }
S3(S3 &s3):a(s3.a) { }
};
const S3 c;
const S3 ca[5];
extern const int f;
class S4 {
int a;
S4();
S4(const S4 &s4);
public:
S4(int v):a(v) { }
};
class S5 {
int a;
S5():a(0) {}
S5(const S5 &s5):a(s5.a) { }
public:
S5(int v):a(v) { }
};
struct S6 {
int ii;
int aa[30];
float xx;
double *pp;
};
struct S7 {
int i;
int a[50];
float x;
S6 s6[5];
double *p;
unsigned bfa : 4;
};
S3 h;
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
typedef int to;
template <typename T, int I> // expected-note {{declared here}}
T tmain(T argc) {
const T d = 5;
const T da[5] = { 0 };
S4 e(4);
S5 g(5);
T i, t[20];
T &j = i;
T *k = &j;
T x;
T y;
T from;
const T (&l)[5] = da;
T *m;
S7 s7;
#pragma omp target update from // expected-error {{expected '(' after 'from'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from() // expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update() // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(alloc) // expected-error {{use of undeclared identifier 'alloc'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(x)
#pragma omp target update from(t[:I])
#pragma omp target update from(T) // expected-error {{'T' does not refer to a value}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(I) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target update from(S2::S2s)
#pragma omp target update from(S2::S2sc)
#pragma omp target update from(from)
#pragma omp target update from(y x) // expected-error {{expected ',' or ')' in 'from' clause}}
#pragma omp target update from(argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target update from(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target update from(ba) // expected-error 2 {{type 'S2' is not mappable to target}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(h) // expected-error {{threadprivate variables are not allowed in 'from' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(k), to(k) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}}
#pragma omp target update from(t), from(t[:5]) // expected-error 2 {{variable can appear only once in OpenMP 'target update' construct}} expected-note 2 {{used here}}
#pragma omp target update from(da)
#pragma omp target update from(da[:4])
#pragma omp target update from(x, a[:2]) // expected-error {{subscripted value is not an array or pointer}}
#pragma omp target update from(x, c[:]) // expected-error {{subscripted value is not an array or pointer}}
#pragma omp target update from(x, (m+1)[2]) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target update from(s7.i, s7.a[:3])
#pragma omp target update from(s7.s6[1].aa[0:5])
#pragma omp target update from(x, s7.s6[:5].aa[6]) // expected-error {{OpenMP array section is not allowed here}}
#pragma omp target update from(x, s7.s6[:5].aa[:6]) // expected-error {{OpenMP array section is not allowed here}}
#pragma omp target update from(s7.p[:10])
#pragma omp target update from(x, s7.bfa) // expected-error {{bit fields cannot be used to specify storage in a 'from' clause}}
#pragma omp target update from(x, s7.p[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
#pragma omp target data map(to: s7.i)
{
#pragma omp target update from(s7.x)
}
return 0;
}
int main(int argc, char **argv) {
const int d = 5;
const int da[5] = { 0 };
S4 e(4);
S5 g(5);
int i, t[20];
int &j = i;
int *k = &j;
int x;
int y;
int from;
const int (&l)[5] = da;
int *m;
S7 s7;
#pragma omp target update from // expected-error {{expected '(' after 'from'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from() // expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update() // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(alloc) // expected-error {{use of undeclared identifier 'alloc'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(x)
#pragma omp target update from(t[:i])
#pragma omp target update from(S2::S2s)
#pragma omp target update from(S2::S2sc)
#pragma omp target update from(from)
#pragma omp target update from(y x) // expected-error {{expected ',' or ')' in 'from' clause}}
#pragma omp target update from(argc > 0 ? x : y) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(S1) // expected-error {{'S1' does not refer to a value}}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}}
#pragma omp target update from(ba) // expected-error 2 {{type 'S2' is not mappable to target}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(h) // expected-error {{threadprivate variables are not allowed in 'from' clause}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(k), to(k) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}}
#pragma omp target update from(t), from(t[:5]) // expected-error {{variable can appear only once in OpenMP 'target update' construct}} expected-note {{used here}}
#pragma omp target update from(da)
#pragma omp target update from(da[:4])
#pragma omp target update from(x, a[:2]) // expected-error {{subscripted value is not an array or pointer}}
#pragma omp target update from(x, c[:]) // expected-error {{subscripted value is not an array or pointer}}
#pragma omp target update from(x, (m+1)[2]) // expected-error {{expected expression containing only member accesses and/or array sections based on named variables}}
#pragma omp target update from(s7.i, s7.a[:3])
#pragma omp target update from(s7.s6[1].aa[0:5])
#pragma omp target update from(x, s7.s6[:5].aa[6]) // expected-error {{OpenMP array section is not allowed here}}
#pragma omp target update from(x, s7.s6[:5].aa[:6]) // expected-error {{OpenMP array section is not allowed here}}
#pragma omp target update from(s7.p[:10])
#pragma omp target update from(x, s7.bfa) // expected-error {{bit fields cannot be used to specify storage in a 'from' clause}}
#pragma omp target update from(x, s7.p[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
#pragma omp target data map(to: s7.i)
{
#pragma omp target update from(s7.x)
}
return tmain<int, 3>(argc)+tmain<to, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
}
| {
"content_hash": "a5d9e226baac44c077d055e2c3cfce85",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 280,
"avg_line_length": 57.05172413793103,
"alnum_prop": 0.7063564017326484,
"repo_name": "ensemblr/llvm-project-boilerplate",
"id": "6aff083b6a4876cf21222b4750e31fe0dedd5a33",
"size": "9985",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "include/llvm/tools/clang/test/OpenMP/target_update_from_messages.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "32"
},
{
"name": "AppleScript",
"bytes": "1429"
},
{
"name": "Assembly",
"bytes": "15649629"
},
{
"name": "Awk",
"bytes": "1747037"
},
{
"name": "Batchfile",
"bytes": "34481"
},
{
"name": "Brainfuck",
"bytes": "284"
},
{
"name": "C",
"bytes": "85584624"
},
{
"name": "C#",
"bytes": "20737"
},
{
"name": "C++",
"bytes": "168418524"
},
{
"name": "CMake",
"bytes": "1174816"
},
{
"name": "CSS",
"bytes": "49900"
},
{
"name": "Cuda",
"bytes": "414703"
},
{
"name": "Emacs Lisp",
"bytes": "110018"
},
{
"name": "Forth",
"bytes": "1490"
},
{
"name": "Fortran",
"bytes": "356707"
},
{
"name": "GAP",
"bytes": "6167"
},
{
"name": "Go",
"bytes": "132137"
},
{
"name": "HTML",
"bytes": "1751124"
},
{
"name": "JavaScript",
"bytes": "141512"
},
{
"name": "LLVM",
"bytes": "62219250"
},
{
"name": "Limbo",
"bytes": "7437"
},
{
"name": "Logos",
"bytes": "1572537943"
},
{
"name": "Lua",
"bytes": "86606"
},
{
"name": "M",
"bytes": "2008"
},
{
"name": "M4",
"bytes": "109560"
},
{
"name": "Makefile",
"bytes": "616437"
},
{
"name": "Mathematica",
"bytes": "7845"
},
{
"name": "Matlab",
"bytes": "53817"
},
{
"name": "Mercury",
"bytes": "1194"
},
{
"name": "Mirah",
"bytes": "1079943"
},
{
"name": "OCaml",
"bytes": "407143"
},
{
"name": "Objective-C",
"bytes": "5910944"
},
{
"name": "Objective-C++",
"bytes": "1720450"
},
{
"name": "OpenEdge ABL",
"bytes": "690534"
},
{
"name": "PHP",
"bytes": "15986"
},
{
"name": "POV-Ray SDL",
"bytes": "19471"
},
{
"name": "Perl",
"bytes": "591927"
},
{
"name": "PostScript",
"bytes": "845774"
},
{
"name": "Protocol Buffer",
"bytes": "20013"
},
{
"name": "Python",
"bytes": "1895427"
},
{
"name": "QMake",
"bytes": "15580"
},
{
"name": "RenderScript",
"bytes": "741"
},
{
"name": "Roff",
"bytes": "94555"
},
{
"name": "Rust",
"bytes": "200"
},
{
"name": "Scheme",
"bytes": "2654"
},
{
"name": "Shell",
"bytes": "1144090"
},
{
"name": "Smalltalk",
"bytes": "144607"
},
{
"name": "SourcePawn",
"bytes": "1544"
},
{
"name": "Standard ML",
"bytes": "2841"
},
{
"name": "Tcl",
"bytes": "8285"
},
{
"name": "TeX",
"bytes": "320484"
},
{
"name": "Vim script",
"bytes": "17239"
},
{
"name": "Yacc",
"bytes": "163484"
}
],
"symlink_target": ""
} |
namespace ash {
namespace {
typedef test::AshTestBase WorkspaceLayoutManagerTest;
// Verifies that a window containing a restore coordinate will be restored to
// to the size prior to minimize, keeping the restore rectangle in tact (if
// there is one).
TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) {
scoped_ptr<aura::Window> window(
CreateTestWindowInShellWithBounds(gfx::Rect(1, 2, 3, 4)));
gfx::Rect bounds(10, 15, 25, 35);
window->SetBounds(bounds);
// This will not be used for un-minimizing window.
SetRestoreBoundsInScreen(window.get(), gfx::Rect(0, 0, 100, 100));
wm::MinimizeWindow(window.get());
wm::RestoreWindow(window.get());
EXPECT_EQ("0,0 100x100", GetRestoreBoundsInScreen(window.get())->ToString());
EXPECT_EQ("10,15 25x35", window.get()->bounds().ToString());
if (!SupportsMultipleDisplays())
return;
UpdateDisplay("400x300,500x400");
window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100),
ScreenAsh::GetSecondaryDisplay());
EXPECT_EQ(Shell::GetAllRootWindows()[1], window->GetRootWindow());
wm::MinimizeWindow(window.get());
// This will not be used for un-minimizing window.
SetRestoreBoundsInScreen(window.get(), gfx::Rect(0, 0, 100, 100));
wm::RestoreWindow(window.get());
EXPECT_EQ("600,0 100x100", window->GetBoundsInScreen().ToString());
// Make sure the unminimized window moves inside the display when
// 2nd display is disconnected.
wm::MinimizeWindow(window.get());
UpdateDisplay("400x300");
wm::RestoreWindow(window.get());
EXPECT_EQ(Shell::GetPrimaryRootWindow(), window->GetRootWindow());
EXPECT_TRUE(
Shell::GetPrimaryRootWindow()->bounds().Intersects(window->bounds()));
}
// WindowObserver implementation used by DontClobberRestoreBoundsWindowObserver.
// This code mirrors what BrowserFrameAura does. In particular when this code
// sees the window was maximized it changes the bounds of a secondary
// window. The secondary window mirrors the status window.
class DontClobberRestoreBoundsWindowObserver : public aura::WindowObserver {
public:
DontClobberRestoreBoundsWindowObserver() : window_(NULL) {}
void set_window(aura::Window* window) { window_ = window; }
virtual void OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) OVERRIDE {
if (!window_)
return;
if (wm::IsWindowMaximized(window)) {
aura::Window* w = window_;
window_ = NULL;
gfx::Rect shelf_bounds(Shell::GetPrimaryRootWindowController()->
GetShelfLayoutManager()->GetIdealBounds());
const gfx::Rect& window_bounds(w->bounds());
w->SetBounds(gfx::Rect(window_bounds.x(), shelf_bounds.y() - 1,
window_bounds.width(), window_bounds.height()));
}
}
private:
aura::Window* window_;
DISALLOW_COPY_AND_ASSIGN(DontClobberRestoreBoundsWindowObserver);
};
// Creates a window, maximized the window and from within the maximized
// notification sets the bounds of a window to overlap the shelf. Verifies this
// doesn't effect the restore bounds.
TEST_F(WorkspaceLayoutManagerTest, DontClobberRestoreBounds) {
DontClobberRestoreBoundsWindowObserver window_observer;
scoped_ptr<aura::Window> window(new aura::Window(NULL));
window->SetType(aura::client::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_TEXTURED);
window->SetBounds(gfx::Rect(10, 20, 30, 40));
// NOTE: for this test to exercise the failure the observer needs to be added
// before the parent set. This mimics what BrowserFrameAura does.
window->AddObserver(&window_observer);
SetDefaultParentByPrimaryRootWindow(window.get());
window->Show();
ash::wm::ActivateWindow(window.get());
scoped_ptr<aura::Window> window2(
CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 30, 40)));
window->AddTransientChild(window2.get());
window2->Show();
window_observer.set_window(window2.get());
wm::MaximizeWindow(window.get());
EXPECT_EQ("10,20 30x40", GetRestoreBoundsInScreen(window.get())->ToString());
window->RemoveObserver(&window_observer);
}
// Verifies when a window is maximized all descendant windows have a size.
TEST_F(WorkspaceLayoutManagerTest, ChildBoundsResetOnMaximize) {
scoped_ptr<aura::Window> window(
CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 30, 40)));
window->Show();
ash::wm::ActivateWindow(window.get());
scoped_ptr<aura::Window> child_window(
aura::test::CreateTestWindowWithBounds(gfx::Rect(5, 6, 7, 8),
window.get()));
child_window->Show();
ash::wm::MaximizeWindow(window.get());
EXPECT_EQ("5,6 7x8", child_window->bounds().ToString());
}
TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) {
// Normal window bounds shouldn't be changed.
gfx::Rect window_bounds(100, 100, 200, 200);
scoped_ptr<aura::Window> window(
CreateTestWindowInShellWithBounds(window_bounds));
EXPECT_EQ(window_bounds, window->bounds());
// If the window is out of the workspace, it would be moved on screen.
gfx::Rect root_window_bounds =
ash::Shell::GetInstance()->GetPrimaryRootWindow()->bounds();
window_bounds.Offset(root_window_bounds.width(), root_window_bounds.height());
ASSERT_FALSE(window_bounds.Intersects(root_window_bounds));
scoped_ptr<aura::Window> out_window(
CreateTestWindowInShellWithBounds(window_bounds));
EXPECT_EQ(window_bounds.size(), out_window->bounds().size());
gfx::Rect bounds = out_window->bounds();
bounds.Intersect(root_window_bounds);
// 2/3 of the window must be visible.
EXPECT_GT(bounds.width(), out_window->bounds().width() * 0.6);
EXPECT_GT(bounds.height(), out_window->bounds().height() * 0.6);
}
// Verifies the size of a window is enforced to be smaller than the work area.
TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) {
// Normal window bounds shouldn't be changed.
gfx::Size work_area(
Shell::GetScreen()->GetPrimaryDisplay().work_area().size());
const gfx::Rect window_bounds(
100, 101, work_area.width() + 1, work_area.height() + 2);
scoped_ptr<aura::Window> window(
CreateTestWindowInShellWithBounds(window_bounds));
EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(),
window->bounds().ToString());
// Directly setting the bounds triggers a slightly different code path. Verify
// that too.
window->SetBounds(window_bounds);
EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(),
window->bounds().ToString());
}
} // namespace
} // namespace ash
| {
"content_hash": "7b6d74c471e6b5f12affcb49f055b406",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 80,
"avg_line_length": 41.141975308641975,
"alnum_prop": 0.6978244561140285,
"repo_name": "jing-bao/pa-chromium",
"id": "30cdf6b098ed0003c3928d08e78c3f7bf868150b",
"size": "7335",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "ash/wm/workspace/workspace_layout_manager_unittest.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
package org.apache.karaf.eik.core.internal;
import org.apache.karaf.eik.core.KarafPlatformModel;
import org.apache.karaf.eik.core.KarafPlatformModelFactory;
import org.apache.karaf.eik.core.KarafPlatformValidator;
import org.apache.karaf.eik.core.model.GenericKarafPlatformModel;
import org.eclipse.core.runtime.IPath;
public class GenericKarafPlatformModelFactory implements KarafPlatformModelFactory {
private static final GenericKarafPlatformValidator platformValidator =
new GenericKarafPlatformValidator();
@Override
public KarafPlatformModel getPlatformModel(final IPath rootDirectory) {
if (!platformValidator.isValid(rootDirectory)) {
}
return new GenericKarafPlatformModel(rootDirectory);
}
@Override
public KarafPlatformValidator getPlatformValidator() {
return platformValidator;
}
}
| {
"content_hash": "0d2393fd2e4da373db0b9a06e023c96f",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 84,
"avg_line_length": 29.1,
"alnum_prop": 0.7800687285223368,
"repo_name": "apache/karaf-eik",
"id": "66641edc51e71a2f579224a853103a031eb345d3",
"size": "1680",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "plugins/org.apache.karaf.eik.core/src/main/java/org/apache/karaf/eik/core/internal/GenericKarafPlatformModelFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "40392"
},
{
"name": "HTML",
"bytes": "6668"
},
{
"name": "Java",
"bytes": "763548"
},
{
"name": "JavaScript",
"bytes": "28564"
}
],
"symlink_target": ""
} |
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Octokit.Tests.Integration.Clients
{
public class UserEmailsClientTests
{
private readonly IUserEmailsClient _emailClient;
public UserEmailsClientTests()
{
var github = Helper.GetAuthenticatedClient();
_emailClient = github.User.Email;
}
[IntegrationTest]
public async Task CanGetEmail()
{
var emails = await _emailClient.GetAll();
Assert.NotEmpty(emails);
}
[IntegrationTest]
public async Task CanGetEmailWithApiOptions()
{
var emails = await _emailClient.GetAll(ApiOptions.None);
Assert.NotEmpty(emails);
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfEmailsWithoutStart()
{
var options = new ApiOptions
{
PageSize = 5,
PageCount = 1
};
var emails = await _emailClient.GetAll(options);
Assert.NotEmpty(emails);
}
const string testEmailAddress = "hahaha-not-a-real-email@foo.com";
[IntegrationTest(Skip = "this isn't passing in CI - i hate past me right now")]
public async Task CanAddAndDeleteEmail()
{
var github = Helper.GetAuthenticatedClient();
await github.User.Email.Add(testEmailAddress);
var emails = await github.User.Email.GetAll();
Assert.Contains(testEmailAddress, emails.Select(x => x.Email));
await github.User.Email.Delete(testEmailAddress);
emails = await github.User.Email.GetAll();
Assert.DoesNotContain(testEmailAddress, emails.Select(x => x.Email));
}
}
}
| {
"content_hash": "ac556f422bdd78d3bb2c88129709d340",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 87,
"avg_line_length": 28.61904761904762,
"alnum_prop": 0.5923460898502496,
"repo_name": "M-Zuber/octokit.net",
"id": "492132ceda549321420f7c6308621afc8de0d320",
"size": "1805",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "6982586"
},
{
"name": "PowerShell",
"bytes": "10952"
},
{
"name": "Shell",
"bytes": "270"
}
],
"symlink_target": ""
} |
#ifndef _SYS_IPC_H
#define _SYS_IPC_H 1
#include <features.h>
/* Get system dependent definition of `struct ipc_perm' and more. */
#include <bits/ipctypes.h>
#include <bits/ipc.h>
#ifndef __uid_t_defined
typedef __uid_t uid_t;
# define __uid_t_defined
#endif
#ifndef __gid_t_defined
typedef __gid_t gid_t;
# define __gid_t_defined
#endif
#ifndef __mode_t_defined
typedef __mode_t mode_t;
# define __mode_t_defined
#endif
#ifndef __key_t_defined
typedef __key_t key_t;
# define __key_t_defined
#endif
__BEGIN_DECLS
/* Generates key for System V style IPC. */
extern key_t ftok (const char *__pathname, int __proj_id) __THROW;
__END_DECLS
#endif /* sys/ipc.h */ | {
"content_hash": "e5aafbeda29da8410fbe722e232d922d",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 69,
"avg_line_length": 17.256410256410255,
"alnum_prop": 0.6731054977711739,
"repo_name": "raulgrell/zig",
"id": "3815ee9809dde8cdb2776ddb012fe7d1d056554e",
"size": "1461",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/libc/include/generic-glibc/sys/ipc.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1187"
},
{
"name": "C",
"bytes": "187893"
},
{
"name": "C++",
"bytes": "3749750"
},
{
"name": "CMake",
"bytes": "38091"
},
{
"name": "HTML",
"bytes": "15836"
},
{
"name": "JavaScript",
"bytes": "73253"
},
{
"name": "Shell",
"bytes": "17887"
},
{
"name": "Zig",
"bytes": "17407339"
}
],
"symlink_target": ""
} |
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">{{site.title}}</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="hidden">
<a href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#overview">Overview</a>
</li>
<li>
<a class="page-scroll" href="#organizers">Organizers</a>
</li>
<li>
<a class="page-scroll" href="#participants">Participants</a>
</li>
<li>
<a class="page-scroll" href="#registration">Registration</a>
</li>
<li>
<a class="page-scroll" href="#funding">Funding</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!-- Header -->
<header>
<div class="container">
<div class="intro-text">
<!-- <div class="team-member">
<img src="img/team/johnmclevey.jpg" class="img-responsive img-circle" alt="">
</div> -->
<div class="intro-lead-in">Challenges and Opportunities for Governance of Socio-Ecological Systems in Comparative Perspective</div>
<a href="#overview" class="page-scroll btn btn-xl">Learn More</a>
<p>Photo Credit: Maris Mezulis</p>
</div>
</div>
</header>
<!--
{% for page in site.pages %}
{% if page.title %}<a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>{% endif %}
{% endfor %}
-->
| {
"content_hash": "4b4cf647b4b8cea6d6f7f87e89902734",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 147,
"avg_line_length": 41.890625,
"alnum_prop": 0.45318910854158895,
"repo_name": "challengesopportunitiesenv/challengesopportunitiesenv.github.io",
"id": "0b247c83e0cde32ea1628ce1225717c557ce4908",
"size": "2681",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_includes/header.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "27625"
},
{
"name": "HTML",
"bytes": "73523"
},
{
"name": "JavaScript",
"bytes": "85512"
}
],
"symlink_target": ""
} |
#include "regionbase.h"
#define SysBase RegionBase->SysBase
#define MEMCHECK(reg, rect, firstrect){\
if ((reg)->numRects >= ((reg)->size - 1)){\
(firstrect) = Realloc(RegionBase,\
(firstrect), ((sizeof(Rect)) * ((reg)->size)), \
(2 * (sizeof(Rect)) * ((reg)->size)));\
if ((firstrect) == 0)\
return;\
(reg)->size *= 2;\
(rect) = &(firstrect)[(reg)->numRects];\
}\
}
typedef void (*REGION_OverlapBandFunctionPtr) (RegionBase *RegionBase, ClipRegion * pReg, Rect * r1, Rect * r1End, Rect * r2, Rect * r2End, INT32 top, INT32 bottom);
typedef void (*REGION_NonOverlapBandFunctionPtr) (RegionBase *RegionBase, ClipRegion * pReg, Rect * r, Rect * end, INT32 top, INT32 bottom);
static void REGION_SetExtents (RegionBase *RegionBase, ClipRegion *pReg)
{
Rect *pRect, *pRectEnd, *pExtents;
if (pReg->numRects == 0)
{
pReg->extents.left = 0;
pReg->extents.top = 0;
pReg->extents.right = 0;
pReg->extents.bottom = 0;
return;
}
pExtents = &pReg->extents;
pRect = pReg->rects;
pRectEnd = &pRect[pReg->numRects - 1];
/*
* Since pRect is the first rectangle in the region, it must have the
* smallest top and since pRectEnd is the last rectangle in the region,
* it must have the largest bottom, because of banding. Initialize left and
* right from pRect and pRectEnd, resp., as good things to initialize them
* to...
*/
pExtents->left = pRect->left;
pExtents->top = pRect->top;
pExtents->right = pRectEnd->right;
pExtents->bottom = pRectEnd->bottom;
while (pRect <= pRectEnd)
{
if (pRect->left < pExtents->left) pExtents->left = pRect->left;
if (pRect->right > pExtents->right) pExtents->right = pRect->right;
pRect++;
}
}
/* *********************************************************************
* REGION_Coalesce
*
* Attempt to merge the rects in the current band with those in the
* previous one. Used only by REGION_RegionOp.
*
* Results:
* The new index for the previous band.
*
* Side Effects:
* If coalescing takes place:
* - rectangles in the previous band will have their bottom fields
* altered.
* - pReg->numRects will be decreased.
*
*/
static INT32 REGION_Coalesce (RegionBase *RegionBase,
ClipRegion *pReg, /* Region to coalesce */
INT32 prevStart, /* Index of start of previous band */
INT32 curStart /* Index of start of current band */
) {
Rect *pPrevRect; /* Current rect in previous band */
Rect *pCurRect; /* Current rect in current band */
Rect *pRegEnd; /* End of region */
INT32 curNumRects; /* Number of rectangles in current band */
INT32 prevNumRects; /* Number of rectangles in previous band */
INT32 bandtop; /* top coordinate for current band */
pRegEnd = &pReg->rects[pReg->numRects];
pPrevRect = &pReg->rects[prevStart];
prevNumRects = curStart - prevStart;
/*
* Figure out how many rectangles are in the current band. Have to do
* this because multiple bands could have been added in REGION_RegionOp
* at the end when one region has been exhausted.
*/
pCurRect = &pReg->rects[curStart];
bandtop = pCurRect->top;
for (curNumRects = 0; (pCurRect != pRegEnd) && (pCurRect->top == bandtop); curNumRects++)
{
pCurRect++;
}
if (pCurRect != pRegEnd)
{
/*
* If more than one band was added, we have to find the start
* of the last band added so the next coalescing job can start
* at the right place... (given when multiple bands are added,
* this may be pointless -- see above).
*/
pRegEnd--;
while (pRegEnd[-1].top == pRegEnd->top)
{
pRegEnd--;
}
curStart = pRegEnd - pReg->rects;
pRegEnd = pReg->rects + pReg->numRects;
}
if ((curNumRects == prevNumRects) && (curNumRects != 0))
{
pCurRect -= curNumRects;
/*
* The bands may only be coalesced if the bottom of the previous
* matches the top scanline of the current.
*/
if (pPrevRect->bottom == pCurRect->top)
{
/*
* Make sure the bands have rects in the same places. This
* assumes that rects have been added in such a way that they
* cover the most area possible. I.e. two rects in a band must
* have some horizontal space between them.
*/
do
{
if ((pPrevRect->left != pCurRect->left) ||
(pPrevRect->right != pCurRect->right))
{
/*
* The bands don't line up so they can't be coalesced.
*/
return (curStart);
}
pPrevRect++;
pCurRect++;
prevNumRects -= 1;
} while (prevNumRects != 0);
pReg->numRects -= curNumRects;
pCurRect -= curNumRects;
pPrevRect -= curNumRects;
/*
* The bands may be merged, so set the bottom of each rect
* in the previous band to that of the corresponding rect in
* the current band.
*/
do
{
pPrevRect->bottom = pCurRect->bottom;
pPrevRect++;
pCurRect++;
curNumRects -= 1;
} while (curNumRects != 0);
/*
* If only one band was added to the region, we have to backup
* curStart to the start of the previous band.
*
* If more than one band was added to the region, copy the
* other bands down. The assumption here is that the other bands
* came from the same region as the current one and no further
* coalescing can be done on them since it's all been done
* already... curStart is already in the right place.
*/
if (pCurRect == pRegEnd)
{
curStart = prevStart;
} else {
do
{
*pPrevRect++ = *pCurRect++;
} while (pCurRect != pRegEnd);
}
}
}
return (curStart);
}
/* *********************************************************************
* REGION_RegionOp
*
* Apply an operation to two regions. Called by GdUnion,
* GdXor, GdSubtract, GdIntersect...
*
* Results:
* None.
*
* Side Effects:
* The new region is overwritten.
*
* Notes:
* The idea behind this function is to view the two regions as sets.
* Together they cover a rectangle of area that this function divides
* into horizontal bands where points are covered only by one region
* or by both. For the first case, the nonOverlapFunc is called with
* each the band and the band's upper and lower extents. For the
* second, the overlapFunc is called to process the entire band. It
* is responsible for clipping the rectangles in the band, though
* this function provides the boundaries.
* At the end of each band, the new region is coalesced, if possible,
* to reduce the number of rectangles in the region.
*
*/
static void REGION_RegionOp(
RegionBase *RegionBase,
ClipRegion *newReg, /* Place to store result */
ClipRegion *reg1, /* First region in operation */
ClipRegion *reg2, /* 2nd region in operation */
REGION_OverlapBandFunctionPtr overlapFunc, /* Function to call for over-lapping bands */
REGION_NonOverlapBandFunctionPtr nonOverlap1Func, /* Function to call for non-overlapping bands in region 1 */
REGION_NonOverlapBandFunctionPtr nonOverlap2Func /* Function to call for non-overlapping bands in region 2 */
) {
Rect *r1; /* Pointer into first region */
Rect *r2; /* Pointer into 2d region */
Rect *r1End; /* End of 1st region */
Rect *r2End; /* End of 2d region */
INT32 ybot; /* Bottom of intersection */
INT32 ytop; /* Top of intersection */
Rect *oldRects; /* Old rects for newReg */
INT32 prevBand; /* Index of start of
* previous band in newReg */
INT32 curBand; /* Index of start of current
* band in newReg */
Rect *r1BandEnd; /* End of current band in r1 */
Rect *r2BandEnd; /* End of current band in r2 */
INT32 top; /* Top of non-overlapping band */
INT32 bot; /* Bottom of non-overlapping band */
/*
* Initialization:
* set r1, r2, r1End and r2End appropriately, preserve the important
* parts of the destination region until the end in case it's one of
* the two source regions, then mark the "new" region empty, allocating
* another array of rectangles for it to use.
*/
r1 = reg1->rects;
r2 = reg2->rects;
r1End = r1 + reg1->numRects;
r2End = r2 + reg2->numRects;
/*
* newReg may be one of the src regions so we can't empty it. We keep a
* note of its rects pointer (so that we can free them later), preserve its
* extents and simply set numRects to zero.
*/
oldRects = newReg->rects;
newReg->numRects = 0;
/*
* Allocate a reasonable number of rectangles for the new region. The idea
* is to allocate enough so the individual functions don't need to
* reallocate and copy the array, which is time consuming, yet we don't
* have to worry about using too much memory. I hope to be able to
* nuke the GdRealloc() at the end of this function eventually.
*/
newReg->size = MAX(reg1->numRects,reg2->numRects) * 2;
if (! (newReg->rects = AllocVec(( sizeof(Rect) * newReg->size ), MEMF_CLEAR|MEMF_FAST)))
{
newReg->size = 0;
return;
}
/*
* Initialize ybot and ytop.
* In the upcoming loop, ybot and ytop serve different functions depending
* on whether the band being handled is an overlapping or non-overlapping
* band.
* In the case of a non-overlapping band (only one of the regions
* has points in the band), ybot is the bottom of the most recent
* intersection and thus clips the top of the rectangles in that band.
* ytop is the top of the next intersection between the two regions and
* serves to clip the bottom of the rectangles in the current band.
* For an overlapping band (where the two regions intersect), ytop clips
* the top of the rectangles of both regions and ybot clips the bottoms.
*/
if (reg1->extents.top < reg2->extents.top) ybot = reg1->extents.top;
else ybot = reg2->extents.top;
/*
* prevBand serves to mark the start of the previous band so rectangles
* can be coalesced into larger rectangles. qv. miCoalesce, above.
* In the beginning, there is no previous band, so prevBand == curBand
* (curBand is set later on, of course, but the first band will always
* start at index 0). prevBand and curBand must be indices because of
* the possible expansion, and resultant moving, of the new region's
* array of rectangles.
*/
prevBand = 0;
do
{
curBand = newReg->numRects;
/*
* This algorithm proceeds one source-band (as opposed to a
* destination band, which is determined by where the two regions
* intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
* rectangle after the last one in the current band for their
* respective regions.
*/
r1BandEnd = r1;
while ((r1BandEnd != r1End) && (r1BandEnd->top == r1->top))
{
r1BandEnd++;
}
r2BandEnd = r2;
while ((r2BandEnd != r2End) && (r2BandEnd->top == r2->top))
{
r2BandEnd++;
}
/*
* First handle the band that doesn't intersect, if any.
*
* Note that attention is restricted to one band in the
* non-intersecting region at once, so if a region has n
* bands between the current position and the next place it overlaps
* the other, this entire loop will be passed through n times.
*/
if (r1->top < r2->top)
{
top = MAX(r1->top,ybot);
bot = MIN(r1->bottom,r2->top);
if ((top != bot) && (nonOverlap1Func != (void (*)())NULL))
{
(* nonOverlap1Func) (RegionBase, newReg, r1, r1BandEnd, top, bot);
}
ytop = r2->top;
}
else if (r2->top < r1->top)
{
top = MAX(r2->top,ybot);
bot = MIN(r2->bottom,r1->top);
if ((top != bot) && (nonOverlap2Func != (void (*)())NULL))
{
(* nonOverlap2Func) (RegionBase, newReg, r2, r2BandEnd, top, bot);
}
ytop = r1->top;
}
else
{
ytop = r1->top;
}
/*
* If any rectangles got added to the region, try and coalesce them
* with rectangles from the previous band. Note we could just do
* this test in miCoalesce, but some machines incur a not
* inconsiderable cost for function calls, so...
*/
if (newReg->numRects != curBand)
{
prevBand = REGION_Coalesce (RegionBase, newReg, prevBand, curBand);
}
/*
* Now see if we've hit an intersecting band. The two bands only
* intersect if ybot > ytop
*/
ybot = MIN(r1->bottom, r2->bottom);
curBand = newReg->numRects;
if (ybot > ytop)
{
(* overlapFunc) (RegionBase, newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
}
if (newReg->numRects != curBand)
{
prevBand = REGION_Coalesce (RegionBase, newReg, prevBand, curBand);
}
/*
* If we've finished with a band (bottom == ybot) we skip forward
* in the region to the next band.
*/
if (r1->bottom == ybot)
{
r1 = r1BandEnd;
}
if (r2->bottom == ybot)
{
r2 = r2BandEnd;
}
} while ((r1 != r1End) && (r2 != r2End));
/*
* Deal with whichever region still has rectangles left.
*/
curBand = newReg->numRects;
if (r1 != r1End)
{
if (nonOverlap1Func != (void (*)())NULL)
{
do
{
r1BandEnd = r1;
while ((r1BandEnd < r1End) && (r1BandEnd->top == r1->top))
{
r1BandEnd++;
}
(* nonOverlap1Func) (RegionBase, newReg, r1, r1BandEnd, MAX(r1->top,ybot), r1->bottom);
r1 = r1BandEnd;
} while (r1 != r1End);
}
} else if ((r2 != r2End) && (nonOverlap2Func != (void (*)())NULL))
{
do
{
r2BandEnd = r2;
while ((r2BandEnd < r2End) && (r2BandEnd->top == r2->top))
{
r2BandEnd++;
}
(* nonOverlap2Func) (RegionBase, newReg, r2, r2BandEnd, MAX(r2->top,ybot), r2->bottom);
r2 = r2BandEnd;
} while (r2 != r2End);
}
if (newReg->numRects != curBand)
{
(void) REGION_Coalesce (RegionBase, newReg, prevBand, curBand);
}
/*
* A bit of cleanup. To keep regions from growing without bound,
* we shrink the array of rectangles to match the new number of
* rectangles in the region. This never goes to 0, however...
*
* Only do this stuff if the number of rectangles allocated is more than
* twice the number of rectangles in the region (a simple optimization...).
*/
if (newReg->numRects < (newReg->size >> 1))
{
if (REGION_NOT_EMPTY(newReg))
{
Rect *prev_rects = newReg->rects;
newReg->rects = Realloc( RegionBase, newReg->rects, sizeof(Rect) * newReg->size, sizeof(Rect) * newReg->numRects );
newReg->size = newReg->numRects;
if (! newReg->rects)
newReg->rects = prev_rects;
}
else
{
/*
* No point in doing the extra work involved in an Xrealloc if
* the region is empty
*/
newReg->size = 1;
FreeVec( newReg->rects );
newReg->rects = AllocVec( sizeof(Rect), MEMF_FAST|MEMF_CLEAR );
}
}
FreeVec( oldRects );
}
/* *********************************************************************
* Region Intersection
***********************************************************************/
/* *********************************************************************
* REGION_IntersectO
*
* Handle an overlapping band for REGION_Intersect.
*
* Results:
* None.
*
* Side Effects:
* Rectangles may be added to the region.
*
*/
static void REGION_IntersectO(RegionBase *RegionBase, ClipRegion *pReg, Rect *r1, Rect *r1End,
Rect *r2, Rect *r2End, INT32 top, INT32 bottom)
{
INT32 left, right;
Rect *pNextRect;
pNextRect = &pReg->rects[pReg->numRects];
while ((r1 != r1End) && (r2 != r2End))
{
left = MAX(r1->left, r2->left);
right = MIN(r1->right, r2->right);
/*
* If there's any overlap between the two rectangles, add that
* overlap to the new region.
* There's no need to check for subsumption because the only way
* such a need could arise is if some region has two rectangles
* right next to each other. Since that should never happen...
*/
if (left < right)
{
MEMCHECK(pReg, pNextRect, pReg->rects);
pNextRect->left = left;
pNextRect->top = top;
pNextRect->right = right;
pNextRect->bottom = bottom;
pReg->numRects += 1;
pNextRect++;
}
/*
* Need to advance the pointers. Shift the one that extends
* to the right the least, since the other still has a chance to
* overlap with that region's next rectangle, if you see what I mean.
*/
if (r1->right < r2->right)
{
r1++;
}
else if (r2->right < r1->right)
{
r2++;
}
else
{
r1++;
r2++;
}
}
}
/**
* Finds the intersection of two regions - i.e. the places where
* they overlap.
*
* @param newReg Output region. May be one of the source regions.
* @param reg1 Source region.
* @param reg2 Source region.
*/
void reg_IntersectRegion(RegionBase *RegionBase, ClipRegion *newReg, ClipRegion *reg1, ClipRegion *reg2)
{
/* check for trivial reject */
if ( (!(reg1->numRects)) || (!(reg2->numRects)) || (!EXTENTCHECK(®1->extents, ®2->extents)))
newReg->numRects = 0;
else
REGION_RegionOp (RegionBase, newReg, reg1, reg2, REGION_IntersectO, NULL, NULL);
/*
* Can't alter newReg's extents before we call miRegionOp because
* it might be one of the source regions and miRegionOp depends
* on the extents of those regions being the same. Besides, this
* way there's no checking against rectangles that will be nuked
* due to coalescing, so we have to examine fewer rectangles.
*/
REGION_SetExtents(RegionBase, newReg);
newReg->type = (newReg->numRects) ? REGION_COMPLEX : REGION_NULL ;
}
/* *********************************************************************
* Region Union
***********************************************************************/
/* *********************************************************************
* REGION_UnionNonO
*
* Handle a non-overlapping band for the union operation. Just
* Adds the rectangles into the region. Doesn't have to check for
* subsumption or anything.
*
* Results:
* None.
*
* Side Effects:
* pReg->numRects is incremented and the final rectangles overwritten
* with the rectangles we're passed.
*
*/
static void REGION_UnionNonO(RegionBase *RegionBase, ClipRegion *pReg,Rect *r,Rect *rEnd,INT32 top, INT32 bottom)
{
Rect *pNextRect;
pNextRect = &pReg->rects[pReg->numRects];
while (r != rEnd)
{
MEMCHECK(pReg, pNextRect, pReg->rects);
pNextRect->left = r->left;
pNextRect->top = top;
pNextRect->right = r->right;
pNextRect->bottom = bottom;
pReg->numRects += 1;
pNextRect++;
r++;
}
}
/* *********************************************************************
* REGION_UnionO
*
* Handle an overlapping band for the union operation. Picks the
* left-most rectangle each time and merges it into the region.
*
* Results:
* None.
*
* Side Effects:
* Rectangles are overwritten in pReg->rects and pReg->numRects will
* be changed.
*
*/
#define MERGERECT(r) \
if ((pReg->numRects != 0) && \
(pNextRect[-1].top == top) && \
(pNextRect[-1].bottom == bottom) && \
(pNextRect[-1].right >= r->left)) \
{ \
if (pNextRect[-1].right < r->right) \
{ \
pNextRect[-1].right = r->right; \
} \
} \
else \
{ \
MEMCHECK(pReg, pNextRect, pReg->rects); \
pNextRect->top = top; \
pNextRect->bottom = bottom; \
pNextRect->left = r->left; \
pNextRect->right = r->right; \
pReg->numRects += 1; \
pNextRect += 1; \
} \
r++;
static void REGION_UnionO(RegionBase *RegionBase, ClipRegion *pReg, Rect *r1, Rect *r1End, Rect *r2, Rect *r2End, INT32 top, INT32 bottom)
{
Rect *pNextRect;
pNextRect = &pReg->rects[pReg->numRects];
while ((r1 != r1End) && (r2 != r2End))
{
if (r1->left < r2->left)
{
MERGERECT(r1);
}
else
{
MERGERECT(r2);
}
}
if (r1 != r1End)
{
do
{
MERGERECT(r1);
} while (r1 != r1End);
}
else while (r2 != r2End)
{
MERGERECT(r2);
}
}
/**
* Finds the union of two regions - i.e. the places which are
* in either reg1 or reg2 or both.
*
* @param newReg Output region. May be one of the source regions.
* @param reg1 Source region.
* @param reg2 Source region.
*/
void reg_UnionRegion(RegionBase *RegionBase, ClipRegion *newReg, ClipRegion *reg1, ClipRegion *reg2)
{
/* checks all the simple cases */
/*
* Region 1 and 2 are the same or region 1 is empty
*/
if ( (reg1 == reg2) || (!(reg1->numRects)) )
{
if (newReg != reg2) CopyRegion(newReg, reg2);
return;
}
/*
* if nothing to union (region 2 empty)
*/
if (!(reg2->numRects))
{
if (newReg != reg1) CopyRegion(newReg, reg1);
return;
}
/*
* Region 1 completely subsumes region 2
*/
if ((reg1->numRects == 1) &&
(reg1->extents.left <= reg2->extents.left) &&
(reg1->extents.top <= reg2->extents.top) &&
(reg1->extents.right >= reg2->extents.right) &&
(reg1->extents.bottom >= reg2->extents.bottom))
{
if (newReg != reg1) CopyRegion(newReg, reg1);
return;
}
/*
* Region 2 completely subsumes region 1
*/
if ((reg2->numRects == 1) &&
(reg2->extents.left <= reg1->extents.left) &&
(reg2->extents.top <= reg1->extents.top) &&
(reg2->extents.right >= reg1->extents.right) &&
(reg2->extents.bottom >= reg1->extents.bottom))
{
if (newReg != reg2) CopyRegion(newReg, reg2);
return;
}
REGION_RegionOp (RegionBase, newReg, reg1, reg2, REGION_UnionO, REGION_UnionNonO, REGION_UnionNonO);
newReg->extents.left = MIN(reg1->extents.left, reg2->extents.left);
newReg->extents.top = MIN(reg1->extents.top, reg2->extents.top);
newReg->extents.right = MAX(reg1->extents.right, reg2->extents.right);
newReg->extents.bottom = MAX(reg1->extents.bottom, reg2->extents.bottom);
newReg->type = (newReg->numRects) ? REGION_COMPLEX : REGION_NULL ;
}
/* *********************************************************************
* Region Subtraction
***********************************************************************/
/* *********************************************************************
* REGION_SubtractNonO1
*
* Deal with non-overlapping band for subtraction. Any parts from
* region 2 we discard. Anything from region 1 we add to the region.
*
* Results:
* None.
*
* Side Effects:
* pReg may be affected.
*
*/
static void REGION_SubtractNonO1(RegionBase *RegionBase, ClipRegion *pReg, Rect *r, Rect *rEnd, INT32 top, INT32 bottom)
{
Rect *pNextRect;
pNextRect = &pReg->rects[pReg->numRects];
while (r != rEnd)
{
MEMCHECK(pReg, pNextRect, pReg->rects);
pNextRect->left = r->left;
pNextRect->top = top;
pNextRect->right = r->right;
pNextRect->bottom = bottom;
pReg->numRects += 1;
pNextRect++;
r++;
}
}
/* *********************************************************************
* REGION_SubtractO
*
* Overlapping band subtraction. x1 is the left-most point not yet
* checked.
*
* Results:
* None.
*
* Side Effects:
* pReg may have rectangles added to it.
*
*/
static void REGION_SubtractO(RegionBase *RegionBase, ClipRegion *pReg, Rect *r1, Rect *r1End, Rect *r2, Rect *r2End, INT32 top, INT32 bottom)
{
Rect *pNextRect;
INT32 left;
left = r1->left;
pNextRect = &pReg->rects[pReg->numRects];
while ((r1 != r1End) && (r2 != r2End))
{
if (r2->right <= left)
{
/*
* Subtrahend missed the boat: go to next subtrahend.
*/
r2++;
}
else if (r2->left <= left)
{
/*
* Subtrahend preceeds minuend: nuke left edge of minuend.
*/
left = r2->right;
if (left >= r1->right)
{
/*
* Minuend completely covered: advance to next minuend and
* reset left fence to edge of new minuend.
*/
r1++;
if (r1 != r1End)
left = r1->left;
}
else
{
/*
* Subtrahend now used up since it doesn't extend beyond
* minuend
*/
r2++;
}
}
else if (r2->left < r1->right)
{
/*
* Left part of subtrahend covers part of minuend: add uncovered
* part of minuend to region and skip to next subtrahend.
*/
MEMCHECK(pReg, pNextRect, pReg->rects);
pNextRect->left = left;
pNextRect->top = top;
pNextRect->right = r2->left;
pNextRect->bottom = bottom;
pReg->numRects += 1;
pNextRect++;
left = r2->right;
if (left >= r1->right)
{
/*
* Minuend used up: advance to new...
*/
r1++;
if (r1 != r1End)
left = r1->left;
}
else
{
/*
* Subtrahend used up
*/
r2++;
}
}
else
{
/*
* Minuend used up: add any remaining piece before advancing.
*/
if (r1->right > left)
{
MEMCHECK(pReg, pNextRect, pReg->rects);
pNextRect->left = left;
pNextRect->top = top;
pNextRect->right = r1->right;
pNextRect->bottom = bottom;
pReg->numRects += 1;
pNextRect++;
}
r1++;
left = r1->left;
}
}
/*
* Add remaining minuend rectangles to region.
*/
while (r1 != r1End)
{
MEMCHECK(pReg, pNextRect, pReg->rects);
pNextRect->left = left;
pNextRect->top = top;
pNextRect->right = r1->right;
pNextRect->bottom = bottom;
pReg->numRects += 1;
pNextRect++;
r1++;
if (r1 != r1End)
{
left = r1->left;
}
}
}
/**
* Finds the difference of two regions (regM - regS) - i.e. the
* places which are in regM but not regS.
*
* @param regD Output (Difference) region. May be one of the source regions.
* @param regM Source (Minuend) region - the region to subtract from.
* @param regS Source (Subtrahend) region - the region we subtract.
*/
void reg_SubtractRegion(RegionBase *RegionBase, ClipRegion *regD, ClipRegion *regM, ClipRegion *regS )
{
/* check for trivial reject */
if ( (!(regM->numRects)) || (!(regS->numRects)) ||
(!EXTENTCHECK(®M->extents, ®S->extents)) )
{
CopyRegion(regD, regM);
return;
}
REGION_RegionOp (RegionBase, regD, regM, regS, REGION_SubtractO, REGION_SubtractNonO1, NULL);
/*
* Can't alter newReg's extents before we call miRegionOp because
* it might be one of the source regions and miRegionOp depends
* on the extents of those regions being the unaltered. Besides, this
* way there's no checking against rectangles that will be nuked
* due to coalescing, so we have to examine fewer rectangles.
*/
REGION_SetExtents (RegionBase, regD);
regD->type = (regD->numRects) ? REGION_COMPLEX : REGION_NULL ;
}
| {
"content_hash": "0fcde8e201b052ab56ab5eff653f3130",
"timestamp": "",
"source": "github",
"line_count": 938,
"max_line_length": 165,
"avg_line_length": 28.904051172707888,
"alnum_prop": 0.5901077013868398,
"repo_name": "cycl0ne/poweros_x86",
"id": "04253f9298840cc462689154f19e8611231c4ced",
"size": "27112",
"binary": false,
"copies": "1",
"ref": "refs/heads/v0.2",
"path": "lib/region/region.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "7429"
},
{
"name": "C",
"bytes": "1784150"
},
{
"name": "C++",
"bytes": "65092"
},
{
"name": "Makefile",
"bytes": "25544"
},
{
"name": "Objective-C",
"bytes": "5379"
},
{
"name": "Shell",
"bytes": "2437"
}
],
"symlink_target": ""
} |
package hu.webarticum.treeprinter.misc.fs;
import java.io.File;
import java.text.DecimalFormat;
import hu.webarticum.treeprinter.TreeNode;
import hu.webarticum.treeprinter.decorator.AbstractTreeNodeDecorator;
import hu.webarticum.treeprinter.text.ConsoleText;
/**
* Decorator for {@link FsTreeNode} that displays more information
*/
public class DefaultFsTreeNodeDecorator extends AbstractTreeNodeDecorator {
public DefaultFsTreeNodeDecorator(TreeNode baseNode) {
super(baseNode);
}
public DefaultFsTreeNodeDecorator(TreeNode baseNode, boolean inherit) {
super(baseNode, inherit);
}
public DefaultFsTreeNodeDecorator(TreeNode baseNode, boolean inherit, boolean decorable) {
super(baseNode, inherit, decorable);
}
@Override
public ConsoleText decoratedContent() {
if (baseNode instanceof FsTreeNode) {
FsTreeNode fsNode = (FsTreeNode) baseNode;
File file = fsNode.getFile();
if (file.isDirectory()) {
return ConsoleText.of(" " + file.getName() + "/");
} else {
return ConsoleText.of(" " + file.getName() + " (" + formatFileSize(file.length()) + ")");
}
} else {
return baseNode.content();
}
}
@Override
protected TreeNode wrapChild(TreeNode childNode, int index) {
return new DefaultFsTreeNodeDecorator(childNode, decorable, inherit);
}
protected String formatFileSize(long fileSize) {
String[] suffixes = new String[]{" KB", " MB", " GB", " TB"};
double floatingSize = fileSize;
String suffix = " b";
for (String _suffix: suffixes) {
if (floatingSize > 850) {
floatingSize /= 1024;
suffix = _suffix;
}
}
return new DecimalFormat("#.##").format(floatingSize) + suffix;
}
}
| {
"content_hash": "cf9b7ba9c5fb9960b36de1347854bfd7",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 105,
"avg_line_length": 31.491803278688526,
"alnum_prop": 0.6220718375845914,
"repo_name": "davidsusu/tree-printer",
"id": "fbaac5e219d8f8da6207263f75edf2dd5e94c15a",
"size": "1921",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/hu/webarticum/treeprinter/misc/fs/DefaultFsTreeNodeDecorator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "144482"
}
],
"symlink_target": ""
} |
``` bash
cd /tmp
git clone https://github.com/studiofact/git-sandbox.git
cd git-sandbox
sudo make install
# Одной командой
(cd /tmp && git clone https://github.com/studiofact/git-sandbox.git && cd git-sandbox && sudo make install)
```
## Список утилит
- `project-add`
- `project-remove`
- `sandbox-add`
- `sandbox-remove`
- `user-add`
- `user-remove`
- `virtualhost-add`
- `virtualhost-remove`
## Структура проектов
``` code
/home
/dev # Каталог с проектами
/project1
/project2
/user1
/www # Песочницы для пользователя user1
/project1
/httpdocs
/project2
/httpdocs
/user2
/www # Песочницы для пользователя user2
/project1
/httpdocs
/project2
/httpdocs
```
## Наименование виртуальных хостов
- Проект `http://project.host.domain`
- Песочницы `http://user.project.host.domain` | {
"content_hash": "c8a06b0731e34965313efa58dc45f704",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 107,
"avg_line_length": 17.591836734693878,
"alnum_prop": 0.6566125290023201,
"repo_name": "studiofact/git-sandbox",
"id": "27552b667c5d60aa0784dae7770f1d8d42723ed8",
"size": "1035",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "13341"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "bb95c05f1a1fcdc0c13556c74db9dcd4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "a80499cc8373ba38a6ff4c2e0a1c2293b93b39f9",
"size": "195",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Asparagaceae/Manfreda/Manfreda variegata/ Syn. Polianthes variegata/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("08Numbers1ToN")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("08Numbers1ToN")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("471f7188-04bb-412f-9859-c7cc23051927")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "6df41be0511987507cedc693fb324d1f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 38.861111111111114,
"alnum_prop": 0.7455325232308792,
"repo_name": "Vladeff/TelerikAcademy",
"id": "e12363f6856382a9c9f5a44327b9140e2351211d",
"size": "1402",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "C#1 Homework/Console Input Output/08Numbers1ToN/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "606478"
},
{
"name": "Visual Basic",
"bytes": "7313"
}
],
"symlink_target": ""
} |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using AutoyaFramework;
using AutoyaFramework.AssetBundles;
using AutoyaFramework.Settings.AssetBundles;
using AutoyaFramework.Settings.Auth;
using Miyamasu;
using UnityEngine;
using UnityEngine.SceneManagement;
public class AssetBundlesImplementationTests : MiyamasuTestRunner
{
private string abListDlPath = "https://raw.githubusercontent.com/sassembla/Autoya/master/AssetBundles/";
[MSetup]
public IEnumerator Setup()
{
var discarded = false;
// delete assetBundleList anyway.
Autoya.AssetBundle_DiscardAssetBundleList(
() =>
{
discarded = true;
},
(code, reason) =>
{
switch (code)
{
case Autoya.AssetBundlesError.NeedToDownloadAssetBundleList:
{
discarded = true;
break;
}
default:
{
Fail("code:" + code + " reason:" + reason);
break;
}
}
}
);
yield return WaitUntil(
() => discarded,
() => { throw new TimeoutException("too late."); }
);
var listExists = Autoya.AssetBundle_IsAssetBundleFeatureReady();
True(!listExists, "exists, not intended.");
True(Caching.ClearCache(), "failed to clean cache.");
Autoya.Debug_Manifest_RenewRuntimeManifest();
}
[MTeardown]
public IEnumerator Teardown()
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
var discarded = false;
// delete assetBundleList anyway.
Autoya.AssetBundle_DiscardAssetBundleList(
() =>
{
discarded = true;
},
(code, reason) =>
{
switch (code)
{
case Autoya.AssetBundlesError.NeedToDownloadAssetBundleList:
{
discarded = true;
break;
}
default:
{
Fail("code:" + code + " reason:" + reason);
break;
}
}
}
);
yield return WaitUntil(
() => discarded,
() => { throw new TimeoutException("too late."); }
);
var listExists = Autoya.AssetBundle_IsAssetBundleFeatureReady();
True(!listExists, "exists, not intended.");
True(Caching.ClearCache());
}
[MTest]
public IEnumerator GetAssetBundleListFromDebugMethod()
{
var listIdentity = "main_assets";
var fileName = "main_assets.json";
var version = "1.0.0";
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
status =>
{
done = true;
},
(code, reason, autoyaStatus) =>
{
// do nothing.
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
}
[MTest]
public IEnumerator GetAssetBundleList()
{
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Debug.Log("GetAssetBundleList failed, code:" + code + " reason:" + reason);
// do nothing.
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
}
[MTest]
public IEnumerator GetAssetBundleListFailThenTryAgain()
{
// fail once.
{
var listIdentity = "fake_main_assets";
var notExistFileName = "fake_main_assets.json";
var version = "1.0.0";
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + notExistFileName,
status =>
{
Fail("should not be succeeded.");
},
(err, reason, autoyaStatus) =>
{
True(err.error == Autoya.ListDownloadError.FailedToDownload, "err does not match.");
done = true;
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to fail getting assetBundleList."); }
);
}
// try again with valid fileName.
{
var listIdentity = "main_assets";
var fileName = "main_assets.json";
var version = "1.0.0";
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
status =>
{
done = true;
},
(code, reason, autoyaStatus) =>
{
// do nothing.
Fail("reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
}
}
[MTest]
public IEnumerator GetAssetBundleBeforeGetAssetBundleListBecomeFailed()
{
var loaderTest = new AssetBundleLoaderTests();
var cor = loaderTest.LoadListFromWeb(abListDlPath + "main_assets" + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + "1.0.0" + "/" + "main_assets.json");
yield return cor;
var list = cor.Current as AssetBundleList;
var done = false;
var assetName = list.assetBundles[0].assetNames[0];
Autoya.AssetBundle_LoadAsset<GameObject>(
assetName,
(name, obj) =>
{
Fail("should not comes here.");
},
(name, err, reason, autoyaStatus) =>
{
True(err == AssetBundleLoadError.AssetBundleListIsNotReady, "not match.");
done = true;
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("not yet failed."); }
);
}
[MTest]
public IEnumerator GetAssetBundle()
{
yield return GetAssetBundleList();
var lists = Autoya.AssetBundle_AssetBundleLists();
True(lists != null);
var done = false;
var assetName = lists.Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles[0].assetNames[0];
if (assetName.EndsWith(".png"))
{
Autoya.AssetBundle_LoadAsset<Texture2D>(
assetName,
(name, tex) =>
{
done = true;
},
(name, err, reason, autoyaStatus) =>
{
Fail("name:" + name + " err:" + err + " reason:" + reason);
}
);
}
else
{
Autoya.AssetBundle_LoadAsset<GameObject>(
assetName,
(name, obj) =>
{
done = true;
},
(name, err, reason, autoyaStatus) =>
{
Fail("name:" + name + " err:" + err + " reason:" + reason);
}
);
}
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("not yet done."); }
);
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
}
[MTest]
public IEnumerator PreloadAssetBundleBeforeGetAssetBundleListWillFail()
{
True(!Autoya.AssetBundle_IsAssetBundleFeatureReady(), "not match.");
var done = false;
Autoya.AssetBundle_Preload(
"1.0.0/sample.preloadList.json",
(willLoadBundleNames, proceed, cancel) =>
{
proceed();
},
progress =>
{
},
() =>
{
Fail("should not be succeeded.");
},
(code, reason, autoyaStatus) =>
{
True(code == -(int)Autoya.AssetBundlesError.NeedToDownloadAssetBundleList, "not match. code:" + code + " reason:" + reason);
done = true;
},
(failedAssetBundleName, code, reason, autoyaStatus) =>
{
},
1
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("not yet done."); }
);
}
[MTest]
public IEnumerator PreloadAssetBundle()
{
yield return GetAssetBundleList();
var done = false;
Autoya.AssetBundle_Preload(
"sample.preloadList.json",
(willLoadBundleNames, proceed, cancel) =>
{
proceed();
},
progress =>
{
},
() =>
{
done = true;
},
(code, reason, autoyaStatus) =>
{
Fail("should not be failed. code:" + code + " reason:" + reason);
},
(failedAssetBundleName, code, reason, autoyaStatus) =>
{
},
1
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("not yet done."); }
);
}
[MTest]
public IEnumerator PreloadAssetBundles()
{
yield return GetAssetBundleList();
var done = false;
Autoya.AssetBundle_Preload(
"sample.preloadList2.json",
(willLoadBundleNames, proceed, cancel) =>
{
proceed();
},
progress =>
{
},
() =>
{
done = true;
},
(code, reason, autoyaStatus) =>
{
Fail("should not be failed. code:" + code + " reason:" + reason);
},
(failedAssetBundleName, code, reason, autoyaStatus) =>
{
},
2
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("not yet done."); }
);
}
[MTest]
public IEnumerator PreloadAssetBundleWithGeneratedPreloadList()
{
yield return GetAssetBundleList();
var done = false;
var lists = Autoya.AssetBundle_AssetBundleLists();
var mainAssetsList = lists.Where(list => list.identity == "main_assets").FirstOrDefault();
NotNull(mainAssetsList);
var preloadList = new PreloadList("test", mainAssetsList);
// rewrite. set 1st content of bundleName.
preloadList.bundleNames = new string[] { preloadList.bundleNames[0] };
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
proceed();
},
progress =>
{
},
() =>
{
done = true;
},
(code, reason, autoyaStatus) =>
{
Fail("should not be failed. code:" + code + " reason:" + reason);
},
(failedAssetBundleName, code, reason, autoyaStatus) =>
{
},
1
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("not yet done."); }
);
}
[MTest]
public IEnumerator PreloadAssetBundlesWithGeneratedPreloadList()
{
yield return GetAssetBundleList();
var done = false;
var lists = Autoya.AssetBundle_AssetBundleLists();
var preloadList = new PreloadList("test", lists.Where(list => list.identity == "main_assets").FirstOrDefault());
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
proceed();
},
progress =>
{
},
() =>
{
done = true;
},
(code, reason, autoyaStatus) =>
{
Fail("should not be failed. code:" + code + " reason:" + reason);
},
(failedAssetBundleName, code, reason, autoyaStatus) =>
{
},
4
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("not yet done."); }
);
}
[MTest]
public IEnumerator IsAssetExistInAssetBundleList()
{
yield return GetAssetBundleList();
var assetName = "Assets/AutoyaTests/RuntimeData/AssetBundles/MainResources/textureName.png";
var exist = Autoya.AssetBundle_IsAssetExist(assetName);
True(exist, "not exist:" + assetName);
}
[MTest]
public IEnumerator IsAssetBundleExistInAssetBundleList()
{
yield return GetAssetBundleList();
var bundleName = "texturename";
var exist = Autoya.AssetBundle_IsAssetBundleExist(bundleName);
True(exist, "not exist:" + bundleName);
}
[MTest]
public IEnumerator AssetBundle_CachedBundleNames()
{
var listDownloaded = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
listDownloaded = true;
},
(error, reason, status) =>
{
}
);
yield return WaitUntil(
() => listDownloaded,
() => { throw new TimeoutException("failed to download list."); }
);
var done = false;
Autoya.AssetBundle_CachedBundleNames(
names =>
{
True(!names.Any());
done = true;
},
(error, reason) =>
{
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("failed to get cached bundle names in time."); }
);
}
[MTest]
public IEnumerator AssetBundle_CachedBundleNamesWillBeUpdated()
{
var listDownloaded = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
listDownloaded = true;
},
(error, reason, status) =>
{
}
);
yield return WaitUntil(
() => listDownloaded,
() => { throw new TimeoutException("failed to download list."); }
);
// load 1 asset.
var done = false;
var assetName = string.Empty;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
assetName = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles[0].assetNames[0];
Autoya.AssetBundle_LoadAsset<GameObject>(
assetName,
(name, asset) =>
{
// succeeded to download AssetBundle and got asset from AB.
done = true;
},
(name, error, reason, autoyaStatus) =>
{
}
);
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var done2 = false;
Autoya.AssetBundle_CachedBundleNames(
names =>
{
True(names.Any());
done2 = true;
},
(error, reason) =>
{
}
);
yield return WaitUntil(
() => done2,
() => { throw new TimeoutException("failed to get cached bundle names in time."); }
);
}
[MTest]
public IEnumerator AssetBundle_NotCachedBundleNames()
{
var listDownloaded = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
listDownloaded = true;
},
(error, reason, status) =>
{
}
);
yield return WaitUntil(
() => listDownloaded,
() => { throw new TimeoutException("failed to download list."); }
);
string[] names = null;
Autoya.AssetBundle_NotCachedBundleNames(
bundleNames =>
{
names = bundleNames;
},
(error, reason) =>
{
Debug.Log("error:" + error + " reason:" + reason);
}
);
yield return WaitUntil(
() => names != null && 0 < names.Length,
() => { throw new TimeoutException("failed to get Not chached bundle names."); }
);
// no asset cached.
var wholeAssetBundleNames = Autoya.AssetBundle_AssetBundleLists().SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();
True(names.Length == wholeAssetBundleNames.Length);
}
[MTest]
public IEnumerator AssetBundle_NotCachedBundleNamesInSomeAssetCached()
{
// load 1 asset.
var done = false;
var assetName = string.Empty;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
assetName = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles[0].assetNames[0];
Autoya.AssetBundle_LoadAsset<GameObject>(
assetName,
(name, asset) =>
{
// succeeded to download AssetBundle and got asset from AB.
done = true;
},
(name, error, reason, autoyaStatus) =>
{
Fail("err:" + error + " reason:" + reason);
}
);
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
// 1 or more assets are cached.(by dependencies.)
string[] names = null;
Autoya.AssetBundle_NotCachedBundleNames(
bundleNames =>
{
names = bundleNames;
},
(error, reason) =>
{
Debug.Log("error:" + error + " reason:" + reason);
}
);
yield return WaitUntil(
() => names != null && 0 < names.Length,
() => { throw new TimeoutException("failed to get Not chached bundle names."); }
);
// 1 or more assets are cached.(by dependencies.)
var wholeAssetBundleNames = Autoya.AssetBundle_AssetBundleLists().SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();
True(names.Length < wholeAssetBundleNames.Length);
True(!names.Contains(assetName), "cotntains.");
}
private IEnumerator LoadAllAssetBundlesOfMainAssets(Action<UnityEngine.Object[]> onLoaded)
{
var bundles = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles;
var loaded = 0;
var allAssetCount = bundles.Sum(s => s.assetNames.Length);
True(0 < allAssetCount, "allAssetCount:" + allAssetCount);
var loadedAssets = new UnityEngine.Object[allAssetCount];
foreach (var bundle in bundles)
{
foreach (var assetName in bundle.assetNames)
{
if (assetName.EndsWith(".png"))
{
Autoya.AssetBundle_LoadAsset(
assetName,
(string name, Texture2D o) =>
{
loadedAssets[loaded] = o;
loaded++;
},
(name, error, reason, autoyaStatus) =>
{
Fail("failed to load asset:" + name + " reason:" + reason);
}
);
}
else if (assetName.EndsWith(".txt"))
{
Autoya.AssetBundle_LoadAsset(
assetName,
(string name, TextAsset o) =>
{
loadedAssets[loaded] = o;
loaded++;
},
(name, error, reason, autoyaStatus) =>
{
Fail("failed to load asset:" + name + " reason:" + reason);
}
);
}
else
{
Autoya.AssetBundle_LoadAsset(
assetName,
(string name, GameObject o) =>
{
loadedAssets[loaded] = o;
loaded++;
},
(name, error, reason, autoyaStatus) =>
{
Fail("failed to load asset:" + name + " reason:" + reason);
}
);
}
}
}
yield return WaitUntil(
() => allAssetCount == loaded,
() => { throw new TimeoutException("failed to load asset in time."); },
10
);
onLoaded(loadedAssets);
}
[MTest]
public IEnumerator UpdateListWithOnMemoryAssets()
{
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
True(Autoya.AssetBundle_IsAssetBundleFeatureReady());
UnityEngine.Object[] loadedAssets = null;
// 全てのABをロード
yield return LoadAllAssetBundlesOfMainAssets(objs => { loadedAssets = objs; });
True(loadedAssets != null);
// 1.0.1 リストの更新判断の関数をセット
var listContainsUsingAssetsAndShouldBeUpdate = false;
Autoya.Debug_SetOverridePoint_ShouldRequestNewAssetBundleList(
(identity, ver) =>
{
var basePath = Autoya.Manifest_LoadRuntimeManifest().resourceInfos.Where(resInfo => resInfo.listIdentity == identity).FirstOrDefault().listDownloadUrl;
var url = basePath + "/" + identity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + ver + "/" + identity + ".json";
return Autoya.ShouldRequestOrNot.Yes(url);
}
);
Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
(condition, proceed, cancel) =>
{
if (condition == Autoya.CurrentUsingBundleCondition.UsingAssetsAreChanged)
{
listContainsUsingAssetsAndShouldBeUpdate = true;
}
proceed();
}
);
// 1.0.1リストを取得
Autoya.Http_Get(
"https://httpbin.org/response-headers?" + AuthSettings.AUTH_RESPONSEHEADER_RESVERSION + "=main_assets:1.0.1",
(conId, data) =>
{
// pass.
},
(conId, code, reason, status) =>
{
Fail("failed to get v1.0.1 List. code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => listContainsUsingAssetsAndShouldBeUpdate,
() => { throw new TimeoutException("failed to get response."); },
10
);
True(Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().version == "1.0.1");
// load状態のAssetはそのまま使用できる
for (var i = 0; i < loadedAssets.Length; i++)
{
var loadedAsset = loadedAssets[i];
True(loadedAsset != null);
}
}
[MTest]
public IEnumerator UpdateListWithOnMemoryAssetsThenReloadChangedAsset()
{
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
True(Autoya.AssetBundle_IsAssetBundleFeatureReady());
UnityEngine.Object[] loadedAssets = null;
// 全てのABをロード
yield return LoadAllAssetBundlesOfMainAssets(objs => { loadedAssets = objs; });
True(loadedAssets != null);
var guidsDict = loadedAssets.ToDictionary(
a => a.name,
a => a.GetInstanceID()
);
// 1.0.1 リストの更新判断の関数をセット
var listContainsUsingAssetsAndShouldBeUpdate = false;
Autoya.Debug_SetOverridePoint_ShouldRequestNewAssetBundleList(
(identity, ver) =>
{
var basePath = Autoya.Manifest_LoadRuntimeManifest().resourceInfos.Where(resInfo => resInfo.listIdentity == identity).FirstOrDefault().listDownloadUrl;
var url = basePath + "/" + identity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + ver + "/" + identity + ".json";
return Autoya.ShouldRequestOrNot.Yes(url);
}
);
Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
(condition, proceed, cancel) =>
{
if (condition == Autoya.CurrentUsingBundleCondition.UsingAssetsAreChanged)
{
listContainsUsingAssetsAndShouldBeUpdate = true;
}
proceed();
}
);
// 1.0.1リストを取得
Autoya.Http_Get(
"https://httpbin.org/response-headers?" + AuthSettings.AUTH_RESPONSEHEADER_RESVERSION + "=main_assets:1.0.1",
(conId, data) =>
{
// pass.
},
(conId, code, reason, status) =>
{
Fail("code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => listContainsUsingAssetsAndShouldBeUpdate,
() => { throw new TimeoutException("failed to get response."); },
10
);
True(Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().version == "1.0.1");
// 再度ロード済みのAssetをLoadしようとすると、更新があったABについて最新を取得してくる。
UnityEngine.Object[] loadedAssets2 = null;
yield return LoadAllAssetBundlesOfMainAssets(objs => { loadedAssets2 = objs; });
var newGuidsDict = loadedAssets2.ToDictionary(
a => a.name,
a => a.GetInstanceID()
);
var changedAssetCount = 0;
foreach (var newGuidItem in newGuidsDict)
{
var name = newGuidItem.Key;
var guid = newGuidItem.Value;
if (guidsDict[name] != guid)
{
changedAssetCount++;
}
}
True(changedAssetCount == 1);
}
[MTest]
public IEnumerator UpdateListWithOnMemoryAssetsThenPreloadLoadedChangedAsset()
{
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
True(Autoya.AssetBundle_IsAssetBundleFeatureReady());
UnityEngine.Object[] loadedAssets = null;
// 全てのABをロード
yield return LoadAllAssetBundlesOfMainAssets(objs => { loadedAssets = objs; });
True(loadedAssets != null);
// var guids = loadedAssets.Select(a => a.GetInstanceID()).ToArray();
var loadedAssetBundleNames = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles.Select(a => a.bundleName).ToArray();
// 1.0.1 リストの更新判断の関数をセット
var listContainsUsingAssetsAndShouldBeUpdate = false;
Autoya.Debug_SetOverridePoint_ShouldRequestNewAssetBundleList(
(identity, ver) =>
{
var basePath = Autoya.Manifest_LoadRuntimeManifest().resourceInfos.Where(resInfo => resInfo.listIdentity == identity).FirstOrDefault().listDownloadUrl;
var url = basePath + "/" + identity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + ver + "/" + identity + ".json";
return Autoya.ShouldRequestOrNot.Yes(url);
}
);
Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
(condition, proceed, cancel) =>
{
if (condition == Autoya.CurrentUsingBundleCondition.UsingAssetsAreChanged)
{
listContainsUsingAssetsAndShouldBeUpdate = true;
}
proceed();
}
);
// 1.0.1リストを取得
Autoya.Http_Get(
"https://httpbin.org/response-headers?" + AuthSettings.AUTH_RESPONSEHEADER_RESVERSION + "=main_assets:1.0.1",
(conId, data) =>
{
// pass.
},
(conId, code, reason, status) =>
{
Fail();
}
);
yield return WaitUntil(
() => listContainsUsingAssetsAndShouldBeUpdate,
() => { throw new TimeoutException("failed to get response."); },
10
);
True(Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().version == "1.0.1");
// preload all.
var preloadDone = false;
var preloadList = new PreloadList("dummy", loadedAssetBundleNames);
Autoya.AssetBundle_PreloadByList(
preloadList,
(preloadCandidateBundleNames, go, stop) =>
{
// all assetBundles should not be download. on memory loaded ABs are not updatable.
True(preloadCandidateBundleNames.Length == 0);
go();
},
progress => { },
() =>
{
preloadDone = true;
},
(code, reason, status) =>
{
Fail("code:" + code + " reason:" + reason);
},
(failedAssetBundleName, code, reason, status) =>
{
Fail("failedAssetBundleName:" + failedAssetBundleName + " code:" + code + " reason:" + reason);
},
5
);
yield return WaitUntil(
() => preloadDone,
() => { throw new TimeoutException("failed to preload."); },
10
);
}
[MTest]
public IEnumerator UpdateListWithOnMemoryAssetsThenPreloadUnloadedChangedAsset()
{
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
True(Autoya.AssetBundle_IsAssetBundleFeatureReady());
UnityEngine.Object[] loadedAssets = null;
// 全てのABをロード
yield return LoadAllAssetBundlesOfMainAssets(objs => { loadedAssets = objs; });
True(loadedAssets != null);
var loadedAssetBundleNames = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles.Select(a => a.bundleName).ToArray();
// 1.0.1 リストの更新判断の関数をセット
var listContainsUsingAssetsAndShouldBeUpdate = false;
Autoya.Debug_SetOverridePoint_ShouldRequestNewAssetBundleList(
(identity, ver) =>
{
var basePath = Autoya.Manifest_LoadRuntimeManifest().resourceInfos.Where(resInfo => resInfo.listIdentity == identity).FirstOrDefault().listDownloadUrl;
var url = basePath + "/" + identity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + ver + "/" + identity + ".json";
return Autoya.ShouldRequestOrNot.Yes(url);
}
);
Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
(condition, proceed, cancel) =>
{
if (condition == Autoya.CurrentUsingBundleCondition.UsingAssetsAreChanged)
{
listContainsUsingAssetsAndShouldBeUpdate = true;
}
proceed();
}
);
// 1.0.1リストを取得
Autoya.Http_Get(
"https://httpbin.org/response-headers?" + AuthSettings.AUTH_RESPONSEHEADER_RESVERSION + "=main_assets:1.0.1",
(conId, data) =>
{
// pass.
},
(conId, code, reason, status) =>
{
Fail();
}
);
yield return WaitUntil(
() => listContainsUsingAssetsAndShouldBeUpdate,
() => { throw new TimeoutException("failed to get response."); },
10
);
True(Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().version == "1.0.1");
// unload all assets on memory.
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
// preload all.
var preloadDone = false;
// 更新がかかっているABを取得する。
var preloadList = new PreloadList("dummy", loadedAssetBundleNames);
Autoya.AssetBundle_PreloadByList(
preloadList,
(preloadCandidateBundleNames, go, stop) =>
{
// all assetBundles should not be download. on memory loaded ABs are not updatable.
True(preloadCandidateBundleNames.Length == 1);
go();
},
progress => { },
() =>
{
preloadDone = true;
},
(code, reason, status) =>
{
Fail("code:" + code + " reason:" + reason);
},
(failedAssetBundleName, code, reason, status) =>
{
Fail("failedAssetBundleName:" + failedAssetBundleName + " code:" + code + " reason:" + reason);
},
5
);
yield return WaitUntil(
() => preloadDone,
() => { throw new TimeoutException("failed to preload."); },
10
);
}
[MTest]
public IEnumerator DownloadSameBundleListAtOnce()
{
var listIdentity = "main_assets";
var fileName = "main_assets.json";
var version = "1.0.0";
var done1 = false;
var done2 = false;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
status =>
{
done1 = true;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
abListDlPath + listIdentity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + version + "/" + fileName,
status2 =>
{
done2 = true;
},
(code, reason, autoyaStatus) =>
{
Fail("code:" + code + " reason:" + reason);
}
);
},
(code, reason, autoyaStatus) =>
{
Fail("code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done1 && done2,
() =>
{
throw new TimeoutException("failed to download multiple list in time.");
},
5
);
}
[MTest]
public IEnumerator DownloadMultipleBundleListAtOnce()
{
var done1 = false;
var done2 = false;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
abListDlPath + "main_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/main_assets.json",
status =>
{
done1 = true;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
abListDlPath + "sub_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/sub_assets.json",
status2 =>
{
done2 = true;
},
(code, reason, autoyaStatus) =>
{
Fail("code:" + code + " reason:" + reason);
}
);
},
(code, reason, autoyaStatus) =>
{
// do nothing.
}
);
yield return WaitUntil(
() => done1 && done2,
() =>
{
throw new TimeoutException("failed to download multiple list in time.");
},
5
);
}
[MTest]
public IEnumerator DownloadedMultipleListsAreEnabled()
{
yield return DownloadMultipleBundleListAtOnce();
// それぞれのリストの要素を使って、動作していることを確認する。
var mainAssetsAssetName = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().assetBundles[0].assetNames[0];
var subAssetsAssetName = Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "sub_assets").FirstOrDefault().assetBundles[0].assetNames[0];
GameObject mainAsset = null;
Autoya.AssetBundle_LoadAsset<GameObject>(
mainAssetsAssetName,
(name, asset) =>
{
mainAsset = asset;
},
(name, error, reason, status) =>
{
}
);
TextAsset subAsset = null;
Autoya.AssetBundle_LoadAsset<TextAsset>(
subAssetsAssetName,
(name, asset) =>
{
subAsset = asset;
},
(name, error, reason, status) =>
{
}
);
yield return WaitUntil(
() => mainAsset != null && subAsset != null,
() => { throw new TimeoutException("failed to load."); }
);
}
[MTest]
public IEnumerator UpdateMultipleListAtOnce()
{
yield return DownloadMultipleBundleListAtOnce();
// main_assetsは1.1、sub_assetsは2.0がサーバ上にある。
// 1.0.1 リストの更新判断の関数をセット
var listContainsUsingAssetsAndShouldBeUpdateCount = 0;
Autoya.Debug_SetOverridePoint_ShouldRequestNewAssetBundleList(
(identity, ver) =>
{
var basePath = Autoya.Manifest_LoadRuntimeManifest().resourceInfos.Where(resInfo => resInfo.listIdentity == identity).FirstOrDefault().listDownloadUrl;
var url = basePath + "/" + identity + "/" + AssetBundlesSettings.PLATFORM_STR + "/" + ver + "/" + identity + ".json";
return Autoya.ShouldRequestOrNot.Yes(url);
}
);
Autoya.Debug_SetOverridePoint_ShouldUpdateToNewAssetBundleList(
(condition, proceed, cancel) =>
{
if (condition == Autoya.CurrentUsingBundleCondition.NoUsingAssetsChanged)
{
listContainsUsingAssetsAndShouldBeUpdateCount++;
}
proceed();
}
);
// 1.0.1、2.0.0 リストを取得
Autoya.Http_Get(
"https://httpbin.org/response-headers?" + AuthSettings.AUTH_RESPONSEHEADER_RESVERSION + "=main_assets:1.0.1,sub_assets:2.0.0",
(conId, data) =>
{
// pass.
},
(conId, code, reason, status) =>
{
Fail();
}
);
yield return WaitUntil(
() => listContainsUsingAssetsAndShouldBeUpdateCount == 2,
() => { throw new TimeoutException("failed to get response."); },
10
);
True(Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "main_assets").FirstOrDefault().version == "1.0.1");
True(Autoya.AssetBundle_AssetBundleLists().Where(list => list.identity == "sub_assets").FirstOrDefault().version == "2.0.0");
}
[MTest]
public IEnumerator DownloadAssetBundleListManually()
{
var url = abListDlPath + "main_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/main_assets.json";
var done1 = false;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
url,
status =>
{
done1 = true;
},
(code, reason, autoyaStatus) =>
{
Fail("code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done1,
() => { throw new TimeoutException("timeout."); }
);
// この時点で、Readyになっている + RuntimeManifestにいろいろ入っているはず。
var runtimeManifest = Autoya.Manifest_LoadRuntimeManifest();
True(runtimeManifest.resourceInfos.Where(rInfo => rInfo.listIdentity == "main_assets").Any());
True(runtimeManifest.resourceInfos.Where(rInfo => rInfo.listIdentity == "main_assets").Where(rInfo => rInfo.listVersion == "1.0.0").Any());
}
/*
あらかじめRuntimeManifestにAssetBundleListのidentityやbasePath(url)が記載されていない状態で
AssetBundleListをダウンロードしようとすると、特にurlに関して解決できない問題を持った状態になるため、前提としてDLに失敗する。
*/
[MTest]
public IEnumerator DownloadAssetBundleListManuallyWithoutPrepareWillFail()
{
// runtimeManifestのリソースリストを空にする。これで、取得したAssetBundleListのidentityが記録上存在しないという状態を作り出せる。
{
var defaultRuntimeManifest = Autoya.Manifest_LoadRuntimeManifest();
defaultRuntimeManifest.resourceInfos = new AutoyaFramework.AppManifest.AssetBundleListInfo[0];
Autoya.Manifest_UpdateRuntimeManifest(defaultRuntimeManifest);
}
var url = abListDlPath + "main_assets/" + AssetBundlesSettings.PLATFORM_STR + "/1.0.0/main_assets.json";
var done1 = false;
Autoya.AssetBundle_DownloadAssetBundleListFromUrlManually(
url,
status =>
{
Fail();
},
(code, reason, autoyaStatus) =>
{
done1 = true;
}
);
yield return WaitUntil(
() => done1,
() => { throw new TimeoutException("timeout."); }
);
// リソースリストの復帰。
Autoya.Debug_Manifest_RenewRuntimeManifest();
}
[MTest]
public IEnumerator PreloadAndLoadSameAssetBundle()
{
/*
同じABを同時にLoadAssetとPreloadで読む。
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var loadAssetSucceeded = false;
/*
start loadAsset and preload against same assetBundle.
*/
Autoya.AssetBundle_LoadAsset<GameObject>(
"Assets/AutoyaTests/RuntimeData/AssetBundles/MainResources/textureName1.prefab",
(name, prefab) =>
{
loadAssetSucceeded = true;
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load Asset. error:" + error + " reason:" + reason);
}
);
var preloadList = new PreloadList("test", new string[] { "texturename1" });
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
10
);
yield return WaitUntil(
() => preloaded && loadAssetSucceeded,
() =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
throw new TimeoutException("timeout.");
}
);
}
[MTest]
public IEnumerator PreloadAndLoadDependentAssetBundle()
{
/*
あるAssetBundleをロード開始し、そのBundleが依存しているBundleを同時にPreloadで得る。
a -> b
+
preload b
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var loadAssetSucceeded = false;
Autoya.AssetBundle_LoadAsset<GameObject>(
"Assets/AutoyaTests/RuntimeData/AssetBundles/MainResources/nestedPrefab.prefab",
(name, prefab) =>
{
loadAssetSucceeded = true;
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load Asset. error:" + error + " reason:" + reason);
}
);
var preloadList = new PreloadList("test", new string[] { "texturename" });
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
True(willLoadBundleNames.Length == 1);
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
10
);
yield return WaitUntil(
() => preloaded && loadAssetSucceeded,
() =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
throw new TimeoutException("timeout.");
}
);
}
[MTest]
public IEnumerator PreloadAndLoadDependentAssetBundle_Rev()
{
/*
あるAssetBundleをロード開始し、そのBundleが依存しているBundleを同時にPreloadで得る。
a -> b
+
preload b
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var loadAssetSucceeded = false;
var preloadList = new PreloadList("test", new string[] { "texturename" });
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
True(willLoadBundleNames.Length == 1);
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
10
);
Autoya.AssetBundle_LoadAsset<GameObject>(
"Assets/AutoyaTests/RuntimeData/AssetBundles/MainResources/nestedPrefab.prefab",
(name, prefab) =>
{
loadAssetSucceeded = true;
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load Asset. error:" + error + " reason:" + reason);
}
);
yield return WaitUntil(
() => preloaded && loadAssetSucceeded,
() =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
throw new TimeoutException("timeout.");
}
);
}
[MTest]
public IEnumerator LoadAndPreloadDependentAssetBundle()
{
/*
あるAssetBundleをPreload開始し、そのBundleが依存しているBundleを同時にLoadAssetで得る。
preload a
+
a -> b
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var loadAssetSucceeded = false;
Autoya.AssetBundle_LoadAsset<Texture2D>(
"Assets/AutoyaTests/RuntimeData/AssetBundles/MainResources/textureName.png",
(name, tex) =>
{
loadAssetSucceeded = true;
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load Asset. error:" + error + " reason:" + reason);
}
);
var preloadList = new PreloadList("testDependentAssetBundle", new string[] { "nestedprefab" });
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
True(willLoadBundleNames.Length == 2);
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
10
);
yield return WaitUntil(
() => preloaded && loadAssetSucceeded,
() =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
throw new TimeoutException("timeout.");
}
);
}
[MTest]
public IEnumerator LoadAndPreloadDependentAssetBundle_Rev()
{
/*
あるAssetBundleをPreload開始し、そのBundleが依存しているBundleを同時にLoadAssetで得る。
preload a
+
a -> b
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var loadAssetSucceeded = false;
var preloadList = new PreloadList("testDependentAssetBundle", new string[] { "nestedprefab" });
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
True(willLoadBundleNames.Length == 2);
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
10
);
Autoya.AssetBundle_LoadAsset<Texture2D>(
"Assets/AutoyaTests/RuntimeData/AssetBundles/MainResources/textureName.png",
(name, tex) =>
{
loadAssetSucceeded = true;
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load Asset. error:" + error + " reason:" + reason);
}
);
yield return WaitUntil(
() => preloaded && loadAssetSucceeded,
() =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
throw new TimeoutException("timeout.");
}
);
}
[MTest]
public IEnumerator PreloadAndLoadAllAssetBundle()
{
/*
全てのAssetBundleのロード開始し、同時にPreloadも開始する。
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var assetBundleLists = Autoya.AssetBundle_AssetBundleLists();
var assetNames = assetBundleLists.SelectMany(list => list.assetBundles).SelectMany(bundleInfo => bundleInfo.assetNames).ToArray();
var loadAssetSucceeded = new Dictionary<string, bool>();
var sceneReleaseCors = new List<AsyncOperation>();
foreach (var assetName in assetNames)
{
loadAssetSucceeded[assetName] = false;
// ignore unity scene.
if (assetName.EndsWith(".unity"))
{
Autoya.AssetBundle_LoadScene(
assetName,
LoadSceneMode.Additive,
name =>
{
loadAssetSucceeded[assetName] = true;
sceneReleaseCors.Add(SceneManager.UnloadSceneAsync(SceneManager.GetSceneByPath(name)));
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load scene. error:" + error + " reason:" + reason);
}
);
continue;
}
Autoya.AssetBundle_LoadAsset<UnityEngine.Object>(
assetName,
(name, obj) =>
{
// Debug.Log("name:" + name);
loadAssetSucceeded[assetName] = true;
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load Asset. error:" + error + " reason:" + reason);
}
);
}
var preloadListTargetBundleNames = assetBundleLists.SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();
var preloadList = new PreloadList("allAssetBundles", preloadListTargetBundleNames);
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
// Debug.Log("willLoadBundleNames:" + string.Join(", ", willLoadBundleNames));
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
100
);
yield return WaitUntil(
() =>
{
var notDone = loadAssetSucceeded.Where((i, c) => !i.Value).Any();
if (notDone)
{
return false;
}
// loadAssetSucceeded is done.
return preloaded;
},
() =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
throw new TimeoutException("timeout.");
}
);
yield return WaitUntil(
() => !sceneReleaseCors.Where(op => !op.isDone).Any(),
() => { throw new TimeoutException("failed to unload all loaded scene."); }
);
}
[MTest]
public IEnumerator PreloadAndLoadAllAssetBundle_Rev()
{
/*
全てのABのPreloadを開始し、全てのAssetBundleのロードも開始する。
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var assetBundleLists = Autoya.AssetBundle_AssetBundleLists();
var assetNames = assetBundleLists.SelectMany(list => list.assetBundles).SelectMany(bundleInfo => bundleInfo.assetNames).ToArray();
var loadAssetSucceeded = new Dictionary<string, bool>();
var preloadListTargetBundleNames = assetBundleLists.SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();
var preloadList = new PreloadList("allAssetBundles", preloadListTargetBundleNames);
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
// Debug.Log("willLoadBundleNames:" + string.Join(", ", willLoadBundleNames));
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
100
);
var sceneReleaseCors = new List<AsyncOperation>();
foreach (var assetName in assetNames)
{
loadAssetSucceeded[assetName] = false;
// ignore unity scene.
if (assetName.EndsWith(".unity"))
{
Autoya.AssetBundle_LoadScene(
assetName,
LoadSceneMode.Additive,
name =>
{
loadAssetSucceeded[assetName] = true;
sceneReleaseCors.Add(SceneManager.UnloadSceneAsync(SceneManager.GetSceneByPath(name)));
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load scene. error:" + error + " reason:" + reason);
}
);
continue;
}
Autoya.AssetBundle_LoadAsset<UnityEngine.Object>(
assetName,
(name, obj) =>
{
loadAssetSucceeded[assetName] = true;
},
(name, error, reason, status) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to load Asset. error:" + error + " reason:" + reason);
}
);
}
yield return WaitUntil(
() =>
{
var notDone = loadAssetSucceeded.Where((i, c) => !i.Value).Any();
if (notDone)
{
return false;
}
// loadAssetSucceeded is done.
return preloaded;
},
() =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
throw new TimeoutException("timeout.");
}
);
yield return WaitUntil(
() => !sceneReleaseCors.Where(op => !op.isDone).Any(),
() => { throw new TimeoutException("failed to unload all loaded scene."); }
);
}
[MTest]
public IEnumerator LoadSceneAdditive()
{
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var loadSceneDone = false;
var sceneName = string.Empty;
Autoya.AssetBundle_LoadScene(
"Assets/AutoyaTests/RuntimeData/bundledScene.unity",
LoadSceneMode.Additive,
loadedSceneName =>
{
loadSceneDone = true;
sceneName = loadedSceneName;
},
(loadFailedSceneName, error, reason, status) =>
{
Fail("failed to load scene:" + loadFailedSceneName + " from AB, error:" + error + " reason:" + reason);
}
);
yield return WaitUntil(
() => loadSceneDone,
() => { throw new TimeoutException("failed to load scene."); }
);
var cor = SceneManager.UnloadSceneAsync(SceneManager.GetSceneByPath(sceneName));
while (!cor.isDone)
{
yield return null;
}
}
[MTest]
public IEnumerator LoadSceneAdditiveSync()
{
Debug.LogWarning("unable to test by UnityTest's bug.");
yield break;
// var done = false;
// Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
// status =>
// {
// done = true;
// },
// (code, reason, asutoyaStatus) =>
// {
// Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
// }
// );
// yield return WaitUntil(
// () => done,
// () => { throw new TimeoutException("faild to get assetBundleList."); }
// );
// var loadSceneDone = false;
// var sceneName = string.Empty;
// Autoya.AssetBundle_LoadScene(
// "Assets/AutoyaTests/RuntimeData/bundledScene.unity",
// LoadSceneMode.Additive,
// loadedSceneName =>
// {
// loadSceneDone = true;
// sceneName = loadedSceneName;
// },
// (loadFailedSceneName, error, reason, status) =>
// {
// Fail("failed to load scene:" + loadFailedSceneName + " from AB, error:" + error + " reason:" + reason);
// },
// false
// );
// yield return WaitUntil(
// () => loadSceneDone,
// () => { throw new TimeoutException("failed to load scene."); }
// );
// var scene = SceneManager.GetSceneByPath(sceneName);
// Debug.Log("scene:" + scene.name + " path:" + scene.path);
// var cor = SceneManager.UnloadSceneAsync(SceneManager.GetSceneByPath(sceneName));
// Debug.Log("cor:" + cor);
// while (!cor.isDone)
// {
// yield return null;
// }
}
[MTest]
public IEnumerator LoadSceneSingle()
{
Debug.LogWarning("unable to test by UnityTest's spec.");
yield break;
// var done = false;
// Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
// status =>
// {
// done = true;
// },
// (code, reason, asutoyaStatus) =>
// {
// Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
// }
// );
// yield return WaitUntil(
// () => done,
// () => { throw new TimeoutException("faild to get assetBundleList."); }
// );
// var loadSceneDone = false;
// var sceneName = string.Empty;
// Autoya.AssetBundle_LoadScene(
// "Assets/AutoyaTests/RuntimeData/bundledScene.unity",
// LoadSceneMode.Single,
// loadedSceneName =>
// {
// loadSceneDone = true;
// sceneName = loadedSceneName;
// },
// (loadFailedSceneName, error, reason, status) =>
// {
// Fail("failed to load scene:" + loadFailedSceneName + " from AB, error:" + error + " reason:" + reason);
// }
// );
// yield return WaitUntil(
// () => loadSceneDone,
// () => { throw new TimeoutException("failed to load scene."); }
// );
// var cor = SceneManager.UnloadSceneAsync(SceneManager.GetSceneByPath(sceneName));
// while (!cor.isDone)
// {
// yield return null;
// }
}
[MTest]
public IEnumerator LoadSceneSingleSync()
{
Debug.LogWarning("unable to test by UnityTest's bug.");
yield break;
// var done = false;
// Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
// status =>
// {
// done = true;
// },
// (code, reason, asutoyaStatus) =>
// {
// Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
// }
// );
// yield return WaitUntil(
// () => done,
// () => { throw new TimeoutException("faild to get assetBundleList."); }
// );
// var loadSceneDone = false;
// var sceneName = string.Empty;
// Autoya.AssetBundle_LoadScene(
// "Assets/AutoyaTests/RuntimeData/bundledScene.unity",
// LoadSceneMode.Single,
// loadedSceneName =>
// {
// loadSceneDone = true;
// sceneName = loadedSceneName;
// },
// (loadFailedSceneName, error, reason, status) =>
// {
// Fail("failed to load scene:" + loadFailedSceneName + " from AB, error:" + error + " reason:" + reason);
// },
// false
// );
// yield return WaitUntil(
// () => loadSceneDone,
// () => { throw new TimeoutException("failed to load scene."); }
// );
// var cor = SceneManager.UnloadSceneAsync(SceneManager.GetSceneByPath(sceneName));
// while (!cor.isDone)
// {
// yield return null;
// }
}
[MTest]
public IEnumerator PreloadScene()
{
Debug.LogWarning("not yet implemented: PreloadScene");
yield break;
}
[MTest]
public IEnumerator FactoryReset()
{
var beforeRestoreLoadBundleNames = new string[0];
{
/*
全てのABのPreloadを開始し、全てのAssetBundleのロードも開始する。
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var assetBundleLists = Autoya.AssetBundle_AssetBundleLists();
var assetNames = assetBundleLists.SelectMany(list => list.assetBundles).SelectMany(bundleInfo => bundleInfo.assetNames).ToArray();
var loadAssetSucceeded = new Dictionary<string, bool>();
var preloadListTargetBundleNames = assetBundleLists.SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();
var preloadList = new PreloadList("allAssetBundles", preloadListTargetBundleNames);
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
beforeRestoreLoadBundleNames = willLoadBundleNames;
// Debug.Log("willLoadBundleNames:" + string.Join(", ", willLoadBundleNames));
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
100
);
yield return WaitUntil(
() => preloaded,
() => { throw new TimeoutException("timeout."); }
);
}
var resetted = false;
Autoya.AssetBundle_FactoryReset(
() =>
{
// pass.
resetted = true;
},
(err, reason) =>
{
Fail("err:" + err + " reason:" + reason);
}
);
yield return WaitUntil(
() => resetted,
() => { throw new TimeoutException("timeout to reset."); }
);
// この時点で、リストがなくてstateが変わっているはず。
True(!Autoya.AssetBundle_IsAssetBundleFeatureReady());
{
/*
全てのABのPreloadを開始し、全てのAssetBundleのロードも開始する。
*/
var done = false;
Autoya.AssetBundle_DownloadAssetBundleListsIfNeed(
status =>
{
done = true;
},
(code, reason, asutoyaStatus) =>
{
Fail("UpdateListWithOnMemoryAssets failed, code:" + code + " reason:" + reason);
}
);
yield return WaitUntil(
() => done,
() => { throw new TimeoutException("faild to get assetBundleList."); }
);
var preloaded = false;
var assetBundleLists = Autoya.AssetBundle_AssetBundleLists();
var assetNames = assetBundleLists.SelectMany(list => list.assetBundles).SelectMany(bundleInfo => bundleInfo.assetNames).ToArray();
var loadAssetSucceeded = new Dictionary<string, bool>();
var preloadListTargetBundleNames = assetBundleLists.SelectMany(list => list.assetBundles).Select(bundleInfo => bundleInfo.bundleName).ToArray();
var preloadList = new PreloadList("allAssetBundles", preloadListTargetBundleNames);
// download preloadList from web then preload described assetBundles.
Autoya.AssetBundle_PreloadByList(
preloadList,
(willLoadBundleNames, proceed, cancel) =>
{
True(willLoadBundleNames.Length == beforeRestoreLoadBundleNames.Length);
// Debug.Log("willLoadBundleNames:" + string.Join(", ", willLoadBundleNames));
proceed();
},
progress =>
{
// Debug.Log("progress:" + progress);
},
() =>
{
preloaded = true;
},
(code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("preload failed. code:" + code + " reason:" + reason);
},
(downloadFailedAssetBundleName, code, reason, autoyaStatus) =>
{
Autoya.AssetBundle_UnloadOnMemoryAssetBundles();
Autoya.AssetBundle_DeleteAllStorageCache();
Fail("failed to preload assetBundle:" + downloadFailedAssetBundleName + ". code:" + code + " reason:" + reason);
},
100
);
yield return WaitUntil(
() => preloaded,
() => { throw new TimeoutException("timeout."); }
);
}
}
// ABFeature自体のテストとして、Autoyaの起動時にダミーのManifestとStoredを生成し、食い違うことを確認する
public IEnumerator CompareAssetBundleListOnBoot()
{
yield break;
}
} | {
"content_hash": "9904002be2827344d6cd760303618654",
"timestamp": "",
"source": "github",
"line_count": 2537,
"max_line_length": 187,
"avg_line_length": 32.61647615293654,
"alnum_prop": 0.49526272538309085,
"repo_name": "sassembla/Autoya",
"id": "eb4599f0f26c772b2df494b72437dfab88456b2e",
"size": "84050",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/AutoyaTests/Tests/Backyard/AssetBundlesImplementationTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "2239261"
},
{
"name": "HTML",
"bytes": "5119"
},
{
"name": "JavaScript",
"bytes": "1082"
},
{
"name": "Objective-C",
"bytes": "43333"
},
{
"name": "Objective-C++",
"bytes": "5635"
},
{
"name": "ShaderLab",
"bytes": "3380"
},
{
"name": "Smalltalk",
"bytes": "151"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__short_rand_square_64b.c
Label Definition File: CWE190_Integer_Overflow.label.xml
Template File: sources-sinks-64b.tmpl.c
*/
/*
* @description
* CWE: 190 Integer Overflow
* BadSource: rand Set data to result of rand()
* GoodSource: Set data to a small, non-zero number (two)
* Sinks: square
* GoodSink: Ensure there will not be an overflow before squaring data
* BadSink : Square data, which can lead to overflow
* Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <math.h>
#ifndef OMITBAD
void CWE190_Integer_Overflow__short_rand_square_64b_badSink(void * dataVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
short * dataPtr = (short *)dataVoidPtr;
/* dereference dataPtr into data */
short data = (*dataPtr);
{
/* POTENTIAL FLAW: if (data*data) > SHRT_MAX, this will overflow */
short result = data * data;
printIntLine(result);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE190_Integer_Overflow__short_rand_square_64b_goodG2BSink(void * dataVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
short * dataPtr = (short *)dataVoidPtr;
/* dereference dataPtr into data */
short data = (*dataPtr);
{
/* POTENTIAL FLAW: if (data*data) > SHRT_MAX, this will overflow */
short result = data * data;
printIntLine(result);
}
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE190_Integer_Overflow__short_rand_square_64b_goodB2GSink(void * dataVoidPtr)
{
/* cast void pointer to a pointer of the appropriate type */
short * dataPtr = (short *)dataVoidPtr;
/* dereference dataPtr into data */
short data = (*dataPtr);
/* FIX: Add a check to prevent an overflow from occurring */
if (abs((long)data) <= (long)sqrt((double)SHRT_MAX))
{
short result = data * data;
printIntLine(result);
}
else
{
printLine("data value is too large to perform arithmetic safely.");
}
}
#endif /* OMITGOOD */
| {
"content_hash": "6d45059fa656785a0bf045211cde4992",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 113,
"avg_line_length": 31.39189189189189,
"alnum_prop": 0.6478691347395609,
"repo_name": "maurer/tiamat",
"id": "a9787a2c5179bc4314c320e718c14f8f26dddcc6",
"size": "2323",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "samples/Juliet/testcases/CWE190_Integer_Overflow/s05/CWE190_Integer_Overflow__short_rand_square_64b.c",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package io.netty.buffer;
import io.netty.util.internal.PlatformDependent;
import org.junit.Assert;
import org.junit.Test;
import java.nio.ByteBuffer;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
public class PoolArenaTest {
private static final int PAGE_SIZE = 8192;
private static final int PAGE_SHIFTS = 11;
//chunkSize = pageSize * (2 ^ pageShifts)
private static final int CHUNK_SIZE = 16777216;
@Test
public void testNormalizeCapacity() {
PoolArena<ByteBuffer> arena = new PoolArena.DirectArena(null, PAGE_SIZE, PAGE_SHIFTS, CHUNK_SIZE, 0);
int[] reqCapacities = {0, 15, 510, 1024, 1023, 1025};
int[] expectedResult = {16, 16, 512, 1024, 1024, 1280};
for (int i = 0; i < reqCapacities.length; i ++) {
Assert.assertEquals(expectedResult[i], arena.sizeIdx2size(arena.size2SizeIdx(reqCapacities[i])));
}
}
@Test
public void testNormalizeAlignedCapacity() {
PoolArena<ByteBuffer> arena = new PoolArena.DirectArena(null, PAGE_SIZE, PAGE_SHIFTS, CHUNK_SIZE, 64);
int[] reqCapacities = {0, 15, 510, 1024, 1023, 1025};
int[] expectedResult = {16, 64, 512, 1024, 1024, 1280};
for (int i = 0; i < reqCapacities.length; i ++) {
Assert.assertEquals(expectedResult[i], arena.sizeIdx2size(arena.size2SizeIdx(reqCapacities[i])));
}
}
@Test
public void testSize2SizeIdx() {
PoolArena<ByteBuffer> arena = new PoolArena.DirectArena(null, PAGE_SIZE, PAGE_SHIFTS, CHUNK_SIZE, 0);
for (int sz = 0; sz <= CHUNK_SIZE; sz++) {
int sizeIdx = arena.size2SizeIdx(sz);
Assert.assertTrue(sz <= arena.sizeIdx2size(sizeIdx));
if (sizeIdx > 0) {
Assert.assertTrue(sz > arena.sizeIdx2size(sizeIdx - 1));
}
}
}
@Test
public void testPages2PageIdx() {
int pageShifts = PAGE_SHIFTS;
PoolArena<ByteBuffer> arena = new PoolArena.DirectArena(null, PAGE_SIZE, PAGE_SHIFTS, CHUNK_SIZE, 0);
int maxPages = CHUNK_SIZE >> pageShifts;
for (int pages = 1; pages <= maxPages; pages++) {
int pageIdxFloor = arena.pages2pageIdxFloor(pages);
Assert.assertTrue(pages << pageShifts >= arena.pageIdx2size(pageIdxFloor));
if (pageIdxFloor > 0 && pages < maxPages) {
Assert.assertTrue(pages << pageShifts < arena.pageIdx2size(pageIdxFloor + 1));
}
int pageIdxCeiling = arena.pages2pageIdx(pages);
Assert.assertTrue(pages << pageShifts <= arena.pageIdx2size(pageIdxCeiling));
if (pageIdxCeiling > 0) {
Assert.assertTrue(pages << pageShifts > arena.pageIdx2size(pageIdxCeiling - 1));
}
}
}
@Test
public void testSizeIdx2size() {
PoolArena<ByteBuffer> arena = new PoolArena.DirectArena(null, PAGE_SIZE, PAGE_SHIFTS, CHUNK_SIZE, 0);
for (int i = 0; i < arena.nSizes; i++) {
assertEquals(arena.sizeIdx2sizeCompute(i), arena.sizeIdx2size(i));
}
}
@Test
public void testPageIdx2size() {
PoolArena<ByteBuffer> arena = new PoolArena.DirectArena(null, PAGE_SIZE, PAGE_SHIFTS, CHUNK_SIZE, 0);
for (int i = 0; i < arena.nPSizes; i++) {
assertEquals(arena.pageIdx2sizeCompute(i), arena.pageIdx2size(i));
}
}
@Test
public void testDirectArenaOffsetCacheLine() throws Exception {
assumeTrue(PlatformDependent.hasUnsafe());
int capacity = 5;
int alignment = 128;
for (int i = 0; i < 1000; i++) {
ByteBuffer bb = PlatformDependent.useDirectBufferNoCleaner()
? PlatformDependent.allocateDirectNoCleaner(capacity + alignment)
: ByteBuffer.allocateDirect(capacity + alignment);
PoolArena.DirectArena arena = new PoolArena.DirectArena(null, 512, 9, 512, alignment);
int offset = arena.offsetCacheLine(bb);
long address = PlatformDependent.directBufferAddress(bb);
Assert.assertEquals(0, (offset + address) & (alignment - 1));
PlatformDependent.freeDirectBuffer(bb);
}
}
@Test
public void testAllocationCounter() {
final PooledByteBufAllocator allocator = new PooledByteBufAllocator(
true, // preferDirect
0, // nHeapArena
1, // nDirectArena
8192, // pageSize
11, // maxOrder
0, // tinyCacheSize
0, // smallCacheSize
0, // normalCacheSize
true // useCacheForAllThreads
);
// create small buffer
final ByteBuf b1 = allocator.directBuffer(800);
// create normal buffer
final ByteBuf b2 = allocator.directBuffer(8192 * 5);
Assert.assertNotNull(b1);
Assert.assertNotNull(b2);
// then release buffer to deallocated memory while threadlocal cache has been disabled
// allocations counter value must equals deallocations counter value
Assert.assertTrue(b1.release());
Assert.assertTrue(b2.release());
Assert.assertTrue(allocator.directArenas().size() >= 1);
final PoolArenaMetric metric = allocator.directArenas().get(0);
Assert.assertEquals(2, metric.numDeallocations());
Assert.assertEquals(2, metric.numAllocations());
Assert.assertEquals(1, metric.numSmallDeallocations());
Assert.assertEquals(1, metric.numSmallAllocations());
Assert.assertEquals(1, metric.numNormalDeallocations());
Assert.assertEquals(1, metric.numNormalAllocations());
}
@Test
public void testDirectArenaMemoryCopy() {
ByteBuf src = PooledByteBufAllocator.DEFAULT.directBuffer(512);
ByteBuf dst = PooledByteBufAllocator.DEFAULT.directBuffer(512);
PooledByteBuf<ByteBuffer> pooledSrc = unwrapIfNeeded(src);
PooledByteBuf<ByteBuffer> pooledDst = unwrapIfNeeded(dst);
// This causes the internal reused ByteBuffer duplicate limit to be set to 128
pooledDst.writeBytes(ByteBuffer.allocate(128));
// Ensure internal ByteBuffer duplicate limit is properly reset (used in memoryCopy non-Unsafe case)
pooledDst.chunk.arena.memoryCopy(pooledSrc.memory, 0, pooledDst, 512);
src.release();
dst.release();
}
@SuppressWarnings("unchecked")
private PooledByteBuf<ByteBuffer> unwrapIfNeeded(ByteBuf buf) {
return (PooledByteBuf<ByteBuffer>) (buf instanceof PooledByteBuf ? buf : buf.unwrap());
}
}
| {
"content_hash": "414c1727b3d01cf0278e82047225ed8a",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 110,
"avg_line_length": 38.901162790697676,
"alnum_prop": 0.6281572261246451,
"repo_name": "zer0se7en/netty",
"id": "590dce11666e39915cb1cdf02bbb374bfaa1e0af",
"size": "7326",
"binary": false,
"copies": "4",
"ref": "refs/heads/4.1",
"path": "buffer/src/test/java/io/netty/buffer/PoolArenaTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "191524"
},
{
"name": "C++",
"bytes": "1637"
},
{
"name": "CSS",
"bytes": "49"
},
{
"name": "Groovy",
"bytes": "1755"
},
{
"name": "HTML",
"bytes": "1466"
},
{
"name": "Java",
"bytes": "16241747"
},
{
"name": "Makefile",
"bytes": "1577"
},
{
"name": "Shell",
"bytes": "8541"
}
],
"symlink_target": ""
} |
using TileMap = std::map<int,ALLEGRO_BITMAP*>;
class TileSet
{
ALLEGRO_BITMAP* source;
int firstTileId;
TileMap map;
int tileWidth;
int tileHeight;
ALLEGRO_BITMAP* createTileBitmap( int tileId );
void destroy();
public:
TileSet( int first = 1, int tWidth = 32, int tHeight = 32 )
: source(nullptr)
, firstTileId(first)
, tileWidth(tWidth)
, tileHeight(tHeight)
{}
~TileSet()
{
destroy();
}
bool loadSourceBitmap( std::string filename );
ALLEGRO_BITMAP* getTile( int tileId );
int getFirstTileID() { return firstTileId; }
int getTileWidth() { return tileWidth; }
int getTileHeight() { return tileHeight; }
};
using TileSetPtr = std::shared_ptr<TileSet>;
#endif // TILESET_H
| {
"content_hash": "73e8f5fe1983f3cc14d475be0bbe96e1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 64,
"avg_line_length": 19.11904761904762,
"alnum_prop": 0.6127023661270237,
"repo_name": "merlinblack/oyunum",
"id": "233051fdd9e00a8c82203774a2421cfb9970de1b",
"size": "922",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/tileset.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "838813"
},
{
"name": "C++",
"bytes": "75044"
},
{
"name": "CMake",
"bytes": "14975"
},
{
"name": "CSS",
"bytes": "2721"
},
{
"name": "HTML",
"bytes": "388910"
},
{
"name": "Lua",
"bytes": "38492"
},
{
"name": "Makefile",
"bytes": "10664"
},
{
"name": "Roff",
"bytes": "6111"
},
{
"name": "Shell",
"bytes": "1038"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Esther Johnson Holistic Nurse</title>
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="{{ site.baseurl }}{{ site.assets.css }}bootstrap.min.css" type="text/css">
<!-- Custom Fonts -->
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="{{ site.baseurl }}{{ site.assets.fonts }}css/font-awesome.min.css" type="text/css">
<!-- Plugin CSS -->
<link rel="stylesheet" href="{{ site.baseurl }}{{ site.assets.css }}animate.min.css" type="text/css">
<!-- Custom CSS -->
<link rel="stylesheet" href="{{ site.baseurl }}{{ site.assets.css }}creative.css" type="text/css">
<!-- 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/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
| {
"content_hash": "13358f644aa56d4fbf789ee1d9c271c7",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 170,
"avg_line_length": 45.65714285714286,
"alnum_prop": 0.6539424280350438,
"repo_name": "SilverIronMan/esther",
"id": "33d8b4fef632077ed78c1ea19df7d0e3cddbcfa9",
"size": "1598",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "_includes/head.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "129729"
},
{
"name": "HTML",
"bytes": "20824"
},
{
"name": "JavaScript",
"bytes": "5077"
}
],
"symlink_target": ""
} |
package com.intellij.designer.designSurface.tools;
import com.intellij.designer.designSurface.EditableArea;
import com.intellij.designer.model.RadComponent;
import com.intellij.openapi.util.SystemInfo;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
/**
* @author Alexander Lobas
*/
public class SelectionTracker extends TargetingTool {
protected final RadComponent myComponent;
private boolean mySelected;
public SelectionTracker(RadComponent component) {
myComponent = component;
}
@Override
protected void resetState() {
super.resetState();
mySelected = false;
}
protected Cursor calculateCursor() {
return myState == STATE_INIT || myState == STATE_DRAG
? getDefaultCursor()
: super.calculateCursor();
}
@Override
protected void handleButtonDown(int button) {
if (myState == STATE_INIT &&
(button == MouseEvent.BUTTON1 || button == MouseEvent.BUTTON3) &&
!myArea.isSelected(myComponent)) {
performSelection();
}
if (button == MouseEvent.BUTTON1) {
if (myState == STATE_INIT) {
myState = STATE_DRAG;
}
}
else {
if (button == MouseEvent.BUTTON3) {
myState = STATE_NONE;
}
else {
myState = STATE_INVALID;
}
handleInvalidInput();
}
}
@Override
protected void handleButtonUp(int button) {
if (myState == STATE_DRAG) {
performSelection();
myState = STATE_NONE;
}
}
@Override
public void keyPressed(KeyEvent event, EditableArea area) throws Exception {
super.keyPressed(event, area);
if (event.getKeyCode() == KeyEvent.VK_ESCAPE) {
myToolProvider.loadDefaultTool();
}
}
private void performSelection() {
if (mySelected || myArea.isTree()) {
return;
}
mySelected = true;
performSelection(this, myComponent);
}
public static void performSelection(InputTool tool, RadComponent component) {
if ((SystemInfo.isMac ? tool.myInputEvent.isMetaDown() : tool.myInputEvent.isControlDown())) {
if (tool.myArea.isSelected(component)) {
tool.myArea.deselect(component);
}
else {
tool.myArea.appendSelection(component);
}
}
else if (tool.myInputEvent.isShiftDown()) {
tool.myArea.appendSelection(component);
}
else {
tool.myArea.select(component);
}
}
} | {
"content_hash": "b111e13204969a24b5820ccc003e7a88",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 98,
"avg_line_length": 24.642857142857142,
"alnum_prop": 0.6538302277432713,
"repo_name": "android-ia/platform_tools_idea",
"id": "a8b35b1f4b68b0d557041456cb46427528e0c47a",
"size": "3015",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "plugins/ui-designer-core/src/com/intellij/designer/designSurface/tools/SelectionTracker.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "174889"
},
{
"name": "C#",
"bytes": "390"
},
{
"name": "C++",
"bytes": "75164"
},
{
"name": "CSS",
"bytes": "11575"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "Groovy",
"bytes": "1838147"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "117376638"
},
{
"name": "JavaScript",
"bytes": "112"
},
{
"name": "Objective-C",
"bytes": "19631"
},
{
"name": "Perl",
"bytes": "6549"
},
{
"name": "Python",
"bytes": "2787996"
},
{
"name": "Shell",
"bytes": "68540"
},
{
"name": "XSLT",
"bytes": "113531"
}
],
"symlink_target": ""
} |
package org.http4s
package server
package middleware
import java.nio.charset.StandardCharsets
import fs2._
import fs2.Stream._
import org.http4s.server.middleware.EntityLimiter.EntityTooLarge
import Method._
import Status._
class EntityLimiterSpec extends Http4sSpec {
import Http4s._
val s = HttpService {
case r: Request if r.uri.path == "/echo" => r.decode[String](Response(Ok).withBody)
}
val b = chunk(Chunk.bytes("hello".getBytes(StandardCharsets.UTF_8)))
"EntityLimiter" should {
"Allow reasonable entities" in {
EntityLimiter(s, 100).apply(Request(POST, uri("/echo"), body = b))
.map(_ => -1) must returnValue(-1)
}
"Limit the maximum size of an EntityBody" in {
EntityLimiter(s, 3).apply(Request(POST, uri("/echo"), body = b))
.map(_ => -1)
.handle { case EntityTooLarge(i) => i } must returnValue(3)
}
"Chain correctly with other HttpServices" in {
val s2 = HttpService {
case r: Request if r.uri.path == "/echo2" => r.decode[String](Response(Ok).withBody)
}
val st = EntityLimiter(s, 3)
(st.apply(Request(POST, uri("/echo2"), body = b))
.map(_ => -1)
must returnValue(-1))
(st.apply(Request(POST, uri("/echo"), body = b))
.map(_ => -1)
.handle { case EntityTooLarge(i) => i }
must returnValue(3))
}
}
}
| {
"content_hash": "21e860f2b5cfe3a595c259ff5193aa8c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 92,
"avg_line_length": 27.03921568627451,
"alnum_prop": 0.6192893401015228,
"repo_name": "ZizhengTai/http4s",
"id": "76f2f39e4fd87f1a2c168e0d480fdc417b2222f3",
"size": "1379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/src/test/scala/org/http4s/server/middleware/EntityLimiterSpec.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "18"
},
{
"name": "JavaScript",
"bytes": "9"
},
{
"name": "Scala",
"bytes": "1465514"
},
{
"name": "Shell",
"bytes": "3023"
}
],
"symlink_target": ""
} |
<?php
namespace Enhavo\Bundle\UserBundle\Form\Type;
use Enhavo\Bundle\UserBundle\Form\Data\ChangeEmail;
use Enhavo\Bundle\UserBundle\Validator\Constraints\EmailNotExists;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
class ChangeEmailConfirmType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('currentPassword', PasswordType::class, [
'label' => 'form.current_password',
'translation_domain' => 'EnhavoUserBundle',
'mapped' => false,
'required' => false,
'constraints' => [
new NotBlank(),
new UserPassword([
'message' => 'enhavo_user.current_password.invalid',
]),
],
'attr' => [
'autocomplete' => 'current-password',
],
]);
$builder->add('email', RepeatedType::class, array(
'type' => TextType::class,
'options' => array(
'translation_domain' => 'EnhavoUserBundle',
'attr' => array(
'autocomplete' => 'new-password',
),
),
'required' => false,
'first_options' => [
'label' => 'change_email.form.new_email',
'required' => false,
'constraints' => [
new NotBlank(),
new Email(),
new EmailNotExists()
],
],
'second_options' => [
'label' => 'change_email.form.confirm_new_email',
'required' => false,
'constraints' => [
new NotBlank(),
new Email(),
],
],
'invalid_message' => 'enhavo_user.change_email.mismatch',
));
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => ChangeEmail::class,
'csrf_token_id' => 'change_email',
]);
}
}
| {
"content_hash": "8869322733e4d7ac349fab80db85152b",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 76,
"avg_line_length": 34.95945945945946,
"alnum_prop": 0.5461925009663703,
"repo_name": "FabianLiebl/enhavo",
"id": "4f557c9551b4fc0c1ed3a4118eb6dc53c7b71073",
"size": "2587",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/Enhavo/Bundle/UserBundle/Form/Type/ChangeEmailConfirmType.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Gherkin",
"bytes": "13222"
},
{
"name": "Handlebars",
"bytes": "670"
},
{
"name": "JavaScript",
"bytes": "123744"
},
{
"name": "PHP",
"bytes": "3559334"
},
{
"name": "SCSS",
"bytes": "91683"
},
{
"name": "Shell",
"bytes": "1529"
},
{
"name": "Twig",
"bytes": "173459"
},
{
"name": "TypeScript",
"bytes": "386486"
},
{
"name": "Vue",
"bytes": "114061"
}
],
"symlink_target": ""
} |
import java.util.stream.Stream;
class Test {
boolean notIsPresent(Stream<String> stream) {
return !stream.findAny().isPresent();
}
} | {
"content_hash": "8fc7e319b85ba120d55f415979b0c013",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 47,
"avg_line_length": 20.142857142857142,
"alnum_prop": 0.7092198581560284,
"repo_name": "allotria/intellij-community",
"id": "bff190a4126d798d4d77a3fc3af7e3de34b2d25c",
"size": "221",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/java-tests/testData/inspection/inefficientStreamCount10/afterSimpleCountComparisonIsEmpty.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "20665"
},
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "60580"
},
{
"name": "C",
"bytes": "195249"
},
{
"name": "C#",
"bytes": "1264"
},
{
"name": "C++",
"bytes": "195810"
},
{
"name": "CMake",
"bytes": "1675"
},
{
"name": "CSS",
"bytes": "201445"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "Groovy",
"bytes": "3197810"
},
{
"name": "HLSL",
"bytes": "57"
},
{
"name": "HTML",
"bytes": "1891055"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "164463076"
},
{
"name": "JavaScript",
"bytes": "570364"
},
{
"name": "Jupyter Notebook",
"bytes": "93222"
},
{
"name": "Kotlin",
"bytes": "4240307"
},
{
"name": "Lex",
"bytes": "147047"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "51270"
},
{
"name": "Objective-C",
"bytes": "27941"
},
{
"name": "Perl",
"bytes": "903"
},
{
"name": "Perl6",
"bytes": "26"
},
{
"name": "Protocol Buffer",
"bytes": "6680"
},
{
"name": "Python",
"bytes": "25385564"
},
{
"name": "Roff",
"bytes": "37534"
},
{
"name": "Ruby",
"bytes": "1217"
},
{
"name": "Scala",
"bytes": "11698"
},
{
"name": "Shell",
"bytes": "65705"
},
{
"name": "Smalltalk",
"bytes": "338"
},
{
"name": "TeX",
"bytes": "25473"
},
{
"name": "Thrift",
"bytes": "1846"
},
{
"name": "TypeScript",
"bytes": "9469"
},
{
"name": "Visual Basic",
"bytes": "77"
},
{
"name": "XSLT",
"bytes": "113040"
}
],
"symlink_target": ""
} |
from django.conf.urls import url
from . import views
urlpatterns = [
url(
regex=r'^$',
view=views.entry,
name='business-entry'
),
url(
regex=r'^log/$',
view=views.entry_log,
name='business-entry-log'
),
url(
regex=r'^overview/$',
view=views.overview,
name='business-overview',
),
]
| {
"content_hash": "c24aa99542aea1fdc15e1fc677360c9a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 33,
"avg_line_length": 18.095238095238095,
"alnum_prop": 0.5157894736842106,
"repo_name": "pterk/django-tcb",
"id": "e40c703a7a570857e2842a5957fd6a9d31727426",
"size": "380",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "business/urls.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "860"
},
{
"name": "HTML",
"bytes": "10807"
},
{
"name": "JavaScript",
"bytes": "484"
},
{
"name": "Python",
"bytes": "45389"
},
{
"name": "Shell",
"bytes": "22"
}
],
"symlink_target": ""
} |
package org.ansj.library.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
import org.ansj.util.MyStaticValue;
/**
* 机构名识别词典加载类
*
* @author ansj
*
*/
public class CompanyAttrLibrary {
private static HashMap<String, int[]> cnMap = null;
private CompanyAttrLibrary() {
}
public static HashMap<String, int[]> getCompanyMap() {
if (cnMap != null) {
return cnMap;
}
try {
init();
} catch (Exception e) {
e.printStackTrace() ;
cnMap = new HashMap<String, int[]>() ;
}
return cnMap;
}
// company_freq
private static void init() throws NumberFormatException, IOException {
// TODO Auto-generated method stub
BufferedReader br = null;
try {
cnMap = new HashMap<String, int[]>();
br = MyStaticValue.getCompanReader();
String temp = null;
String[] strs = null;
int[] cna = null;
while ((temp = br.readLine()) != null) {
strs = temp.split("\t");
cna = new int[2];
cna[0] = Integer.parseInt(strs[1]);
cna[1] = Integer.parseInt(strs[2]);
cnMap.put(strs[0], cna);
}
} finally {
if (br != null)
br.close();
}
}
}
| {
"content_hash": "1cf45b0a3f586aea7f66410deb3b7eb9",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 71,
"avg_line_length": 20.75862068965517,
"alnum_prop": 0.5988372093023255,
"repo_name": "treejames/ansj_seg",
"id": "fed20ab52ce8dcb708b46a9db705867ff72150e8",
"size": "1224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/ansj/library/company/CompanyAttrLibrary.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
name: Simple State Propagation
desc: Learn about simple state propagation.
---
Simple State Propagation is the mechanism through which Pakyow propagates
changes in state from one client to another. It prioritizes user trust and makes
it easier to reason about your program. This is best explained with an example.
Let's say we're building a comment system for a blog. When a comment is added,
we want it to show up immediately without requiring a page reload. It should
show up automatically not only for the user who created it, but for anyone else
who is currently looking at the page.
When a comment is created, Pakyow uses Simple State Propagation to tell all
clients (including the originator of the comment) how to render the new state.
It does this by building up rendering instructions that follow the View
Transformation Protocol and pushing those instructions to any clients that need
an update.
Letting the server accept state changes before rendering the change helps to
guarantee consistency. A user knows that if the comment shows up on the page,
it'll continue to show up when the page is refreshed. There's no chance of
getting into a state where one client's representation of state is ahead of the
server. Ultimate truth originates only from the One True Server.
| {
"content_hash": "0f5bbd3078e5f7641cd5bc5f1e62effb",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 80,
"avg_line_length": 51.44,
"alnum_prop": 0.8063763608087092,
"repo_name": "jphager2/pakyow",
"id": "134b7d36257327f50ed304273aef46121b6b6d70",
"size": "1290",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/concepts/simple_state_propagation.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "14741"
},
{
"name": "JavaScript",
"bytes": "111298"
},
{
"name": "Ruby",
"bytes": "564873"
}
],
"symlink_target": ""
} |
module System.FSQuery.Parser
( parseSQL
, prop_parseSQL
) where
import Control.Applicative
import Control.Monad (liftM, liftM2, liftM3, when, foldM, mplus)
import Text.ParserCombinators.Parsec hiding (many, (<|>))
import Text.ParserCombinators.Parsec.Char (CharParser)
import Data.Char (toLower, toUpper)
import System.FSQuery.Data
import System.FSQuery.Util
import Test.QuickCheck
import Data.List (intercalate)
parseSQL :: String -> Either ParseError SQL
parseSQL = fmap addDepth . parse p_sql ""
addDepth :: SQL -> SQL
addDepth (Con (From xs) y) =
Con (From zs) y
where zs = [(fst x, d) | x <- xs]
d = getDepth y
addDepth (Con x y) = Con (addDepth x) (addDepth y)
addDepth x = x
getDepth :: SQL -> Maybe Integer
getDepth (Where g) = getDepthFromGuard g
where
getDepthFromGuard :: Guard -> Maybe Integer
getDepthFromGuard (GGroup x) =
getDepthFromGuard x
getDepthFromGuard (GAnd x y) =
getDepthFromGuard x `mplus` getDepthFromGuard y
getDepthFromGuard (GOr x y) =
getDepthFromGuard x `mplus` getDepthFromGuard y
getDepthFromGuard (GAtom op "depth" x) =
let v = read x :: Integer
in case op of
"=" -> Just v
"<=" -> Just v
"<" -> Just $ v-1
_ -> Nothing
getDepthFromGuard (GAtom {}) = Nothing
getDepth (Con x y) =
getDepth x `mplus` getDepth y
getDepth x = Nothing
-- Note: Rule of Comsuming White Spaces
-- A parser whose prefix is 'p_' should always consume
-- the spaces after it parsed what it supposed to parse.
p_sql :: CharParser () SQL
p_sql = do
-- Note: error handling
-- If any one of these parser fails,
-- the entire parser should fail (ParseError).
selectC <- p_select
fromC <- p_from
whereC <- p_where
orderByC <- p_orderBy
limitC <- p_limit
p_eQuery
return $ foldl1 Con [fromC, whereC, orderByC, limitC, selectC]
p_select :: CharParser () SQL
p_select = do
-- If lookAhead OK, it doesn't comsume input.
-- If lookAhead fails, which means a p_eSelect is not present,
-- which in turn, means that the query user supplied is not
-- well-formed, in this case, it doesn't matter whether or not
-- lookAhead consumes input.
p_bSelect
colNames <- p_commaSeparatedColumnValues
lookAhead p_eSelect
return $ Select colNames
p_from :: CharParser () SQL
p_from = do
p_bFrom
sourceNames <- p_commaSeparatedSourceValues
lookAhead p_eFrom
return $ From [(x, Nothing) | x<-sourceNames]
p_where :: CharParser () SQL
p_where = option Nil p_where'
p_where' = do
lookAhead p_bWhere
p_bWhere
guard <- p_guard
lookAhead p_eWhere
return $ Where guard
p_orderBy :: CharParser () SQL
p_orderBy = option Nil p_orderBy'
p_orderBy' = do
lookAhead p_bOrderBy
p_bOrderBy
x <- sepBy p_obCell (char ',' <* spaces)
lookAhead p_eOrderBy
return $ OrderBy x
p_limit :: CharParser () SQL
p_limit = option Nil p_limit'
p_limit' = do
lookAhead p_bLimit
p_bLimit
x <- many1 digit <* spaces
lookAhead p_eLimit
return $ Limit (read x :: Integer)
p_guard :: CharParser () Guard
p_guard =
chainl1 p_gUnit p_gConnector
p_gUnit :: CharParser () Guard
p_gUnit =
p_gGroup
<|> p_gAtom
<?> "unit of guard"
p_gGroup :: CharParser () Guard
p_gGroup = do
char '(' <* spaces
c <- p_guard
char ')' <* spaces
return $ GGroup c
p_gConnector :: CharParser () (Guard -> Guard -> Guard)
p_gConnector = do
c <- try (iString "and" >> skipMany1 space >> return "and")
<|> try (iString "or" >> skipMany1 space >> return "or")
<?> "\"AND\"/\"OR\" in WHERE clause"
spaces
case c of
"and" -> return GAnd
"or" -> return GOr
p_gAtom :: CharParser () Guard
p_gAtom = do
k <- p_gAtomKey
op <- p_gAtomOp
v <- if k == "size" then p_gFileSize else p_gAtomValue
return $ GAtom op k v
p_gAtomKey :: CharParser () String
p_gAtomKey = do
key <- try p_quotedString
<|> many1 (oneOf allowedCharInBareColumnName)
<?> "column name in WHERE clause"
spaces
return key
p_gAtomOp :: CharParser () String
p_gAtomOp = do
op <- try (string "=")
<|> try (string "/=")
<|> try (string ">=")
<|> try (string "<=")
<|> try (string ">")
<|> try (string "<")
<|> (string "~=")
<?> "operator in WHERE clause"
spaces
return op
p_gAtomValue :: CharParser () String
p_gAtomValue = do
val <- try p_quotedString
<|> many1 (noneOf disallowedCharInBareColumnValue)
<?> "column value in WHERE clause"
spaces
return val
-- TODO
-- This is used to ensure that the file size is
-- in the right format, so no error will happen
-- when converting the unit. I'm not sure this is
-- the correct way to do this (error handling).
p_gFileSize :: CharParser () String
p_gFileSize =
try p_gQuotedFileSize
<|> p_gBareFileSize
p_gQuotedFileSize = do
char '"' <* spaces
x <- many1 (oneOf $ ['0'..'9']++".") <* spaces
y <- p_gFileSizeUnit <* spaces
char '"' <* skipMany1 space
return $ x++y
p_gBareFileSize = do
x <- many1 (oneOf $ ['0'..'9']++".")
y <- p_gFileSizeUnit
return $ x++y
p_gFileSizeUnit :: CharParser () String
p_gFileSizeUnit = do
x <- try (iString "b")
<|> iString "kib"
<|> iString "mib"
<|> iString "gib"
<|> iString "tib"
<|> iString "pib"
<|> iString "eib"
<|> iString "zib"
<|> iString "yib"
<?> "unit of file size"
spaces
return x
-- The "b" in "p_bSelect" means "beginning of",
-- "e" in "p_eSelect" means "end of".
p_bSelect :: CharParser () String
p_bSelect = iString "select" <* skipMany1 space
p_eSelect =
try p_bFrom
<|> p_eQuery
<?> "end of SELECT"
p_bFrom :: CharParser () String
p_bFrom = iString "from" <* skipMany1 space
p_eFrom =
try p_bWhere
<|> try p_bOrderBy
<|> try p_bLimit
<|> p_eQuery
<?> "end of FROM"
p_bWhere :: CharParser () String
p_bWhere = iString "where" <* skipMany1 space
p_eWhere =
try p_bOrderBy
<|> try p_bLimit
<|> p_eQuery
<?> "end of WHERE"
p_bOrderBy :: CharParser () String
p_bOrderBy = do
x <- iString "order" <* skipMany1 space
y <- iString "by" <* skipMany1 space
return $ x++y
p_eOrderBy =
try p_bLimit
<|> p_eQuery
<?> "end of ORDER BY"
p_bLimit :: CharParser () String
p_bLimit = iString "limit" <* skipMany1 space
p_eLimit =
p_eQuery
<?> "end of LIMIT"
p_eQuery :: CharParser () String
p_eQuery =
string ";"
<?> "end of query"
p_commaSeparatedColumnValues :: CharParser () [String]
p_commaSeparatedColumnValues =
sepBy p_columnCell (char ',' <* spaces)
p_commaSeparatedSourceValues :: CharParser () [String]
p_commaSeparatedSourceValues =
sepBy p_sourceCell (char ',' <* spaces)
p_columnCell :: CharParser () FieldName
p_columnCell =
try (many1 (oneOf allowedCharInBareColumnName) <* spaces)
<|> p_quotedString
p_sourceCell :: CharParser () String
p_sourceCell =
-- An unquoted value shouldn't contain space,
-- comma (because it is used to separate values),
-- double quote (because it's not a good idea),
-- and semicolon (because it's used to terminate a query).
try (many1 (noneOf ";, \"") <* spaces)
<|> p_quotedString
p_obCell :: CharParser () (FieldName, SortOrder)
p_obCell = do
x <- p_columnCell
y <- p_obOrder
return (x, y)
p_obOrder =
( (iString "asc" *> return "asc")
<|> (iString "desc" *> return "desc")
) <* spaces
-- Allow these characters in bare column name,
-- "bare" means no double quotes around.
allowedCharInBareColumnName = ['0'..'9']++['a'..'z']++['A'..'Z']++"_-.*"
disallowedCharInBareColumnValue = " ()\";"
-- case insensive matching
iChar c = char (toLower c) <|> char (toUpper c)
iString = mapM iChar
p_quotedString :: CharParser () String
p_quotedString = do
char '"' <?> "open quote"
-- Note: This would allow empty string.
c <- many p_quotedChar
(char '"' <* spaces) <?> "close quote"
return c
p_quotedChar :: CharParser () Char
p_quotedChar =
noneOf "\""
<|> try (string "\"\"" >> return '"')
----------------------------------------------------------------------
-- QuickCheck
----------------------------------------------------------------------
prop_parseSQL :: SQLString -> Bool
prop_parseSQL sqlStr =
case parseSQL $ show sqlStr of
Left _ -> False
Right _ -> True
newtype SQLString = SQLString String
instance Show SQLString where
show (SQLString s) = s
instance Arbitrary SQLString where
arbitrary = do
selectC <- genSelect
fromC <- genFrom
whereC <- genWhere
orderByC <- genOrderBy
limitC <- genLimit
let t = [selectC, fromC, whereC, orderByC, limitC]
let s = unwords $ filter (not . null) t
r <- mixCase $ s ++ ";"
return $ SQLString r
genSelect = do
cols <- genColumns
return $ "select " ++ intercalate "," cols
genFrom = do
srcs <- genSources
return $ "from " ++ intercalate "," srcs
genColumns :: Gen [String]
genColumns = resize 20 x
where x = listOf1 genOneColumn
genOneColumn :: Gen String
genOneColumn = do
let cols = [ "path", "name", "basename", "extension"
, "depth", "size", "atime", "mtime", "ctime" ]
let quotedCols = map doubleQuote cols
elements $ cols ++ quotedCols
genSources :: Gen [String]
genSources = resize 1 x
where x = listOf1 genSource
genSource = resize 20 x
where x = listOf1 $ elements (['a'..'z'] ++ ['A'..'Z'])
genWhere = do
g <- genGuards
return $ if null g
then ""
else "where " ++ g
genAtomGuard = do
col <- genOneColumn
op <- elements ["=", ">", "<", "/=" , ">=" , "<=" , "~="]
let genVal = case trimWhile (=='"') col of
"size" -> genFileSize
"depth" -> genNatural
"atime" -> genTime
"ctime" -> genTime
"mtime" -> genTime
_ -> genString
val <- genVal
return $ foldl1 (++) [col, op, val]
genAtomGuards = do
x <- listOf1 genAtomGuard
let y = filter (not . null) x
chainGuard genConnector y
genGroupGuard = do
x <- genAtomGuards
return $ "(" ++ x ++ ")"
genUnitGuard = oneof [genAtomGuard, genGroupGuard]
genGuards = do
x <- listOf genUnitGuard
let y = filter (not . null) x
chainGuard genConnector y
genConnector = elements [" and ", " or "]
chainGuard :: Gen String -> [String] -> Gen String
chainGuard _ [] = return ""
chainGuard _ [x] = return x
chainGuard c (x:y:rest) = do
h <- chainGuard2 c [x, y]
chainGuard c (h:rest)
chainGuard2 :: Gen String -> [String] -> Gen String
chainGuard2 g [x,y] = do
c <- g
return $ x ++ c ++ y
genOrderBy = do
x <- genOrderBys
return $ if null x
then ""
else "order by " ++ intercalate "," x
genOrderBys = resize 10 x
where x = listOf genOneOrderBy
genOneOrderBy = do
col <- genOneColumn
ord <- elements ["asc", "desc"]
return $ col ++ " " ++ ord
genLimit = do
g <- elements [True, False]
if not g
then return ""
else do
n <- elements [0..65536]
return $ "limit " ++ show n
genNatural = oneof [genPositiveInteger, fmap (:[]) genDigit]
genPositiveInteger = do
h <- genDigit1
t <- listOf genDigit
return $ h:t
genFloat = oneof [genNatural, x] where
x = do
h <- genNatural
t <- listOf1 $ elements digits
return $ h ++ "." ++ t
genDigit = elements digits
genDigit1 = elements digits1
genFileSizeUnit =
elements [ "B" , "KiB", "MiB"
, "GiB", "TiB", "PiB"
, "EiB", "ZiB", "YiB" ]
genFileSize = do
n <- genFloat
u <- genFileSizeUnit
return $ n++u
genTime = do
y <- elements $ map show [1900, 3000]
m <- genInt2 1 12
d <- genInt2 1 31
hh <- genInt2 0 23
mm <- genInt2 0 59
ss <- genInt2 0 59
let date = intercalate "-" [y, m, d]
let time = intercalate ":" [hh, mm, ss]
return $ doubleQuote (date ++ " " ++ time)
genInt2 :: Int -> Int -> Gen String
genInt2 start stop = do
x <- elements $ map show [start, stop]
return $ if length x == 1 then '0':x else x
genString = oneof [genBareString, genQuotedString]
genBareString = listOf1 $ elements s
where s = concat [digits, letters, ".$^"]
genQuotedString = fmap doubleQuote genBareString
mixCase :: String -> Gen String
mixCase = mapM f
where f c = do
u <- elements [True, False]
return $ if u then toUpper c else toLower c
| {
"content_hash": "be3cab236756c489e409d28f737ce624",
"timestamp": "",
"source": "github",
"line_count": 504,
"max_line_length": 72,
"avg_line_length": 25.446428571428573,
"alnum_prop": 0.5873684210526315,
"repo_name": "qwfy/fsquery",
"id": "c6d6e8349a738461d894855be4c44991806a0ba9",
"size": "12825",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/System/FSQuery/Parser.hs",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Haskell",
"bytes": "31309"
}
],
"symlink_target": ""
} |
func processVariants(mainWG *sync.WaitGroup, reader io.Reader, hashTable *variant.HashTable,
opt options) {
defer mainWG.Done()
variants := make(chan *vcf.Variant)
invalids := make(chan vcf.InvalidLine)
keyed := make(chan keyedGnomad)
accumulator := make(chan int)
wg := sync.WaitGroup{}
wg.Add(5)
go parseVCF(&wg, reader, variants, invalids)
go consumeInvalids(&wg, invalids)
go parseGnomadFields(&wg, variants, keyed, opt.ParseParallelism)
go send(&wg, hashTable, opt.ColumnNameModifier, keyed, accumulator, opt.SendParallelism)
go count(&wg, accumulator, opt.LogBreakpoint)
wg.Wait()
}
| {
"content_hash": "e199685122c001b042a9e7fae978c0f2",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 92,
"avg_line_length": 28.952380952380953,
"alnum_prop": 0.7450657894736842,
"repo_name": "vdemario/talks",
"id": "3465d0c8944053341d61050731cb985730b962cd",
"size": "608",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "locaweb/gnomad_real.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "12102"
}
],
"symlink_target": ""
} |
[% page.banner = page.title = "Perl Tips" %]
<p></p>
Join <!-- <& /mail/_subscriber_count, list => 'tips' &> =-->
thousands of
others by subscribing to our tips
mailinglist. Either by sending an empty mail to
<a href="mailto:tips-subscribe@perl.org">tips-subscribe@perl.org</a>
or by filling out the form below.
<& /mail/subscribe_form, list => "tips", return => "/tips/" &>
<p>
Check the <a
href="http://archive.develooper.com/tips%40perl.org/">archive</a>
if you would like to read a few tips before subscribing.
<p>
We have a <a href="/about/privacy">privacy policy</a> that says we
won't give your email address away like candy and we won't send you
spam.
| {
"content_hash": "5c2a0119a34f2058ab991cd4b864f5fa",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 68,
"avg_line_length": 27.791666666666668,
"alnum_prop": 0.6911544227886057,
"repo_name": "autarch/perlweb",
"id": "620adbfd702ffedf67e9ec6169aebaf5bb06993f",
"size": "667",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "docs/learn/tips.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "39919"
},
{
"name": "JavaScript",
"bytes": "22100"
},
{
"name": "Perl",
"bytes": "7922790"
},
{
"name": "Shell",
"bytes": "1932"
}
],
"symlink_target": ""
} |
<?php
spl_autoload_register(function ($classname) {require ( $classname . ".php");});
$datalogin = Core::checkSessions();?>
<!doctype html>
<html lang="<?php echo Core::getInstance()->setlang?>">
<head>
<title><?php echo Core::lang('edit_user_profile')?> - <?php echo Core::getInstance()->title?></title>
<?php include 'global-meta.php';?>
</head>
<body>
<div class="wrapper">
<div class="sidebar" data-background-color="white" data-active-color="danger">
<?php include 'global-menu.php';?>
</div>
<div class="main-panel">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar bar1"></span>
<span class="icon-bar bar2"></span>
<span class="icon-bar bar3"></span>
</button>
<a class="navbar-brand" href="#"><?php echo Core::lang('edit_user_profile')?></a>
</div>
<?php include 'global-nav.php';?>
</div>
</nav>
<?php include 'tab-user-profile-edit.php';?>
<?php include 'global-footer.php';?>
</div>
</div>
<?php include'global-js.php';?>
</body>
</html>
| {
"content_hash": "d76a076128042948e0834cc5acfbd410",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 105,
"avg_line_length": 33.5,
"alnum_prop": 0.5266524520255863,
"repo_name": "aalfiann/reSlim-bookstore",
"id": "9d53f5cde66811b335febd29d16fe17db696be5a",
"size": "1407",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/example/modul-user-profile-edit.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3917"
},
{
"name": "CSS",
"bytes": "339869"
},
{
"name": "JavaScript",
"bytes": "1987310"
},
{
"name": "PHP",
"bytes": "1218485"
}
],
"symlink_target": ""
} |
package com.kylemiller.watchdogd.web.interceptor;
import java.util.Date;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.kylemiller.watchdogd.model.User;
public class CurrentUsersInterceptor extends HandlerInterceptorAdapter {
public static final String ANON_KEY = "ANONYMOUS--";
private Map currentUsers;
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
SecurityContext sc = SecurityContextHolder.getContext();
if (null == sc) return true;
Authentication auth = sc.getAuthentication();
if (null == auth) return true;
Object obj = auth.getPrincipal();
User user = null;
//if (null != obj && obj instanceof User) s = ((User) obj).getUsername();
if (null != obj && obj instanceof User) user = (User) obj;
//else s = String.format("%s%s", ANON_KEY, request.getRemoteAddr());
else user = new AnonymousUser(request.getRemoteAddr());
getCurrentUsers().put(user, new Date());
return true;
}
public class AnonymousUser extends User {
private String ip;
public AnonymousUser(String ip) {
this.ip = ip;
}
@Override
public String getUsername() {
return ip;
}
}
public Map getCurrentUsers() {
return currentUsers;
}
public void setCurrentUsers(Map currentUsers) {
this.currentUsers = currentUsers;
}
}
| {
"content_hash": "940b133d0124f8a798c422d7538b75ee",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 118,
"avg_line_length": 27.03174603174603,
"alnum_prop": 0.7445684086905461,
"repo_name": "backupparachute/watchdog-daemon",
"id": "144f6bb24ff3aaffda5fba405a3fdeee96d0f59e",
"size": "1703",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "watchdogd-web/src/java/com/kylemiller/watchdogd/web/interceptor/CurrentUsersInterceptor.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "20875"
},
{
"name": "Java",
"bytes": "342703"
},
{
"name": "JavaScript",
"bytes": "52"
}
],
"symlink_target": ""
} |
#include "erfa.h"
void eraLtecm(double epj, double rm[3][3])
{
/* Frame bias (IERS Conventions 2010, Eqs. 5.21 and 5.33) */
const double dx = -0.016617 * ERFA_DAS2R,
de = -0.0068192 * ERFA_DAS2R,
dr = -0.0146 * ERFA_DAS2R;
double p[3], z[3], w[3], s, x[3], y[3];
/* Equator pole. */
eraLtpequ(epj, p);
/* Ecliptic pole (bottom row of equatorial to ecliptic matrix). */
eraLtpecl(epj, z);
/* Equinox (top row of matrix). */
eraPxp(p, z, w);
eraPn(w, &s, x);
/* Middle row of matrix. */
eraPxp(z, x, y);
/* Combine with frame bias. */
rm[0][0] = x[0] - x[1]*dr + x[2]*dx;
rm[0][1] = x[0]*dr + x[1] + x[2]*de;
rm[0][2] = - x[0]*dx - x[1]*de + x[2];
rm[1][0] = y[0] - y[1]*dr + y[2]*dx;
rm[1][1] = y[0]*dr + y[1] + y[2]*de;
rm[1][2] = - y[0]*dx - y[1]*de + y[2];
rm[2][0] = z[0] - z[1]*dr + z[2]*dx;
rm[2][1] = z[0]*dr + z[1] + z[2]*de;
rm[2][2] = - z[0]*dx - z[1]*de + z[2];
}
/*----------------------------------------------------------------------
**
**
** Copyright (C) 2013-2017, NumFOCUS Foundation.
** All rights reserved.
**
** This library is derived, with permission, from the International
** Astronomical Union's "Standards of Fundamental Astronomy" library,
** available from http://www.iausofa.org.
**
** The ERFA version is intended to retain identical functionality to
** the SOFA library, but made distinct through different function and
** file names, as set out in the SOFA license conditions. The SOFA
** original has a role as a reference standard for the IAU and IERS,
** and consequently redistribution is permitted only in its unaltered
** state. The ERFA version is not subject to this restriction and
** therefore can be included in distributions which do not support the
** concept of "read only" software.
**
** Although the intent is to replicate the SOFA API (other than
** replacement of prefix names) and results (with the exception of
** bugs; any that are discovered will be fixed), SOFA is not
** responsible for any errors found in this version of the library.
**
** If you wish to acknowledge the SOFA heritage, please acknowledge
** that you are using a library derived from SOFA, rather than SOFA
** itself.
**
**
** TERMS AND CONDITIONS
**
** 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 Standards Of Fundamental Astronomy Board,
** the International Astronomical Union nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
**
*/
| {
"content_hash": "7cd4dc064f057e0f3b7e3c10abf51d26",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 72,
"avg_line_length": 39.64,
"alnum_prop": 0.6584258324924319,
"repo_name": "bsipocz/astropy",
"id": "664c879633556ec7caed9bcde88909a6cff0eccf",
"size": "6115",
"binary": false,
"copies": "5",
"ref": "refs/heads/hacking",
"path": "cextern/erfa/ltecm.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "442627"
},
{
"name": "C++",
"bytes": "1057"
},
{
"name": "HTML",
"bytes": "1172"
},
{
"name": "Objective-C",
"bytes": "615"
},
{
"name": "Python",
"bytes": "9395160"
},
{
"name": "TeX",
"bytes": "853"
}
],
"symlink_target": ""
} |
layout: course
department: Environmental Design (ENV DES)
course: 100
course-name: The City - Theories and Methods in Urban Studies
prerequisites: None
description: This course is concerned with the study of cities. Focusing on great cities around the world - from Chicago to Los Angeles, from Rio to Shanghai, from Vienna to Cairo it covers of historical and contemporary patterns of urbanization and urbanism. Through these case studies, it introduces the key ideas, debates, and research genres of the interdisciplinary field of urban studies. In other words, this is simultaneously a "great cities" and "great theories" course. Its purpose is to train students in critical analysis of the socio-spatial formations of their lived world.
units: 4
tools:
cluster:
- Social Science
foundational:
applied: Applied
meta: Meta
---
| {
"content_hash": "4d3e08c170e4efa47feb73ff973173c9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 587,
"avg_line_length": 59.357142857142854,
"alnum_prop": 0.8002406738868832,
"repo_name": "marwahaha/datamap",
"id": "dea84cdf71163f972f45974ff23735ceb21f0f51",
"size": "835",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "courses/environmental-design-(env-des)-100-the-city--theories-and-methods-in-urban-studies.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "28213"
},
{
"name": "CoffeeScript",
"bytes": "121"
},
{
"name": "HTML",
"bytes": "21930"
},
{
"name": "JavaScript",
"bytes": "67172"
},
{
"name": "Python",
"bytes": "6813"
},
{
"name": "Ruby",
"bytes": "3616"
}
],
"symlink_target": ""
} |
.monaco-workbench > .part.editor {
background-repeat: no-repeat;
background-position: 50% 50%;
}
.monaco-workbench > .part.editor.empty {
background-image: url('letterpress.svg');
}
.vs-dark .monaco-workbench > .part.editor.empty {
background-image: url('letterpress-dark.svg');
}
.hc-black .monaco-workbench > .part.editor.empty {
background-image: url('letterpress-hc.svg');
}
@media
(-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dppx) {
.monaco-workbench > .part.editor {
background-size: 260px 260px;
}
} | {
"content_hash": "c5203ad66e83b72444b26b93b4a3691b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 50,
"avg_line_length": 20.53846153846154,
"alnum_prop": 0.704119850187266,
"repo_name": "hungys/vscode",
"id": "be300080fdde6f3e0e07451bd18086809711a851",
"size": "885",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "src/vs/workbench/browser/parts/editor/media/editorpart.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5690"
},
{
"name": "C",
"bytes": "818"
},
{
"name": "C#",
"bytes": "1640"
},
{
"name": "C++",
"bytes": "1000"
},
{
"name": "CSS",
"bytes": "434463"
},
{
"name": "Clojure",
"bytes": "1206"
},
{
"name": "CoffeeScript",
"bytes": "590"
},
{
"name": "F#",
"bytes": "634"
},
{
"name": "Go",
"bytes": "628"
},
{
"name": "Groovy",
"bytes": "3928"
},
{
"name": "HLSL",
"bytes": "184"
},
{
"name": "HTML",
"bytes": "28846"
},
{
"name": "Inno Setup",
"bytes": "107789"
},
{
"name": "Java",
"bytes": "599"
},
{
"name": "JavaScript",
"bytes": "3268774"
},
{
"name": "Lua",
"bytes": "252"
},
{
"name": "Makefile",
"bytes": "553"
},
{
"name": "Objective-C",
"bytes": "1387"
},
{
"name": "PHP",
"bytes": "802"
},
{
"name": "Perl",
"bytes": "857"
},
{
"name": "Perl6",
"bytes": "1065"
},
{
"name": "PowerShell",
"bytes": "4851"
},
{
"name": "Python",
"bytes": "2119"
},
{
"name": "R",
"bytes": "362"
},
{
"name": "Ruby",
"bytes": "1703"
},
{
"name": "Rust",
"bytes": "532"
},
{
"name": "ShaderLab",
"bytes": "330"
},
{
"name": "Shell",
"bytes": "29144"
},
{
"name": "Swift",
"bytes": "220"
},
{
"name": "TypeScript",
"bytes": "12647938"
},
{
"name": "Visual Basic",
"bytes": "893"
}
],
"symlink_target": ""
} |
package org.apache.ambari.server.security.authorization;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang.StringUtils;
/**
* Describes LDAP Server connection parameters
*/
public class LdapServerProperties {
private String primaryUrl;
private String secondaryUrl;
private boolean useSsl;
private boolean anonymousBind;
private String managerDn;
private String managerPassword;
private String baseDN;
private String dnAttribute;
private String referralMethod;
//LDAP group properties
private String groupBase;
private String groupObjectClass;
private String groupMembershipAttr;
private String groupNamingAttr;
private String adminGroupMappingRules;
private boolean groupMappingEnabled;
//LDAP user properties
private String userBase;
private String userObjectClass;
private String usernameAttribute;
private boolean forceUsernameToLowercase = false;
private String userSearchBase = "";
private String syncGroupMemberReplacePattern = "";
private String syncUserMemberReplacePattern = "";
private String groupSearchFilter;
private String userSearchFilter;
private String alternateUserSearchFilter; // alternate user search filter to be used when users use their alternate login id (e.g. User Principal Name)
private String syncUserMemberFilter = "";
private String syncGroupMemberFilter = "";
//LDAP pagination properties
private boolean paginationEnabled = true;
private String adminGroupMappingMemberAttr = ""; // custom group search filter for admin mappings
public List<String> getLdapUrls() {
String protocol = useSsl ? "ldaps://" : "ldap://";
if (StringUtils.isEmpty(primaryUrl)) {
return Collections.emptyList();
} else {
List<String> list = new ArrayList<>();
list.add(protocol + primaryUrl);
if (!StringUtils.isEmpty(secondaryUrl)) {
list.add(protocol + secondaryUrl);
}
return list;
}
}
public String getPrimaryUrl() {
return primaryUrl;
}
public void setPrimaryUrl(String primaryUrl) {
this.primaryUrl = primaryUrl;
}
public String getSecondaryUrl() {
return secondaryUrl;
}
public void setSecondaryUrl(String secondaryUrl) {
this.secondaryUrl = secondaryUrl;
}
public boolean isUseSsl() {
return useSsl;
}
public void setUseSsl(boolean useSsl) {
this.useSsl = useSsl;
}
public boolean isAnonymousBind() {
return anonymousBind;
}
public void setAnonymousBind(boolean anonymousBind) {
this.anonymousBind = anonymousBind;
}
public String getManagerDn() {
return managerDn;
}
public void setManagerDn(String managerDn) {
this.managerDn = managerDn;
}
public String getManagerPassword() {
return managerPassword;
}
public void setManagerPassword(String managerPassword) {
this.managerPassword = managerPassword;
}
public String getBaseDN() {
return baseDN;
}
public void setBaseDN(String baseDN) {
this.baseDN = baseDN;
}
public String getUserSearchBase() {
return userSearchBase;
}
public void setUserSearchBase(String userSearchBase) {
this.userSearchBase = userSearchBase;
}
/**
* Returns the LDAP filter to search users by.
* @param useAlternateUserSearchFilter if true than return LDAP filter that expects user name in
* User Principal Name format to filter users constructed from {@link org.apache.ambari.server.configuration.Configuration#LDAP_ALT_USER_SEARCH_FILTER}.
* Otherwise the filter is constructed from {@link org.apache.ambari.server.configuration.Configuration#LDAP_USER_SEARCH_FILTER}
* @return the LDAP filter string
*/
public String getUserSearchFilter(boolean useAlternateUserSearchFilter) {
String filter = useAlternateUserSearchFilter ? alternateUserSearchFilter : userSearchFilter;
return resolveUserSearchFilterPlaceHolders(filter);
}
public String getUsernameAttribute() {
return usernameAttribute;
}
public void setUsernameAttribute(String usernameAttribute) {
this.usernameAttribute = usernameAttribute;
}
/**
* Sets whether the username retrieved from the LDAP server during authentication is to be forced
* to all lowercase characters before assigning to the authenticated user.
*
* @param forceUsernameToLowercase true to force the username to be lowercase; false to leave as
* it was when retrieved from the LDAP server
*/
public void setForceUsernameToLowercase(boolean forceUsernameToLowercase) {
this.forceUsernameToLowercase = forceUsernameToLowercase;
}
/**
* Gets whether the username retrieved from the LDAP server during authentication is to be forced
* to all lowercase characters before assigning to the authenticated user.
*
* @return true to force the username to be lowercase; false to leave as it was when retrieved from
* the LDAP server
*/
public boolean isForceUsernameToLowercase() {
return forceUsernameToLowercase;
}
public String getGroupBase() {
return groupBase;
}
public void setGroupBase(String groupBase) {
this.groupBase = groupBase;
}
public String getGroupObjectClass() {
return groupObjectClass;
}
public void setGroupObjectClass(String groupObjectClass) {
this.groupObjectClass = groupObjectClass;
}
public String getGroupMembershipAttr() {
return groupMembershipAttr;
}
public void setGroupMembershipAttr(String groupMembershipAttr) {
this.groupMembershipAttr = groupMembershipAttr;
}
public String getGroupNamingAttr() {
return groupNamingAttr;
}
public void setGroupNamingAttr(String groupNamingAttr) {
this.groupNamingAttr = groupNamingAttr;
}
public String getAdminGroupMappingRules() {
return adminGroupMappingRules;
}
public void setAdminGroupMappingRules(String adminGroupMappingRules) {
this.adminGroupMappingRules = adminGroupMappingRules;
}
public String getGroupSearchFilter() {
return groupSearchFilter;
}
public void setGroupSearchFilter(String groupSearchFilter) {
this.groupSearchFilter = groupSearchFilter;
}
public void setUserSearchFilter(String userSearchFilter) {
this.userSearchFilter = userSearchFilter;
}
public void setAlternateUserSearchFilter(String alternateUserSearchFilter) {
this.alternateUserSearchFilter = alternateUserSearchFilter;
}
public boolean isGroupMappingEnabled() {
return groupMappingEnabled;
}
public void setGroupMappingEnabled(boolean groupMappingEnabled) {
this.groupMappingEnabled = groupMappingEnabled;
}
public void setUserBase(String userBase) {
this.userBase = userBase;
}
public void setUserObjectClass(String userObjectClass) {
this.userObjectClass = userObjectClass;
}
public String getUserBase() {
return userBase;
}
public String getUserObjectClass() {
return userObjectClass;
}
public String getDnAttribute() {
return dnAttribute;
}
public void setDnAttribute(String dnAttribute) {
this.dnAttribute = dnAttribute;
}
public void setReferralMethod(String referralMethod) {
this.referralMethod = referralMethod;
}
public String getReferralMethod() {
return referralMethod;
}
public boolean isPaginationEnabled() {
return paginationEnabled;
}
public void setPaginationEnabled(boolean paginationEnabled) {
this.paginationEnabled = paginationEnabled;
}
public String getSyncGroupMemberReplacePattern() {
return syncGroupMemberReplacePattern;
}
public void setSyncGroupMemberReplacePattern(String syncGroupMemberReplacePattern) {
this.syncGroupMemberReplacePattern = syncGroupMemberReplacePattern;
}
public String getSyncUserMemberReplacePattern() {
return syncUserMemberReplacePattern;
}
public void setSyncUserMemberReplacePattern(String syncUserMemberReplacePattern) {
this.syncUserMemberReplacePattern = syncUserMemberReplacePattern;
}
public String getSyncUserMemberFilter() {
return syncUserMemberFilter;
}
public void setSyncUserMemberFilter(String syncUserMemberFilter) {
this.syncUserMemberFilter = syncUserMemberFilter;
}
public String getSyncGroupMemberFilter() {
return syncGroupMemberFilter;
}
public void setSyncGroupMemberFilter(String syncGroupMemberFilter) {
this.syncGroupMemberFilter = syncGroupMemberFilter;
}
public String getAdminGroupMappingMemberAttr() {
return adminGroupMappingMemberAttr;
}
public void setAdminGroupMappingMemberAttr(String adminGroupMappingMemberAttr) {
this.adminGroupMappingMemberAttr = adminGroupMappingMemberAttr;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
LdapServerProperties that = (LdapServerProperties) obj;
if (primaryUrl != null ? !primaryUrl.equals(that.primaryUrl) : that.primaryUrl != null) return false;
if (secondaryUrl != null ? !secondaryUrl.equals(that.secondaryUrl) : that.secondaryUrl != null) return false;
if (useSsl!=that.useSsl) return false;
if (anonymousBind!=that.anonymousBind) return false;
if (managerDn != null ? !managerDn.equals(that.managerDn) : that.managerDn != null) return false;
if (managerPassword != null ? !managerPassword.equals(that.managerPassword) : that.managerPassword != null)
return false;
if (baseDN != null ? !baseDN.equals(that.baseDN) : that.baseDN != null) return false;
if (userBase != null ? !userBase.equals(that.userBase) : that.userBase != null)
return false;
if (userObjectClass != null ? !userObjectClass.equals(that.userObjectClass) : that.userObjectClass != null)
return false;
if (usernameAttribute != null ? !usernameAttribute.equals(that.usernameAttribute) : that.usernameAttribute != null)
return false;
if (forceUsernameToLowercase != that.forceUsernameToLowercase)
return false;
if (groupBase != null ? !groupBase.equals(that.groupBase) :
that.groupBase != null) return false;
if (groupObjectClass != null ? !groupObjectClass.equals(that.groupObjectClass) :
that.groupObjectClass != null) return false;
if (groupMembershipAttr != null ? !groupMembershipAttr.equals(
that.groupMembershipAttr) : that.groupMembershipAttr != null) return false;
if (groupNamingAttr != null ? !groupNamingAttr.equals(that.groupNamingAttr) :
that.groupNamingAttr != null) return false;
if (adminGroupMappingRules != null ? !adminGroupMappingRules.equals(
that.adminGroupMappingRules) : that.adminGroupMappingRules != null) return false;
if (groupSearchFilter != null ? !groupSearchFilter.equals(
that.groupSearchFilter) : that.groupSearchFilter != null) return false;
if (dnAttribute != null ? !dnAttribute.equals(
that.dnAttribute) : that.dnAttribute != null) return false;
if (syncGroupMemberReplacePattern != null ? !syncGroupMemberReplacePattern.equals(
that.syncGroupMemberReplacePattern) : that.syncGroupMemberReplacePattern != null) return false;
if (syncUserMemberReplacePattern != null ? !syncUserMemberReplacePattern.equals(
that.syncUserMemberReplacePattern) : that.syncUserMemberReplacePattern != null) return false;
if (syncUserMemberFilter != null ? !syncUserMemberFilter.equals(
that.syncUserMemberFilter) : that.syncUserMemberFilter != null) return false;
if (syncGroupMemberFilter != null ? !syncGroupMemberFilter.equals(
that.syncGroupMemberFilter) : that.syncGroupMemberFilter != null) return false;
if (referralMethod != null ? !referralMethod.equals(that.referralMethod) : that.referralMethod != null) return false;
if (groupMappingEnabled != that.isGroupMappingEnabled()) return false;
if (paginationEnabled != that.isPaginationEnabled()) return false;
if (userSearchFilter != null ? !userSearchFilter.equals(that.userSearchFilter) : that.userSearchFilter != null) return false;
if (alternateUserSearchFilter != null ? !alternateUserSearchFilter.equals(that.alternateUserSearchFilter) : that.alternateUserSearchFilter != null) return false;
if (adminGroupMappingMemberAttr != null ? !adminGroupMappingMemberAttr.equals(that.adminGroupMappingMemberAttr) : that.adminGroupMappingMemberAttr != null) return false;
return true;
}
@Override
public int hashCode() {
int result = primaryUrl != null ? primaryUrl.hashCode() : 0;
result = 31 * result + (secondaryUrl != null ? secondaryUrl.hashCode() : 0);
result = 31 * result + (useSsl ? 1 : 0);
result = 31 * result + (anonymousBind ? 1 : 0);
result = 31 * result + (managerDn != null ? managerDn.hashCode() : 0);
result = 31 * result + (managerPassword != null ? managerPassword.hashCode() : 0);
result = 31 * result + (baseDN != null ? baseDN.hashCode() : 0);
result = 31 * result + (userBase != null ? userBase.hashCode() : 0);
result = 31 * result + (userObjectClass != null ? userObjectClass.hashCode() : 0);
result = 31 * result + (usernameAttribute != null ? usernameAttribute.hashCode() : 0);
result = 31 * result + (forceUsernameToLowercase ? 1 : 0);
result = 31 * result + (groupBase != null ? groupBase.hashCode() : 0);
result = 31 * result + (groupObjectClass != null ? groupObjectClass.hashCode() : 0);
result = 31 * result + (groupMembershipAttr != null ? groupMembershipAttr.hashCode() : 0);
result = 31 * result + (groupNamingAttr != null ? groupNamingAttr.hashCode() : 0);
result = 31 * result + (adminGroupMappingRules != null ? adminGroupMappingRules.hashCode() : 0);
result = 31 * result + (groupSearchFilter != null ? groupSearchFilter.hashCode() : 0);
result = 31 * result + (dnAttribute != null ? dnAttribute.hashCode() : 0);
result = 31 * result + (syncUserMemberReplacePattern != null ? syncUserMemberReplacePattern.hashCode() : 0);
result = 31 * result + (syncGroupMemberReplacePattern != null ? syncGroupMemberReplacePattern.hashCode() : 0);
result = 31 * result + (syncUserMemberFilter != null ? syncUserMemberFilter.hashCode() : 0);
result = 31 * result + (syncGroupMemberFilter != null ? syncGroupMemberFilter.hashCode() : 0);
result = 31 * result + (referralMethod != null ? referralMethod.hashCode() : 0);
result = 31 * result + (userSearchFilter != null ? userSearchFilter.hashCode() : 0);
result = 31 * result + (alternateUserSearchFilter != null ? alternateUserSearchFilter.hashCode() : 0);
result = 31 * result + (adminGroupMappingMemberAttr != null ? adminGroupMappingMemberAttr.hashCode() : 0);
return result;
}
/**
* Resolves known placeholders found within the given ldap user search ldap filter
* @param filter
* @return returns the filter with the resolved placeholders.
*/
protected String resolveUserSearchFilterPlaceHolders(String filter) {
return filter
.replace("{usernameAttribute}", usernameAttribute)
.replace("{userObjectClass}", userObjectClass);
}
}
| {
"content_hash": "234fcdb9ff0d7713ed7cc853722bbcf7",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 187,
"avg_line_length": 36.107142857142854,
"alnum_prop": 0.7301022090339597,
"repo_name": "radicalbit/ambari",
"id": "a4a95165e1f41d6ef704ec42712bbfe56b5c2921",
"size": "15970",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "42212"
},
{
"name": "C",
"bytes": "331204"
},
{
"name": "C#",
"bytes": "182799"
},
{
"name": "C++",
"bytes": "257"
},
{
"name": "CSS",
"bytes": "1287531"
},
{
"name": "CoffeeScript",
"bytes": "4323"
},
{
"name": "FreeMarker",
"bytes": "2654"
},
{
"name": "Groovy",
"bytes": "88056"
},
{
"name": "HTML",
"bytes": "5098825"
},
{
"name": "Java",
"bytes": "29006663"
},
{
"name": "JavaScript",
"bytes": "17274453"
},
{
"name": "Makefile",
"bytes": "11111"
},
{
"name": "PHP",
"bytes": "149648"
},
{
"name": "PLSQL",
"bytes": "2160"
},
{
"name": "PLpgSQL",
"bytes": "314333"
},
{
"name": "PowerShell",
"bytes": "2087991"
},
{
"name": "Python",
"bytes": "14584206"
},
{
"name": "R",
"bytes": "1457"
},
{
"name": "Roff",
"bytes": "13935"
},
{
"name": "Ruby",
"bytes": "14478"
},
{
"name": "SQLPL",
"bytes": "2117"
},
{
"name": "Shell",
"bytes": "741459"
},
{
"name": "Vim script",
"bytes": "5813"
}
],
"symlink_target": ""
} |
package com.github.davidmoten.rtree;
import org.junit.Test;
import com.github.davidmoten.util.TestingUtil;
public class ComparatorsTest {
@Test
public void testConstructorIsPrivate() {
TestingUtil.callConstructorAndCheckIsPrivate(Comparators.class);
}
}
| {
"content_hash": "3dda4c4dcd4103dc576af6ed9d09f775",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 19.928571428571427,
"alnum_prop": 0.7598566308243727,
"repo_name": "lhyqie/rtree",
"id": "a61a4fab90d410a736cbe3becc29916afba932ad",
"size": "279",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/test/java/com/github/davidmoten/rtree/ComparatorsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "191863"
},
{
"name": "Python",
"bytes": "1931"
},
{
"name": "Shell",
"bytes": "171"
}
],
"symlink_target": ""
} |
import { Vector3 } from './../../math/Vector3';
import { Curve } from './../core/Curve';
export class CubicBezierCurve3 extends Curve<Vector3> {
constructor(v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3);
v0: Vector3;
v1: Vector3;
v2: Vector3;
v3: Vector3;
getPoint(t: number): Vector3;
}
| {
"content_hash": "59202e661f36b0111238c433c0a08130",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 66,
"avg_line_length": 23.76923076923077,
"alnum_prop": 0.6601941747572816,
"repo_name": "Michayal/michayal.github.io",
"id": "efce56ae21305deec0dddc80853ca86aae414237",
"size": "309",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "node_modules/super-three/src/extras/curves/CubicBezierCurve3.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "16564"
},
{
"name": "JavaScript",
"bytes": "2034596"
},
{
"name": "Shell",
"bytes": "123"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "a8fcd9fb8576fafcc7deaa152c2008ad",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "c3346bacdb7407f5412faa5ae0bd4251733d0b27",
"size": "188",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Crepidiastrum/Crepidiastrum lanceolatum/ Syn. Youngia integra/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RPTListener : RPTemplate {
public override bool match (KNSubject other)
{
OutputTemplate = "you";
Debug.Log ("RPTListener Match: Listener: " + listener.name + " subject: " + other.SubjectName);
if (listener != null) {
return other.Equals (KNManager.GetSubject (listener.name));
} else {
return false;
}
}
}
| {
"content_hash": "21c3abb27bcf6c98e7156f36db291372",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 97,
"avg_line_length": 24.823529411764707,
"alnum_prop": 0.7037914691943128,
"repo_name": "DrDoak/Sol",
"id": "203408f31083d79ab34b0d2e6d9012fe4383d878",
"size": "424",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/Scripts/AI/Response/RPTListener.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "577340"
},
{
"name": "HLSL",
"bytes": "9999"
},
{
"name": "ShaderLab",
"bytes": "95737"
}
],
"symlink_target": ""
} |
<?php
/**
* Mini-cart
*
* Contains the markup for the mini-cart, used by the cart widget
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce;
?>
<?php do_action( 'woocommerce_before_mini_cart' ); ?>
<ul class="cart_list product_list_widget <?php echo $args['list_class']; ?>">
<?php if ( sizeof( WC()->cart->get_cart() ) > 0 ) : ?>
<?php
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
$product_name = apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key );
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
$product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
?>
<li>
<a href="<?php echo get_permalink( $product_id ); ?>">
<?php echo $thumbnail . '<h6>'.$product_name.'</h6>'; ?>
</a>
<?php echo WC()->cart->get_item_data( $cart_item ); ?>
<?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key ); ?>
</li>
<?php
}
}
?>
<?php else : ?>
<li class="empty"><?php _e( 'No products in the cart.',THB_THEME_NAME ); ?></li>
<?php endif; ?>
</ul><!-- end product list -->
<?php if ( sizeof( WC()->cart->get_cart() ) > 0 ) : ?>
<p class="total"><strong><?php _e( 'Subtotal',THB_THEME_NAME ); ?>:</strong> <?php echo WC()->cart->get_cart_subtotal(); ?></p>
<?php do_action( 'woocommerce_widget_shopping_cart_before_buttons' ); ?>
<p class="buttons">
<a href="<?php echo WC()->cart->get_cart_url(); ?>" class="button grey wc-forward"><?php _e( 'View Cart',THB_THEME_NAME ); ?></a>
<a href="<?php echo WC()->cart->get_checkout_url(); ?>" class="button accent checkout wc-forward"><?php _e( 'Checkout',THB_THEME_NAME ); ?></a>
</p>
<?php endif; ?>
<?php do_action( 'woocommerce_after_mini_cart' ); ?> | {
"content_hash": "b94e131280d15000625b0b812f6cf246",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 213,
"avg_line_length": 37.22857142857143,
"alnum_prop": 0.5951650038372985,
"repo_name": "soyluking/soyluking-wp",
"id": "fd087809a1e175cf031e05e22c0e390a65401cde",
"size": "2606",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "woocommerce/cart/mini-cart.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "629606"
},
{
"name": "Gettext Catalog",
"bytes": "235654"
},
{
"name": "JavaScript",
"bytes": "107295"
},
{
"name": "PHP",
"bytes": "1271111"
}
],
"symlink_target": ""
} |