text stringlengths 2 1.04M | meta dict |
|---|---|
package stroom.processor.impl.db;
import stroom.db.util.AbstractFlyWayDbModule;
import stroom.db.util.DataSourceProxy;
import stroom.processor.impl.ProcessorConfig.ProcessorDbConfig;
import javax.sql.DataSource;
public class ProcessorDbModule extends AbstractFlyWayDbModule<ProcessorDbConfig, ProcessorDbConnProvider> {
private static final String MODULE = "stroom-processor";
private static final String FLYWAY_LOCATIONS = "stroom/processor/impl/db/migration";
private static final String FLYWAY_TABLE = "processor_schema_history";
@Override
protected String getFlyWayTableName() {
return FLYWAY_TABLE;
}
@Override
protected String getModuleName() {
return MODULE;
}
@Override
protected String getFlyWayLocation() {
return FLYWAY_LOCATIONS;
}
@Override
protected Class<ProcessorDbConnProvider> getConnectionProviderType() {
return ProcessorDbConnProvider.class;
}
@Override
protected ProcessorDbConnProvider createConnectionProvider(final DataSource dataSource) {
return new DataSourceImpl(dataSource);
}
private static class DataSourceImpl extends DataSourceProxy implements ProcessorDbConnProvider {
private DataSourceImpl(final DataSource dataSource) {
super(dataSource, MODULE);
}
}
}
| {
"content_hash": "d99654a6074e51feec292263472668dc",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 107,
"avg_line_length": 29.32608695652174,
"alnum_prop": 0.7390659747961453,
"repo_name": "gchq/stroom",
"id": "1980347b84b376835aba2344495cf934d18f4ab1",
"size": "1349",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "stroom-processor/stroom-processor-impl-db/src/main/java/stroom/processor/impl/db/ProcessorDbModule.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "272243"
},
{
"name": "Dockerfile",
"bytes": "21009"
},
{
"name": "HTML",
"bytes": "14114"
},
{
"name": "Java",
"bytes": "22782925"
},
{
"name": "JavaScript",
"bytes": "14516557"
},
{
"name": "Makefile",
"bytes": "661"
},
{
"name": "Python",
"bytes": "3176"
},
{
"name": "SCSS",
"bytes": "158667"
},
{
"name": "Shell",
"bytes": "166531"
},
{
"name": "TypeScript",
"bytes": "2009517"
},
{
"name": "XSLT",
"bytes": "174226"
}
],
"symlink_target": ""
} |
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit3061cba326f89c02f6ec805d21d84d00::getLoader();
| {
"content_hash": "36114ad428d6437cee8e12f2dcb6e167",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 75,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.7595628415300546,
"repo_name": "lozy219/tangerine",
"id": "ac4e8b22592f398f7a9ff6ac4e09a208e59afefa",
"size": "183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/autoload.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "24495"
},
{
"name": "CSS",
"bytes": "9034"
},
{
"name": "HTML",
"bytes": "15054"
},
{
"name": "JavaScript",
"bytes": "25665"
},
{
"name": "PHP",
"bytes": "36152"
}
],
"symlink_target": ""
} |
package org.camunda.bpm.model.dmn.impl.instance;
import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.LATEST_DMN_NS;
import static org.camunda.bpm.model.dmn.impl.DmnModelConstants.DMN_ELEMENT_QUESTION;
import org.camunda.bpm.model.dmn.instance.Question;
import org.camunda.bpm.model.xml.ModelBuilder;
import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext;
import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder;
import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider;
public class QuestionImpl extends DmnModelElementInstanceImpl implements Question {
public QuestionImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Question.class, DMN_ELEMENT_QUESTION)
.namespaceUri(LATEST_DMN_NS)
.instanceProvider(new ModelTypeInstanceProvider<Question>() {
public Question newInstance(ModelTypeInstanceContext instanceContext) {
return new QuestionImpl(instanceContext);
}
});
typeBuilder.build();
}
}
| {
"content_hash": "48ecc0403260016052cb5860bc56923c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 103,
"avg_line_length": 38.03225806451613,
"alnum_prop": 0.7947413061916879,
"repo_name": "ingorichtsmeier/camunda-bpm-platform",
"id": "71350953dff076ab2a1eb8abd8d7749263299dee",
"size": "1986",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "model-api/dmn-model/src/main/java/org/camunda/bpm/model/dmn/impl/instance/QuestionImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "8608"
},
{
"name": "CSS",
"bytes": "5486"
},
{
"name": "Fluent",
"bytes": "3111"
},
{
"name": "FreeMarker",
"bytes": "1442812"
},
{
"name": "Groovy",
"bytes": "1904"
},
{
"name": "HTML",
"bytes": "961289"
},
{
"name": "Java",
"bytes": "44047866"
},
{
"name": "JavaScript",
"bytes": "3063613"
},
{
"name": "Less",
"bytes": "154956"
},
{
"name": "Python",
"bytes": "192"
},
{
"name": "Ruby",
"bytes": "60"
},
{
"name": "SQLPL",
"bytes": "44180"
},
{
"name": "Shell",
"bytes": "11634"
}
],
"symlink_target": ""
} |
require 'spec_helper'
describe "the base response" do
describe "on a successful response" do
before(:each) do
@response = parse_canned_response(:successful, :iowp, :v1)
end
it "should identify success" do
@response.success?.should == true
end
it "should identify meta fields correctly" do
@response.request_id.should == "3000852"
@response.response_datetime.should == Time.parse("Fri Apr 09 02:03:09 2010")
end
it "should give you the raw hash to access" do
@response.hash.should_not be_nil
end
it "should not provide the errors" do
@response.errors.should be_empty
end
it "should provide the raw and parsed response" do
@response.response_hash.should be_a(Hash)
xml = @response.raw_response
xml.should have_xpath("/XML/REQUEST/META")
end
end
describe "on an unsuccessful response" do
before(:each) do
@response = parse_canned_response(:unsuccessful, :iowp, :v1)
end
it "should identify success" do
@response.success?.should == false
end
it "should identify meta fields correctly" do
@response.request_id.should == "3000854"
@response.response_datetime.should == Time.parse("Fri Apr 09 02:03:28 2010")
end
it "should provide the errors" do
@response.errors.should_not be_empty
@response.errors.first.code.should_not be_nil
@response.errors.first.message.should_not be_nil
end
it "should provide the raw and parsed response" do
@response.response_hash.should be_a(Hash)
xml = @response.raw_response
xml.should have_xpath("/XML/REQUEST/META")
end
end
end
| {
"content_hash": "bfc67ecc53b686e9647544fe948578e0",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 82,
"avg_line_length": 28.372881355932204,
"alnum_prop": 0.6654719235364397,
"repo_name": "thoughtworks/global_collect",
"id": "d650255ed2548863a595a1996993a332ef2e2c32",
"size": "1701",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "spec/responses/base_spec.rb",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Ruby",
"bytes": "156787"
}
],
"symlink_target": ""
} |
<?php namespace Barryvdh\Debugbar\Twig\TokenParser;
use Barryvdh\Debugbar\Twig\Node\StopwatchNode;
/**
* Token Parser for the stopwatch tag. Based on Symfony\Bridge\Twig\TokenParser\StopwatchTokenParser;
*
* @author Wouter J <wouter@wouterj.nl>
*/
class StopwatchTokenParser extends \Twig_TokenParser
{
protected $debugbarAvailable;
public function __construct($debugbarAvailable)
{
$this->debugbarAvailable = $debugbarAvailable;
}
public function parse(\Twig_Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
// {% stopwatch 'bar' %}
$name = $this->parser->getExpressionParser()->parseExpression();
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
// {% endstopwatch %}
$body = $this->parser->subparse(array($this, 'decideStopwatchEnd'), true);
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
if ($this->debugbarAvailable) {
return new StopwatchNode(
$name,
$body,
new \Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()),
$lineno,
$this->getTag()
);
}
return $body;
}
public function getTag()
{
return 'stopwatch';
}
public function decideStopwatchEnd(\Twig_Token $token)
{
return $token->test('endstopwatch');
}
}
| {
"content_hash": "2e599ff0812d1c1319d3924458bf961a",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 101,
"avg_line_length": 27.472727272727273,
"alnum_prop": 0.57114493712773,
"repo_name": "focuslife/v0.1",
"id": "896c280ebd638e3dc837d7541d2c57e09eed65dd",
"size": "1511",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "vendor/barryvdh/laravel-debugbar/src/Twig/TokenParser/StopwatchTokenParser.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "428"
},
{
"name": "CSS",
"bytes": "72"
},
{
"name": "JavaScript",
"bytes": "519"
},
{
"name": "PHP",
"bytes": "273407"
}
],
"symlink_target": ""
} |
import { upsert } from 'pouchdb-utils';
import { stringMd5 } from 'pouchdb-md5';
import createViewSignature from './createViewSignature';
function createView(sourceDB, viewName, mapFun, reduceFun, temporary, localDocName) {
var viewSignature = createViewSignature(mapFun, reduceFun);
var cachedViews;
if (!temporary) {
// cache this to ensure we don't try to update the same view twice
cachedViews = sourceDB._cachedViews = sourceDB._cachedViews || {};
if (cachedViews[viewSignature]) {
return cachedViews[viewSignature];
}
}
var promiseForView = sourceDB.info().then(function (info) {
var depDbName = info.db_name + '-mrview-' +
(temporary ? 'temp' : stringMd5(viewSignature));
// save the view name in the source db so it can be cleaned up if necessary
// (e.g. when the _design doc is deleted, remove all associated view data)
function diffFunction(doc) {
doc.views = doc.views || {};
var fullViewName = viewName;
if (fullViewName.indexOf('/') === -1) {
fullViewName = viewName + '/' + viewName;
}
var depDbs = doc.views[fullViewName] = doc.views[fullViewName] || {};
/* istanbul ignore if */
if (depDbs[depDbName]) {
return; // no update necessary
}
depDbs[depDbName] = true;
return doc;
}
return upsert(sourceDB, '_local/' + localDocName, diffFunction).then(function () {
return sourceDB.registerDependentDatabase(depDbName).then(function (res) {
var db = res.db;
db.auto_compaction = true;
var view = {
name: depDbName,
db: db,
sourceDB: sourceDB,
adapter: sourceDB.adapter,
mapFun: mapFun,
reduceFun: reduceFun
};
return view.db.get('_local/lastSeq').catch(function (err) {
/* istanbul ignore if */
if (err.status !== 404) {
throw err;
}
}).then(function (lastSeqDoc) {
view.seq = lastSeqDoc ? lastSeqDoc.seq : 0;
if (cachedViews) {
view.db.once('destroyed', function () {
delete cachedViews[viewSignature];
});
}
return view;
});
});
});
});
if (cachedViews) {
cachedViews[viewSignature] = promiseForView;
}
return promiseForView;
}
export default createView;
| {
"content_hash": "373c9ee8f594c635bcda3ec976a990e9",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 86,
"avg_line_length": 32.12162162162162,
"alnum_prop": 0.5986537652503156,
"repo_name": "seigel/pouchdb",
"id": "fb579cb0c6c0579377108814e312fd81b54f120c",
"size": "2377",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "packages/node_modules/pouchdb-abstract-mapreduce/src/createView.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "12440"
},
{
"name": "JavaScript",
"bytes": "2266239"
},
{
"name": "Shell",
"bytes": "11363"
}
],
"symlink_target": ""
} |
namespace Envoy {
namespace Server {
SharedMemory* attachSharedMemory(uint32_t base_id, uint32_t restart_epoch) {
Api::OsSysCalls& os_sys_calls = Api::OsSysCallsSingleton::get();
Api::HotRestartOsSysCalls& hot_restart_os_sys_calls = Api::HotRestartOsSysCallsSingleton::get();
int flags = O_RDWR;
const std::string shmem_name = fmt::format("/envoy_shared_memory_{}", base_id);
if (restart_epoch == 0) {
flags |= O_CREAT | O_EXCL;
// If we are meant to be first, attempt to unlink a previous shared memory instance. If this
// is a clean restart this should then allow the shm_open() call below to succeed.
hot_restart_os_sys_calls.shmUnlink(shmem_name.c_str());
}
const Api::SysCallIntResult result =
hot_restart_os_sys_calls.shmOpen(shmem_name.c_str(), flags, S_IRUSR | S_IWUSR);
if (result.rc_ == -1) {
PANIC(fmt::format("cannot open shared memory region {} check user permissions. Error: {}",
shmem_name, errorDetails(result.errno_)));
}
if (restart_epoch == 0) {
const Api::SysCallIntResult truncateRes =
os_sys_calls.ftruncate(result.rc_, sizeof(SharedMemory));
RELEASE_ASSERT(truncateRes.rc_ != -1, "");
}
const Api::SysCallPtrResult mmapRes = os_sys_calls.mmap(
nullptr, sizeof(SharedMemory), PROT_READ | PROT_WRITE, MAP_SHARED, result.rc_, 0);
SharedMemory* shmem = reinterpret_cast<SharedMemory*>(mmapRes.rc_);
RELEASE_ASSERT(shmem != MAP_FAILED, "");
RELEASE_ASSERT((reinterpret_cast<uintptr_t>(shmem) % alignof(decltype(shmem))) == 0, "");
if (restart_epoch == 0) {
shmem->size_ = sizeof(SharedMemory);
shmem->version_ = HOT_RESTART_VERSION;
initializeMutex(shmem->log_lock_);
initializeMutex(shmem->access_log_lock_);
} else {
RELEASE_ASSERT(shmem->size_ == sizeof(SharedMemory),
"Hot restart SharedMemory size mismatch! You must have hot restarted into a "
"not-hot-restart-compatible new version of Envoy.");
RELEASE_ASSERT(shmem->version_ == HOT_RESTART_VERSION,
"Hot restart version mismatch! You must have hot restarted into a "
"not-hot-restart-compatible new version of Envoy.");
}
// Here we catch the case where a new Envoy starts up when the current Envoy has not yet fully
// initialized. The startup logic is quite complicated, and it's not worth trying to handle this
// in a finer way. This will cause the startup to fail with an error code early, without
// affecting any currently running processes. The process runner should try again later with some
// back off and with the same hot restart epoch number.
uint64_t old_flags = shmem->flags_.fetch_or(SHMEM_FLAGS_INITIALIZING);
if (old_flags & SHMEM_FLAGS_INITIALIZING) {
throw EnvoyException("previous envoy process is still initializing");
}
return shmem;
}
void initializeMutex(pthread_mutex_t& mutex) {
pthread_mutexattr_t attribute;
pthread_mutexattr_init(&attribute);
pthread_mutexattr_setpshared(&attribute, PTHREAD_PROCESS_SHARED);
pthread_mutexattr_setrobust(&attribute, PTHREAD_MUTEX_ROBUST);
pthread_mutex_init(&mutex, &attribute);
}
// The base id is automatically scaled by 10 to prevent overlap of domain socket names when
// multiple Envoys with different base-ids run on a single host. Note that older versions of Envoy
// performed the multiplication in OptionsImpl which produced incorrect server info output.
// TODO(zuercher): ideally, the base_id would be separated from the restart_epoch in
// the socket names to entirely prevent collisions between consecutive base ids.
HotRestartImpl::HotRestartImpl(uint32_t base_id, uint32_t restart_epoch)
: base_id_(base_id), scaled_base_id_(base_id * 10),
as_child_(HotRestartingChild(scaled_base_id_, restart_epoch)),
as_parent_(HotRestartingParent(scaled_base_id_, restart_epoch)),
shmem_(attachSharedMemory(scaled_base_id_, restart_epoch)), log_lock_(shmem_->log_lock_),
access_log_lock_(shmem_->access_log_lock_) {
// If our parent ever goes away just terminate us so that we don't have to rely on ops/launching
// logic killing the entire process tree. We should never exist without our parent.
int rc = prctl(PR_SET_PDEATHSIG, SIGTERM);
RELEASE_ASSERT(rc != -1, "");
}
void HotRestartImpl::drainParentListeners() {
as_child_.drainParentListeners();
// At this point we are initialized and a new Envoy can startup if needed.
shmem_->flags_ &= ~SHMEM_FLAGS_INITIALIZING;
}
int HotRestartImpl::duplicateParentListenSocket(const std::string& address) {
return as_child_.duplicateParentListenSocket(address);
}
void HotRestartImpl::initialize(Event::Dispatcher& dispatcher, Server::Instance& server) {
as_parent_.initialize(dispatcher, server);
}
void HotRestartImpl::sendParentAdminShutdownRequest(time_t& original_start_time) {
as_child_.sendParentAdminShutdownRequest(original_start_time);
}
void HotRestartImpl::sendParentTerminateRequest() { as_child_.sendParentTerminateRequest(); }
HotRestart::ServerStatsFromParent
HotRestartImpl::mergeParentStatsIfAny(Stats::StoreRoot& stats_store) {
std::unique_ptr<envoy::HotRestartMessage> wrapper_msg = as_child_.getParentStats();
ServerStatsFromParent response;
// getParentStats() will happily and cleanly return nullptr if we have no parent.
if (wrapper_msg) {
as_child_.mergeParentStats(stats_store, wrapper_msg->reply().stats());
response.parent_memory_allocated_ = wrapper_msg->reply().stats().memory_allocated();
response.parent_connections_ = wrapper_msg->reply().stats().num_connections();
}
return response;
}
void HotRestartImpl::shutdown() { as_parent_.shutdown(); }
uint32_t HotRestartImpl::baseId() { return base_id_; }
std::string HotRestartImpl::version() { return hotRestartVersion(); }
std::string HotRestartImpl::hotRestartVersion() {
return fmt::format("{}.{}", HOT_RESTART_VERSION, sizeof(SharedMemory));
}
} // namespace Server
} // namespace Envoy
| {
"content_hash": "950eb90b0c7fb17a28e96f15b9c6338f",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 99,
"avg_line_length": 45.74045801526717,
"alnum_prop": 0.7181241655540721,
"repo_name": "lizan/envoy",
"id": "c9e0aa7e7d023ac91b5ba36328893d176674d52d",
"size": "6485",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/server/hot_restart_impl.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "27272"
},
{
"name": "C++",
"bytes": "22340931"
},
{
"name": "Dockerfile",
"bytes": "1136"
},
{
"name": "Emacs Lisp",
"bytes": "966"
},
{
"name": "Go",
"bytes": "695"
},
{
"name": "Makefile",
"bytes": "303"
},
{
"name": "PowerShell",
"bytes": "2704"
},
{
"name": "PureBasic",
"bytes": "472"
},
{
"name": "Python",
"bytes": "450224"
},
{
"name": "Rust",
"bytes": "892"
},
{
"name": "Shell",
"bytes": "145058"
},
{
"name": "Starlark",
"bytes": "1359687"
},
{
"name": "Thrift",
"bytes": "748"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "b5ce47d13782953b391779638d7130b9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "907e4ac6961301e5b8b98a6752cbb072e5013e8a",
"size": "202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Macrolobium/Macrolobium pittieri/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([undefined, '../ApiClient', './RackHDBootImageNetworkAddress'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(undefined, require('../ApiClient'), require('./RackHDBootImageNetworkAddress'));
} else {
// Browser globals (root is window)
if (!root.RedfishV100) {
root.RedfishV100 = {};
}
factory(root.RedfishV100, root.RedfishV100.ApiClient, root.RedfishV100.RackHDBootImageNetworkAddress);
}
}(this, function(module, ApiClient, RackHDBootImageNetworkAddress) {
'use strict';
var RackHDBootImageNetworkDevice = function RackHDBootImageNetworkDevice(device) {
/**
* The name of the network device.
* datatype: String
* required
**/
this['device'] = device;
/**
* This the ipv4 parameter of the network device.
* datatype: RackHDBootImageNetworkAddress
**/
this['ipv4'] = new RackHDBootImageNetworkAddress();
/**
* This is the ipv6 parameter of the network device.
* datatype: RackHDBootImageNetworkAddress
**/
this['ipv6'] = new RackHDBootImageNetworkAddress();
};
RackHDBootImageNetworkDevice.prototype.constructFromObject = function(data) {
if (!data) {
return this;
}
if (data['device']) {
this['device'] = ApiClient.convertToType(data['device'], 'String');
}
if (data['ipv4']) {
this['ipv4'].constructFromObject(data['ipv4']);
}
if (data['ipv6']) {
this['ipv6'].constructFromObject(data['ipv6']);
}
return this;
}
/**
* get The name of the network device.
* @return {String}
**/
RackHDBootImageNetworkDevice.prototype.getDevice = function() {
return this['device'];
}
/**
* set The name of the network device.
* @param {String} device
**/
RackHDBootImageNetworkDevice.prototype.setDevice = function(device) {
this['device'] = device;
}
/**
* get This the ipv4 parameter of the network device.
* @return {RackHDBootImageNetworkAddress}
**/
RackHDBootImageNetworkDevice.prototype.getIpv4 = function() {
return this['ipv4'];
}
/**
* set This the ipv4 parameter of the network device.
* @param {RackHDBootImageNetworkAddress} ipv4
**/
RackHDBootImageNetworkDevice.prototype.setIpv4 = function(ipv4) {
this['ipv4'] = ipv4;
}
/**
* get This is the ipv6 parameter of the network device.
* @return {RackHDBootImageNetworkAddress}
**/
RackHDBootImageNetworkDevice.prototype.getIpv6 = function() {
return this['ipv6'];
}
/**
* set This is the ipv6 parameter of the network device.
* @param {RackHDBootImageNetworkAddress} ipv6
**/
RackHDBootImageNetworkDevice.prototype.setIpv6 = function(ipv6) {
this['ipv6'] = ipv6;
}
RackHDBootImageNetworkDevice.prototype.toJson = function() {
return JSON.stringify(this);
}
if (module) {
module.RackHDBootImageNetworkDevice = RackHDBootImageNetworkDevice;
}
return RackHDBootImageNetworkDevice;
}));
| {
"content_hash": "e1906a19d368a07111533d7d3a537581",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 109,
"avg_line_length": 25.609375,
"alnum_prop": 0.6510067114093959,
"repo_name": "jlongever/redfish-client-node",
"id": "8987a5e3d77bd810ecc1aa454aa09277eebdc335",
"size": "3278",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/model/RackHDBootImageNetworkDevice.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "627495"
}
],
"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_92) on Wed Mar 01 10:26:34 ICT 2017 -->
<title>Uses of Class com.model.algorithm.DiagonalStrategy.Direction</title>
<meta name="date" content="2017-03-01">
<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 Class com.strategy.DiagonalStrategy.Direction";
}
}
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="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/strategy/class-use/DiagonalStrategy.Direction.html" target="_top">Frames</a></li>
<li><a href="DiagonalStrategy.Direction.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.model.algorithm.DiagonalStrategy.Direction" class="title">Uses of Class<br>com.model.algorithm.DiagonalStrategy.Direction</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="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">DiagonalStrategy.Direction</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#com.strategy">com.model.strategy</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="com.strategy">
<!-- -->
</a>
<h3>Uses of <a href="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">DiagonalStrategy.Direction</a> in <a href="../../../com/strategy/package-summary.html">com.model.strategy</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="../../../com/strategy/package-summary.html">com.model.strategy</a> that return <a href="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">DiagonalStrategy.Direction</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="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">DiagonalStrategy.Direction</a></code></td>
<td class="colLast"><span class="typeNameLabel">DiagonalStrategy.Direction.</span><code><span class="memberNameLink"><a href="../../../com/strategy/DiagonalStrategy.Direction.html#valueOf-java.lang.String-">valueOf</a></span>(java.lang.String name)</code>
<div class="block">Returns the enum constant of this type with the specified name.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">DiagonalStrategy.Direction</a>[]</code></td>
<td class="colLast"><span class="typeNameLabel">DiagonalStrategy.Direction.</span><code><span class="memberNameLink"><a href="../../../com/strategy/DiagonalStrategy.Direction.html#values--">values</a></span>()</code>
<div class="block">Returns an array containing the constants of this enum type, in
the order they are declared.</div>
</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="../../../com/strategy/package-summary.html">com.model.strategy</a> with parameters of type <a href="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">DiagonalStrategy.Direction</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>private boolean</code></td>
<td class="colLast"><span class="typeNameLabel">DiagonalStrategy.</span><code><span class="memberNameLink"><a href="../../../com/strategy/DiagonalStrategy.html#isWin-com.player.Location-java.lang.String-com.strategy.DiagonalStrategy.Direction-">isWin</a></span>(<a href="../../../com/player/Location.html" title="class in com.model.player">Location</a> l,
java.lang.String winCond,
<a href="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">DiagonalStrategy.Direction</a> d)</code>
<div class="block">check is win with direction (left or right).</div>
</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="../../../com/strategy/DiagonalStrategy.Direction.html" title="enum in com.model.strategy">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?com/strategy/class-use/DiagonalStrategy.Direction.html" target="_top">Frames</a></li>
<li><a href="DiagonalStrategy.Direction.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "77db3b3f3ea173888f6cc9769eb588e0",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 360,
"avg_line_length": 43.61052631578947,
"alnum_prop": 0.6684769490707217,
"repo_name": "Bubblebitoey/Softspec-Hw1-5810546056-5810546552",
"id": "efee1fa25f12e1be23ff633e53d3e000a4fa0cf7",
"size": "8286",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/com/strategy/class-use/DiagonalStrategy.Direction.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "82143"
}
],
"symlink_target": ""
} |
//
// GDPhotoUtil.h
// DaZhuanJia
//
// Created by wangguodong on 15/8/20.
// Copyright (c) 2015年 隔壁老王. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef void (^GDPhotoCompleteBlock)(NSData *imageData);
@interface GDPhotoUtil : NSObject
/**
类方法,单例化
@return GDPhotoUtil实例
*/
+ (instancetype)sharedInstance;
/**
类方法,当前是否获取到相机的使用权限
@return BOOL
*/
+ (BOOL)isCameraValid;
/**
返回folder下面fileName的本地路径
@param folder 文件夹名称
@param fileName 文件名称
@return NSString 文件的本地路径
*/
+ (NSString *)getPhotoLocalPathWithFolder:(NSString *)folder fileName:(NSString *)fileName;
/**
从相机或者照片中获取图片
@param editEnabled 是否允许编辑
@param targetSize 目标尺寸
@param compressionQuality 压缩率
@param completeBlock 获取图片成功后的回调block
@return void
*/
- (void)takePhotoWithEditEnabled:(BOOL)editEnabled
targetSize:(CGSize)targetSize
compressionQuality:(CGFloat)compressionQuality
completed:(GDPhotoCompleteBlock)completeBlock;
@end
| {
"content_hash": "e977b3c994da61833977ccce9d3ee247",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 91,
"avg_line_length": 21.82,
"alnum_prop": 0.6663611365719523,
"repo_name": "guodong10518/GDTest",
"id": "20b45385eaa76af9c1279b51a0313f635b57d3d1",
"size": "1275",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GDTest/Header/GDUtils/GDPhotoUtil.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "54081"
},
{
"name": "Ruby",
"bytes": "2403"
}
],
"symlink_target": ""
} |
import { Injectable } from '@angular/core';
import { NgRedux } from '@angular-redux/store';
import { Observable } from 'rxjs/Observable';
import { NOTIFICATION_TYPE } from 'constant';
import { combineActionsToReducer } from 'utils';
import { IAlertState, Notification } from './app-interfaces';
const CLEAR_ALL_NOTIFICATIONS: string = 'NOTIFICATION_STATE/CLEAR_ALL_NOTIFICATIONS';
const HIDE_NOTIFICATION: string = 'NOTIFICATION_STATE/HIDE_NOTIFICATION';
const SHOW_NOTIFICATION: string = 'NOTIFICATION_STATE/SHOW_NOTIFICATION';
const SHOW_CONFIRMATION: string = 'NOTIFICATION_STATE/SHOW_CONFIRMATION';
/**
* Define all actions to handle show/hide alert, notification on right and modals.
*
* @export
* @class AlertsActions
*/
@Injectable()
export class AlertsActions {
constructor(private redux: NgRedux<IAlertState>) {}
showConfirmation(type:string, msg: string) {
const confirmation = new Notification();
confirmation.message = msg;
confirmation.type = NOTIFICATION_TYPE.SUCCESS;
this.redux.dispatch({ type: SHOW_CONFIRMATION, payload: confirmation });
}
showError(error: string) {
const notification = new Notification();
notification.message = error;
notification.type = NOTIFICATION_TYPE.ERROR;
this.redux.dispatch({ type: SHOW_NOTIFICATION, payload: notification });
this.addQueueForHide(notification.id);
}
show(type:string, msg: string) {
const notification = new Notification();
notification.message = msg;
notification.type = NOTIFICATION_TYPE.SUCCESS;
this.redux.dispatch({ type: SHOW_NOTIFICATION, payload: notification });
this.addQueueForHide(notification.id);
}
// FIXME:
addQueueForHide(id: string){
const currentState = this.redux.getState();
Observable.interval(2000)
.take(1)
.subscribe(x=> this.hide(id));
}
hide(id: string) {
this.redux.dispatch({ type: HIDE_NOTIFICATION, payload: id });
}
clearAll() {
this.redux.dispatch({ type: HIDE_NOTIFICATION, payload: null });
}
}
export const alertsInitialState: IAlertState = {
confirmation: null,
notifications: []
};
export const alertsReducer = combineActionsToReducer(
{
[SHOW_CONFIRMATION]: (state, action) => {
const { payload } = action;
return {
...state,
confirmation: payload
}
},
[SHOW_NOTIFICATION]: (state, action) => {
const { payload } = action;
return {
...state,
notifications: [payload]
}
},
[HIDE_NOTIFICATION]: (state, action) => {
const { payload } = action;
const { notifications } = state;
const newState = notifications.filter(x=> x.id !== payload);
return {
...state,
notifications: newState
}
},
[CLEAR_ALL_NOTIFICATIONS]: (state, action) => {
return {
...state,
notifications: []
}
}
},
alertsInitialState); | {
"content_hash": "08e426621751d3b4f1fc8d84908c7fed",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 85,
"avg_line_length": 30.980392156862745,
"alnum_prop": 0.6104430379746836,
"repo_name": "dvhuy/dkNg",
"id": "25cde3cf391bb6559ab12f155529359ac96901a6",
"size": "3160",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/core/state/alerts.state.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3166014"
},
{
"name": "HTML",
"bytes": "21965"
},
{
"name": "JavaScript",
"bytes": "17942"
},
{
"name": "TypeScript",
"bytes": "51250"
}
],
"symlink_target": ""
} |
module VSim.VIR
( module VSim.VIR.AST
, module VSim.VIR.Types
) where
import VSim.VIR.AST
import VSim.VIR.Types
| {
"content_hash": "69c77d087ab25cc89799fb351288f1da",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 27,
"avg_line_length": 16.875,
"alnum_prop": 0.6370370370370371,
"repo_name": "ierton/vsim",
"id": "f6fd38dcbe3802c45f113799595a9c2505bdf2e0",
"size": "305",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/VSim/VIR.hs",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Haskell",
"bytes": "550731"
},
{
"name": "JavaScript",
"bytes": "14"
},
{
"name": "Perl",
"bytes": "1555"
}
],
"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) on Mon Jan 13 19:53:36 EST 2014 -->
<title>BasisHatShapeControl</title>
<meta name="date" content="2014-01-13">
<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="BasisHatShapeControl";
}
//-->
</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="class-use/BasisHatShapeControl.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/drip/spline/bspline/BasisHatPairGenerator.html" title="class in org.drip.spline.bspline"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/drip/spline/bspline/CubicRationalLeftRaw.html" title="class in org.drip.spline.bspline"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/drip/spline/bspline/BasisHatShapeControl.html" target="_top">Frames</a></li>
<li><a href="BasisHatShapeControl.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.drip.spline.bspline</div>
<h2 title="Class BasisHatShapeControl" class="title">Class BasisHatShapeControl</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../org/drip/quant/function1D/AbstractUnivariate.html" title="class in org.drip.quant.function1D">org.drip.quant.function1D.AbstractUnivariate</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../org/drip/spline/bspline/TensionBasisHat.html" title="class in org.drip.spline.bspline">org.drip.spline.bspline.TensionBasisHat</a></li>
<li>
<ul class="inheritance">
<li>org.drip.spline.bspline.BasisHatShapeControl</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../org/drip/spline/bspline/LeftHatShapeControl.html" title="class in org.drip.spline.bspline">LeftHatShapeControl</a>, <a href="../../../../org/drip/spline/bspline/RightHatShapeControl.html" title="class in org.drip.spline.bspline">RightHatShapeControl</a></dd>
</dl>
<hr>
<br>
<pre>public abstract class <span class="strong">BasisHatShapeControl</span>
extends <a href="../../../../org/drip/spline/bspline/TensionBasisHat.html" title="class in org.drip.spline.bspline">TensionBasisHat</a></pre>
<div class="block">BasisHatShapeControl implements the shape control function for the hat basis set as laid out in the
framework outlined in Koch and Lyche (1989), Koch and Lyche (1993), and Kvasov (2000) Papers.
Currently BasisHatShapeControl implements the following shape control customizers:
- Cubic Polynomial with Rational Linear Shape Controller.
- Cubic Polynomial with Rational Quadratic Shape Controller.
- Cubic Polynomial with Rational Exponential Shape Controller.</div>
</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>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../org/drip/spline/bspline/BasisHatShapeControl.html#SHAPE_CONTROL_RATIONAL_EXPONENTIAL">SHAPE_CONTROL_RATIONAL_EXPONENTIAL</a></strong></code>
<div class="block">Cubic Polynomial with Rational Exponential Shape Controller</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../org/drip/spline/bspline/BasisHatShapeControl.html#SHAPE_CONTROL_RATIONAL_LINEAR">SHAPE_CONTROL_RATIONAL_LINEAR</a></strong></code>
<div class="block">Cubic Polynomial with Rational Linear Shape Controller</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../org/drip/spline/bspline/BasisHatShapeControl.html#SHAPE_CONTROL_RATIONAL_QUADRATIC">SHAPE_CONTROL_RATIONAL_QUADRATIC</a></strong></code>
<div class="block">Cubic Polynomial with Rational Quadratic Shape Controller</div>
</td>
</tr>
</table>
</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/drip/spline/bspline/BasisHatShapeControl.html#BasisHatShapeControl(double, double, java.lang.String, double)">BasisHatShapeControl</a></strong>(double dblLeftPredictorOrdinate,
double dblRightPredictorOrdinate,
java.lang.String strShapeControlType,
double dblTension)</code>
<div class="block">BasisHatShapeControl constructor</div>
</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>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../org/drip/spline/bspline/BasisHatShapeControl.html#shapeControlType()">shapeControlType</a></strong>()</code>
<div class="block">Retrieve the Type of the Shape Controller</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.drip.spline.bspline.TensionBasisHat">
<!-- -->
</a>
<h3>Methods inherited from class org.drip.spline.bspline.<a href="../../../../org/drip/spline/bspline/TensionBasisHat.html" title="class in org.drip.spline.bspline">TensionBasisHat</a></h3>
<code><a href="../../../../org/drip/spline/bspline/TensionBasisHat.html#in(double)">in</a>, <a href="../../../../org/drip/spline/bspline/TensionBasisHat.html#left()">left</a>, <a href="../../../../org/drip/spline/bspline/TensionBasisHat.html#normalizer()">normalizer</a>, <a href="../../../../org/drip/spline/bspline/TensionBasisHat.html#right()">right</a>, <a href="../../../../org/drip/spline/bspline/TensionBasisHat.html#tension()">tension</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_org.drip.quant.function1D.AbstractUnivariate">
<!-- -->
</a>
<h3>Methods inherited from class org.drip.quant.function1D.<a href="../../../../org/drip/quant/function1D/AbstractUnivariate.html" title="class in org.drip.quant.function1D">AbstractUnivariate</a></h3>
<code><a href="../../../../org/drip/quant/function1D/AbstractUnivariate.html#calcDerivative(double, int)">calcDerivative</a>, <a href="../../../../org/drip/quant/function1D/AbstractUnivariate.html#calcDifferential(double, double, int)">calcDifferential</a>, <a href="../../../../org/drip/quant/function1D/AbstractUnivariate.html#calcDifferential(double, int)">calcDifferential</a>, <a href="../../../../org/drip/quant/function1D/AbstractUnivariate.html#evaluate(double)">evaluate</a>, <a href="../../../../org/drip/quant/function1D/AbstractUnivariate.html#integrate(double, double)">integrate</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>equals, 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="SHAPE_CONTROL_RATIONAL_LINEAR">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SHAPE_CONTROL_RATIONAL_LINEAR</h4>
<pre>public static final java.lang.String SHAPE_CONTROL_RATIONAL_LINEAR</pre>
<div class="block">Cubic Polynomial with Rational Linear Shape Controller</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.drip.spline.bspline.BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_LINEAR">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="SHAPE_CONTROL_RATIONAL_QUADRATIC">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SHAPE_CONTROL_RATIONAL_QUADRATIC</h4>
<pre>public static final java.lang.String SHAPE_CONTROL_RATIONAL_QUADRATIC</pre>
<div class="block">Cubic Polynomial with Rational Quadratic Shape Controller</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.drip.spline.bspline.BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_QUADRATIC">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="SHAPE_CONTROL_RATIONAL_EXPONENTIAL">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SHAPE_CONTROL_RATIONAL_EXPONENTIAL</h4>
<pre>public static final java.lang.String SHAPE_CONTROL_RATIONAL_EXPONENTIAL</pre>
<div class="block">Cubic Polynomial with Rational Exponential Shape Controller</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../constant-values.html#org.drip.spline.bspline.BasisHatShapeControl.SHAPE_CONTROL_RATIONAL_EXPONENTIAL">Constant Field Values</a></dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="BasisHatShapeControl(double, double, java.lang.String, double)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BasisHatShapeControl</h4>
<pre>public BasisHatShapeControl(double dblLeftPredictorOrdinate,
double dblRightPredictorOrdinate,
java.lang.String strShapeControlType,
double dblTension)
throws java.lang.Exception</pre>
<div class="block">BasisHatShapeControl constructor</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>dblLeftPredictorOrdinate</code> - The Left Predictor Ordinate</dd><dd><code>dblRightPredictorOrdinate</code> - The Right Predictor Ordinate</dd><dd><code>strShapeControlType</code> - Type of the Shape Controller to be used - LINEAR/QUADRATIC/EXPONENTIAL
Rational</dd><dd><code>dblTension</code> - Tension of the Tension Hat Function</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - Thrown if the input is invalid</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="shapeControlType()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>shapeControlType</h4>
<pre>public java.lang.String shapeControlType()</pre>
<div class="block">Retrieve the Type of the Shape Controller</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>The Type of the Shape Controller</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><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="class-use/BasisHatShapeControl.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/drip/spline/bspline/BasisHatPairGenerator.html" title="class in org.drip.spline.bspline"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/drip/spline/bspline/CubicRationalLeftRaw.html" title="class in org.drip.spline.bspline"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/drip/spline/bspline/BasisHatShapeControl.html" target="_top">Frames</a></li>
<li><a href="BasisHatShapeControl.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": "a03da893d780d797501d51be153b07c5",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 608,
"avg_line_length": 44.06005221932115,
"alnum_prop": 0.6554666666666666,
"repo_name": "tectronics/rootfinder",
"id": "c8c337cf97ffee2313020a3de0b4fa1b79716a79",
"size": "16875",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "2.3/docs/Javadoc/org/drip/spline/bspline/BasisHatShapeControl.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "34839"
},
{
"name": "HTML",
"bytes": "77000232"
},
{
"name": "Java",
"bytes": "10842587"
}
],
"symlink_target": ""
} |
MAKEFLAGS=-r
# The source directory tree.
srcdir := ..
abs_srcdir := $(abspath $(srcdir))
# The name of the builddir.
builddir_name ?= .
# The V=1 flag on command line makes us verbosely print command lines.
ifdef V
quiet=
else
quiet=quiet_
endif
# Specify BUILDTYPE=Release on the command line for a release build.
BUILDTYPE ?= Release
# Directory all our build output goes into.
# Note that this must be two directories beneath src/ for unit tests to pass,
# as they reach into the src/ directory for data with relative paths.
builddir ?= $(builddir_name)/$(BUILDTYPE)
abs_builddir := $(abspath $(builddir))
depsdir := $(builddir)/.deps
# Object output directory.
obj := $(builddir)/obj
abs_obj := $(abspath $(obj))
# We build up a list of every single one of the targets so we can slurp in the
# generated dependency rule Makefiles in one pass.
all_deps :=
CC.target ?= $(CC)
CFLAGS.target ?= $(CFLAGS)
CXX.target ?= $(CXX)
CXXFLAGS.target ?= $(CXXFLAGS)
LINK.target ?= $(LINK)
LDFLAGS.target ?= $(LDFLAGS)
AR.target ?= $(AR)
# C++ apps need to be linked with g++.
#
# Note: flock is used to seralize linking. Linking is a memory-intensive
# process so running parallel links can often lead to thrashing. To disable
# the serialization, override LINK via an envrionment variable as follows:
#
# export LINK=g++
#
# This will allow make to invoke N linker processes as specified in -jN.
LINK ?= ./gyp-mac-tool flock $(builddir)/linker.lock $(CXX.target)
# TODO(evan): move all cross-compilation logic to gyp-time so we don't need
# to replicate this environment fallback in make as well.
CC.host ?= gcc
CFLAGS.host ?=
CXX.host ?= g++
CXXFLAGS.host ?=
LINK.host ?= $(CXX.host)
LDFLAGS.host ?=
AR.host ?= ar
# Define a dir function that can handle spaces.
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
# "leading spaces cannot appear in the text of the first argument as written.
# These characters can be put into the argument value by variable substitution."
empty :=
space := $(empty) $(empty)
# http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
replace_spaces = $(subst $(space),?,$1)
unreplace_spaces = $(subst ?,$(space),$1)
dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
# Flags to make gcc output dependency info. Note that you need to be
# careful here to use the flags that ccache and distcc can understand.
# We write to a dep file on the side first and then rename at the end
# so we can't end up with a broken dep file.
depfile = $(depsdir)/$(call replace_spaces,$@).d
DEPFLAGS = -MMD -MF $(depfile).raw
# We have to fixup the deps output in a few ways.
# (1) the file output should mention the proper .o file.
# ccache or distcc lose the path to the target, so we convert a rule of
# the form:
# foobar.o: DEP1 DEP2
# into
# path/to/foobar.o: DEP1 DEP2
# (2) we want missing files not to cause us to fail to build.
# We want to rewrite
# foobar.o: DEP1 DEP2 \
# DEP3
# to
# DEP1:
# DEP2:
# DEP3:
# so if the files are missing, they're just considered phony rules.
# We have to do some pretty insane escaping to get those backslashes
# and dollar signs past make, the shell, and sed at the same time.
# Doesn't work with spaces, but that's fine: .d files have spaces in
# their names replaced with other characters.
define fixup_dep
# The depfile may not exist if the input file didn't have any #includes.
touch $(depfile).raw
# Fixup path as in (1).
sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
# Add extra rules as in (2).
# We remove slashes and replace spaces with new lines;
# remove blank lines;
# delete the first line and append a colon to the remaining lines.
sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
grep -v '^$$' |\
sed -e 1d -e 's|$$|:|' \
>> $(depfile)
rm $(depfile).raw
endef
# Command definitions:
# - cmd_foo is the actual command to run;
# - quiet_cmd_foo is the brief-output summary of the command.
quiet_cmd_cc = CC($(TOOLSET)) $@
cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
quiet_cmd_cxx = CXX($(TOOLSET)) $@
cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
quiet_cmd_objc = CXX($(TOOLSET)) $@
cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
quiet_cmd_objcxx = CXX($(TOOLSET)) $@
cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
# Commands for precompiled header files.
quiet_cmd_pch_c = CXX($(TOOLSET)) $@
cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
quiet_cmd_pch_cc = CXX($(TOOLSET)) $@
cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
quiet_cmd_pch_m = CXX($(TOOLSET)) $@
cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $<
quiet_cmd_pch_mm = CXX($(TOOLSET)) $@
cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $<
# gyp-mac-tool is written next to the root Makefile by gyp.
# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
# already.
quiet_cmd_mac_tool = MACTOOL $(4) $<
cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@"
quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@
cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)
quiet_cmd_infoplist = INFOPLIST $@
cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
quiet_cmd_touch = TOUCH $@
cmd_touch = touch $@
quiet_cmd_copy = COPY $@
# send stderr to /dev/null to ignore messages when linking directories.
cmd_copy = rm -rf "$@" && cp -af "$<" "$@"
quiet_cmd_alink = LIBTOOL-STATIC $@
cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
# Define an escape_quotes function to escape single quotes.
# This allows us to handle quotes properly as long as we always use
# use single quotes and escape_quotes.
escape_quotes = $(subst ','\'',$(1))
# This comment is here just to include a ' to unconfuse syntax highlighting.
# Define an escape_vars function to escape '$' variable syntax.
# This allows us to read/write command lines with shell variables (e.g.
# $LD_LIBRARY_PATH), without triggering make substitution.
escape_vars = $(subst $$,$$$$,$(1))
# Helper that expands to a shell command to echo a string exactly as it is in
# make. This uses printf instead of echo because printf's behaviour with respect
# to escape sequences is more portable than echo's across different shells
# (e.g., dash, bash).
exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
# Helper to compare the command we're about to run against the command
# we logged the last time we ran the command. Produces an empty
# string (false) when the commands match.
# Tricky point: Make has no string-equality test function.
# The kernel uses the following, but it seems like it would have false
# positives, where one string reordered its arguments.
# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
# $(filter-out $(cmd_$@), $(cmd_$(1))))
# We instead substitute each for the empty string into the other, and
# say they're equal if both substitutions produce the empty string.
# .d files contain ? instead of spaces, take that into account.
command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
$(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
# Helper that is non-empty when a prerequisite changes.
# Normally make does this implicitly, but we force rules to always run
# so we can check their command lines.
# $? -- new prerequisites
# $| -- order-only dependencies
prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
# Helper that executes all postbuilds until one fails.
define do_postbuilds
@E=0;\
for p in $(POSTBUILDS); do\
eval $$p;\
E=$$?;\
if [ $$E -ne 0 ]; then\
break;\
fi;\
done;\
if [ $$E -ne 0 ]; then\
rm -rf "$@";\
exit $$E;\
fi
endef
# do_cmd: run a command via the above cmd_foo names, if necessary.
# Should always run for a given target to handle command-line changes.
# Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
# Third argument, if non-zero, makes it do POSTBUILDS processing.
# Note: We intentionally do NOT call dirx for depfile, since it contains ? for
# spaces already and dirx strips the ? characters.
define do_cmd
$(if $(or $(command_changed),$(prereq_changed)),
@$(call exact_echo, $($(quiet)cmd_$(1)))
@mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
$(if $(findstring flock,$(word 2,$(cmd_$1))),
@$(cmd_$(1))
@echo " $(quiet_cmd_$(1)): Finished",
@$(cmd_$(1))
)
@$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
@$(if $(2),$(fixup_dep))
$(if $(and $(3), $(POSTBUILDS)),
$(call do_postbuilds)
)
)
endef
# Declare the "all" target first so it is the default,
# even though we don't have the deps yet.
.PHONY: all
all:
# make looks for ways to re-generate included makefiles, but in our case, we
# don't have a direct way. Explicitly telling make that it has nothing to do
# for them makes it go faster.
%.d: ;
# Use FORCE_DO_CMD to force a target to run. Should be coupled with
# do_cmd.
.PHONY: FORCE_DO_CMD
FORCE_DO_CMD:
TOOLSET := target
# Suffix rules, putting all outputs into $(obj).
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD
@$(call do_cmd,objc,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD
@$(call do_cmd,objcxx,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
@$(call do_cmd,cc,1)
# Try building from generated source, too.
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD
@$(call do_cmd,objc,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD
@$(call do_cmd,objcxx,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
@$(call do_cmd,cxx,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD
@$(call do_cmd,objc,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD
@$(call do_cmd,objcxx,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
@$(call do_cmd,cc,1)
$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
@$(call do_cmd,cc,1)
ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
$(findstring $(join ^,$(prefix)),\
$(join ^,bcrypt_lib.target.mk)))),)
include bcrypt_lib.target.mk
endif
quiet_cmd_regen_makefile = ACTION Regenerating $@
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/thm/Development/thm76.de/node_modules/bcrypt/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/thm/.node-gyp/0.10.26/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/thm/.node-gyp/0.10.26" "-Dmodule_root_dir=/Users/thm/Development/thm76.de/node_modules/bcrypt" binding.gyp
Makefile: $(srcdir)/../../../../.node-gyp/0.10.26/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
$(call do_cmd,regen_makefile)
# "all" is a concatenation of the "all" targets from all the included
# sub-makefiles. This is just here to clarify.
all:
# Add in dependency-tracking rules. $(all_deps) is the list of every single
# target in our tree. Only consider the ones with .d (dependency) info:
d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
ifneq ($(d_files),)
include $(d_files)
endif
| {
"content_hash": "83aafb6379c079f900ea58e44ab2f8e0",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 570,
"avg_line_length": 38.468023255813954,
"alnum_prop": 0.6526108969999245,
"repo_name": "thm76/thm76.de",
"id": "0f164c83cd15fb597833fbd576b65220152755f3",
"size": "13563",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "node_modules/bcrypt/build/Makefile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "309"
},
{
"name": "JavaScript",
"bytes": "5760"
}
],
"symlink_target": ""
} |
<?php
App::uses('AppHelper', 'View/Helper');
App::uses('CakeSession', 'Model/Datasource');
/**
* Session Helper.
*
* Session reading from the view.
*
* @package Cake.View.Helper
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html
*/
class SessionHelper extends AppHelper {
/**
* Used to read a session values set in a controller for a key or return values for all keys.
*
* In your view: `$this->Session->read('Controller.sessKey');`
* Calling the method without a param will return all session vars
*
* @param string $name the name of the session key you want to read
* @return mixed values from the session vars
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#SessionHelper::read
*/
public function read($name = null) {
return CakeSession::read($name);
}
/**
* Used to check is a session key has been set
*
* In your view: `$this->Session->check('Controller.sessKey');`
*
* @param string $name
* @return boolean
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#SessionHelper::check
*/
public function check($name) {
return CakeSession::check($name);
}
/**
* Returns last error encountered in a session
*
* In your view: `$this->Session->error();`
*
* @return string last error
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#displaying-notifcations-or-flash-messages
*/
public function error() {
return CakeSession::error();
}
/**
* Used to render the message set in Controller::Session::setFlash()
*
* In your view: $this->Session->flash('somekey');
* Will default to flash if no param is passed
*
* You can pass additional information into the flash message generation. This allows you
* to consolidate all the parameters for a given type of flash message into the view.
*
* {{{
* echo $this->Session->flash('flash', array('params' => array('class' => 'new-flash')));
* }}}
*
* The above would generate a flash message with a custom class name. Using $attrs['params'] you
* can pass additional data into the element rendering that will be made available as local variables
* when the element is rendered:
*
* {{{
* echo $this->Session->flash('flash', array('params' => array('name' => $user['User']['name'])));
* }}}
*
* This would pass the current user's name into the flash message, so you could create personalized
* messages without the controller needing access to that data.
*
* Lastly you can choose the element that is rendered when creating the flash message. Using
* custom elements allows you to fully customize how flash messages are generated.
*
* {{{
* echo $this->Session->flash('flash', array('element' => 'my_custom_element'));
* }}}
*
* If you want to use an element from a plugin for rendering your flash message you can do that using the
* plugin param:
*
* {{{
* echo $this->Session->flash('flash', array(
* 'element' => 'my_custom_element',
* 'params' => array('plugin' => 'my_plugin')
* ));
* }}}
*
* @param string $key The [Message.]key you are rendering in the view.
* @param array $attrs Additional attributes to use for the creation of this flash message.
* Supports the 'params', and 'element' keys that are used in the helper.
* @return string
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#SessionHelper::flash
*/
public function flash($key = 'flash', $attrs = array()) {
$out = false;
if (CakeSession::check('Message.' . $key)) {
$flash = CakeSession::read('Message.' . $key);
$message = $flash['message'];
unset($flash['message']);
if (!empty($attrs)) {
$flash = array_merge($flash, $attrs);
}
if ($flash['element'] === 'default') {
$class = 'message';
if (!empty($flash['params']['class'])) {
$class = $flash['params']['class'];
}
$out = '<div id="' . $key . 'Message" class="' . $class . '">' . $message . '</div>';
} elseif (!$flash['element']) {
$out = $message;
} else {
$options = array();
if (isset($flash['params']['plugin'])) {
$options['plugin'] = $flash['params']['plugin'];
}
$tmpVars = $flash['params'];
$tmpVars['message'] = $message;
$out = $this->_View->element($flash['element'], $tmpVars, $options);
}
CakeSession::delete('Message.' . $key);
}
return $out;
}
/**
* Used to check is a session is valid in a view
*
* @return boolean
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/session.html#SessionHelper::valid
*/
public function valid() {
return CakeSession::valid();
}
}
| {
"content_hash": "4254699a08343f9b929f32d8a36f4fa5",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 117,
"avg_line_length": 31.244897959183675,
"alnum_prop": 0.6564337034617896,
"repo_name": "nickpack/Methadone",
"id": "86158b96288415ae3badb8c1c34cd4c28b5cd7b2",
"size": "5311",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "src/lib/Cake/View/Helper/SessionHelper.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "6672"
},
{
"name": "PHP",
"bytes": "7652190"
},
{
"name": "Perl",
"bytes": "6460"
},
{
"name": "Puppet",
"bytes": "3905"
},
{
"name": "Ruby",
"bytes": "536"
},
{
"name": "Shell",
"bytes": "7626"
}
],
"symlink_target": ""
} |
package informer
import (
"fmt"
"sync"
"time"
"github.com/golang/glog"
dynamicclientset "metacontroller.app/dynamic/clientset"
)
// SharedInformerFactory is a factory for requesting dynamic informers from a
// shared pool. It's analogous to the static SharedInformerFactory generated for
// static types.
type SharedInformerFactory struct {
clientset *dynamicclientset.Clientset
defaultResync time.Duration
mutex sync.Mutex
refCount map[string]int
sharedInformers map[string]*sharedResourceInformer
}
// NewSharedInformerFactory creates a new factory for shared, dynamic informers.
// Usually there is only one of these for the whole process, created in main().
func NewSharedInformerFactory(clientset *dynamicclientset.Clientset, defaultResync time.Duration) *SharedInformerFactory {
return &SharedInformerFactory{
clientset: clientset,
defaultResync: defaultResync,
refCount: make(map[string]int),
sharedInformers: make(map[string]*sharedResourceInformer),
}
}
// Resource returns a dynamic informer and lister for the given resource.
// These are shared with any other controllers in the same process that request
// the same resource.
//
// If this function returns successfully, the caller should ensure they call
// Close() on the returned ResourceInformer when they no longer need it.
// Shared informers that become unused will be stopped to minimize our load on
// the API server.
func (f *SharedInformerFactory) Resource(apiVersion, resource string) (*ResourceInformer, error) {
f.mutex.Lock()
defer f.mutex.Unlock()
// Return existing informer if there is one.
key := resourceKey(apiVersion, resource)
if sharedInformer, ok := f.sharedInformers[key]; ok {
count := f.refCount[key] + 1
f.refCount[key] = count
glog.V(4).Infof("Subscribed to shared informer for %v in %v (total subscribers now %v)", resource, apiVersion, count)
return newResourceInformer(sharedInformer), nil
}
// Create one if it doesn't exist.
client, err := f.clientset.Resource(apiVersion, resource)
if err != nil {
return nil, fmt.Errorf("can't create client for %v shared informer: %v", key, err)
}
stopCh := make(chan struct{})
// closeFn is called by users of the shared informer (via Close()) to indicate
// they no longer need it. We do all incrementing/decrementing of the ref
// count in the factory while holding the factory mutex, so that removing
// shared informers is serialized along with creating them.
closeFn := func() {
f.mutex.Lock()
defer f.mutex.Unlock()
count := f.refCount[key] - 1
glog.V(4).Infof("Unsubscribed from shared informer for %v in %v (total subscribers now %v)", resource, apiVersion, count)
if count > 0 {
// Others are still using it.
f.refCount[key] = count
return
}
// We're the last ones using it.
glog.V(4).Infof("Stopping shared informer for %v in %v (no more subscribers)", resource, apiVersion)
close(stopCh)
delete(f.refCount, key)
delete(f.sharedInformers, key)
}
glog.V(4).Infof("Starting shared informer for %v in %v", resource, apiVersion)
sharedInformer := newSharedResourceInformer(client, f.defaultResync, closeFn)
f.sharedInformers[key] = sharedInformer
f.refCount[key] = 1
// Start the new informer immediately.
// Users should check HasSynced() before using it.
go sharedInformer.informer.Run(stopCh)
return newResourceInformer(sharedInformer), nil
}
func resourceKey(apiVersion, resource string) string {
return fmt.Sprintf("%s.%s", resource, apiVersion)
}
| {
"content_hash": "6da03f1da6eb18f5f6370e169f5e20cf",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 123,
"avg_line_length": 34,
"alnum_prop": 0.7406674208144797,
"repo_name": "GoogleCloudPlatform/metacontroller",
"id": "eaa5c9442075e9d8f4514c316f8eb083b7b25f23",
"size": "4094",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dynamic/informer/factory.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "444"
},
{
"name": "Go",
"bytes": "239016"
},
{
"name": "Makefile",
"bytes": "2026"
},
{
"name": "Ruby",
"bytes": "3684"
},
{
"name": "Shell",
"bytes": "1171"
}
],
"symlink_target": ""
} |
package cn.newcapec.framework.core.model.dbmeta;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
*
* @author andy.li
*/
@SuppressWarnings("all")
public class MetaDataRetriever extends Thread {
private Container container;
private DatabaseMetaData metadata;
private IErrorHandler errorHandler = new DefaultErrorHandler();
public MetaDataRetriever(Container container, DatabaseMetaData metadata,
IErrorHandler errorHandler) {
this.container = container;
this.metadata = metadata;
if (errorHandler != null) {
this.errorHandler = errorHandler;
}
}
public void run() {
try {
populateTableData(metadata,null, container);
} catch (Exception e) {
errorHandler.onError(null, e);
} finally {
try {
if (null != metadata && null != metadata.getConnection())
metadata.getConnection().close();
} catch (SQLException sqle) {
}
}
}
/**
* Return the number of tables that match the schema pattern and table
* pattern given
*
* @param metadata
* @param schemaPattern
* @param tablePattern
* @return the number of tables
* @throws java.sql.SQLException
*/
public static int getTableCount(DatabaseMetaData metadata,
String schemaPattern, String tablePattern) throws SQLException {
String[] names = { "TABLE" };
String _schema = null;
String _table = null;
if (null != schemaPattern && schemaPattern.trim().length() > 0)
_schema = schemaPattern.trim();
else
_schema = metadata.getUserName();//默认当前数据库链接用户
if (null != tablePattern && tablePattern.trim().length() > 0)
_table = tablePattern.trim();
else
_table = null;
ResultSet rs = null;
try {
int count = 0;
rs = metadata.getTables(null, _schema, _table, names);
// Map tables = new HashMap();
// String TABLE_NAME = "TABLE_NAME";
String TABLE_TYPE = "TABLE_TYPE";
String SYSTEM = "SYSTEM";
while (rs.next()) {
String tableType = rs.getString(TABLE_TYPE);
if (null == tableType
|| tableType.toUpperCase().indexOf(SYSTEM) < 0) {
count++;
}
}
return count;
} finally {
if (null != rs)
rs.close();
}
}
/**
* Load the container with table objects that only contain the name. Start
* the thread or call populateTableData to load the columns and keys.
*
* @param container
* @param metadata
* @param schemaPattern
* @param tablePattern
* @throws java.sql.SQLException
*/
public static void getTables(Container container,
DatabaseMetaData metadata, String schemaPattern, String tablePattern)
throws SQLException {
String[] names = { "TABLE" };
String _schema = null;
String _table = null;
if (null != schemaPattern && schemaPattern.trim().length() > 0)
_schema = schemaPattern.trim();
else
_schema = metadata.getUserName();//默认当前数据库链接用户
if (null != tablePattern && tablePattern.trim().length() > 0)
_table = tablePattern.trim();
else
_table = null;
ResultSet rs = null;
try {
rs = metadata.getTables(null, _schema, _table, names);
Map tables = new HashMap();
String TABLE_NAME = "TABLE_NAME";
String TABLE_TYPE = "TABLE_TYPE";
String SYSTEM = "SYSTEM";
while (rs.next()) {
String tableName = rs.getString(TABLE_NAME);
if (tableName.indexOf("$") != -1){
continue;
}
DBTable table = new DBTable(container, tableName);
String tableType = rs.getString(TABLE_TYPE);
if (null == tableType
|| tableType.toUpperCase().indexOf(SYSTEM) < 0) {
tables.put(table.getName(), table);
}
}
container.setTables(tables);
} finally {
if (null != rs)
rs.close();
}
}
/**
* Populate the column and key information for the tables.
*
* @param metadata
* @param container
* the table container
* @throws java.sql.SQLException
*/
public static void populateTableData(DatabaseMetaData metadata,String schemaPattern,
Container container) throws SQLException {
Map tables = container.getTables();
for (Iterator i = tables.values().iterator(); i.hasNext();) {
DBTable table = (DBTable) i.next();
readTableColumns(metadata, schemaPattern,table);
}
for (Iterator i = tables.values().iterator(); i.hasNext();) {
DBTable table = (DBTable) i.next();
readTableKeys(metadata, schemaPattern,table, tables);
}
for (Iterator i = tables.values().iterator(); i.hasNext();) {
DBTable table = (DBTable) i.next();
table.init();
}
container.fullyLoaded = true;
}
/**
* Read the columns from the DatabaseMetaData and notify the given table of
* the colums
*
* @param meta
* @param schemaPattern
* @param table
* @throws java.sql.SQLException
*/
private static void readTableColumns(DatabaseMetaData meta, String schemaPattern,DBTable table)
throws SQLException {
ResultSet columns = null;
try {
if (null != schemaPattern && schemaPattern.trim().length() > 0)
schemaPattern = schemaPattern.trim();
else
schemaPattern = meta.getUserName();//默认当前数据库链接用户
columns = meta.getColumns(null, schemaPattern, table.getName(), "%");
while (columns.next()) {
String columnName = columns.getString("COLUMN_NAME");
String datatype = columns.getString("TYPE_NAME");
int datasize = columns.getInt("COLUMN_SIZE");
int digits = columns.getInt("DECIMAL_DIGITS");
int nullable = columns.getInt("NULLABLE");
DBColumn newColumn = new DBColumn(table, columnName, datatype,
datasize, digits, nullable);
table.notifyColumn(newColumn);
}
} finally {
if (null != columns)
columns.close();
}
}
/**
* Read the primary and foreign keys from the DatabaseMetaData and notify
* the given table of the keys
*
* @param meta
* @param table
* @param tables
* @throws java.sql.SQLException
*/
private static void readTableKeys(DatabaseMetaData meta,String schemaPattern, DBTable table,
Map tables) throws SQLException {
ResultSet keys = null;
try {
if (null != schemaPattern && schemaPattern.trim().length() > 0)
schemaPattern = schemaPattern.trim();
else
schemaPattern = meta.getUserName();//默认当前数据库链接用户
// primary keys
keys = meta.getPrimaryKeys(null, schemaPattern, table.getName());
while (keys.next()) {
String tableName = keys.getString("TABLE_NAME");
String columnName = keys.getString("COLUMN_NAME");
table = (DBTable) tables.get(checkName(tableName));
table.notifyPrimaryKey(checkName(columnName));
}
// foreign keys
keys = meta.getImportedKeys(null, schemaPattern, table.getName());
//List rels = new ArrayList();
while (keys.next()) {
String pkTableName = keys.getString("PKTABLE_NAME");
pkTableName = keys.getString("PKTABLE_NAME");
String pkColumnName = keys.getString("PKCOLUMN_NAME");
String fkTableName = keys.getString("FKTABLE_NAME");
String fkColumnName = keys.getString("FKCOLUMN_NAME");
DBTable pkTable = (DBTable) tables.get(checkName(pkTableName));
DBTable fkTable = (DBTable) tables.get(checkName(fkTableName));
if (null != pkTable && null != fkTable) {
DBColumn pkColumn = pkTable
.getColumn(checkName(pkColumnName));
if (null != pkColumn)
table.notifyForeignKey(checkName(fkColumnName),
pkColumn);
}
}
} finally {
if (null != keys)
keys.close();
}
}
private static String checkName(String s) {
if (null == s)
return null;
s = stringReplace(s, "`", "");
return s;
}
/**
* Replace the contents of the from string with the contents of the to
* string in the base string
*
* @param base
* the string to replace part of
* @param from
* the string to be replaced
* @param to
* the string to replace
*/
public static String stringReplace(String base, String from, String to) {
StringBuffer sb1 = new StringBuffer(base);
StringBuffer sb2 = new StringBuffer(base.length() + 50);
char[] f = from.toCharArray();
char[] t = to.toCharArray();
char[] test = new char[f.length];
for (int x = 0; x < sb1.length(); x++) {
if (x + test.length > sb1.length()) {
sb2.append(sb1.charAt(x));
} else {
sb1.getChars(x, x + test.length, test, 0);
if (aEquals(test, f)) {
sb2.append(t);
x = x + test.length - 1;
} else {
sb2.append(sb1.charAt(x));
}
}
}
return sb2.toString();
}
static private boolean aEquals(char[] a, char[] b) {
if (a.length != b.length) {
return false;
}
for (int x = 0; x < a.length; x++) {
if (a[x] != b[x]) {
return false;
}
}
return true;
}
} | {
"content_hash": "2f325f8193d01c1d972b61b7c0570165",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 96,
"avg_line_length": 28.301639344262295,
"alnum_prop": 0.6574374420759963,
"repo_name": "3203317/2013",
"id": "5712adb2d55531d3a3e9e4ae51990c5bc975aa81",
"size": "8720",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nsp/platform/Develop/framework-core/trunk/core/src/main/java/cn/newcapec/framework/core/model/dbmeta/MetaDataRetriever.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "298893"
},
{
"name": "CSS",
"bytes": "2478429"
},
{
"name": "ColdFusion",
"bytes": "864115"
},
{
"name": "Java",
"bytes": "2182264"
},
{
"name": "JavaScript",
"bytes": "26272909"
},
{
"name": "Lasso",
"bytes": "122535"
},
{
"name": "PHP",
"bytes": "471940"
},
{
"name": "Perl",
"bytes": "282121"
},
{
"name": "Python",
"bytes": "266343"
},
{
"name": "Shell",
"bytes": "154"
}
],
"symlink_target": ""
} |
#include "util/thread.h"
#include "kernel/find_fn.h"
#include "library/placeholder.h"
#include "library/kernel_bindings.h"
namespace lean {
static name g_placeholder_name = name(name::mk_internal_unique_name(), "_");
MK_THREAD_LOCAL_GET(unsigned, get_placeholder_id, 0)
static unsigned next_placeholder_id() {
unsigned & c = get_placeholder_id();
unsigned r = c;
c++;
return r;
}
level mk_level_placeholder() { return mk_global_univ(name(g_placeholder_name, next_placeholder_id())); }
expr mk_expr_placeholder() { return mk_constant(name(g_placeholder_name, next_placeholder_id())); }
static bool is_placeholder(name const & n) { return !n.is_atomic() && n.get_prefix() == g_placeholder_name; }
bool is_placeholder(level const & e) { return is_global(e) && is_placeholder(global_id(e)); }
bool is_placeholder(expr const & e) { return is_constant(e) && is_placeholder(const_name(e)); }
bool has_placeholder(level const & l) {
bool r = false;
for_each(l, [&](level const & e) {
if (is_placeholder(e))
r = true;
return !r;
});
return r;
}
bool has_placeholder(expr const & e) {
return (bool) find(e, [](expr const & e, unsigned) { // NOLINT
if (is_placeholder(e))
return true;
else if (is_sort(e))
return has_placeholder(sort_level(e));
else if (is_constant(e))
return std::any_of(const_levels(e).begin(), const_levels(e).end(), [](level const & l) { return has_placeholder(l); });
else
return false;
});
}
static int mk_level_placeholder(lua_State * L) { return push_level(L, mk_level_placeholder()); }
static int mk_expr_placeholder(lua_State * L) { return push_expr(L, mk_expr_placeholder()); }
static int is_placeholder(lua_State * L) {
if (is_expr(L, 1))
return push_boolean(L, is_placeholder(to_expr(L, 1)));
else
return push_boolean(L, is_placeholder(to_level(L, 1)));
}
static int has_placeholder(lua_State * L) {
if (is_expr(L, 1))
return push_boolean(L, has_placeholder(to_expr(L, 1)));
else
return push_boolean(L, has_placeholder(to_level(L, 1)));
}
void open_placeholder(lua_State * L) {
SET_GLOBAL_FUN(mk_level_placeholder, "mk_level_placeholder");
SET_GLOBAL_FUN(mk_expr_placeholder, "mk_expr_placeholder");
SET_GLOBAL_FUN(is_placeholder, "is_placeholder");
SET_GLOBAL_FUN(has_placeholder, "has_placeholder");
}
}
| {
"content_hash": "2c09c44d5d9ab447fcd30d4b89b02441",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 135,
"avg_line_length": 37.984848484848484,
"alnum_prop": 0.6222576785001994,
"repo_name": "soonhokong/travis_test",
"id": "06e6a385fba4b6cad9527b9caff5efdfe134ae10",
"size": "2675",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/library/placeholder.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "166971"
},
{
"name": "C++",
"bytes": "1879677"
},
{
"name": "Emacs Lisp",
"bytes": "37552"
},
{
"name": "Lua",
"bytes": "157804"
},
{
"name": "Objective-C",
"bytes": "361"
},
{
"name": "Python",
"bytes": "167992"
},
{
"name": "Shell",
"bytes": "13193"
}
],
"symlink_target": ""
} |
package org.bubblecloud.zigbee.api.cluster.impl.global.reporting;
import org.bubblecloud.zigbee.v3.serialization.ZBDeserializer;
import org.bubblecloud.zigbee.v3.model.ZigBeeType;
import org.bubblecloud.zigbee.api.cluster.impl.api.global.AttributeReport;
/**
* @author <a href="mailto:stefano.lenzi@isti.cnr.it">Stefano "Kismet" Lenzi</a>
* @author <a href="mailto:francesco.furfari@isti.cnr.it">Francesco Furfari</a>
* @version $LastChangedRevision: 799 $ ($LastChangedDate: 2013-08-06 19:00:05 +0300 (Tue, 06 Aug 2013) $)
* @since 0.2.0
*/
public class AttributeReportImpl implements AttributeReport {
private short attributeId;
private Object value;
private final ZigBeeType type;
public AttributeReportImpl(ZBDeserializer deserializer) {
attributeId = deserializer.read_short();
byte dataType = deserializer.read_byte();
;
type = ZigBeeType.getType(dataType);
value = deserializer.readZigBeeType(type);
}
public Object getAttributeData() {
return value;
}
public ZigBeeType getAttributeDataType() {
return type;
}
public int getAttributeId() {
return attributeId;
}
}
| {
"content_hash": "c624869d4f1e8a530fb820ea2eeba3e8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 106,
"avg_line_length": 29.146341463414632,
"alnum_prop": 0.704602510460251,
"repo_name": "cdjackson/zigbee4java",
"id": "84eb6097b8134d3d6e5dc0fd0c274f3884264a1d",
"size": "2014",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "zigbee-dongle-cc2531/src/main/java/org/bubblecloud/zigbee/api/cluster/impl/global/reporting/AttributeReportImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "209"
},
{
"name": "HTML",
"bytes": "4267"
},
{
"name": "Java",
"bytes": "3021545"
},
{
"name": "Shell",
"bytes": "251"
}
],
"symlink_target": ""
} |
/**
* Automatically generated file. Please do not edit.
* @author Highcharts Config Generator by Karasiq
* @see [[http://api.highcharts.com/highmaps]]
*/
package com.highmaps.config
import scalajs.js, js.`|`
import com.highcharts.CleanJsObject
import com.highcharts.HighchartsUtils._
/**
* @note JavaScript name: <code>plotOptions-bb-tooltip</code>
*/
@js.annotation.ScalaJSDefined
class PlotOptionsBbTooltip extends com.highcharts.HighchartsGenericObject {
/**
* <p>The HTML of the point's line in the tooltip. Variables are enclosed
* by curly brackets. Available variables are point.x, point.y, series.
* name and series.color and other properties on the same form.
* Furthermore, <code>point.y</code> can be extended by the <code>tooltip.valuePrefix</code>
* and <code>tooltip.valueSuffix</code> variables. This can also be overridden for
* each series, which makes it a good hook for displaying units.</p>
* <p>In styled mode, the dot is colored by a class name rather
* than the point color.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/pointformat/">A different point format with value suffix</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/tooltip/format/">Format demo</a>
* @since 2.2
*/
val pointFormat: js.UndefOr[String] = js.undefined
/**
* <p>Number of decimals in indicator series.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/valuedecimals/">Set decimals, prefix and suffix for the value</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/tooltip/valuedecimals/">Set decimals, prefix and suffix for the value</a>
* @since 6.0.0
*/
val valueDecimals: js.UndefOr[Double] = js.undefined
/**
* <p>For series on a datetime axes, the date format in the tooltip's
* header will by default be guessed based on the closest data points.
* This member gives the default string representations used for
* each unit. For an overview of the replacement codes, see
* <a href="/class-reference/Highcharts#dateFormat">dateFormat</a>.</p>
* @since 2.3
*/
val dateTimeLabelFormats: js.UndefOr[js.Object] = js.undefined
/**
* <p>A string to append to the tooltip format.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/footerformat/">A table for value alignment</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/tooltip/format/">Format demo</a>
* @since 2.2
*/
val footerFormat: js.UndefOr[String] = js.undefined
/**
* <p>Padding inside the tooltip, in pixels.</p>
* @since 5.0.0
*/
val padding: js.UndefOr[Double] = js.undefined
/**
* <p>The HTML of the tooltip header line. Variables are enclosed by
* curly brackets. Available variables are <code>point.key</code>, <code>series.name</code>,
* <code>series.color</code> and other members from the <code>point</code> and <code>series</code>
* objects. The <code>point.key</code> variable contains the category name, x
* value or datetime string depending on the type of axis. For datetime
* axes, the <code>point.key</code> date format can be set using
* <code>tooltip.xDateFormat</code>. To access the original point use
* <code>point.point</code>.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/footerformat/">An HTML table in the tooltip</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/footerformat/">An HTML table in the tooltip</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/tooltip/format/">Format demo</a>
* @since 2.3
*/
val headerFormat: js.UndefOr[String] = js.undefined
/**
* <p>Whether the tooltip should follow the mouse as it moves across
* columns, pie slices and other point types with an extent. By default
* it behaves this way for scatter, bubble and pie series by override
* in the <code>plotOptions</code> for those series types.</p>
* <p>For touch moves to behave the same way, <a href="#tooltip.followTouchMove">followTouchMove</a> must be <code>true</code> also.</p>
* @since 3.0
*/
val followPointer: js.UndefOr[Boolean] = js.undefined
/**
* <p>Whether the tooltip should update as the finger moves on a touch
* device. If this is <code>true</code> and <a href="#chart.panning">chart.panning</a> is
* set,<code>followTouchMove</code> will take over one-finger touches, so the user
* needs to use two fingers for zooming and panning.</p>
* <p>Note the difference to <a href="#tooltip.followPointer">followPointer</a> that
* only defines the <em>position</em> of the tooltip. If <code>followPointer</code> is
* false in for example a column series, the tooltip will show above or
* below the column, but as <code>followTouchMove</code> is true, the tooltip will
* jump from column to column as the user swipes across the plot area.</p>
* @since 3.0.1
*/
val followTouchMove: js.UndefOr[Boolean] = js.undefined
/**
* <p>The number of milliseconds to wait until the tooltip is hidden when
* mouse out from a point or chart.</p>
* @since 3.0
*/
val hideDelay: js.UndefOr[Double] = js.undefined
/**
* <p>Whether to allow the tooltip to render outside the chart's SVG
* element box. By default (<code>false</code>), the tooltip is rendered within the
* chart's SVG element, which results in the tooltip being aligned
* inside the chart area. For small charts, this may result in clipping
* or overlapping. When <code>true</code>, a separate SVG element is created and
* overlaid on the page, allowing the tooltip to be aligned inside the
* page itself.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/outside">Small charts with tooltips outside</a>
* @since 6.1.1
*/
val outside: js.UndefOr[Boolean] = js.undefined
/**
* <p>A callback function for formatting the HTML output for a single point
* in the tooltip. Like the <code>pointFormat</code> string, but with more
* flexibility.</p>
* @since 4.1.0
*/
val pointFormatter: js.UndefOr[js.Function] = js.undefined
/**
* <p>Split the tooltip into one label per series, with the header close
* to the axis. This is recommended over <a href="#tooltip.shared">shared</a>
* tooltips for charts with multiple line series, generally making them
* easier to read. This option takes precedence over <code>tooltip.shared</code>.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/split/">Split tooltip</a>
* @since 5.0.0
*/
val split: js.UndefOr[Boolean] = js.undefined
/**
* <p>A string to prepend to each series' y value. Overridable in each
* series' tooltip options object.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/valuedecimals/">Set decimals, prefix and suffix for the value</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/tooltip/valuedecimals/">Set decimals, prefix and suffix for the value</a>
* @since 2.2
*/
val valuePrefix: js.UndefOr[String] = js.undefined
/**
* <p>A string to append to each series' y value. Overridable in each
* series' tooltip options object.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/valuedecimals/">Set decimals, prefix and suffix for the value</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/tooltip/valuedecimals/">Set decimals, prefix and suffix for the value</a>
* @since 2.2
*/
val valueSuffix: js.UndefOr[String] = js.undefined
/**
* <p>The format for the date in the tooltip header if the X axis is a
* datetime axis. The default is a best guess based on the smallest
* distance between points in the chart.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/tooltip/xdateformat/">A different format</a>
* @since 2.3
*/
val xDateFormat: js.UndefOr[String] = js.undefined
/**
* <p>How many decimals to show for the <code>point.change</code> value when the
* <code>series.compare</code> option is set. This is overridable in each series'
* tooltip options object. The default is to preserve all decimals.</p>
* @since 1.0.1
*/
val changeDecimals: js.UndefOr[Double] = js.undefined
}
object PlotOptionsBbTooltip {
/**
* @param pointFormat <p>The HTML of the point's line in the tooltip. Variables are enclosed. by curly brackets. Available variables are point.x, point.y, series.. name and series.color and other properties on the same form.. Furthermore, <code>point.y</code> can be extended by the <code>tooltip.valuePrefix</code>. and <code>tooltip.valueSuffix</code> variables. This can also be overridden for. each series, which makes it a good hook for displaying units.</p>. <p>In styled mode, the dot is colored by a class name rather. than the point color.</p>
* @param valueDecimals <p>Number of decimals in indicator series.</p>
* @param dateTimeLabelFormats <p>For series on a datetime axes, the date format in the tooltip's. header will by default be guessed based on the closest data points.. This member gives the default string representations used for. each unit. For an overview of the replacement codes, see. <a href="/class-reference/Highcharts#dateFormat">dateFormat</a>.</p>
* @param footerFormat <p>A string to append to the tooltip format.</p>
* @param padding <p>Padding inside the tooltip, in pixels.</p>
* @param headerFormat <p>The HTML of the tooltip header line. Variables are enclosed by. curly brackets. Available variables are <code>point.key</code>, <code>series.name</code>,. <code>series.color</code> and other members from the <code>point</code> and <code>series</code>. objects. The <code>point.key</code> variable contains the category name, x. value or datetime string depending on the type of axis. For datetime. axes, the <code>point.key</code> date format can be set using. <code>tooltip.xDateFormat</code>. To access the original point use. <code>point.point</code>.</p>
* @param followPointer <p>Whether the tooltip should follow the mouse as it moves across. columns, pie slices and other point types with an extent. By default. it behaves this way for scatter, bubble and pie series by override. in the <code>plotOptions</code> for those series types.</p>. <p>For touch moves to behave the same way, <a href="#tooltip.followTouchMove">followTouchMove</a> must be <code>true</code> also.</p>
* @param followTouchMove <p>Whether the tooltip should update as the finger moves on a touch. device. If this is <code>true</code> and <a href="#chart.panning">chart.panning</a> is. set,<code>followTouchMove</code> will take over one-finger touches, so the user. needs to use two fingers for zooming and panning.</p>. <p>Note the difference to <a href="#tooltip.followPointer">followPointer</a> that. only defines the <em>position</em> of the tooltip. If <code>followPointer</code> is. false in for example a column series, the tooltip will show above or. below the column, but as <code>followTouchMove</code> is true, the tooltip will. jump from column to column as the user swipes across the plot area.</p>
* @param hideDelay <p>The number of milliseconds to wait until the tooltip is hidden when. mouse out from a point or chart.</p>
* @param outside <p>Whether to allow the tooltip to render outside the chart's SVG. element box. By default (<code>false</code>), the tooltip is rendered within the. chart's SVG element, which results in the tooltip being aligned. inside the chart area. For small charts, this may result in clipping. or overlapping. When <code>true</code>, a separate SVG element is created and. overlaid on the page, allowing the tooltip to be aligned inside the. page itself.</p>
* @param pointFormatter <p>A callback function for formatting the HTML output for a single point. in the tooltip. Like the <code>pointFormat</code> string, but with more. flexibility.</p>
* @param split <p>Split the tooltip into one label per series, with the header close. to the axis. This is recommended over <a href="#tooltip.shared">shared</a>. tooltips for charts with multiple line series, generally making them. easier to read. This option takes precedence over <code>tooltip.shared</code>.</p>
* @param valuePrefix <p>A string to prepend to each series' y value. Overridable in each. series' tooltip options object.</p>
* @param valueSuffix <p>A string to append to each series' y value. Overridable in each. series' tooltip options object.</p>
* @param xDateFormat <p>The format for the date in the tooltip header if the X axis is a. datetime axis. The default is a best guess based on the smallest. distance between points in the chart.</p>
* @param changeDecimals <p>How many decimals to show for the <code>point.change</code> value when the. <code>series.compare</code> option is set. This is overridable in each series'. tooltip options object. The default is to preserve all decimals.</p>
*/
def apply(pointFormat: js.UndefOr[String] = js.undefined, valueDecimals: js.UndefOr[Double] = js.undefined, dateTimeLabelFormats: js.UndefOr[js.Object] = js.undefined, footerFormat: js.UndefOr[String] = js.undefined, padding: js.UndefOr[Double] = js.undefined, headerFormat: js.UndefOr[String] = js.undefined, followPointer: js.UndefOr[Boolean] = js.undefined, followTouchMove: js.UndefOr[Boolean] = js.undefined, hideDelay: js.UndefOr[Double] = js.undefined, outside: js.UndefOr[Boolean] = js.undefined, pointFormatter: js.UndefOr[js.Function] = js.undefined, split: js.UndefOr[Boolean] = js.undefined, valuePrefix: js.UndefOr[String] = js.undefined, valueSuffix: js.UndefOr[String] = js.undefined, xDateFormat: js.UndefOr[String] = js.undefined, changeDecimals: js.UndefOr[Double] = js.undefined): PlotOptionsBbTooltip = {
val pointFormatOuter: js.UndefOr[String] = pointFormat
val valueDecimalsOuter: js.UndefOr[Double] = valueDecimals
val dateTimeLabelFormatsOuter: js.UndefOr[js.Object] = dateTimeLabelFormats
val footerFormatOuter: js.UndefOr[String] = footerFormat
val paddingOuter: js.UndefOr[Double] = padding
val headerFormatOuter: js.UndefOr[String] = headerFormat
val followPointerOuter: js.UndefOr[Boolean] = followPointer
val followTouchMoveOuter: js.UndefOr[Boolean] = followTouchMove
val hideDelayOuter: js.UndefOr[Double] = hideDelay
val outsideOuter: js.UndefOr[Boolean] = outside
val pointFormatterOuter: js.UndefOr[js.Function] = pointFormatter
val splitOuter: js.UndefOr[Boolean] = split
val valuePrefixOuter: js.UndefOr[String] = valuePrefix
val valueSuffixOuter: js.UndefOr[String] = valueSuffix
val xDateFormatOuter: js.UndefOr[String] = xDateFormat
val changeDecimalsOuter: js.UndefOr[Double] = changeDecimals
com.highcharts.HighchartsGenericObject.toCleanObject(new PlotOptionsBbTooltip {
override val pointFormat: js.UndefOr[String] = pointFormatOuter
override val valueDecimals: js.UndefOr[Double] = valueDecimalsOuter
override val dateTimeLabelFormats: js.UndefOr[js.Object] = dateTimeLabelFormatsOuter
override val footerFormat: js.UndefOr[String] = footerFormatOuter
override val padding: js.UndefOr[Double] = paddingOuter
override val headerFormat: js.UndefOr[String] = headerFormatOuter
override val followPointer: js.UndefOr[Boolean] = followPointerOuter
override val followTouchMove: js.UndefOr[Boolean] = followTouchMoveOuter
override val hideDelay: js.UndefOr[Double] = hideDelayOuter
override val outside: js.UndefOr[Boolean] = outsideOuter
override val pointFormatter: js.UndefOr[js.Function] = pointFormatterOuter
override val split: js.UndefOr[Boolean] = splitOuter
override val valuePrefix: js.UndefOr[String] = valuePrefixOuter
override val valueSuffix: js.UndefOr[String] = valueSuffixOuter
override val xDateFormat: js.UndefOr[String] = xDateFormatOuter
override val changeDecimals: js.UndefOr[Double] = changeDecimalsOuter
})
}
}
| {
"content_hash": "8ca3b5f31a7f7e99c28929645be6fa40",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 826,
"avg_line_length": 72.32051282051282,
"alnum_prop": 0.7297169532588784,
"repo_name": "Karasiq/scalajs-highcharts",
"id": "5e1b7d1ab2cf28189aa74a8ec972949792e7b8a0",
"size": "16923",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/com/highmaps/config/PlotOptionsBbTooltip.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Scala",
"bytes": "131509301"
}
],
"symlink_target": ""
} |
module ODFReport
class Table
include Nested
def initialize(opts, image_manager)
@name = opts[:name]
@collection_field = opts[:collection_field]
@collection = opts[:collection]
@image_manager = image_manager
@file_type = opts[:file_type]
case @file_type
when :doc then @name_space = 'w'
when :ppt then @name_space = 'a'
end
@fields = []
@texts = []
@tables = []
@images = []
@charts = []
@template_rows = []
@header = opts[:header].nil? ? true : opts[:header]
@skip_if_empty = opts[:skip_if_empty] || false
end
def replace!(doc, row = nil)
if (@file_type == :doc and doc.namespaces.include? 'xmlns:w' and doc.xpath("//w:document").any?) or# Look through document.xml
(@file_type == :ppt and doc.namespaces.include? 'xmlns:a')
return unless table = find_table_node(doc)
@template_rows = table.xpath(".//#{@name_space}:tr")
# Disabling the below because it creates an odd effect on the table
# @header = table.xpath("//w:tblHeader").empty? ? @header : false
@collection = get_collection_from_item(row, @collection_field) if row
if @skip_if_empty && @collection.empty?
table.remove
return
end
@collection.each do |data_item|
new_node = get_next_row
@tables.each { |t| t.replace!(new_node, data_item) }
@images.each { |i| @image_manager.register_new_image(i.dup, new_node, data_item) }
@texts.each { |t| t.replace!(new_node, data_item) }
@fields.each { |f| f.replace!(new_node, data_item) }
@charts.each { |c| c.replace!(new_node, data_item) }
table.add_child(new_node)
end
@template_rows.each_with_index do |r, i|
r.remove if (get_start_node..template_length) === i
end
end
end # replace
def remove!(doc)
if doc.namespaces.include? 'xmlns:w' and doc.xpath("//w:document").any?
return unless table = find_table_node(doc)
table.remove
end
end # replace_section
private
def get_next_row
@row_cursor = get_start_node unless defined?(@row_cursor)
ret = @template_rows[@row_cursor]
if @template_rows.size == @row_cursor + 1
@row_cursor = get_start_node
else
@row_cursor += 1
end
return ret.dup
end
def get_start_node
@header ? 1 : 0
end
def template_length
@tl ||= @template_rows.size
end
def find_table_node(doc)
case @file_type
when :doc then tables = doc.xpath("//w:tbl[w:tblPr[w:tblCaption[@w:val='#{@name}']]]")
when :ppt then tables = doc.xpath("//p:graphicFrame[p:nvGraphicFramePr[p:cNvPr[@title='#{@name}']]]/a:graphic/a:graphicData/a:tbl")
end
tables.empty? ? nil : tables.first
end
end
end
| {
"content_hash": "d9ea62d68db43ec683d6c4fa7caf30f8",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 137,
"avg_line_length": 27.57843137254902,
"alnum_prop": 0.5940277284038393,
"repo_name": "tdenovan/odf-report",
"id": "5ccd06f2cf55adb23e71488c332fe1a5dc71a379",
"size": "2813",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/odf-report/table.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "24298"
}
],
"symlink_target": ""
} |
namespace JustOrderIt.Data.DbAccessConfig.SampleDataGenerators.HelperModels
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.GlobalConstants;
public class ProcessedImage
{
public string OriginalFileName { get; set; }
public string FileExtension { get; set; }
public string UrlPath { get; set; }
public byte[] SmallSizeContent { get; set; }
public byte[] ThumbnailContent { get; set; }
public byte[] HighResolutionContent { get; set; }
}
}
| {
"content_hash": "c3946ecc6d28b1b320ad415c516e2e88",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 26.5,
"alnum_prop": 0.639937106918239,
"repo_name": "mpenchev86/ASP.NET-MVC-FinalProject",
"id": "fef89a062737a03d3a87aaa5cd095970eabfd38d",
"size": "638",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Source/Data/JustOrderIt.Data.DbAccessConfig/SampleData/HelperModels/ProcessedImage.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "107"
},
{
"name": "C#",
"bytes": "1106404"
},
{
"name": "CSS",
"bytes": "348266"
},
{
"name": "HTML",
"bytes": "3554"
},
{
"name": "JavaScript",
"bytes": "47562"
}
],
"symlink_target": ""
} |
/**
* @file WhiteNoiseGenerator.cpp
*
* White noise generator.
*
* This file is part of the Aquila DSP library.
* Aquila is free software, licensed under the MIT/X11 License. A copy of
* the license is provided with the library in the LICENSE file.
*
* @package Aquila
* @version 3.0.0-dev
* @author Zbigniew Siciarz
* @date 2007-2014
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @since 3.0.0
*/
#include "WhiteNoiseGenerator.h"
#include "../../functions.h"
namespace Aquila
{
/**
* Creates the generator object.
*
* @param sampleFrequency sample frequency of the signal
*/
WhiteNoiseGenerator::WhiteNoiseGenerator(FrequencyType sampleFrequency):
Generator(sampleFrequency)
{
}
/**
* Fills the buffer with generated white noise samples.
*
* @param samplesCount how many samples to generate
*/
void WhiteNoiseGenerator::generate(std::size_t samplesCount)
{
m_data.resize(samplesCount);
for (std::size_t i = 0; i < samplesCount; ++i)
{
m_data[i] = m_amplitude * (randomDouble() - 0.5);
}
}
}
| {
"content_hash": "73e30b77dd3c4e6f51d7b7d340199f8a",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 76,
"avg_line_length": 25.108695652173914,
"alnum_prop": 0.6406926406926406,
"repo_name": "tempbottle/aquila",
"id": "bcce665994df8eeb18bc576c5122b7e9e192473d",
"size": "1155",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "aquila/source/generator/WhiteNoiseGenerator.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "502"
},
{
"name": "C",
"bytes": "56674"
},
{
"name": "C++",
"bytes": "405277"
},
{
"name": "CMake",
"bytes": "53749"
},
{
"name": "Python",
"bytes": "4122"
}
],
"symlink_target": ""
} |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/water2"
android:orientation="vertical" >
<Button
android:id="@+id/a2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:background="#0099cc"
android:text="Events"
android:textColor="#ffffff"
android:textSize="30sp"
android:textStyle="bold" >
</Button>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/a"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="Paper Presentation"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
<Button
android:id="@+id/b"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="Case Presentation"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
<Button
android:id="@+id/c"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="Poster Presentation"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
<Button
android:id="@+id/d"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="Workshops"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
<Button
android:id="@+id/e"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="Debate"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
<Button
android:id="@+id/f"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="MedQuiz"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
<Button
android:id="@+id/g"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="MedTech"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
<Button
android:id="@+id/h"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/sel"
android:text="Other Events"
android:textColor="#ffffff"
android:textSize="22sp"
android:textStyle="italic" >
</Button>
</LinearLayout>
</ScrollView>
</LinearLayout> | {
"content_hash": "c2852500024979016d7d96e237481040",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 72,
"avg_line_length": 36.592592592592595,
"alnum_prop": 0.5157894736842106,
"repo_name": "avi33tbtt/OSMECON-2014",
"id": "81fb5e1f407c518e678538c4b800bcdc51c6af65",
"size": "4940",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/title2.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "47885"
}
],
"symlink_target": ""
} |
<?php
// Call Zend_Filter_CamelCaseToDashTest::main() if this source file is executed directly.
if (!defined("PHPUnit_MAIN_METHOD")) {
define("PHPUnit_MAIN_METHOD", "Zend_Filter_Word_CamelCaseToDashTest::main");
}
require_once 'Zend/Filter/Word/CamelCaseToDash.php';
/**
* Test class for Zend_Filter_Word_CamelCaseToDash.
*
* @category Zend
* @package Zend_Filter
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Filter
*/
class Zend_Filter_Word_CamelCaseToDashTest extends PHPUnit_Framework_TestCase
{
/**
* Runs the test methods of this class.
*
* @access public
* @static
*/
public static function main()
{
$suite = new PHPUnit_Framework_TestSuite("Zend_Filter_Word_CamelCaseToDashTest");
$result = PHPUnit_TextUI_TestRunner::run($suite);
}
public function testFilterSeparatesCamelCasedWordsWithDashes()
{
$string = 'CamelCasedWords';
$filter = new Zend_Filter_Word_CamelCaseToDash();
$filtered = $filter->filter($string);
$this->assertNotEquals($string, $filtered);
$this->assertEquals('Camel-Cased-Words', $filtered);
}
}
// Call Zend_Filter_Word_CamelCaseToDashTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == "Zend_Filter_Word_CamelCaseToDashTest::main") {
Zend_Filter_Word_CamelCaseToDashTest::main();
}
| {
"content_hash": "5e7f6ab0d21f223e16647c79241346ca",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 94,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6780866192630899,
"repo_name": "svenax/ZendFramework",
"id": "4be9615be8b90979d63744be07eea229ce37176e",
"size": "2264",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "tests/Zend/Filter/Word/CamelCaseToDashTest.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "30081"
},
{
"name": "PHP",
"bytes": "31409683"
},
{
"name": "PowerShell",
"bytes": "1028"
},
{
"name": "Puppet",
"bytes": "770"
},
{
"name": "Ruby",
"bytes": "3301"
},
{
"name": "Shell",
"bytes": "10511"
},
{
"name": "TypeScript",
"bytes": "3445"
}
],
"symlink_target": ""
} |
from google.cloud import container_v1
async def sample_set_addons_config():
# Create a client
client = container_v1.ClusterManagerAsyncClient()
# Initialize request argument(s)
request = container_v1.SetAddonsConfigRequest(
)
# Make the request
response = await client.set_addons_config(request=request)
# Handle the response
print(response)
# [END container_v1_generated_ClusterManager_SetAddonsConfig_async]
| {
"content_hash": "aca4257155809b1d5e4c03533ba22870",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 67,
"avg_line_length": 25.11111111111111,
"alnum_prop": 0.7323008849557522,
"repo_name": "googleapis/python-container",
"id": "fd9de008a6cdc80fa06d1bff067b7a989bc8e54a",
"size": "1847",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "samples/generated_samples/container_v1_generated_cluster_manager_set_addons_config_async.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2050"
},
{
"name": "Python",
"bytes": "2480646"
},
{
"name": "Shell",
"bytes": "30669"
}
],
"symlink_target": ""
} |
package moodlistener.blusay.item;
import moodlistener.blusay.R;
import android.app.Activity;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
/**
* Created by Michelle on 12/29/2017.
*/
public class MoodList extends ArrayAdapter<Mood> {
private Activity context;
private List<Mood> moodList;
public MoodList(Activity context, List<Mood> moods){
super(context, R.layout.item_mood, moods);
this.context = context;
this.moodList = moods;
}
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View moodItem = inflater.inflate(R.layout.item_mood, null, true);
//set any xml text/data here
Mood mood = moodList.get(position);
return moodItem;
}
}
| {
"content_hash": "121f58e1745ef736779c22cf6a3d3dd2",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 94,
"avg_line_length": 26.75,
"alnum_prop": 0.7186915887850467,
"repo_name": "laimich/Blusay",
"id": "4edfa8cc7dded0b758eb1085df1f7cfcbda268c6",
"size": "1070",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/moodlistener/blusay/item/MoodList.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "20750"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Pitcher pl. Old World 2:1315. 2009
#### Original name
null
### Remarks
null | {
"content_hash": "e1942c1c684692796a77f45cbb03d342",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 12.615384615384615,
"alnum_prop": 0.7012195121951219,
"repo_name": "mdoering/backbone",
"id": "0e6d37c0b5964a50c961c46eea3ccd92745cd90f",
"size": "261",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Nepenthaceae/Nepenthes/Nepenthes micramphora/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"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_65) on Wed Jan 06 12:54:54 MSK 2016 -->
<title>com.centurylink.cloud.sdk.core.config Class Hierarchy (sdk 1.2.2 API)</title>
<meta name="date" content="2016-01-06">
<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="com.centurylink.cloud.sdk.core.config Class Hierarchy (sdk 1.2.2 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>Class</li>
<li class="navBarCell1Rev">Tree</li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/centurylink/cloud/sdk/core/client/retry/package-tree.html">Prev</a></li>
<li><a href="../../../../../../com/centurylink/cloud/sdk/core/exceptions/package-tree.html">Next</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/centurylink/cloud/sdk/core/config/package-tree.html" target="_top">Frames</a></li>
<li><a href="package-tree.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">
<h1 class="title">Hierarchy For Package com.centurylink.cloud.sdk.core.config</h1>
<span class="packageHierarchyLabel">Package Hierarchies:</span>
<ul class="horizontal">
<li><a href="../../../../../../overview-tree.html">All Packages</a></li>
</ul>
</div>
<div class="contentContainer">
<h2 title="Class Hierarchy">Class Hierarchy</h2>
<ul>
<li type="circle">java.lang.Object
<ul>
<li type="circle">com.fasterxml.jackson.databind.JsonDeserializer<T>
<ul>
<li type="circle">com.centurylink.cloud.sdk.core.config.<a href="../../../../../../com/centurylink/cloud/sdk/core/config/OffsetDateTimeDeserializer.html" title="class in com.centurylink.cloud.sdk.core.config"><span class="typeNameLink">OffsetDateTimeDeserializer</span></a></li>
</ul>
</li>
<li type="circle">com.centurylink.cloud.sdk.core.config.<a href="../../../../../../com/centurylink/cloud/sdk/core/config/SdkConfiguration.html" title="class in com.centurylink.cloud.sdk.core.config"><span class="typeNameLink">SdkConfiguration</span></a></li>
<li type="circle">com.centurylink.cloud.sdk.core.config.<a href="../../../../../../com/centurylink/cloud/sdk/core/config/SdkConfigurationBuilder.html" title="class in com.centurylink.cloud.sdk.core.config"><span class="typeNameLink">SdkConfigurationBuilder</span></a></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>Class</li>
<li class="navBarCell1Rev">Tree</li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/centurylink/cloud/sdk/core/client/retry/package-tree.html">Prev</a></li>
<li><a href="../../../../../../com/centurylink/cloud/sdk/core/exceptions/package-tree.html">Next</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/centurylink/cloud/sdk/core/config/package-tree.html" target="_top">Frames</a></li>
<li><a href="package-tree.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "b049b11c98922998b8c1e4bd2be68f5a",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 278,
"avg_line_length": 40.51063829787234,
"alnum_prop": 0.6074929971988795,
"repo_name": "CenturyLinkCloud/clc-java-sdk",
"id": "c313434e3d56e29f060233c365d7d5881fb8debf",
"size": "5712",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/javadoc/com/centurylink/cloud/sdk/core/config/package-tree.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "86"
},
{
"name": "HTML",
"bytes": "3370"
},
{
"name": "Java",
"bytes": "1370002"
},
{
"name": "JavaScript",
"bytes": "26453"
}
],
"symlink_target": ""
} |
<?php
//
// Copyright (c) 2020-2022 Grigore Stefan <g_stefan@yahoo.com>
// Created by Grigore Stefan <g_stefan@yahoo.com>
//
// MIT License (MIT) <http://opensource.org/licenses/MIT>
//
defined("XYO_CLOUD") or die("Access is denied");
$listModuleGroup = array();
$listModuleGroup["*"] = $this->getFromLanguage("select.xyo_module_group_any_edit");
$dsModuleGroup = &$this->getDataSource("db.table.xyo_module_group");
if ($dsModuleGroup) {
$dsModuleGroup->clear();
$dsModuleGroup->setOrder("name",1);
for ($dsModuleGroup->load(); $dsModuleGroup->isValid(); $dsModuleGroup->loadNext()) {
$listModuleGroup[$dsModuleGroup->id] = $dsModuleGroup->name;
};
};
$this->setParameter("select.xyo_module_group_id", $listModuleGroup);
| {
"content_hash": "71bc070c69de41060f9011dfdf2dbd47",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 86,
"avg_line_length": 34.18181818181818,
"alnum_prop": 0.6821808510638298,
"repo_name": "g-stefan/xyo-cloud",
"id": "26b4cea4a0078268ce2ced8dc947fa64af6b873a",
"size": "752",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "source/site/module/xyo/xyo-app-module/model/select-xyo-module-group-edit.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "6487"
},
{
"name": "CSS",
"bytes": "10889"
},
{
"name": "HTML",
"bytes": "69235"
},
{
"name": "JavaScript",
"bytes": "9085"
},
{
"name": "PHP",
"bytes": "1644719"
}
],
"symlink_target": ""
} |
<html dir="LTR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
<title>ProtectCloseTextWriter Members</title>
<xml>
</xml>
<link rel="stylesheet" type="text/css" href="MSDN.css" />
</head>
<body id="bodyID" class="dtBODY">
<div id="nsbanner">
<div id="bannerrow1">
<table class="bannerparthead" cellspacing="0">
<tr id="hdr">
<td class="runninghead">Apache log4net SDK Documentation - Microsoft .NET Framework 4.0</td>
<td class="product">
</td>
</tr>
</table>
</div>
<div id="TitleRow">
<h1 class="dtH1">ProtectCloseTextWriter Members
</h1>
</div>
</div>
<div id="nstext">
<p>
<a href="log4net.Util.ProtectCloseTextWriter.html">ProtectCloseTextWriter overview</a>
</p>
<h4 class="dtH4">Public Instance Constructors</h4>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr VALIGN="top">
<td width="50%">
<img src="pubmethod.gif" />
<a href="log4net.Util.ProtectCloseTextWriterConstructor.html">ProtectCloseTextWriter Constructor</a>
</td>
<td width="50%"> Constructor </td>
</tr>
</table>
</div>
<h4 class="dtH4">Public Instance Properties</h4>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr VALIGN="top"><td width="50%"><img src="pubproperty.gif"></img><a href="log4net.Util.TextWriterAdapter.Encoding.html">Encoding</a> (inherited from <b>TextWriterAdapter</b>)</td><td width="50%"> The Encoding in which the output is written </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubproperty.gif"></img><a href="log4net.Util.TextWriterAdapter.FormatProvider.html">FormatProvider</a> (inherited from <b>TextWriterAdapter</b>)</td><td width="50%"> Gets an object that controls formatting </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubproperty.gif"></img><a href="log4net.Util.TextWriterAdapter.NewLine.html">NewLine</a> (inherited from <b>TextWriterAdapter</b>)</td><td width="50%"> Gets or sets the line terminator string used by the TextWriter </td></tr></table>
</div>
<h4 class="dtH4">Public Instance Methods</h4>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="log4net.Util.ProtectCloseTextWriter.Attach.html">Attach</a></td><td width="50%"> Attach this instance to a different underlying <a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemIOTextWriterClassTopic.htm">TextWriter</a>
</td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="log4net.Util.ProtectCloseTextWriter.Close.html">Close</a></td><td width="50%"> Does not close the underlying output writer. </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemMarshalByRefObjectClassCreateObjRefTopic.htm">CreateObjRef</a> (inherited from <b>MarshalByRefObject</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemIOTextWriterClassDisposeTopic.htm">Dispose</a> (inherited from <b>TextWriter</b>)</td><td width="50%">Overloaded. </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassEqualsTopic.htm">Equals</a> (inherited from <b>Object</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="log4net.Util.TextWriterAdapter.Flush.html">Flush</a> (inherited from <b>TextWriterAdapter</b>)</td><td width="50%"> Flushes any buffered output </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassGetHashCodeTopic.htm">GetHashCode</a> (inherited from <b>Object</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemMarshalByRefObjectClassGetLifetimeServiceTopic.htm">GetLifetimeService</a> (inherited from <b>MarshalByRefObject</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassGetTypeTopic.htm">GetType</a> (inherited from <b>Object</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemMarshalByRefObjectClassInitializeLifetimeServiceTopic.htm">InitializeLifetimeService</a> (inherited from <b>MarshalByRefObject</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassToStringTopic.htm">ToString</a> (inherited from <b>Object</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="log4net.Util.TextWriterAdapter.Write_overloads.html">Write</a> (inherited from <b>TextWriterAdapter</b>)</td><td width="50%">Overloaded. Writes a character to the wrapped TextWriter </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemIOTextWriterClassWriteTopic.htm">Write</a> (inherited from <b>TextWriter</b>)</td><td width="50%">Overloaded. </td></tr>
<tr VALIGN="top"><td width="50%"><img src="pubmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemIOTextWriterClassWriteLineTopic.htm">WriteLine</a> (inherited from <b>TextWriter</b>)</td><td width="50%">Overloaded. </td></tr></table>
</div>
<h4 class="dtH4">Protected Instance Fields</h4>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr VALIGN="top"><td width="50%"><img src="protfield.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemIOTextWriterClassCoreNewLineTopic.htm">CoreNewLine</a> (inherited from <b>TextWriter</b>)</td><td width="50%"> </td></tr></table>
</div>
<h4 class="dtH4">Protected Instance Properties</h4>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr VALIGN="top"><td width="50%"><img src="protproperty.gif"></img><a href="log4net.Util.TextWriterAdapter.Writer.html">Writer</a> (inherited from <b>TextWriterAdapter</b>)</td><td width="50%"> Gets or sets the underlying <a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemIOTextWriterClassTopic.htm">TextWriter</a>. </td></tr></table>
</div>
<h4 class="dtH4">Protected Instance Methods</h4>
<div class="tablediv">
<table class="dtTABLE" cellspacing="0">
<tr VALIGN="top"><td width="50%"><img src="protmethod.gif"></img><a href="log4net.Util.TextWriterAdapter.Dispose_overload_1.html">Dispose</a> (inherited from <b>TextWriterAdapter</b>)</td><td width="50%">Overloaded. Dispose this writer </td></tr>
<tr VALIGN="top"><td width="50%"><img src="protmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassFinalizeTopic.htm">Finalize</a> (inherited from <b>Object</b>)</td><td width="50%"> </td></tr>
<tr VALIGN="top"><td width="50%"><img src="protmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemMarshalByRefObjectClassMemberwiseCloneTopic.htm">MemberwiseClone</a> (inherited from <b>MarshalByRefObject</b>)</td><td width="50%">Overloaded. </td></tr>
<tr VALIGN="top"><td width="50%"><img src="protmethod.gif"></img><a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassMemberwiseCloneTopic.htm">MemberwiseClone</a> (inherited from <b>Object</b>)</td><td width="50%">Overloaded. </td></tr></table>
</div>
<h4 class="dtH4">See Also</h4>
<p>
<a href="log4net.Util.ProtectCloseTextWriter.html">ProtectCloseTextWriter Class</a> | <a href="log4net.Util.html">log4net.Util Namespace</a></p>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;">
<param name="Keyword" value="ProtectCloseTextWriter class">
</param>
<param name="Keyword" value="log4net.Util.ProtectCloseTextWriter class">
</param>
<param name="Keyword" value="ProtectCloseTextWriter class, all members">
</param>
</object>
<hr />
<div id="footer"><a href='http://logging.apache.org/log4net/'>Copyright 2004-2013 The Apache Software Foundation.</a><br></br>Apache log4net, Apache and log4net are trademarks of The Apache Software Foundation.</div>
</div>
</body>
</html> | {
"content_hash": "aa91d7a7f0e274b5b105b245cb6beda4",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 348,
"avg_line_length": 89.70297029702971,
"alnum_prop": 0.6803532008830022,
"repo_name": "YOTOV-LIMITED/pokerleaguemanager",
"id": "13e58a364a999999decc230607a77f07e93aef2f",
"size": "9060",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/Log4net 1.2.13/doc/release/sdk/log4net.Util.ProtectCloseTextWriterMembers.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "77"
},
{
"name": "C#",
"bytes": "356708"
},
{
"name": "CSS",
"bytes": "15059"
},
{
"name": "HTML",
"bytes": "9558034"
},
{
"name": "JavaScript",
"bytes": "5435"
},
{
"name": "PowerShell",
"bytes": "97040"
},
{
"name": "Shell",
"bytes": "1019"
},
{
"name": "Smalltalk",
"bytes": "9078"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>needed? (ActiveRecord::ConnectionAdapters::JdbcAdapter::ConnectionPoolCallbacks)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
<pre><span class="ruby-comment cmt"># File lib/active_record/connection_adapters/jdbc_adapter.rb, line 435</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">needed?</span>
<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:connection_pool</span>)
<span class="ruby-keyword kw">end</span></pre>
</body>
</html> | {
"content_hash": "5012ebc6331b33d0eec3fa29bb686bc0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 237,
"avg_line_length": 59.111111111111114,
"alnum_prop": 0.6832706766917294,
"repo_name": "varshavaradarajan/functional-tests",
"id": "6a0014e3e92eb79ab7a6d6bb2ebf8e9a44a5d1f3",
"size": "1064",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/jruby/lib/ruby/gems/1.8/doc/activerecord-jdbc-adapter-0.9.7-java/rdoc/classes/ActiveRecord/ConnectionAdapters/JdbcAdapter/ConnectionPoolCallbacks.src/M000048.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "12917"
},
{
"name": "C",
"bytes": "144"
},
{
"name": "C++",
"bytes": "37"
},
{
"name": "CSS",
"bytes": "6622"
},
{
"name": "Gherkin",
"bytes": "484"
},
{
"name": "HTML",
"bytes": "1316282"
},
{
"name": "Java",
"bytes": "1846156"
},
{
"name": "JavaScript",
"bytes": "787482"
},
{
"name": "PHP",
"bytes": "2182"
},
{
"name": "Ruby",
"bytes": "132504"
},
{
"name": "Shell",
"bytes": "116894"
},
{
"name": "Tcl",
"bytes": "11341"
},
{
"name": "Visual Basic",
"bytes": "84"
}
],
"symlink_target": ""
} |
#ifndef __ARCH_OBJECT_STRUCTURES_H
#define __ARCH_OBJECT_STRUCTURES_H
#include <mode/object/structures.h>
#endif
| {
"content_hash": "8abd42b01de7ac19e2c7319902040e6e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 35,
"avg_line_length": 14.625,
"alnum_prop": 0.7435897435897436,
"repo_name": "zhicheng/seL4",
"id": "796e35d827da42b0e43b277491ad8ec889e09e45",
"size": "387",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "include/arch/arm/arch/object/structures.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Assembly",
"bytes": "39860"
},
{
"name": "Brainfuck",
"bytes": "3986"
},
{
"name": "C",
"bytes": "1262037"
},
{
"name": "C++",
"bytes": "70429"
},
{
"name": "HyPhy",
"bytes": "27931"
},
{
"name": "Makefile",
"bytes": "67313"
},
{
"name": "Objective-C",
"bytes": "360"
},
{
"name": "Python",
"bytes": "28230"
},
{
"name": "TeX",
"bytes": "190376"
}
],
"symlink_target": ""
} |
The current stable version of Debian, which is codenamed Wheezy, does not
include the facilities to generate a dynamic message-of-the-day (MOTD). The
shell scripts in this folder will allow you to do that.
Follow these steps:
sudo apt-get install figlet uptimed
sudo mkdir /etc/update-motd.d/
cd /etc/update-motd.d/
sudo touch 00-header
sudo touch 10-sysinfo
sudo touch 90-footer
sudo chmod /etc/update-motd.d/*
sudo rm /etc/motd
sudo ln -s /var/run/motd /etc/motd
Now copy the contents of `00-header`, `10-sysinfo`, and `90-footer` to
`/etc/update-motd.d/` on your server!
Edit the file `/etc/pam.d/sshd` and comment out the line that reads:
session optional pam_motd.so motd=/run/motd.dynamic noupdate
Edit the file `/etc/ssh/sshd_config` and edit the settings `PrintMotd` and
`PrintLastLog` so that they look like this:
PrintMotd no
PrintLastLog no
Finally, remove the file `/var/run/motd.dynamic` and reboot your system.
Have lots of fun!
| {
"content_hash": "ca84f385730d9597bf40d5f38d5647dd",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 31.5,
"alnum_prop": 0.7172619047619048,
"repo_name": "gorauskas/Hacks",
"id": "e31b222c028aaffcb4c7b9e4b87514000d75d34f",
"size": "1038",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "shell/dynamic-motd/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1755"
},
{
"name": "C#",
"bytes": "9437"
},
{
"name": "CSS",
"bytes": "2367"
},
{
"name": "Common Lisp",
"bytes": "869"
},
{
"name": "Emacs Lisp",
"bytes": "199"
},
{
"name": "HTML",
"bytes": "5132"
},
{
"name": "JavaScript",
"bytes": "2510"
},
{
"name": "PowerShell",
"bytes": "52297"
},
{
"name": "Python",
"bytes": "42034"
},
{
"name": "Scheme",
"bytes": "1051"
},
{
"name": "Shell",
"bytes": "5042"
}
],
"symlink_target": ""
} |
import java.lang.Runnable;
import java.util.ArrayList;
import java.io.*;
public class FindReducer implements Reducer{
private boolean exist;
private String data;
private ArrayList<Object> param;
private ArrayList<String> param_types;
private ArrayList<Object> result;
private ArrayList<String> result_types;
private final static long serialVersionUID = 1;
public FindReducer(){
this.param = new ArrayList<Object>();
this.param_types = new ArrayList<String>();
this.result = new ArrayList<Object>();
this.result_types = new ArrayList<String>();
this.exist = true;
}
public void setArgs(ArrayList<Object> param, ArrayList<String> types){
this.param = param;
this.param_types = types;
}
public void run(){
for (int i=0;i<this.param.size();i++){
if (!this.param_types.get(i).equals("Boolean")){
//fault
System.exit(2);
}
}
for (int i=0;i<this.param.size();i++){
this.exist = (this.exist || (boolean)this.param.get(i));
}
}
public ArrayList<String> getTypes(){
ArrayList<String> type = new ArrayList<String>();
type.add("Boolean");
return type;
}
public ArrayList<Object> getResult(){
ArrayList<Object> res = new ArrayList<Object>();
res.add((Boolean)this.exist);
return res;
}
}
| {
"content_hash": "4f61692f6a0a9397abe6e2a89a6f7af5",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 74,
"avg_line_length": 28.21153846153846,
"alnum_prop": 0.588957055214724,
"repo_name": "lixf/MapReduce",
"id": "43d6c203e1b7a382e3542886f1106d3e6ce47fda",
"size": "1469",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/client/FindReducer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "90755"
},
{
"name": "Shell",
"bytes": "2697"
}
],
"symlink_target": ""
} |
_Applies to: Excel 2016, Office 2016_
Represents major or minor gridlines on a chart axis.
## Properties
| Property | Type |Description
|:---------------|:--------|:----------|
|visible|bool|Boolean value representing if the axis gridlines are visible or not.|
_See property access [examples.](#property-access-examples)_
## Relationships
| Relationship | Type |Description|
|:---------------|:--------|:----------|
|format|[ChartGridlinesFormat](chartgridlinesformat.md)|Represents the formatting of chart gridlines. Read-only.|
## Methods
| Method | Return Type |Description|
|:---------------|:--------|:----------|
|[load(param: object)](#loadparam-object)|void|Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.|
## Method Details
### load(param: object)
Fills the proxy object created in JavaScript layer with property and object values specified in the parameter.
#### Syntax
```js
object.load(param);
```
#### Parameters
| Parameter | Type |Description|
|:---------------|:--------|:----------|
|param|object|Optional. Accepts parameter and relationship names as delimited string or an array. Or, provide [loadOption](loadoption.md) object.|
#### Returns
void
### Property access examples
Get the `visible` of Major Gridlines on value axis of Chart1
```js
Excel.run(function (ctx) {
var chart = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1");
var majGridlines = chart.axes.valueaxis.majorGridlines;
majGridlines.load('visible');
return ctx.sync().then(function() {
console.log(majGridlines.visible);
});
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```
Set to show major gridlines on valueAxis of Chart1
```js
Excel.run(function (ctx) {
var chart = ctx.workbook.worksheets.getItem("Sheet1").charts.getItem("Chart1");
chart.axes.valueaxis.majorgridlines.visible = true;
return ctx.sync().then(function() {
console.log("Axis Gridlines Added ");
});
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
```
| {
"content_hash": "79bc4892ad99e9a948c1d50614562aee",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 158,
"avg_line_length": 29.948051948051948,
"alnum_prop": 0.6764960971379012,
"repo_name": "sumurthy/md_apispec",
"id": "2090730147f8339417f36183f360f0902dd70c76",
"size": "2358",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "jsOutputMarkdowns/chartgridlines.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "27"
},
{
"name": "Ruby",
"bytes": "92883"
}
],
"symlink_target": ""
} |
<!doctype html>
<html lang="en" ng-app="dnwTennisApp">
<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="Decatur Northwest Tennis Lottery Signup">
<meta name="author" content="Tom Lennon">
<link rel="shortcut icon" href="assets/favicon.ico">
<title>{{ template .PageTitle }}</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap theme -->
<link href="css/bootstrap-theme.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/theme.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy this line! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[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]-->
<link rel="stylesheet" href="css/app.css"/>
</head>
<body ng-controller="mainController">
<div class="container theme-showcase" role="main">
{{ template "header" . }}
{{ template "campinfopanel ." }}
{{ template "body . " }}
</div> <!-- /container -->
<script src="lib/angular/angular.js"></script>
<script src="lib/angular/angular-route.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="lib/bootstrap/bootstrap.min.js"></script>
<script src="js/app.js"></script>
</body>
</html> | {
"content_hash": "638a4797aeb8e612d764a1ee5bc9deea",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 103,
"avg_line_length": 32.72222222222222,
"alnum_prop": 0.6502546689303905,
"repo_name": "telennon/dnwTennis",
"id": "a49ce5cbb668c40d9cbfae7b5c39a0d832deb08b",
"size": "1767",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "RegistrationWebSite/html/base.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "563"
},
{
"name": "Go",
"bytes": "44825"
},
{
"name": "JavaScript",
"bytes": "5808"
},
{
"name": "PHP",
"bytes": "6510"
}
],
"symlink_target": ""
} |
package org.apache.ignite.internal;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeTask;
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.managers.deployment.GridDeploymentResponse;
import org.apache.ignite.testframework.GridTestExternalClassLoader;
import org.apache.ignite.testframework.config.GridTestProperties;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.junit.Test;
/**
* Tests affinity and affinity mapper P2P loading.
*/
public class GridPeerDeploymentRetryTest extends GridCommonAbstractTest {
/** */
private static final String EXT_TASK_CLASS_NAME = "org.apache.ignite.tests.p2p.CacheDeploymentTestTask2";
/** URL of classes. */
private static final URL[] URLS;
/** Current deployment mode. Used in {@link #getConfiguration(String)}. */
private DeploymentMode depMode;
/**
* Initialize URLs.
*/
static {
try {
URLS = new URL[] {new URL(GridTestProperties.getProperty("p2p.uri.cls"))};
}
catch (MalformedURLException e) {
throw new RuntimeException("Define property p2p.uri.cls", e);
}
}
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
cfg.setDeploymentMode(depMode);
return cfg;
}
/**
*
*/
public GridPeerDeploymentRetryTest() {
super(false);
}
/**
* Test {@link DeploymentMode#PRIVATE} mode.
*
* @throws Exception if error occur.
*/
@Test
public void testPrivateMode() throws Exception {
depMode = DeploymentMode.PRIVATE;
deploymentTest();
}
/**
* Test {@link DeploymentMode#ISOLATED} mode.
*
* @throws Exception if error occur.
*/
@Test
public void testIsolatedMode() throws Exception {
depMode = DeploymentMode.ISOLATED;
deploymentTest();
}
/**
* Test {@link DeploymentMode#CONTINUOUS} mode.
*
* @throws Exception if error occur.
*/
@Test
public void testContinuousMode() throws Exception {
depMode = DeploymentMode.CONTINUOUS;
deploymentTest();
}
/**
* Test {@link DeploymentMode#SHARED} mode.
*
* @throws Exception if error occur.
*/
@Test
public void testSharedMode() throws Exception {
depMode = DeploymentMode.SHARED;
deploymentTest();
}
/** @throws Exception If failed. */
private void deploymentTest() throws Exception {
Ignite g1 = startGrid(1);
Ignite g2 = startGrid(2);
try {
GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(URLS);
TestRecordingCommunicationSpi rec1 =
(TestRecordingCommunicationSpi)g1.configuration().getCommunicationSpi();
rec1.blockMessages((node, message) -> message instanceof GridDeploymentResponse);
ComputeTask<Object, ?> task = (ComputeTask<Object, ?>)ldr.loadClass(EXT_TASK_CLASS_NAME).newInstance();
ClusterNode node = g1.cluster().node(g2.cluster().localNode().id());
try {
g1.compute(g1.cluster().forRemotes()).execute(task, node);
fail("Exception should be thrown");
}
catch (IgniteException ignore) {
// Expected exception.
}
rec1.stopBlock(false, null, true, true);
g1.compute(g1.cluster().forRemotes()).execute(task, node);
}
finally {
stopAllGrids(true);
}
}
}
| {
"content_hash": "7add29774c4b388f7455c549e14efe09",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 115,
"avg_line_length": 28.286713286713287,
"alnum_prop": 0.646229913473424,
"repo_name": "SomeFire/ignite",
"id": "df80b112f2a83e778e7facad632dfece6342f84a",
"size": "4847",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "modules/core/src/test/java/org/apache/ignite/internal/GridPeerDeploymentRetryTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "61105"
},
{
"name": "C",
"bytes": "5286"
},
{
"name": "C#",
"bytes": "6461926"
},
{
"name": "C++",
"bytes": "3681449"
},
{
"name": "CSS",
"bytes": "281251"
},
{
"name": "Dockerfile",
"bytes": "16105"
},
{
"name": "Groovy",
"bytes": "15081"
},
{
"name": "HTML",
"bytes": "821135"
},
{
"name": "Java",
"bytes": "42676141"
},
{
"name": "JavaScript",
"bytes": "1785625"
},
{
"name": "M4",
"bytes": "21724"
},
{
"name": "Makefile",
"bytes": "121296"
},
{
"name": "PHP",
"bytes": "486991"
},
{
"name": "PLpgSQL",
"bytes": "623"
},
{
"name": "PowerShell",
"bytes": "12208"
},
{
"name": "Python",
"bytes": "342274"
},
{
"name": "Scala",
"bytes": "1386030"
},
{
"name": "Shell",
"bytes": "612951"
},
{
"name": "TSQL",
"bytes": "6130"
},
{
"name": "TypeScript",
"bytes": "476855"
}
],
"symlink_target": ""
} |
namespace _1.PractiseIntegerNumbers
{
using System;
public class StartUp
{
public static void Main()
{
sbyte num1 = sbyte.Parse(Console.ReadLine());
byte num2 = byte.Parse(Console.ReadLine());
short num3 = short.Parse(Console.ReadLine());
ushort num4 = ushort.Parse(Console.ReadLine());
uint num5 = uint.Parse(Console.ReadLine());
int num6 = int.Parse(Console.ReadLine());
long num7 = long.Parse(Console.ReadLine());
Console.WriteLine(num1);
Console.WriteLine(num2);
Console.WriteLine(num3);
Console.WriteLine(num4);
Console.WriteLine(num5);
Console.WriteLine(num6);
Console.WriteLine(num7);
}
}
}
| {
"content_hash": "dbb36ea32f897a095062c136205794c3",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 59,
"avg_line_length": 31,
"alnum_prop": 0.5388291517323776,
"repo_name": "fmavrodiev/CSharpSoftUni",
"id": "cbdc5c0ee3d1732d4454bc47ccc3c1438986252f",
"size": "839",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ExercisesDataTypesAndVariables/1.PractiseIntegerNumbers/StartUp.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "399924"
}
],
"symlink_target": ""
} |
.. _motor-hardware:
The Motor
=========
.. _motor-hardware-works:
How it works
------------
The motor is the simplest of the hardware outputs. It takes a single input of
between -63 and +63, and sets the speed of the motor accordingly (with -63
being maximum speed in one direction, and +63 being maximum speed in the other).
.. _motor-hardware-methods:
Supported methods
-----------------
The module supports the following operations:
.. function:: .stop()
Stops the motor.
.. function:: .set_speed(speed)
Sets the speed of the motor. ``speed`` must be in the range **-63** to
**+63**. ``builtins.ValueError`` is raised if speed is outside that range.
.. _motor-hardware-examples:
Complete examples
-----------------
The following examples use the motors:
* :doc:`/examples/mightymover`
| {
"content_hash": "9d1a4fa39f4f2d432152f23fb349d372",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 21.205128205128204,
"alnum_prop": 0.6553808948004837,
"repo_name": "offmessage/blackpearl",
"id": "fbf929aaf38e50f42bc8740d44013b5c827f6d4c",
"size": "827",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/hardware/outputs/motor.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "35493"
}
],
"symlink_target": ""
} |
"use strict";
const _ = require("lodash");
const declarationValueIndex = require("../../utils/declarationValueIndex");
const isStandardSyntaxFunction = require("../../utils/isStandardSyntaxFunction");
const isStandardSyntaxValue = require("../../utils/isStandardSyntaxValue");
const keywordSets = require("../../reference/keywordSets");
const namedColorDataHex = require("../../reference/namedColorData");
const optionsMatches = require("../../utils/optionsMatches");
const propertySets = require("../../reference/propertySets");
const report = require("../../utils/report");
const ruleMessages = require("../../utils/ruleMessages");
const validateOptions = require("../../utils/validateOptions");
const valueParser = require("postcss-value-parser");
const generateColorFuncs = require("./generateColorFuncs");
const ruleName = "color-named";
const messages = ruleMessages(ruleName, {
expected: (named, original) => `Expected "${original}" to be "${named}"`,
rejected: named => `Unexpected named color "${named}"`
});
// Todo tested on case insensivity
const NODE_TYPES = ["word", "function"];
const rule = function(expectation, options) {
return (root, result) => {
const validOptions = validateOptions(
result,
ruleName,
{
actual: expectation,
possible: ["never", "always-where-possible"]
},
{
actual: options,
possible: {
ignoreProperties: [_.isString],
ignore: ["inside-function"]
},
optional: true
}
);
if (!validOptions) {
return;
}
const namedColors = Object.keys(namedColorDataHex);
const namedColorData = {};
namedColors.forEach(name => {
const hex = namedColorDataHex[name];
namedColorData[name] = {
hex,
func: generateColorFuncs(hex[0])
};
});
root.walkDecls(decl => {
if (propertySets.acceptCustomIdents.has(decl.prop)) {
return;
}
// Return early if the property is to be ignored
if (optionsMatches(options, "ignoreProperties", decl.prop)) {
return;
}
valueParser(decl.value).walk(node => {
const value = node.value,
type = node.type,
sourceIndex = node.sourceIndex;
if (
optionsMatches(options, "ignore", "inside-function") &&
type === "function"
) {
return false;
}
if (!isStandardSyntaxFunction(node)) {
return false;
}
if (!isStandardSyntaxValue(value)) {
return;
}
// Return early if neither a word nor a function
if (NODE_TYPES.indexOf(type) === -1) {
return;
}
// Check for named colors for "never" option
if (
expectation === "never" &&
type === "word" &&
namedColors.indexOf(value.toLowerCase()) !== -1
) {
complain(
messages.rejected(value),
decl,
declarationValueIndex(decl) + sourceIndex
);
return;
}
// Check "always-where-possible" option ...
if (expectation !== "always-where-possible") {
return;
}
// First by checking for alternative color function representations ...
if (
type === "function" &&
keywordSets.colorFunctionNames.has(value.toLowerCase())
) {
// Remove all spaces to match what's in `representations`
const normalizedFunctionString = valueParser
.stringify(node)
.replace(/\s+/g, "");
let namedColor;
for (let i = 0, l = namedColors.length; i < l; i++) {
namedColor = namedColors[i];
if (
namedColorData[namedColor].func.indexOf(
normalizedFunctionString.toLowerCase()
) !== -1
) {
complain(
messages.expected(namedColor, normalizedFunctionString),
decl,
declarationValueIndex(decl) + sourceIndex
);
return; // Exit as soon as a problem is found
}
}
return;
}
// Then by checking for alternative hex representations
let namedColor;
for (let i = 0, l = namedColors.length; i < l; i++) {
namedColor = namedColors[i];
if (
namedColorData[namedColor].hex.indexOf(value.toLowerCase()) !== -1
) {
complain(
messages.expected(namedColor, value),
decl,
declarationValueIndex(decl) + sourceIndex
);
return; // Exit as soon as a problem is found
}
}
});
});
function complain(message, node, index) {
report({
result,
ruleName,
message,
node,
index
});
}
};
};
rule.ruleName = ruleName;
rule.messages = messages;
module.exports = rule;
| {
"content_hash": "25104a5d3d7ad32f477a4f2fd7942226",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 81,
"avg_line_length": 28.78735632183908,
"alnum_prop": 0.5552006388500699,
"repo_name": "Epat9/YourHomeBudget",
"id": "583154ac6b3747163376457cc365770ef042f46d",
"size": "5009",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "node_modules/stylelint/lib/rules/color-named/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "85"
},
{
"name": "CSS",
"bytes": "8634"
},
{
"name": "HTML",
"bytes": "1888"
},
{
"name": "JavaScript",
"bytes": "73327"
},
{
"name": "Shell",
"bytes": "120"
}
],
"symlink_target": ""
} |
namespace Employees.App.Commands
{
using Employees.App.Commands.Abstractions;
using System;
public class ExitCommand : Command
{
public ExitCommand(string[] cmdArgs) : base(cmdArgs)
{
}
public override void Execute() => Environment.Exit(Environment.ExitCode);
}
}
| {
"content_hash": "7c9f084a8060a61c7794330d6165679f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 81,
"avg_line_length": 22.785714285714285,
"alnum_prop": 0.64576802507837,
"repo_name": "RAstardzhiev/SoftUni-C-Scharp",
"id": "aad4a47cf43b44c19fa1b7cf27d17d1f3be4a120",
"size": "321",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Databases Advanced - Entity Framework Core/Auto Mapping Objects/AutoMappingObjects/Employees.App/Commands/ExitCommand.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "715188"
}
],
"symlink_target": ""
} |
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-geo-pin',
templateUrl: 'geo-pin.component.html',
styleUrls: ['geo-pin.component.scss']
})
export class GeoPinComponent {
@Input('excluded') excluded = false;
}
| {
"content_hash": "79e26a21af854fe0e72ea4a3be03e22a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 49,
"avg_line_length": 23,
"alnum_prop": 0.6758893280632411,
"repo_name": "aitarget/aitarget-components",
"id": "578e093726f8bd75c34fdd13b9c47240206954fc",
"size": "253",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib/components/targeting/targeting-form/geo/geo-pin/geo-pin.component.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "38874"
},
{
"name": "HTML",
"bytes": "39663"
},
{
"name": "JavaScript",
"bytes": "6581"
},
{
"name": "TypeScript",
"bytes": "407434"
}
],
"symlink_target": ""
} |
var request = require('request');
var jwt = require('jsonwebtoken');
exports.discoverykeys = function (req, res) {
var url = 'https://login.microsoftonline.com/' + req.params.tenant +
'/discovery/v2.0/keys?p=' + req.query.p;
request(url, function (err, response, body) {
if (err) {
res.status(500).send(err.message);
} else {
res.json(body);
}
});
};
exports.verifytoken = function (req, res) {
var token = req.query.token;
var cert = req.query.n;
var alg = req.query.alg;
jwt.verify(token, cert, { algorithms: [alg] }, function (err, payload) {
if (!err) {
res.status(500).send(err.message);
} else {
console.log(payload);
res.json({ verified: true });
}
});
}; | {
"content_hash": "41594c86be2a9d633869b7501810e289",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 76,
"avg_line_length": 28.03448275862069,
"alnum_prop": 0.5448954489544895,
"repo_name": "SMK1085/ng2azureadb2c",
"id": "049329d73ca10bd66abacdd1c152c0ae1d417ef7",
"size": "813",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/routes/api.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "37"
},
{
"name": "HTML",
"bytes": "1867"
},
{
"name": "JavaScript",
"bytes": "10359"
},
{
"name": "TypeScript",
"bytes": "21351"
}
],
"symlink_target": ""
} |
"""Tests for API client and approvals-related API calls."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import threading
import time
from absl import app
from grr_response_core.lib.util import compatibility
from grr_response_server.gui import api_auth_manager
from grr_response_server.gui import api_call_router_with_approval_checks
from grr_response_server.gui import api_integration_test_lib
from grr.test_lib import hunt_test_lib
from grr.test_lib import test_lib
class ApiClientLibApprovalsTest(api_integration_test_lib.ApiIntegrationTest,
hunt_test_lib.StandardHuntTestMixin):
def setUp(self):
super(ApiClientLibApprovalsTest, self).setUp()
cls = api_call_router_with_approval_checks.ApiCallRouterWithApprovalChecks
cls.ClearCache()
config_overrider = test_lib.ConfigOverrider(
{"API.DefaultRouter": compatibility.GetName(cls)})
config_overrider.Start()
self.addCleanup(config_overrider.Stop)
# Force creation of new APIAuthorizationManager, so that configuration
# changes are picked up.
api_auth_manager.InitializeApiAuthManager()
def testCreateClientApproval(self):
client_id = self.SetupClient(0)
approval = self.api.Client(client_id).CreateApproval(
reason="blah", notified_users=[u"foo"])
self.assertEqual(approval.client_id, client_id)
self.assertEqual(approval.data.subject.client_id, client_id)
self.assertEqual(approval.data.reason, "blah")
self.assertFalse(approval.data.is_valid)
def testWaitUntilClientApprovalValid(self):
client_id = self.SetupClient(0)
approval = self.api.Client(client_id).CreateApproval(
reason="blah", notified_users=[u"foo"])
self.assertFalse(approval.data.is_valid)
def ProcessApproval():
time.sleep(1)
self.GrantClientApproval(
client_id,
requestor=self.token.username,
approval_id=approval.approval_id,
approver=u"foo")
thread = threading.Thread(name="ProcessApprover", target=ProcessApproval)
thread.start()
try:
result_approval = approval.WaitUntilValid()
self.assertTrue(result_approval.data.is_valid)
finally:
thread.join()
def testCreateHuntApproval(self):
h_id = self.StartHunt()
approval = self.api.Hunt(h_id).CreateApproval(
reason="blah", notified_users=[u"foo"])
self.assertEqual(approval.hunt_id, h_id)
self.assertEqual(approval.data.subject.hunt_id, h_id)
self.assertEqual(approval.data.reason, "blah")
self.assertFalse(approval.data.is_valid)
def testWaitUntilHuntApprovalValid(self):
h_id = self.StartHunt()
approval = self.api.Hunt(h_id).CreateApproval(
reason="blah", notified_users=[u"approver"])
self.assertFalse(approval.data.is_valid)
def ProcessApproval():
time.sleep(1)
self.GrantHuntApproval(
h_id,
requestor=self.token.username,
approval_id=approval.approval_id,
approver=u"approver")
ProcessApproval()
thread = threading.Thread(name="HuntApprover", target=ProcessApproval)
thread.start()
try:
result_approval = approval.WaitUntilValid()
self.assertTrue(result_approval.data.is_valid)
finally:
thread.join()
def main(argv):
test_lib.main(argv)
if __name__ == "__main__":
app.run(main)
| {
"content_hash": "d259b136359af786f7d35075ac7751a1",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 78,
"avg_line_length": 31.118181818181817,
"alnum_prop": 0.7028921998247152,
"repo_name": "demonchild2112/travis-test",
"id": "252fa9510b263c17699823876c82a25658adfcb7",
"size": "3445",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "grr/server/grr_response_server/gui/api_integration_tests/approvals_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "227"
},
{
"name": "Batchfile",
"bytes": "3446"
},
{
"name": "C",
"bytes": "11321"
},
{
"name": "C++",
"bytes": "54535"
},
{
"name": "CSS",
"bytes": "35549"
},
{
"name": "Dockerfile",
"bytes": "1819"
},
{
"name": "HCL",
"bytes": "7208"
},
{
"name": "HTML",
"bytes": "190212"
},
{
"name": "JavaScript",
"bytes": "11691"
},
{
"name": "Jupyter Notebook",
"bytes": "199190"
},
{
"name": "Makefile",
"bytes": "3139"
},
{
"name": "PowerShell",
"bytes": "1984"
},
{
"name": "Python",
"bytes": "7213255"
},
{
"name": "Roff",
"bytes": "444"
},
{
"name": "Shell",
"bytes": "48882"
},
{
"name": "Standard ML",
"bytes": "8172"
},
{
"name": "TSQL",
"bytes": "51"
}
],
"symlink_target": ""
} |
using System;
using Microsoft.Practices.ObjectBuilder;
using DataAccess;
using System.Web.UI.WebControls;
using EncryptionUtility;
namespace PollGenerator.Poll.Views
{
public partial class NaujaApklausa : Microsoft.Practices.CompositeWeb.Web.UI.Page, INaujaApklausaView
{
private NaujaApklausaPresenter _presenter;
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this._presenter.OnViewInitialized();
}
this._presenter.OnViewLoaded();
}
[CreateNew]
public NaujaApklausaPresenter Presenter
{
get
{
return this._presenter;
}
set
{
if (value == null)
throw new ArgumentNullException("value");
this._presenter = value;
this._presenter.View = this;
}
}
// TODO: Forward events to the presenter and show state to the user.
// For examples of this, see the View-Presenter (with Application Controller) QuickStart:
// ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.practices.wcsf.2007oct/wcsf/html/08da6294-8a4e-46b2-8bbe-ec94c06f1c30.html
protected void CreateButton_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
// adding Database manager
DbAccessManager manager = new DbAccessManager();
// getting content place holder
ContentPlaceHolder content = (ContentPlaceHolder) Master.FindControl("DefaultContent");
// get information form TextBox
string pollName = NameTextBox.Text;
string pollDesc = DescriptionTextBox.Text;
string pollCompleted = EndDescTextBox.Text;
string userName = User.Identity.Name;
// insert new Poll
manager.InsertPoll(pollName, pollDesc, pollCompleted, userName);
// get Poll ID
int pollId = manager.GetPollID(pollName, pollDesc, pollCompleted, userName);
Response.Redirect("~/Poll/ApklausosValdymas.aspx?ID=" + Server.UrlEncode(Encryption.Encrypt(pollId.ToString())));
this.ClearFields();
}
}
private void ClearFields()
{
NameTextBox.Text = "";
DescriptionTextBox.Text = "";
EndDescTextBox.Text = "";
}
protected void PollNameCustomValidation_ServerValidate(object source, ServerValidateEventArgs args)
{
DbAccessManager dbManager = new DbAccessManager();
// if Poll name for user exist
if(dbManager.IsPollName(args.Value, User.Identity.Name))
{
args.IsValid = false;
}
else // if not...
{
args.IsValid = true;
}
}
}
}
| {
"content_hash": "0d0d0d3dc123c328ee356a5a2a366fea",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 129,
"avg_line_length": 29.23076923076923,
"alnum_prop": 0.5569078947368421,
"repo_name": "SauliusSun/Poll-generator",
"id": "bb029b8193123b5d1e48d9af31042d9d3f5590e7",
"size": "3042",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PollGenerator/WebSites/PollGenerator/Poll/NaujaApklausa.aspx.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "61964"
},
{
"name": "C#",
"bytes": "178788"
},
{
"name": "CSS",
"bytes": "36250"
},
{
"name": "PHP",
"bytes": "15420"
},
{
"name": "XSLT",
"bytes": "21697"
}
],
"symlink_target": ""
} |
"""Generates training data for learning/updating MentorNet."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import itertools
import os
import pickle
import models
import numpy as np
import tensorflow as tf
flags = tf.app.flags
flags.DEFINE_string('outdir', '', 'Directory to the save training data.')
flags.DEFINE_string('vstar_fn', '', 'the vstar function to use.')
flags.DEFINE_string('vstar_gamma', '', 'the hyper_parameter for the vstar_fn')
flags.DEFINE_integer('sample_size', 100000,
'size to of the total generated data set.')
flags.DEFINE_string('input_csv_filename', '', 'input_csv_filename')
FLAGS = flags.FLAGS
tf.logging.set_verbosity(tf.logging.INFO)
def generate_pretrain_defined(vstar_fn, outdir, sample_size):
"""Generates a trainable dataset given a vstar_fn.
Args:
vstar_fn: the name of the variable star function to use.
outdir: directory to save the training data.
sample_size: size of the sample.
"""
batch_l = np.concatenate((np.arange(0, 10, 0.1), np.arange(10, 30, 1)))
batch_diff = np.arange(-5, 5, 0.1)
batch_y = np.array([0])
batch_e = np.arange(0, 100, 1)
data = []
for t in itertools.product(batch_l, batch_diff, batch_y, batch_e):
data.append(t)
data = np.array(data)
v = vstar_fn(data)
v = v.reshape([-1, 1])
data = np.hstack((data, v))
perm = np.arange(data.shape[0])
np.random.shuffle(perm)
data = data[perm[0:min(sample_size, len(perm))],]
tr_size = int(data.shape[0] * 0.8)
tr = data[0:tr_size]
ts = data[(tr_size + 1):data.shape[0]]
if not os.path.exists(outdir):
os.makedirs(outdir)
print('training_shape={} test_shape={}'.format(tr.shape, ts.shape))
with open(os.path.join(outdir, 'tr.p'), 'wb') as outfile:
pickle.dump(tr, outfile)
with open(os.path.join(outdir, 'ts.p'), 'wb') as outfile:
pickle.dump(ts, outfile)
def generate_data_driven(input_csv_filename,
outdir,
percentile_range='40,50,60,75,80,90'):
"""Generates a data-driven trainable dataset, given a CSV.
Refer to README.md for details on how to format the CSV.
Args:
input_csv_filename: the path of the CSV file. The csv file format
0: epoch_percentage
1: noisy label
2: clean label
3: loss
outdir: directory to save the training data.
percentile_range: the percentiles used to compute the moving average.
"""
raw = read_from_csv(input_csv_filename)
raw = np.array(raw.values())
dataset_name = os.path.splitext(os.path.basename(input_csv_filename))[0]
percentile_range = percentile_range.split(',')
percentile_range = [int(x) for x in percentile_range]
for percentile in percentile_range:
percentile = int(percentile)
p_perncentile = np.percentile(raw[:, 3], percentile)
v_star = np.float32(raw[:, 1] == raw[:, 2])
l = raw[:, 3]
diff = raw[:, 3] - p_perncentile
# label not used in the current version.
y = np.array([0] * len(v_star))
epoch_percentage = raw[:, 0]
data = np.vstack((l, diff, y, epoch_percentage, v_star))
data = np.transpose(data)
perm = np.arange(data.shape[0])
np.random.shuffle(perm)
data = data[perm,]
tr_size = int(data.shape[0] * 0.8)
tr = data[0:tr_size]
ts = data[(tr_size + 1):data.shape[0]]
cur_outdir = os.path.join(
outdir, '{}_percentile_{}'.format(dataset_name, percentile))
if not os.path.exists(cur_outdir):
os.makedirs(cur_outdir)
print('training_shape={} test_shape={}'.format(tr.shape, ts.shape))
print(cur_outdir)
with open(os.path.join(cur_outdir, 'tr.p'), 'wb') as outfile:
pickle.dump(tr, outfile)
with open(os.path.join(cur_outdir, 'ts.p'), 'wb') as outfile:
pickle.dump(ts, outfile)
def read_from_csv(input_csv_file):
"""Reads Data from an input CSV file.
Args:
input_csv_file: the path of the CSV file.
Returns:
a numpy array with different data at each index:
"""
data = {}
with open(input_csv_file, 'r') as csv_file_in:
reader = csv.reader(csv_file_in)
for row in reader:
for (_, cell) in enumerate(row):
rdata = cell.strip().split(' ')
rid = rdata[0]
rdata = [float(t) for t in rdata[1:]]
data[rid] = rdata
csv_file_in.close()
return data
def main(_):
if FLAGS.vstar_fn == 'data_driven':
generate_data_driven(FLAGS.input_csv_filename, FLAGS.outdir)
elif FLAGS.vstar_fn in dir(models):
generate_pretrain_defined(
getattr(models, FLAGS.vstar_fn), FLAGS.outdir, FLAGS.sample_size)
else:
tf.logging.error('%s is not defined in models.py', FLAGS.vstar_fn)
if __name__ == '__main__':
tf.app.run()
| {
"content_hash": "057dbf01187ad1d3b80f9bdccc39189b",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 78,
"avg_line_length": 28.72289156626506,
"alnum_prop": 0.6424077181208053,
"repo_name": "google/mentornet",
"id": "f4ccd15dfa60acae7876422e59a723e6b89bcea5",
"size": "5447",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "code/training_mentornet/data_generator.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "102112"
},
{
"name": "Shell",
"bytes": "51715"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "18d5ad078e7b1cc8a069938e678ed44b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "6dbb097d3ba7bdbff98b3c42311448b013e12782",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Apocynaceae/Orbea/Orbea umbracula/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import minimist from "minimist";
import {has} from "lodash";
import help from "./commands/help";
import version from "./commands/version";
import compile from "./commands/compile";
import run from "./commands/run";
import playground from "./commands/playground";
const commands = {
help, version,
compile, run, playground
};
// command aliases
commands.build = commands.compile;
commands.start = commands.exec = commands.run;
commands.open = function(argv) {
argv.open = true;
return commands.run.apply(this, arguments);
};
const argv = minimist(process.argv.slice(2), {
string: [ "output", "format", "moduleName", "moduleId" ],
boolean: [ "help", "version", "open", "watch" ],
alias: {
h: "help", H: "help",
v: "version", V: "version",
m: "sourceMap", "source-map": "sourceMap", "sourcemap": "sourceMap",
o: "output",
w: "watch",
f: "format",
n: "moduleName", "module-name": "moduleName",
"module-id": "moduleId"
}
});
let cmd;
if (argv.help) cmd = "help";
else if (argv.version) cmd = "version";
else if (argv._.length) {
let tcmd = argv._[0];
if (has(commands, tcmd)) {
cmd = tcmd;
argv._.shift();
} else {
cmd = "compile";
}
} else {
cmd = process.stdin.isTTY ? "help" : "compile";
}
commands[cmd](argv);
| {
"content_hash": "9933a16c2a3afdab26b0f0e574116b08",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 70,
"avg_line_length": 23.58490566037736,
"alnum_prop": 0.6448,
"repo_name": "BeneathTheInk/Temple",
"id": "e7e5b47225f47fa13f5b39494398fbf85802aec7",
"size": "1250",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/cli.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "108546"
}
],
"symlink_target": ""
} |
var pkg = require("./package.json"),
project = require("./project.json"),
webpack = require('webpack');
module.exports = {
entry: {
app: ['./Client/js/app.jsx'],
vendor: Object.keys(pkg.dependencies)
},
output: {
path: "./wwwroot/js",
filename: 'scripts.[name].js'
},
devtool: 'sourcemap',
plugins: [
new webpack.optimize.CommonsChunkPlugin("vendor", "scripts.vendor.js")
],
resolve: {
extensions: ['.js', '.jsx', '']
},
module: {
preLoaders: [
{
test: /.js.?$/,
exclude: /(node_modules|bower_components|wwwroot)/,
loader: 'eslint-loader'
}
],
loaders: [
{
test: /.js.?$/,
exclude: /(node_modules|bower_components|wwwroot)/,
loader: 'babel?cacheDirectory&optional=es7.objectRestSpread'
}
]
}
};
| {
"content_hash": "a20bbc9bca05b6ed9601f98ef4d027cf",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 78,
"avg_line_length": 26.2972972972973,
"alnum_prop": 0.47584789311408016,
"repo_name": "ugeolog/LearnWordsFast",
"id": "e1aaa1b4a42c38c6956bfe8485c4213600f020d5",
"size": "975",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/LearnWordsFast/webpack.config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "84"
},
{
"name": "C#",
"bytes": "120980"
},
{
"name": "CSS",
"bytes": "819"
},
{
"name": "JavaScript",
"bytes": "31551"
},
{
"name": "PowerShell",
"bytes": "3734"
}
],
"symlink_target": ""
} |
package vn.getgreen.network;
import org.json.JSONObject;
public interface ResponseListener {
public void onStart(GClient client);
public void onFinish(GClient client);
public void onFailure(GClient client, int statusCode, JSONObject message);
public void onSuccess(GClient client, JSONObject jsonObject);
}
| {
"content_hash": "4f4501ce4bde61e94569a7ffc87afaec",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 75,
"avg_line_length": 24.53846153846154,
"alnum_prop": 0.7931034482758621,
"repo_name": "Thanhktm/getgreen",
"id": "1e21abb5852f086aa5e76c097ee89cc6f883bf55",
"size": "319",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/vn/getgreen/network/ResponseListener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "364138"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>Quanto <i>Amborella</i> sono le piante? | gvdr</title>
<meta name="description" content="Darwin lo aveva definito un abominabile mistero: da dove arrivano le piante da fiore? A cosa assomiglia la loro mamma? Quanti sessi contava? Quanto è vecchia...">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-Frame-Options" content="sameorigin">
<!-- CSS -->
<link rel="stylesheet" href="/css/main.css">
<!--Favicon-->
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<!-- Canonical -->
<link rel="canonical" href="http://gvdr.github.io/blog/Amborella_debate">
<!-- RSS -->
<link rel="alternate" type="application/atom+xml" title="gvdr" href="http://gvdr.github.io/feed.xml" />
<!-- Font Awesome -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Google Fonts -->
<link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,700italic,400italic" rel="stylesheet" type="text/css">
<!-- Google Analytics -->
</head>
<body>
<header class="site-header">
<div class="branding">
<a href="/">
<img class="avatar" src="/img/avatar.png" alt=""/>
</a>
<h1 class="site-title">
<a href="/">gvdr</a>
</h1>
</div>
<nav class="site-nav">
<ul>
<li>
<a class="page-link" href="/about/">about</a>
</li>
<li>
<a class="page-link" href="/science/index.html">research</a>
</li>
<li>
<a class="page-link" href="/blog/index.html">thoughts</a>
</li>
<li>
<a class="page-link" href="/cv/index.html">cv</a>
</li>
<li>
<a class="page-link" href="/Talks/index.html">talks</a>
</li>
<!-- Social icons from Font Awesome, if enabled -->
<li>
<a href="http://gvdr.github.io/feed.xml" title="Follow RSS feed">
<i class="fa fa-fw fa-rss"></i>
</a>
</li>
<li>
<a href="mailto:gvd16@uclive.ac.nz" title="Email">
<i class="fa fa-fw fa-envelope"></i>
</a>
</li>
<li>
<a href="https://github.com/gvdr/" title="Follow on GitHub">
<i class="fa fa-fw fa-github"></i>
</a>
</li>
<li>
<a href="https://twitter.com/ipnosimmia" title="Follow on Twitter">
<i class="fa fa-fw fa-twitter"></i>
</a>
</li>
</ul>
</nav>
</header>
<div class="content">
<article >
<header style="background-image: url('/')">
<h1 class="title">Quanto <i>Amborella</i> sono le piante?</h1>
<p class="meta">
March 4, 2015
- gvdr
</p>
</header>
<section class="post-content">
<p>Darwin lo aveva definito un abominabile mistero: da dove arrivano le piante da fiore? A cosa assomiglia la loro <em>mamma</em>? Quanti sessi contava? Quanto è vecchia? Abominabile, credo, perché non son domande che si fanno ad una signora…</p>
<p>Per risolvere la questione è utile individuare la radice dell’albero evolutivo (la filogenia) delle Magnoliofite (o Angiosperme, per chi preferisce la nomenclatura di Lindl a quella di Cronquist, Takhttajan & Max Zimmermann).</p>
<p><img src="/images/Amborella.jpg" style="float: right" width="50%" title="Amborella trichopodia - by Wertheim Conservatory, Florida International University, Miami, Florida, USA." /></p>
<p>Alla fine dello scorso millenio, una serie di analisi basate su un pugno di geni (Parkinson, Adams e Palmer 1999; Qiu et al. 1999; Soltis, Soltis e Chase 1999) assegna ad <em>Amborella trichopoda</em> l’eredita’ di un ramo evolutivo isolato da tutte le altre Angiosperme. <em>Amborella</em> è dunque una specie basale: “the most recent common ancestor” (l’antenato comune piu’ recente) di <em>Amborella</em> e una qualsiasi altra pianta da fiore sarebbe la mamma di tutte le Angiosperme. Poco dopo altri studi (Barkman et al. 2000; Graham and Olmstead 2000) mostrano che per individuare quella radice con precisione occorre tener conto che alcuni loci genetici sono evoluti molto più rapidamente di altri. La matematica diventa complessa, i modelli alternativi si moltiplicano.</p>
<p>Protagonisti del dibattito, da più di dieci anni, sono Vadim Goremykin [2] da una parte e Douglas e Pamela Soltis [3] dall’altra. I “tedeschi” (Goremykin e compagni) e gli “yankee” (Soltis & Soltis e compagni) se le danno di santa ragione. Complice, mi raccontano voci di corridoio, l’inglese imperfetto di Goremykin. Il titolo orignale “<em>Amborella</em> Is Not a Basal Angiosperm” sarebbe stato meglio reso con “<em>Amborella</em> Is Not the Basal Angiosperm”. Infatti, nelle analisi del gruppo di ricerca tedesco, un’altra manciata di piante contendono ad Amborella il primato.</p>
<p>L’avvento della genomica non risolve la diatriba. Nel mentre la genetica delle piante è entrata nella “big science”. Attorno ad <em>Amborella</em> si costituisce un consorzio ben finanziato e ben piazzato. Goremykin si trasferisce in Italia, alla Fondazione Edmund Mach di San Michele all’Adige, e non demorde. Nel 2013 pubblica in Systematic Biology una rigorosa analisi filogenetica [4] che piazza una clade formata da <em>Trithuria</em>, una Nifeacee, e Amborella da una parte e tutte le piante fiorite dall’altra. Il consorzio di Soltis - Soltis et al. risponde [5] e la discussione non si placa [6], complice la povera storia famigliare di Amborella che conta pochissimi parenti ancora in vita.</p>
<p>Forse è presto per stabilire chi ha ragione e chi ha torto. La discussione si è comunque rivelata fruttuosa, e ha permesso di affrontare alcuni spinosi nodi metodologici. Io faccio il tifo per le Ninfee, piante acquatiche, con grandi fiori colorati. Altro che la modesta Amborella.</p>
<p>[1] Endress, Peter K. “<a href="http://www.jstor.org/stable/10.1086/321919">The flowers in extant basal angiosperms and inferences on ancestral flowers.</a>” International Journal of Plant Sciences 162, no. 5 (2001): 1111-1140.</p>
<p>[2] Goremykin, Vadim V., Karen I. Hirsch-Ernst, Stefan Wölfl, and Frank H. Hellwig. “<a href="http://mbe.oxfordjournals.org/content/20/9/1499.abstract">Analysis of the Amborella trichopoda chloroplast genome sequence suggests that Amborella is not a basal angiosperm.</a>” Molecular biology and evolution 20, no. 9 (2003): 1499-1505.</p>
<p>[3] Soltis, Douglas E., and Pamela S. Soltis. “<a href="http://www.amjbot.org/content/91/6/997.abstract">Amborella not a “basal angiosperm”? Not so fast.</a>” American Journal of Botany 91, no. 6 (2004): 997-1001.</p>
<p>[4] Goremykin, Vadim V., Svetlana V. Nikiforova, Patrick J. Biggs, Bojian Zhong, Peter Delange, William Martin, Stefan Woetzel, Robin A. Atherton, Patricia A. Mclenachan, and Peter J. Lockhart. “<a href="http://sysbio.oxfordjournals.org/content/62/1/50">The evolutionary root of flowering plants.</a>” Systematic biology 62, no. 1 (2013): 50-61.</p>
<p>[5] Drew, Bryan T., Brad R. Ruhfel, Stephen A. Smith, Michael J. Moore, Barbara G. Briggs, Matthew A. Gitzendanner, Pamela S. Soltis, and Douglas E. Soltis. “<a href="http://sysbio.oxfordjournals.org/content/63/3/368">Another look at the root of the angiosperms reveals a familiar tale.</a>” Systematic biology (2014): syt108.</p>
<p>[6] Xi, Zhenxiang, Liang Liu, Joshua S. Rest, and Charles C. Davis. “<a href="http://sysbio.oxfordjournals.org/content/63/6/919.abstract">Coalescent versus concatenation methods and the placement of Amborella as sister to water lilies.</a>” Systematic biology 63, no. 6 (2014): 919-932.</p>
<p>Wickett, Norman J., Siavash Mirarab, Nam Nguyen, Tandy Warnow, Eric Carpenter, Naim Matasci, Saravanaraj Ayyampalayam et al. “<a href="http://www.pnas.org/content/111/45/E4859.full">Phylotranscriptomic analysis of the origin and early diversification of land plants.</a>” Proceedings of the National Academy of Sciences 111, no. 45 (2014): E4859-E4868.</p>
</section>
</article>
<!-- Disqus -->
<div class="comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'gvdr';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
<footer class="site-footer">
<p class="text">This goofy website has been created using <a href="http://jekyllrb.com">Jekyll</a> with <a href="https://rohanchandra.github.io/project/type/">Type Theme</a> on a Linux machine.
</p>
</footer>
</body>
</html>
| {
"content_hash": "f959b44360932e74eb4b0b8a58cd9f60",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 784,
"avg_line_length": 38.294372294372295,
"alnum_prop": 0.6934207551435677,
"repo_name": "gvdr/gvdr.github.io",
"id": "d70af138cf7488cddb8766d7916bb0bcbcbb3f94",
"size": "8937",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_site/blog/Amborella_debate/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9238"
},
{
"name": "HTML",
"bytes": "3590348"
},
{
"name": "Makefile",
"bytes": "1342"
},
{
"name": "R",
"bytes": "27127"
},
{
"name": "Ruby",
"bytes": "4222"
},
{
"name": "TeX",
"bytes": "66039"
}
],
"symlink_target": ""
} |
package com.github.namioka.ddd_concept.examples.javaee7.application.service.impl;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.github.namioka.ddd_concept.examples.javaee7.application.NamingRule;
import com.github.namioka.ddd_concept.examples.javaee7.application.RootPackage;
import com.github.namioka.ddd_concept.examples.javaee7.domain.model.test.Test;
import com.github.namioka.ddd_concept.examples.javaee7.domain.model.test.TestDetail;
import java.io.IOException;
import javax.inject.Inject;
import javax.validation.ConstraintViolationException;
import lombok.extern.slf4j.Slf4j;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;
@Slf4j
@RunWith(Arquillian.class)
public class TestApplicationServiceImplTest {
@ClassRule
public static final RuleChain RULE_CHAIN = RuleChain.outerRule(new NamingRule());
private static ObjectMapper objectMapper;
@Inject
private TestApplicationServiceImpl testApplicationServiceImpl;
@Deployment
public static JavaArchive createDeployment() {
JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
.addPackages(true, RootPackage.class.getPackage())
.addAsResource("META-INF/beans.xml", "META-INF/beans.xml");
if (log.isDebugEnabled()) {
log.debug(jar.toString(true));
}
return jar;
}
@BeforeClass
public static void beforeClass() {
objectMapper = new ObjectMapper();
objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
objectMapper.setVisibilityChecker(objectMapper.getSerializationConfig().getDefaultVisibilityChecker()
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
.withIsGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE));
}
@org.junit.Test
public void UnitOfWork_StateUnderTest_ExpectedBehavior1() { // TODO should change method name
//
Test test1 = new Test();
test1.addTestDetail(new TestDetail("A"));
test1.addTestDetail(new TestDetail("B"));
test1.addTestDetail(new TestDetail("C"));
//
log.info("{}({}) -> \n{}", "Before create", test1, writeValueAsString(test1));
test1 = testApplicationServiceImpl.create(test1);
log.info("{}({}) -> \n{}", "After create", test1, writeValueAsString(test1));
testApplicationServiceImpl.read(test1.getId());
//
test1.getTestDetails().remove(0);
test1.getTestDetails().stream().forEach(t -> {
t.setValue(t.getValue() + "-2");
});
test1.addTestDetail(new TestDetail("D"));
//
log.info("{}({}) -> \n{}", "Before update", test1, writeValueAsString(test1));
testApplicationServiceImpl.update(test1);
log.info("{}({}) -> \n{}", "After update", test1, writeValueAsString(test1));
testApplicationServiceImpl.read(test1.getId());
//
Test test2 = readValue(writeValueAsString(test1), Test.class);
test2.getTestDetails().remove(0);
test2.getTestDetails().stream().forEach(t -> {
t.setValue(t.getValue() + "-3");
});
test2.addTestDetail(new TestDetail("E"));
log.info("{}({}) -> \n{}", "Before update", test2, writeValueAsString(test2));
testApplicationServiceImpl.update(test2);
log.info("{}({}) -> \n{}", "After update", test2, writeValueAsString(test2));
testApplicationServiceImpl.read(test2.getId());
}
@org.junit.Test(expected = ConstraintViolationException.class)
public void UnitOfWork_StateUnderTest_ExpectedBehavior2() { // TODO should change method name
testApplicationServiceImpl.create(null);
}
private String writeValueAsString(final Object value) {
try {
return objectMapper.writeValueAsString(value);
} catch (JsonProcessingException cause) {
throw new RuntimeException(cause);
}
}
private <T> T readValue(final String content, final Class<T> valueType) {
try {
return objectMapper.readValue(content, valueType);
} catch (IOException cause) {
throw new RuntimeException(cause);
}
}
}
| {
"content_hash": "8f297810b70b9aa6a48a6f4b75ba2867",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 109,
"avg_line_length": 42.530973451327434,
"alnum_prop": 0.6918435289221806,
"repo_name": "namioka/ddd-concept",
"id": "29343cf9ac75bd6a7ad19f34629c89ca76aeb42a",
"size": "4806",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/examples-javaee7/examples-javaee7-application/src/test/java/com/github/namioka/ddd_concept/examples/javaee7/application/service/impl/TestApplicationServiceImplTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "49946"
},
{
"name": "Shell",
"bytes": "2255"
}
],
"symlink_target": ""
} |
package com.intellij.psi.impl.source.tree;
import com.intellij.lang.ASTNode;
import com.intellij.lang.java.JShellLanguage;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.PsiJShellHolderMethodImpl;
import com.intellij.psi.impl.source.PsiJShellImportHolderImpl;
import com.intellij.psi.impl.source.PsiJShellRootClassImpl;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.IFileElementType;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author Eugene Zhuravlev
* Date: 21-Jun-17
*/
public interface JShellElementType {
IFileElementType FILE = new IFileElementType("JSHELL_FILE", JShellLanguage.INSTANCE);
IElementType ROOT_CLASS = new IJShellElementType("JSHELL_ROOT_CLASS") {
private final AtomicInteger ourClassCounter = new AtomicInteger();
@Override
public PsiElement createPsi(ASTNode node) {
return new PsiJShellRootClassImpl(node, ourClassCounter.getAndIncrement());
}
};
IElementType STATEMENTS_HOLDER = new IJShellElementType("JSHELL_STATEMENTS_HOLDER") {
private final AtomicInteger ourMethodCounter = new AtomicInteger();
@Override
public PsiElement createPsi(ASTNode node) {
return new PsiJShellHolderMethodImpl(node, ourMethodCounter.getAndIncrement());
}
};
IElementType IMPORT_HOLDER = new IJShellElementType("JSHELL_IMPORT_HOLDER") {
@Override
public PsiElement createPsi(ASTNode node) {
return new PsiJShellImportHolderImpl(node);
}
};
}
| {
"content_hash": "9ad7bd9b47c84497246eceb5c66f59fd",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 87,
"avg_line_length": 34,
"alnum_prop": 0.7727272727272727,
"repo_name": "da1z/intellij-community",
"id": "12a9cce1f20855eb66b604bdcda73bd582573cc5",
"size": "2096",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "java/java-psi-impl/src/com/intellij/psi/impl/source/tree/JShellElementType.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "20665"
},
{
"name": "AspectJ",
"bytes": "182"
},
{
"name": "Batchfile",
"bytes": "61131"
},
{
"name": "C",
"bytes": "213044"
},
{
"name": "C#",
"bytes": "1264"
},
{
"name": "C++",
"bytes": "181560"
},
{
"name": "CMake",
"bytes": "1675"
},
{
"name": "CSS",
"bytes": "172743"
},
{
"name": "CoffeeScript",
"bytes": "1759"
},
{
"name": "DTrace",
"bytes": "578"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "Groovy",
"bytes": "3356487"
},
{
"name": "HLSL",
"bytes": "57"
},
{
"name": "HTML",
"bytes": "1903378"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "168760745"
},
{
"name": "JavaScript",
"bytes": "148969"
},
{
"name": "Jupyter Notebook",
"bytes": "93222"
},
{
"name": "Kotlin",
"bytes": "5493011"
},
{
"name": "Lex",
"bytes": "148791"
},
{
"name": "Makefile",
"bytes": "2352"
},
{
"name": "NSIS",
"bytes": "51699"
},
{
"name": "Objective-C",
"bytes": "27309"
},
{
"name": "PHP",
"bytes": "2425"
},
{
"name": "Perl",
"bytes": "962"
},
{
"name": "Python",
"bytes": "25962640"
},
{
"name": "Roff",
"bytes": "37534"
},
{
"name": "Ruby",
"bytes": "1217"
},
{
"name": "Shell",
"bytes": "64132"
},
{
"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": ""
} |
package com.facebook.widget;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.*;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.facebook.*;
import com.facebook.android.*;
import com.facebook.internal.Logger;
import com.facebook.internal.ServerProtocol;
import com.facebook.internal.Utility;
import com.facebook.internal.Validate;
/**
* This class provides a mechanism for displaying Facebook Web dialogs inside a Dialog. Helper
* methods are provided to construct commonly-used dialogs, or a caller can specify arbitrary
* parameters to call other dialogs.
*/
public class WebDialog extends Dialog {
private static final String LOG_TAG = Logger.LOG_TAG_BASE + "WebDialog";
private static final String DISPLAY_TOUCH = "touch";
private static final String USER_AGENT = "user_agent";
static final String REDIRECT_URI = "fbconnect://success";
static final String CANCEL_URI = "fbconnect://cancel";
static final boolean DISABLE_SSL_CHECK_FOR_TESTING = false;
// width below which there are no extra margins
private static final int NO_PADDING_SCREEN_WIDTH = 480;
// width beyond which we're always using the MIN_SCALE_FACTOR
private static final int MAX_PADDING_SCREEN_WIDTH = 800;
// height below which there are no extra margins
private static final int NO_PADDING_SCREEN_HEIGHT = 800;
// height beyond which we're always using the MIN_SCALE_FACTOR
private static final int MAX_PADDING_SCREEN_HEIGHT = 1280;
// the minimum scaling factor for the web dialog (50% of screen size)
private static final double MIN_SCALE_FACTOR = 0.5;
// translucent border around the webview
private static final int BACKGROUND_GRAY = 0xCC000000;
public static final int DEFAULT_THEME = android.R.style.Theme_Translucent_NoTitleBar;
private String url;
private OnCompleteListener onCompleteListener;
private WebView webView;
private ProgressDialog spinner;
private ImageView crossImageView;
private FrameLayout contentFrameLayout;
private boolean listenerCalled = false;
private boolean isDetached = false;
/**
* Interface that implements a listener to be called when the user's interaction with the
* dialog completes, whether because the dialog finished successfully, or it was cancelled,
* or an error was encountered.
*/
public interface OnCompleteListener {
/**
* Called when the dialog completes.
*
* @param values on success, contains the values returned by the dialog
* @param error on an error, contains an exception describing the error
*/
void onComplete(Bundle values, FacebookException error);
}
/**
* Constructor which can be used to display a dialog with an already-constructed URL.
*
* @param context the context to use to display the dialog
* @param url the URL of the Web Dialog to display; no validation is done on this URL, but it should
* be a valid URL pointing to a Facebook Web Dialog
*/
public WebDialog(Context context, String url) {
this(context, url, DEFAULT_THEME);
}
/**
* Constructor which can be used to display a dialog with an already-constructed URL and a custom theme.
*
* @param context the context to use to display the dialog
* @param url the URL of the Web Dialog to display; no validation is done on this URL, but it should
* be a valid URL pointing to a Facebook Web Dialog
* @param theme identifier of a theme to pass to the Dialog class
*/
public WebDialog(Context context, String url, int theme) {
super(context, theme);
this.url = url;
}
/**
* Constructor which will construct the URL of the Web dialog based on the specified parameters.
*
* @param context the context to use to display the dialog
* @param action the portion of the dialog URL following "dialog/"
* @param parameters parameters which will be included as part of the URL
* @param theme identifier of a theme to pass to the Dialog class
* @param listener the listener to notify, or null if no notification is desired
*/
public WebDialog(Context context, String action, Bundle parameters, int theme, OnCompleteListener listener) {
super(context, theme);
if (parameters == null) {
parameters = new Bundle();
}
// our webview client only handles the redirect uri we specify, so just hard code it here
parameters.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, REDIRECT_URI);
parameters.putString(ServerProtocol.DIALOG_PARAM_DISPLAY, DISPLAY_TOUCH);
parameters.putString(ServerProtocol.DIALOG_PARAM_TYPE, USER_AGENT);
Uri uri = Utility.buildUri(ServerProtocol.getDialogAuthority(), ServerProtocol.DIALOG_PATH + action,
parameters);
this.url = uri.toString();
onCompleteListener = listener;
}
/**
* Sets the listener which will be notified when the dialog finishes.
*
* @param listener the listener to notify, or null if no notification is desired
*/
public void setOnCompleteListener(OnCompleteListener listener) {
onCompleteListener = listener;
}
/**
* Gets the listener which will be notified when the dialog finishes.
*
* @return the listener, or null if none has been specified
*/
public OnCompleteListener getOnCompleteListener() {
return onCompleteListener;
}
@Override
public void dismiss() {
if (webView != null) {
webView.stopLoading();
}
if (!isDetached) {
if (spinner.isShowing()) {
spinner.dismiss();
}
super.dismiss();
}
}
@Override
public void onDetachedFromWindow() {
isDetached = true;
super.onDetachedFromWindow();
}
@Override
public void onAttachedToWindow() {
isDetached = false;
super.onAttachedToWindow();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
sendCancelToListener();
}
});
spinner = new ProgressDialog(getContext());
spinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
spinner.setMessage(getContext().getString(R.string.com_facebook_loading));
spinner.setOnCancelListener(new OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
sendCancelToListener();
WebDialog.this.dismiss();
}
});
requestWindowFeature(Window.FEATURE_NO_TITLE);
contentFrameLayout = new FrameLayout(getContext());
// First calculate how big the frame layout should be
calculateSize();
getWindow().setGravity(Gravity.CENTER);
// resize the dialog if the soft keyboard comes up
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
/* Create the 'x' image, but don't add to the contentFrameLayout layout yet
* at this point, we only need to know its drawable width and height
* to place the webview
*/
createCrossImage();
/* Now we know 'x' drawable width and height,
* layout the webview and add it the contentFrameLayout layout
*/
int crossWidth = crossImageView.getDrawable().getIntrinsicWidth();
setUpWebView(crossWidth / 2 + 1);
/* Finally add the 'x' image to the contentFrameLayout layout and
* add contentFrameLayout to the Dialog view
*/
contentFrameLayout.addView(crossImageView, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
setContentView(contentFrameLayout);
}
private void calculateSize() {
WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
// always use the portrait dimensions to do the scaling calculations so we always get a portrait shaped
// web dialog
int width = metrics.widthPixels < metrics.heightPixels ? metrics.widthPixels : metrics.heightPixels;
int height = metrics.widthPixels < metrics.heightPixels ? metrics.heightPixels : metrics.widthPixels;
int dialogWidth = Math.min(
getScaledSize(width, metrics.density, NO_PADDING_SCREEN_WIDTH, MAX_PADDING_SCREEN_WIDTH),
metrics.widthPixels);
int dialogHeight = Math.min(
getScaledSize(height, metrics.density, NO_PADDING_SCREEN_HEIGHT, MAX_PADDING_SCREEN_HEIGHT),
metrics.heightPixels);
getWindow().setLayout(dialogWidth, dialogHeight);
}
/**
* Returns a scaled size (either width or height) based on the parameters passed.
* @param screenSize a pixel dimension of the screen (either width or height)
* @param density density of the screen
* @param noPaddingSize the size at which there's no padding for the dialog
* @param maxPaddingSize the size at which to apply maximum padding for the dialog
* @return a scaled size.
*/
private int getScaledSize(int screenSize, float density, int noPaddingSize, int maxPaddingSize) {
int scaledSize = (int) ((float) screenSize / density);
double scaleFactor;
if (scaledSize <= noPaddingSize) {
scaleFactor = 1.0;
} else if (scaledSize >= maxPaddingSize) {
scaleFactor = MIN_SCALE_FACTOR;
} else {
// between the noPadding and maxPadding widths, we take a linear reduction to go from 100%
// of screen size down to MIN_SCALE_FACTOR
scaleFactor = MIN_SCALE_FACTOR +
((double) (maxPaddingSize - scaledSize))
/ ((double) (maxPaddingSize - noPaddingSize))
* (1.0 - MIN_SCALE_FACTOR);
}
return (int) (screenSize * scaleFactor);
}
private void sendSuccessToListener(Bundle values) {
if (onCompleteListener != null && !listenerCalled) {
listenerCalled = true;
onCompleteListener.onComplete(values, null);
}
}
private void sendErrorToListener(Throwable error) {
if (onCompleteListener != null && !listenerCalled) {
listenerCalled = true;
FacebookException facebookException = null;
if (error instanceof FacebookException) {
facebookException = (FacebookException) error;
} else {
facebookException = new FacebookException(error);
}
onCompleteListener.onComplete(null, facebookException);
}
}
private void sendCancelToListener() {
sendErrorToListener(new FacebookOperationCanceledException());
}
private void createCrossImage() {
crossImageView = new ImageView(getContext());
// Dismiss the dialog when user click on the 'x'
crossImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendCancelToListener();
WebDialog.this.dismiss();
}
});
Drawable crossDrawable = getContext().getResources().getDrawable(R.drawable.com_facebook_close);
crossImageView.setImageDrawable(crossDrawable);
/* 'x' should not be visible while webview is loading
* make it visible only after webview has fully loaded
*/
crossImageView.setVisibility(View.INVISIBLE);
}
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
LinearLayout webViewContainer = new LinearLayout(getContext());
webView = new WebView(getContext());
webView.setVerticalScrollBarEnabled(false);
webView.setHorizontalScrollBarEnabled(false);
webView.setWebViewClient(new DialogWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
webView.setVisibility(View.INVISIBLE);
webView.getSettings().setSavePassword(false);
webViewContainer.setPadding(margin, margin, margin, margin);
webViewContainer.addView(webView);
webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
contentFrameLayout.addView(webViewContainer);
}
private class DialogWebViewClient extends WebViewClient {
@Override
@SuppressWarnings("deprecation")
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Utility.logd(LOG_TAG, "Redirect URL: " + url);
if (url.startsWith(WebDialog.REDIRECT_URI)) {
Bundle values = Util.parseUrl(url);
String error = values.getString("error");
if (error == null) {
error = values.getString("error_type");
}
String errorMessage = values.getString("error_msg");
if (errorMessage == null) {
errorMessage = values.getString("error_description");
}
String errorCodeString = values.getString("error_code");
int errorCode = FacebookRequestError.INVALID_ERROR_CODE;
if (!Utility.isNullOrEmpty(errorCodeString)) {
try {
errorCode = Integer.parseInt(errorCodeString);
} catch (NumberFormatException ex) {
errorCode = FacebookRequestError.INVALID_ERROR_CODE;
}
}
if (Utility.isNullOrEmpty(error) && Utility
.isNullOrEmpty(errorMessage) && errorCode == FacebookRequestError.INVALID_ERROR_CODE) {
sendSuccessToListener(values);
} else if (error != null && (error.equals("access_denied") ||
error.equals("OAuthAccessDeniedException"))) {
sendCancelToListener();
} else {
FacebookRequestError requestError = new FacebookRequestError(errorCode, error, errorMessage);
sendErrorToListener(new FacebookServiceException(requestError, errorMessage));
}
WebDialog.this.dismiss();
return true;
} else if (url.startsWith(WebDialog.CANCEL_URI)) {
sendCancelToListener();
WebDialog.this.dismiss();
return true;
} else if (url.contains(DISPLAY_TOUCH)) {
return false;
}
// launch non-dialog URLs in a full browser
getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
sendErrorToListener(new FacebookDialogException(description, errorCode, failingUrl));
WebDialog.this.dismiss();
}
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
if (DISABLE_SSL_CHECK_FOR_TESTING) {
handler.proceed();
} else {
super.onReceivedSslError(view, handler, error);
sendErrorToListener(new FacebookDialogException(null, ERROR_FAILED_SSL_HANDSHAKE, null));
handler.cancel();
WebDialog.this.dismiss();
}
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
Utility.logd(LOG_TAG, "Webview loading URL: " + url);
super.onPageStarted(view, url, favicon);
if (!isDetached) {
spinner.show();
}
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
if (!isDetached) {
spinner.dismiss();
}
/*
* Once web view is fully loaded, set the contentFrameLayout background to be transparent
* and make visible the 'x' image.
*/
contentFrameLayout.setBackgroundColor(Color.TRANSPARENT);
webView.setVisibility(View.VISIBLE);
crossImageView.setVisibility(View.VISIBLE);
}
}
private static class BuilderBase<CONCRETE extends BuilderBase<?>> {
private Context context;
private Session session;
private String applicationId;
private String action;
private int theme = DEFAULT_THEME;
private OnCompleteListener listener;
private Bundle parameters;
protected BuilderBase(Context context, String action) {
Session activeSession = Session.getActiveSession();
if (activeSession != null && activeSession.isOpened()) {
this.session = activeSession;
} else {
String applicationId = Utility.getMetadataApplicationId(context);
if (applicationId != null) {
this.applicationId = applicationId;
} else {
throw new FacebookException("Attempted to create a builder without an open" +
" Active Session or a valid default Application ID.");
}
}
finishInit(context, action, null);
}
protected BuilderBase(Context context, Session session, String action, Bundle parameters) {
Validate.notNull(session, "session");
if (!session.isOpened()) {
throw new FacebookException("Attempted to use a Session that was not open.");
}
this.session = session;
finishInit(context, action, parameters);
}
protected BuilderBase(Context context, String applicationId, String action, Bundle parameters) {
if (applicationId == null) {
applicationId = Utility.getMetadataApplicationId(context);
}
Validate.notNullOrEmpty(applicationId, "applicationId");
this.applicationId = applicationId;
finishInit(context, action, parameters);
}
/**
* Sets a theme identifier which will be passed to the underlying Dialog.
*
* @param theme a theme identifier which will be passed to the Dialog class
* @return the builder
*/
public CONCRETE setTheme(int theme) {
this.theme = theme;
@SuppressWarnings("unchecked")
CONCRETE result = (CONCRETE) this;
return result;
}
/**
* Sets the listener which will be notified when the dialog finishes.
*
* @param listener the listener to notify, or null if no notification is desired
* @return the builder
*/
public CONCRETE setOnCompleteListener(OnCompleteListener listener) {
this.listener = listener;
@SuppressWarnings("unchecked")
CONCRETE result = (CONCRETE) this;
return result;
}
/**
* Constructs a WebDialog using the parameters provided. The dialog is not shown,
* but is ready to be shown by calling Dialog.show().
*
* @return the WebDialog
*/
public WebDialog build() {
if (session != null && session.isOpened()) {
parameters.putString(ServerProtocol.DIALOG_PARAM_APP_ID, session.getApplicationId());
parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, session.getAccessToken());
} else {
parameters.putString(ServerProtocol.DIALOG_PARAM_APP_ID, applicationId);
}
return new WebDialog(context, action, parameters, theme, listener);
}
protected String getApplicationId() {
return applicationId;
}
protected Context getContext() {
return context;
}
protected int getTheme() {
return theme;
}
protected Bundle getParameters() {
return parameters;
}
protected WebDialog.OnCompleteListener getListener() {
return listener;
}
private void finishInit(Context context, String action, Bundle parameters) {
this.context = context;
this.action = action;
if (parameters != null) {
this.parameters = parameters;
} else {
this.parameters = new Bundle();
}
}
}
/**
* Provides a builder that allows construction of an arbitary Facebook web dialog.
*/
public static class Builder extends BuilderBase<Builder> {
/**
* Constructor that builds a dialog using either the active session, or the application
* id specified in the application/meta-data.
*
* @param context the Context within which the dialog will be shown.
* @param action the portion of the dialog URL following www.facebook.com/dialog/.
* See https://developers.facebook.com/docs/reference/dialogs/ for details.
*/
public Builder(Context context, String action) {
super(context, action);
}
/**
* Constructor that builds a dialog for an authenticated user.
*
* @param context the Context within which the dialog will be shown.
* @param session the Session representing an authenticating user to use for
* showing the dialog; must not be null, and must be opened.
* @param action the portion of the dialog URL following www.facebook.com/dialog/.
* See https://developers.facebook.com/docs/reference/dialogs/ for details.
* @param parameters a Bundle containing parameters to pass as part of the URL.
*/
public Builder(Context context, Session session, String action, Bundle parameters) {
super(context, session, action, parameters);
}
/**
* Constructor that builds a dialog without an authenticated user.
*
* @param context the Context within which the dialog will be shown.
* @param applicationId the application ID to be included in the dialog URL.
* @param action the portion of the dialog URL following www.facebook.com/dialog/.
* See https://developers.facebook.com/docs/reference/dialogs/ for details.
* @param parameters a Bundle containing parameters to pass as part of the URL.
*/
public Builder(Context context, String applicationId, String action, Bundle parameters) {
super(context, applicationId, action, parameters);
}
}
/**
* Provides a builder that allows construction of the parameters for showing
* the <a href="https://developers.facebook.com/docs/reference/dialogs/feed">Feed Dialog</a>.
*/
public static class FeedDialogBuilder extends BuilderBase<FeedDialogBuilder> {
private static final String FEED_DIALOG = "feed";
private static final String FROM_PARAM = "from";
private static final String TO_PARAM = "to";
private static final String LINK_PARAM = "link";
private static final String PICTURE_PARAM = "picture";
private static final String SOURCE_PARAM = "source";
private static final String NAME_PARAM = "name";
private static final String CAPTION_PARAM = "caption";
private static final String DESCRIPTION_PARAM = "description";
/**
* Constructor that builds a Feed Dialog using either the active session, or the application
* ID specified in the application/meta-data.
*
* @param context the Context within which the dialog will be shown.
*/
public FeedDialogBuilder(Context context) {
super(context, FEED_DIALOG);
}
/**
* Constructor that builds a Feed Dialog using the provided session.
*
* @param context the Context within which the dialog will be shown.
* @param session the Session representing an authenticating user to use for
* showing the dialog; must not be null, and must be opened.
*/
public FeedDialogBuilder(Context context, Session session) {
super(context, session, FEED_DIALOG, null);
}
/**
* Constructor that builds a Feed Dialog using the provided session and parameters.
*
* @param context the Context within which the dialog will be shown.
* @param session the Session representing an authenticating user to use for
* showing the dialog; must not be null, and must be opened.
* @param parameters a Bundle containing parameters to pass as part of the
* dialog URL. No validation is done on these parameters; it is
* the caller's responsibility to ensure they are valid. For more information,
* see <a href="https://developers.facebook.com/docs/reference/dialogs/feed/">
* https://developers.facebook.com/docs/reference/dialogs/feed/</a>.
*/
public FeedDialogBuilder(Context context, Session session, Bundle parameters) {
super(context, session, FEED_DIALOG, parameters);
}
/**
* Constructor that builds a Feed Dialog using the provided application ID and parameters.
*
* @param context the Context within which the dialog will be shown.
* @param applicationId the application ID to use. If null, the application ID specified in the
* application/meta-data will be used instead.
* @param parameters a Bundle containing parameters to pass as part of the
* dialog URL. No validation is done on these parameters; it is
* the caller's responsibility to ensure they are valid. For more information,
* see <a href="https://developers.facebook.com/docs/reference/dialogs/feed/">
* https://developers.facebook.com/docs/reference/dialogs/feed/</a>.
*/
public FeedDialogBuilder(Context context, String applicationId, Bundle parameters) {
super(context, applicationId, FEED_DIALOG, parameters);
}
/**
* Sets the ID of the profile that is posting to Facebook. If none is specified,
* the default is "me". This profile must be either the authenticated user or a
* Page that the user is an administrator of.
*
* @param id Facebook ID of the profile to post from
* @return the builder
*/
public FeedDialogBuilder setFrom(String id) {
getParameters().putString(FROM_PARAM, id);
return this;
}
/**
* Sets the ID of the profile that the story will be published to. If not specified, it
* will default to the same profile that the story is being published from.
*
* @param id Facebook ID of the profile to post to
* @return the builder
*/
public FeedDialogBuilder setTo(String id) {
getParameters().putString(TO_PARAM, id);
return this;
}
/**
* Sets the URL of a link to be shared.
*
* @param link the URL
* @return the builder
*/
public FeedDialogBuilder setLink(String link) {
getParameters().putString(LINK_PARAM, link);
return this;
}
/**
* Sets the URL of a picture to be shared.
*
* @param picture the URL of the picture
* @return the builder
*/
public FeedDialogBuilder setPicture(String picture) {
getParameters().putString(PICTURE_PARAM, picture);
return this;
}
/**
* Sets the URL of a media file attached to this post. If this is set, any picture
* set via setPicture will be ignored.
*
* @param source the URL of the media file
* @return the builder
*/
public FeedDialogBuilder setSource(String source) {
getParameters().putString(SOURCE_PARAM, source);
return this;
}
/**
* Sets the name of the item being shared.
*
* @param name the name
* @return the builder
*/
public FeedDialogBuilder setName(String name) {
getParameters().putString(NAME_PARAM, name);
return this;
}
/**
* Sets the caption to be displayed.
*
* @param caption the caption
* @return the builder
*/
public FeedDialogBuilder setCaption(String caption) {
getParameters().putString(CAPTION_PARAM, caption);
return this;
}
/**
* Sets the description to be displayed.
*
* @param description the description
* @return the builder
*/
public FeedDialogBuilder setDescription(String description) {
getParameters().putString(DESCRIPTION_PARAM, description);
return this;
}
}
/**
* Provides a builder that allows construction of the parameters for showing
* the <a href="https://developers.facebook.com/docs/reference/dialogs/requests">Requests Dialog</a>.
*/
public static class RequestsDialogBuilder extends BuilderBase<RequestsDialogBuilder> {
private static final String APPREQUESTS_DIALOG = "apprequests";
private static final String MESSAGE_PARAM = "message";
private static final String TO_PARAM = "to";
private static final String DATA_PARAM = "data";
private static final String TITLE_PARAM = "title";
/**
* Constructor that builds a Requests Dialog using either the active session, or the application
* ID specified in the application/meta-data.
*
* @param context the Context within which the dialog will be shown.
*/
public RequestsDialogBuilder(Context context) {
super(context, APPREQUESTS_DIALOG);
}
/**
* Constructor that builds a Requests Dialog using the provided session.
*
* @param context the Context within which the dialog will be shown.
* @param session the Session representing an authenticating user to use for
* showing the dialog; must not be null, and must be opened.
*/
public RequestsDialogBuilder(Context context, Session session) {
super(context, session, APPREQUESTS_DIALOG, null);
}
/**
* Constructor that builds a Requests Dialog using the provided session and parameters.
*
* @param context the Context within which the dialog will be shown.
* @param session the Session representing an authenticating user to use for
* showing the dialog; must not be null, and must be opened.
* @param parameters a Bundle containing parameters to pass as part of the
* dialog URL. No validation is done on these parameters; it is
* the caller's responsibility to ensure they are valid. For more information,
* see <a href="https://developers.facebook.com/docs/reference/dialogs/requests/">
* https://developers.facebook.com/docs/reference/dialogs/requests/</a>.
*/
public RequestsDialogBuilder(Context context, Session session, Bundle parameters) {
super(context, session, APPREQUESTS_DIALOG, parameters);
}
/**
* Constructor that builds a Requests Dialog using the provided application ID and parameters.
*
* @param context the Context within which the dialog will be shown.
* @param applicationId the application ID to use. If null, the application ID specified in the
* application/meta-data will be used instead.
* @param parameters a Bundle containing parameters to pass as part of the
* dialog URL. No validation is done on these parameters; it is
* the caller's responsibility to ensure they are valid. For more information,
* see <a href="https://developers.facebook.com/docs/reference/dialogs/requests/">
* https://developers.facebook.com/docs/reference/dialogs/requests/</a>.
*/
public RequestsDialogBuilder(Context context, String applicationId, Bundle parameters) {
super(context, applicationId, APPREQUESTS_DIALOG, parameters);
}
/**
* Sets the string users receiving the request will see. The maximum length
* is 60 characters.
*
* @param message the message
* @return the builder
*/
public RequestsDialogBuilder setMessage(String message) {
getParameters().putString(MESSAGE_PARAM, message);
return this;
}
/**
* Sets the user ID or user name the request will be sent to. If this is not
* specified, a friend selector will be displayed and the user can select up
* to 50 friends.
*
* @param id the id or user name to send the request to
* @return the builder
*/
public RequestsDialogBuilder setTo(String id) {
getParameters().putString(TO_PARAM, id);
return this;
}
/**
* Sets optional data which can be used for tracking; maximum length is 255
* characters.
*
* @param data the data
* @return the builder
*/
public RequestsDialogBuilder setData(String data) {
getParameters().putString(DATA_PARAM, data);
return this;
}
/**
* Sets an optional title for the dialog; maximum length is 50 characters.
*
* @param title the title
* @return the builder
*/
public RequestsDialogBuilder setTitle(String title) {
getParameters().putString(TITLE_PARAM, title);
return this;
}
}
}
| {
"content_hash": "2dbf9d25fa4c9d635cfbe9a322b2c08e",
"timestamp": "",
"source": "github",
"line_count": 877,
"max_line_length": 113,
"avg_line_length": 41.29532497149373,
"alnum_prop": 0.615943229511818,
"repo_name": "gimmelamb/UbiSolar",
"id": "aaced5ccddfdd2cec95b44bb03b79e2af10e3df4",
"size": "36816",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "android/UbiSolar/UbiSolar/libs/facebook/src/com/facebook/widget/WebDialog.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1512792"
}
],
"symlink_target": ""
} |
package trie
import (
"fmt"
u "github.com/dockerian/go-coding/utils"
)
// -------- NodeItem, NodeStack, and method receivers
// NodeItem struct
type NodeItem struct {
node *Node
data string
}
// NodeStack struct
type NodeStack struct {
top *NodeItem
elements []*NodeItem
size int
}
// String func for NodeItem
func (e *NodeItem) String() string {
return fmt.Sprintf("node: %+v, data: %s", e.node, e.data)
}
// Peek is a pointer method receiver for NodeStack to peek the top item
func (s *NodeStack) Peek() *NodeItem {
if s.size > 0 {
v := s.top
u.Debug("stack: {%+v}, peek: {%+v}\n", s, v)
return v
}
return nil
}
// Pop is a pointer method receiver for NodeStack to pop the top item
func (s *NodeStack) Pop() *NodeItem {
if s.size > 0 {
v := s.top
// u.Debug("- pop: {%+v}, from: {%+v}\n", v, s)
s.elements = s.elements[0 : s.size-1]
s.size--
if s.size > 0 {
s.top = s.elements[s.size-1]
} else {
s.top = nil
}
// u.Debug("stack: {%+v}, after - pop: {%+v}\n", s, v)
return v
}
return nil
}
// Push is a pointer method receiver for NodeStack to push into the stack
func (s *NodeStack) Push(p *NodeItem) {
if s.size == 0 {
s.elements = make([]*NodeItem, 0)
}
// u.Debug("+push: {%+v}, to: {%+v}\n", p, s)
s.top = p
s.elements = append(s.elements, p)
s.size++
// u.Debug("stack: {%+v}, after push: {%+v}\n", s, p)
}
// Size is a pointer method receiver for NodeStack to return the stack size
func (s *NodeStack) Size() int {
return s.size
}
// String func for NodeStack
func (s *NodeStack) String() string {
return fmt.Sprintf("size: %d, top: {%+v}", s.size, s.top)
}
| {
"content_hash": "941f3aacc00413e0abab36960811b275",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 75,
"avg_line_length": 21.31168831168831,
"alnum_prop": 0.6106032906764168,
"repo_name": "dockerian/shuati",
"id": "b0473830fa1efecbd04588fdd957893570e9957f",
"size": "1641",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ds/trie/nodeStack.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "17490"
},
{
"name": "Go",
"bytes": "204191"
},
{
"name": "HTML",
"bytes": "67320"
},
{
"name": "Java",
"bytes": "27669"
},
{
"name": "JavaScript",
"bytes": "2590"
},
{
"name": "Makefile",
"bytes": "6497"
},
{
"name": "Shell",
"bytes": "3271"
}
],
"symlink_target": ""
} |
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
: ${KUBE_VERSION_ROOT:=${KUBE_ROOT}}
: ${KUBECTL:="${KUBE_VERSION_ROOT}/cluster/kubectl.sh"}
: ${KUBE_CONFIG_FILE:="config-test.sh"}
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_VERSION_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
prepare-e2e
GUESTBOOK="${KUBE_ROOT}/examples/guestbook"
echo "WARNING: this test is a no op that only attempts to launch guestbook resources."
# Launch the guestbook example
${KUBECTL} create -f "${GUESTBOOK}"
sleep 15
POD_LIST_1=$(${KUBECTL} get pods -o template '--template={{range.items}}{{.id}} {{end}}')
echo "Pods running: ${POD_LIST_1}"
# TODO make this an actual test. Open up a firewall and use curl to post and
# read a message via the frontend
${KUBECTL} stop -f "${GUESTBOOK}"
POD_LIST_2=$(${KUBECTL} get pods -o template '--template={{range.items}}{{.id}} {{end}}')
echo "Pods running after shutdown: ${POD_LIST_2}"
exit 0
| {
"content_hash": "1a11d20268725296105388b931dfc9c1",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 89,
"avg_line_length": 27.43243243243243,
"alnum_prop": 0.6886699507389162,
"repo_name": "vishvananda/kubernetes",
"id": "b784c39b90eee45a9bbcb5be312f47519fbf5859",
"size": "1805",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "hack/e2e-suite/guestbook.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "90591"
},
{
"name": "CSS",
"bytes": "3153"
},
{
"name": "Go",
"bytes": "5482171"
},
{
"name": "HTML",
"bytes": "7993"
},
{
"name": "Java",
"bytes": "3258"
},
{
"name": "JavaScript",
"bytes": "11912"
},
{
"name": "Makefile",
"bytes": "6518"
},
{
"name": "Nginx",
"bytes": "1013"
},
{
"name": "PHP",
"bytes": "1029"
},
{
"name": "Python",
"bytes": "7895"
},
{
"name": "Scheme",
"bytes": "1112"
},
{
"name": "Shell",
"bytes": "483373"
}
],
"symlink_target": ""
} |
#include "config.h"
#include "core/editing/MergeIdenticalElementsCommand.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "core/dom/Element.h"
namespace blink {
MergeIdenticalElementsCommand::MergeIdenticalElementsCommand(PassRefPtrWillBeRawPtr<Element> first, PassRefPtrWillBeRawPtr<Element> second)
: SimpleEditCommand(first->document())
, m_element1(first)
, m_element2(second)
{
ASSERT(m_element1);
ASSERT(m_element2);
ASSERT(m_element1->nextSibling() == m_element2);
}
void MergeIdenticalElementsCommand::doApply()
{
if (m_element1->nextSibling() != m_element2 || !m_element1->hasEditableStyle() || !m_element2->hasEditableStyle())
return;
m_atChild = m_element2->firstChild();
NodeVector children;
getChildNodes(*m_element1, children);
for (auto& child : children)
m_element2->insertBefore(child.release(), m_atChild.get(), IGNORE_EXCEPTION);
m_element1->remove(IGNORE_EXCEPTION);
}
void MergeIdenticalElementsCommand::doUnapply()
{
ASSERT(m_element1);
ASSERT(m_element2);
RefPtrWillBeRawPtr<Node> atChild = m_atChild.release();
ContainerNode* parent = m_element2->parentNode();
if (!parent || !parent->hasEditableStyle())
return;
TrackExceptionState exceptionState;
parent->insertBefore(m_element1.get(), m_element2.get(), exceptionState);
if (exceptionState.hadException())
return;
WillBeHeapVector<RefPtrWillBeMember<Node>> children;
for (Node* child = m_element2->firstChild(); child && child != atChild; child = child->nextSibling())
children.append(child);
for (auto& child : children)
m_element1->appendChild(child.release(), exceptionState);
}
void MergeIdenticalElementsCommand::trace(Visitor* visitor)
{
visitor->trace(m_element1);
visitor->trace(m_element2);
visitor->trace(m_atChild);
SimpleEditCommand::trace(visitor);
}
} // namespace blink
| {
"content_hash": "85f589ab4b5ff74332651929075cafc0",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 139,
"avg_line_length": 28.169014084507044,
"alnum_prop": 0.7065,
"repo_name": "nwjs/blink",
"id": "712d38ebe843ba92b79d0a22aa40c49e593db976",
"size": "3356",
"binary": false,
"copies": "7",
"ref": "refs/heads/nw12",
"path": "Source/core/editing/MergeIdenticalElementsCommand.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "1835"
},
{
"name": "Assembly",
"bytes": "14584"
},
{
"name": "Batchfile",
"bytes": "35"
},
{
"name": "C",
"bytes": "105608"
},
{
"name": "C++",
"bytes": "42652662"
},
{
"name": "CSS",
"bytes": "537806"
},
{
"name": "CoffeeScript",
"bytes": "163"
},
{
"name": "GLSL",
"bytes": "11578"
},
{
"name": "Groff",
"bytes": "28067"
},
{
"name": "HTML",
"bytes": "56362733"
},
{
"name": "Java",
"bytes": "108885"
},
{
"name": "JavaScript",
"bytes": "26647564"
},
{
"name": "Objective-C",
"bytes": "47905"
},
{
"name": "Objective-C++",
"bytes": "342893"
},
{
"name": "PHP",
"bytes": "171657"
},
{
"name": "Perl",
"bytes": "583379"
},
{
"name": "Python",
"bytes": "3788510"
},
{
"name": "Ruby",
"bytes": "141818"
},
{
"name": "Shell",
"bytes": "8888"
},
{
"name": "XSLT",
"bytes": "49926"
},
{
"name": "Yacc",
"bytes": "64744"
}
],
"symlink_target": ""
} |
package net.ripe.db.whois.logsearch;
import com.google.common.base.Splitter;
import net.ripe.db.whois.logsearch.logformat.LegacyLogFile;
import net.ripe.db.whois.logsearch.logformat.LogSource;
import net.ripe.db.whois.logsearch.logformat.LoggedUpdate;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.lang.StringUtils;
import org.apache.lucene.queryparser.classic.ParseException;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.FileCopyUtils;
import java.io.*;
import java.util.Iterator;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Component
public class LogFileSearch {
private static final Pattern PASSWORD_PATTERN = Pattern.compile("(?im)^(override|password):\\s*(.+)\\s*$");
private static final Splitter PATH_ELEMENT_SPLITTER = Splitter.on(File.separatorChar).omitEmptyStrings();
private final File logDir;
private final LogFileIndex logFileIndex;
@Autowired
public LogFileSearch(
@Value("${dir.update.audit.log}") final String logDir,
final LogFileIndex logFileIndex) {
this.logDir = new File(logDir);
this.logFileIndex = logFileIndex;
}
public Set<LoggedUpdate> searchLoggedUpdateIds(final String queryString, final LocalDate fromDate, final LocalDate toDate) throws IOException, ParseException {
return logFileIndex.searchByDateRangeAndContent(queryString, fromDate, toDate);
}
public void writeLoggedUpdate(final LoggedUpdate loggedUpdate, final Writer writer) {
final String filteredContents = filterContents(fetchContents(loggedUpdate));
try {
final String box = StringUtils.repeat("#", loggedUpdate.getUpdateId().length() + 15);
writer.write(box);
writer.write("\n");
writer.write(String.format("# %-9s: %s%s #\n", "id", loggedUpdate.getUpdateId(), StringUtils.repeat(" ", box.length() - 15 - loggedUpdate.getUpdateId().length())));
writer.write(String.format("# %-9s: %s%s #\n", "date", loggedUpdate.getDate(), StringUtils.repeat(" ", box.length() - 15 - loggedUpdate.getDate().length())));
writer.write(box);
writer.write("\n\n");
writer.write(filteredContents);
writer.write("\n\n");
} catch (IOException e) {
throw new IllegalStateException("Writing contents", e);
}
}
private String fetchContents(LoggedUpdate loggedUpdate) {
try {
final Iterable<String> split = PATH_ELEMENT_SPLITTER.split(loggedUpdate.getUpdateId());
return recurseIntoDir(new File("/"), split.iterator());
} catch (IllegalArgumentException e) {
return e.getMessage();
}
}
private String recurseIntoDir(File dir, Iterator<String> path) {
if (!path.hasNext()) {
throw new IllegalArgumentException(dir.getAbsolutePath() + " is not an update log entry");
}
File file = new File(dir, path.next());
if (file.isDirectory()) {
return recurseIntoDir(file, path);
} else if (file.isFile()) {
return fetchFromArchive(file, path);
} else {
throw new IllegalArgumentException(file.getAbsolutePath() + " is neither file nor directory");
}
}
private String fetchFromArchive(File file, Iterator<String> path) {
final String fileName = file.getName().toLowerCase();
if (fileName.endsWith(".bz2")) {
return fetchFromBzip2(file, path);
} else if (fileName.endsWith(".tar")) {
return fetchFromTar(file, path);
} else if (fileName.endsWith(".gz")) {
return fetchGzip(file);
} else {
throw new IllegalArgumentException("Unknown archive file: " + file.getAbsolutePath());
}
}
private String fetchGzip(File file) {
try (InputStreamReader reader = new InputStreamReader(new GzipCompressorInputStream(new FileInputStream(file)))) {
return FileCopyUtils.copyToString(reader);
} catch (IOException e) {
throw new IllegalArgumentException("Error processing gzip file: " + file.getAbsolutePath(), e);
}
}
private String fetchFromTar(File file, Iterator<String> path) {
final String lookup = StringUtils.join(path, '/');
try (final TarArchiveInputStream tarInput = new TarArchiveInputStream(new BufferedInputStream(new FileInputStream(file)))) {
for (TarArchiveEntry tarEntry = tarInput.getNextTarEntry(); tarEntry != null; tarEntry = tarInput.getNextTarEntry()) {
String tarEntryName = tarEntry.getName();
if (tarEntryName.startsWith("./")) {
tarEntryName = tarEntryName.substring(2);
}
if (tarEntry.isFile() && tarEntryName.equals(lookup)) {
return LogSource.getGzippedContent(tarInput, tarEntry.getSize());
}
}
throw new IllegalArgumentException(String.format("File: %s not found in tar archive: %s", lookup, file.getAbsolutePath()));
} catch (IOException e) {
throw new IllegalArgumentException("Error processing tar archive: " + file.getAbsolutePath(), e);
}
}
private String fetchFromBzip2(File file, Iterator<String> path) {
int count = Integer.parseInt(path.next());
StringBuilder result = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new BZip2CompressorInputStream(new FileInputStream(file))))) {
String line;
while ((line = reader.readLine()) != null) {
if (count == 0) {
result.append(line).append('\n');
}
if (LegacyLogFile.LOGSECTION_PATTERN.matcher(line).matches()) {
count--;
if (count < 0) {
return result.toString();
}
}
}
} catch (IOException e) {
throw new IllegalArgumentException("Error processing bzip2 archive: " + file.getAbsolutePath(), e);
}
return result.toString();
}
// we have to support historical override/password formats here, so we can't rely on whois-update for this functionality
private String filterContents(final String contents) {
final Matcher matcher = PASSWORD_PATTERN.matcher(contents);
final StringBuffer result = new StringBuffer();
while (matcher.find()) {
if (matcher.group(1).equalsIgnoreCase("password")) {
matcher.appendReplacement(result, "password: FILTERED");
} else {
final String[] override = StringUtils.split(matcher.group(2), ',');
if (override.length == 3) {
matcher.appendReplacement(result, String.format("override: %s, FILTERED, %s", override[0], override[2]));
} else if (override.length == 2) {
matcher.appendReplacement(result, String.format("override: %s, FILTERED", override[0]));
} else {
matcher.appendReplacement(result, "override: FILTERED");
}
}
}
matcher.appendTail(result);
return result.toString();
}
}
| {
"content_hash": "62f98a3f8e20b7e90d56461cac70dd89",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 176,
"avg_line_length": 43.97752808988764,
"alnum_prop": 0.6373275421563618,
"repo_name": "APNIC-net/whois",
"id": "afc01dee95dc90578e18c9c13c41150b49bd17a9",
"size": "7828",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "whois-logsearch/src/main/java/net/ripe/db/whois/logsearch/LogFileSearch.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Groovy",
"bytes": "4073850"
},
{
"name": "HTML",
"bytes": "3083"
},
{
"name": "Java",
"bytes": "4882998"
},
{
"name": "Lex",
"bytes": "87910"
},
{
"name": "Shell",
"bytes": "13230"
},
{
"name": "Yacc",
"bytes": "89381"
}
],
"symlink_target": ""
} |
module I18n
DEFAULT_INTERPOLATION_PATTERNS = [
/%%/,
/%\{([\w|]+)\}/, # matches placeholders like "%{foo} or %{foo|word}"
/%<(\w+)>([^\d]*?\d*\.?\d*[bBdiouxXeEfgGcps])/ # matches placeholders like "%<foo>.d"
].freeze
INTERPOLATION_PATTERN = Regexp.union(DEFAULT_INTERPOLATION_PATTERNS)
deprecate_constant :INTERPOLATION_PATTERN
class << self
# Return String or raises MissingInterpolationArgument exception.
# Missing argument's logic is handled by I18n.config.missing_interpolation_argument_handler.
def interpolate(string, values)
raise ReservedInterpolationKey.new($1.to_sym, string) if string =~ I18n.reserved_keys_pattern
raise ArgumentError.new('Interpolation values must be a Hash.') unless values.kind_of?(Hash)
interpolate_hash(string, values)
end
def interpolate_hash(string, values)
string.gsub(Regexp.union(config.interpolation_patterns)) do |match|
if match == '%%'
'%'
else
key = ($1 || $2 || match.tr("%{}", "")).to_sym
value = if values.key?(key)
values[key]
else
config.missing_interpolation_argument_handler.call(key, values, string)
end
value = value.call(values) if value.respond_to?(:call)
$3 ? sprintf("%#{$3}", value) : value
end
end
end
end
end
| {
"content_hash": "7d00a81ba9706eebd31cf0b8ec593bc3",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 99,
"avg_line_length": 39.638888888888886,
"alnum_prop": 0.5970567624386826,
"repo_name": "Homebrew/brew",
"id": "dab8f0ed32efde768a6bc96001736da1ef5e2f4b",
"size": "1611",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/i18n-1.12.0/lib/i18n/interpolate/ruby.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Dockerfile",
"bytes": "1861"
},
{
"name": "HTML",
"bytes": "29627"
},
{
"name": "PostScript",
"bytes": "485"
},
{
"name": "Roff",
"bytes": "108869"
},
{
"name": "Ruby",
"bytes": "3852532"
},
{
"name": "Shell",
"bytes": "265377"
},
{
"name": "Swift",
"bytes": "2161"
}
],
"symlink_target": ""
} |
<div class="container">
<h2>Register to centre</h2>
<form class="form-horizontal" method="POST" action="/manage/submit2">
<div class="form-group">
<label class="control-label col-sm-2" for="team">Factory:</label>
<div class="col-sm-10">
<input class="form-control" id="team" name="team" placeholder="lemon">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" name="haha" class="btn btn-default" value="Submit"/>
</div>
</div>
</form>
</div> | {
"content_hash": "3c95ca175d30fb5f20b561660b65809b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 38.5,
"alnum_prop": 0.5335497835497836,
"repo_name": "LeiPei/RobotProject",
"id": "91dca03c3a7fd8da8f3144743924793710c4d27e",
"size": "924",
"binary": false,
"copies": "3",
"ref": "refs/heads/feature/role",
"path": "application/views/Manage/itemedit.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "602"
},
{
"name": "CSS",
"bytes": "5084"
},
{
"name": "HTML",
"bytes": "5633"
},
{
"name": "JavaScript",
"bytes": "20576"
},
{
"name": "PHP",
"bytes": "1891267"
}
],
"symlink_target": ""
} |
/*eslint-env node, mocha */
var expect = require('expect.js');
var expand = require('../../api/common')({client: {}}).expandEmbeddedObject;
describe('Embedded object expansion', function () {
it('does nothing if it doesnt find the test field', function (done) {
expect(expand({'hello': 'world'}, 'a', 'b')).to.be(undefined);
done();
});
it('expands an object based on the prefix and clean up after itself', function (done) {
var item = {post: '1', 'post_ignore': 'bob', post_post: '1', post_content: 'alpha', post_date: 'today', another_field: 'value'};
var embed = {post: '1', 'ignore': 'bob', content: 'alpha', date: 'today'};
expect(expand(item, 'post', 'content')).to.eql(embed);
expect(item).to.eql({post: '1', another_field: 'value'});
done();
});
it('expands an object based on the prefix and clean up after itself, ignoring what it is told to ignore', function (done) {
var item = {post: '1', 'post_ignore': 'bob', post_post: '1', post_content: 'alpha', post_date: 'today', another_field: 'value'};
var embed = {post: '1', content: 'alpha', date: 'today'};
expect(expand(item, 'post', 'content', ['post', 'post_ignore'])).to.eql(embed);
expect(item).to.eql({post: '1', 'post_ignore': 'bob', another_field: 'value'});
done();
});
});
| {
"content_hash": "76989eb1f989ebe0b3a0a8b570b03169",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 132,
"avg_line_length": 45.06896551724138,
"alnum_prop": 0.6151491966335119,
"repo_name": "gajjargaurav/seguir",
"id": "151fa014d3de01371cffcd765aa93ec3b6eafca3",
"size": "1307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/unit/expand.test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Handlebars",
"bytes": "252"
},
{
"name": "JavaScript",
"bytes": "313515"
}
],
"symlink_target": ""
} |
import os
import sys
import yaml
def parse_args(envirnment, arguments):
manifest = envirnment.manifest
try:
with open(manifest, 'r') as stream:
available_arguments = yaml.load(stream)
except:
print('An error occurred while attempting to open the Manifest-file.')
sys.exit()
else:
for argument in arguments:
if available_arguments != None:
if argument in available_arguments:
value = available_arguments[argument]
available_arguments = available_arguments[argument]
else:
# print('This command is not available. Try again.')
# sys.exit()
alternate_parse_args(envirnment, arguments)
return
else:
alternate_parse_args(envirnment, arguments)
return
if type(value) is list:
for v in value:
envirnment.run(v)
elif not type(value) is dict:
envirnment.run(value)
else:
print('This command is not available. Try again.')
sys.exit()
# Поиск команды в конфигурации из домашней директории, если такая
# есть.
def alternate_parse_args(envirnment, arguments):
manifest = os.path.join(os.path.expanduser('~'), '.wa')
try:
with open(manifest, 'r') as stream:
available_arguments = yaml.load(stream)
except:
print('An error occurred while attempting to open the Manifest-file.')
sys.exit()
else:
for argument in arguments:
if available_arguments != None:
if argument in available_arguments:
value = available_arguments[argument]
available_arguments = available_arguments[argument]
else:
print('This command is not available. Try again.')
sys.exit()
else:
print('This command is not available. Try again.')
sys.exit()
if type(value) is list:
for v in value:
envirnment.run(v)
elif not type(value) is dict:
envirnment.run(value)
else:
print('This command is not available. Try again.')
sys.exit()
# А что если пользовательская папка является корнем файловой системы? Баг?
def find_manifest(path=os.getcwd()):
if not os.path.isfile(os.path.join(path, '.wa')) and os.path.dirname(path) != os.path.dirname(os.path.expanduser('~')):
if os.path.dirname(path) == path:
# you have yourself root.
# works on Windows and *nix paths.
# does NOT work on Windows shares (\\server\share)
# If .wa not found, but exist in <home path>
# current dir will be a project root
if os.path.isfile(os.path.join(os.path.expanduser('~'), '.wa')):
touch('.wa')
return '.'
else:
print(os.path.join(os.path.expanduser('~'), '.wa'))
print('Manifest-file not found')
sys.exit()
path = os.path.abspath(os.path.join(path, os.pardir))
return find_manifest(path)
else:
return path
def touch(fname):
if os.path.exists(fname):
os.utime(fname, None)
else:
open(fname, 'a').close()
| {
"content_hash": "bf2e90a267fe69448f5991e473fdf954",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 123,
"avg_line_length": 34.707070707070706,
"alnum_prop": 0.5480209545983702,
"repo_name": "char16t/wa",
"id": "9f88fd3bfd2379ec8c2ca5f48640abaca5ab04df",
"size": "3571",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wa/utils.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "82"
},
{
"name": "Python",
"bytes": "15421"
}
],
"symlink_target": ""
} |
var Time = React.createClass({
getInitialState: function () {
return { time: new Date() };
},
componentDidMount: function () {
this.interval = setInterval(function () {
this.setState({ time: new Date() });
}.bind(this), 500);
},
componentWillUnmount: function () {
clearInterval(this.interval);
},
/* jshint ignore:start */
render: function () {
return (
<p>{this.state.time.toUTCString()}</p>
);
}
/* jshint ignore:end */
});
module.exports = Time;
| {
"content_hash": "781d8f7d1670dc7a6d54fb0e1f9bc465",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 45,
"avg_line_length": 20.4,
"alnum_prop": 0.5901960784313726,
"repo_name": "maxleiko/react-simple",
"id": "807b5e3d85f2ffafba5b9897ce1c9d0ff81e9f59",
"size": "510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/components/Time.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "660"
},
{
"name": "HTML",
"bytes": "483"
},
{
"name": "JavaScript",
"bytes": "6960"
}
],
"symlink_target": ""
} |
<?php namespace System\Console;
use File;
use Illuminate\Console\Command;
use System\Classes\UpdateManager;
use System\Classes\PluginManager;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class PluginRemove extends Command
{
use \Illuminate\Console\ConfirmableTrait;
/**
* The console command name.
* @var string
*/
protected $name = 'plugin:remove';
/**
* The console command description.
* @var string
*/
protected $description = 'Removes an existing plugin.';
/**
* Create a new command instance.
* @return \System\Console\PluginRemove
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
* @return void
*/
public function fire()
{
$pluginManager = PluginManager::instance();
$pluginName = $this->argument('name');
$pluginName = $pluginManager->normalizeIdentifier($pluginName);
if (!$pluginManager->hasPlugin($pluginName))
return $this->error(sprintf('Unable to find a registered plugin called "%s"', $pluginName));
if (!$this->confirmToProceed(sprintf('This will DELETE "%s" from the filesystem and database.', $pluginName)))
return;
/*
* Rollback plugin
*/
$manager = UpdateManager::instance()->resetNotes();
$manager->rollbackPlugin($pluginName);
foreach ($manager->getNotes() as $note)
$this->output->writeln($note);
/*
* Delete from file system
*/
if ($pluginPath = $pluginManager->getPluginPath($pluginName)) {
File::deleteDirectory($pluginPath);
$this->output->writeln(sprintf('<info>Deleted: %s</info>', $pluginName));
}
}
/**
* Get the console command arguments.
* @return array
*/
protected function getArguments()
{
return [
['name', InputArgument::REQUIRED, 'The name of the plugin. Eg: AuthorName.PluginName'],
];
}
/**
* Get the console command options.
* @return array
*/
protected function getOptions()
{
return [
['force', null, InputOption::VALUE_NONE, 'Force the operation to run.'],
];
}
/**
* Get the default confirmation callback.
* @return \Closure
*/
protected function getDefaultConfirmCallback()
{
return function() { return true; };
}
} | {
"content_hash": "061b6b5a975c4536f2731d69f096b769",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 118,
"avg_line_length": 25.22772277227723,
"alnum_prop": 0.5910518053375197,
"repo_name": "sysatom/ComicSearch",
"id": "c2ad2610e0ff5602564f66656ecb7a5bfb739f5b",
"size": "2548",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/system/console/PluginRemove.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11499"
},
{
"name": "JavaScript",
"bytes": "20177"
},
{
"name": "PHP",
"bytes": "1569686"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.hdfs.server.namenode;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ADD;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ADD_BLOCK;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ADD_CACHE_DIRECTIVE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ADD_CACHE_POOL;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ALLOCATE_BLOCK_ID;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ALLOW_SNAPSHOT;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_CANCEL_DELEGATION_TOKEN;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_CLEAR_NS_QUOTA;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_CLOSE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_CONCAT_DELETE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_CREATE_SNAPSHOT;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_DELETE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_DELETE_SNAPSHOT;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_DISALLOW_SNAPSHOT;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_END_LOG_SEGMENT;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_GET_DELEGATION_TOKEN;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_INVALID;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_MKDIR;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_MODIFY_CACHE_DIRECTIVE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_MODIFY_CACHE_POOL;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_REASSIGN_LEASE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_REMOVE_CACHE_DIRECTIVE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_REMOVE_CACHE_POOL;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_REMOVE_XATTR;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_RENAME;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_RENAME_OLD;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_RENAME_SNAPSHOT;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_RENEW_DELEGATION_TOKEN;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_ACL;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ROLLING_UPGRADE_FINALIZE;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_ROLLING_UPGRADE_START;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_GENSTAMP_V1;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_GENSTAMP_V2;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_NS_QUOTA;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_OWNER;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_PERMISSIONS;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_QUOTA;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_REPLICATION;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_XATTR;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_START_LOG_SEGMENT;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SYMLINK;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_TIMES;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_UPDATE_BLOCKS;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_UPDATE_MASTER_KEY;
import static org.apache.hadoop.hdfs.server.namenode.FSEditLogOpCodes.OP_SET_STORAGE_POLICY;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.List;
import java.util.zip.CheckedInputStream;
import java.util.zip.Checksum;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.fs.ChecksumException;
import org.apache.hadoop.fs.Options.Rename;
import org.apache.hadoop.fs.XAttr;
import org.apache.hadoop.fs.XAttrCodec;
import org.apache.hadoop.fs.permission.AclEntry;
import org.apache.hadoop.fs.permission.AclEntryScope;
import org.apache.hadoop.fs.permission.AclEntryType;
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.permission.PermissionStatus;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DeprecatedUTF8;
import org.apache.hadoop.hdfs.protocol.Block;
import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo;
import org.apache.hadoop.hdfs.protocol.CachePoolInfo;
import org.apache.hadoop.hdfs.protocol.ClientProtocol;
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import org.apache.hadoop.hdfs.protocol.LayoutVersion;
import org.apache.hadoop.hdfs.protocol.LayoutVersion.Feature;
import org.apache.hadoop.hdfs.protocol.proto.AclProtos.AclEditLogProto;
import org.apache.hadoop.hdfs.protocol.proto.XAttrProtos.XAttrEditLogProto;
import org.apache.hadoop.hdfs.protocolPB.PBHelper;
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
import org.apache.hadoop.hdfs.server.blockmanagement.BlockStoragePolicySuite;
import org.apache.hadoop.hdfs.util.XMLUtils;
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException;
import org.apache.hadoop.hdfs.util.XMLUtils.Stanza;
import org.apache.hadoop.io.ArrayWritable;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableFactories;
import org.apache.hadoop.io.WritableFactory;
import org.apache.hadoop.ipc.ClientId;
import org.apache.hadoop.ipc.RpcConstants;
import org.apache.hadoop.security.token.delegation.DelegationKey;
import org.apache.hadoop.util.DataChecksum;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
/**
* Helper classes for reading the ops from an InputStream.
* All ops derive from FSEditLogOp and are only
* instantiated from Reader#readOp()
*/
@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract class FSEditLogOp {
public final FSEditLogOpCodes opCode;
long txid = HdfsConstants.INVALID_TXID;
byte[] rpcClientId = RpcConstants.DUMMY_CLIENT_ID;
int rpcCallId = RpcConstants.INVALID_CALL_ID;
final public static class OpInstanceCache {
private final EnumMap<FSEditLogOpCodes, FSEditLogOp> inst =
new EnumMap<FSEditLogOpCodes, FSEditLogOp>(FSEditLogOpCodes.class);
public OpInstanceCache() {
inst.put(OP_ADD, new AddOp());
inst.put(OP_CLOSE, new CloseOp());
inst.put(OP_SET_REPLICATION, new SetReplicationOp());
inst.put(OP_CONCAT_DELETE, new ConcatDeleteOp());
inst.put(OP_RENAME_OLD, new RenameOldOp());
inst.put(OP_DELETE, new DeleteOp());
inst.put(OP_MKDIR, new MkdirOp());
inst.put(OP_SET_GENSTAMP_V1, new SetGenstampV1Op());
inst.put(OP_SET_PERMISSIONS, new SetPermissionsOp());
inst.put(OP_SET_OWNER, new SetOwnerOp());
inst.put(OP_SET_NS_QUOTA, new SetNSQuotaOp());
inst.put(OP_CLEAR_NS_QUOTA, new ClearNSQuotaOp());
inst.put(OP_SET_QUOTA, new SetQuotaOp());
inst.put(OP_TIMES, new TimesOp());
inst.put(OP_SYMLINK, new SymlinkOp());
inst.put(OP_RENAME, new RenameOp());
inst.put(OP_REASSIGN_LEASE, new ReassignLeaseOp());
inst.put(OP_GET_DELEGATION_TOKEN, new GetDelegationTokenOp());
inst.put(OP_RENEW_DELEGATION_TOKEN, new RenewDelegationTokenOp());
inst.put(OP_CANCEL_DELEGATION_TOKEN, new CancelDelegationTokenOp());
inst.put(OP_UPDATE_MASTER_KEY, new UpdateMasterKeyOp());
inst.put(OP_START_LOG_SEGMENT, new LogSegmentOp(OP_START_LOG_SEGMENT));
inst.put(OP_END_LOG_SEGMENT, new LogSegmentOp(OP_END_LOG_SEGMENT));
inst.put(OP_UPDATE_BLOCKS, new UpdateBlocksOp());
inst.put(OP_ALLOW_SNAPSHOT, new AllowSnapshotOp());
inst.put(OP_DISALLOW_SNAPSHOT, new DisallowSnapshotOp());
inst.put(OP_CREATE_SNAPSHOT, new CreateSnapshotOp());
inst.put(OP_DELETE_SNAPSHOT, new DeleteSnapshotOp());
inst.put(OP_RENAME_SNAPSHOT, new RenameSnapshotOp());
inst.put(OP_SET_GENSTAMP_V2, new SetGenstampV2Op());
inst.put(OP_ALLOCATE_BLOCK_ID, new AllocateBlockIdOp());
inst.put(OP_ADD_BLOCK, new AddBlockOp());
inst.put(OP_ADD_CACHE_DIRECTIVE,
new AddCacheDirectiveInfoOp());
inst.put(OP_MODIFY_CACHE_DIRECTIVE,
new ModifyCacheDirectiveInfoOp());
inst.put(OP_REMOVE_CACHE_DIRECTIVE,
new RemoveCacheDirectiveInfoOp());
inst.put(OP_ADD_CACHE_POOL, new AddCachePoolOp());
inst.put(OP_MODIFY_CACHE_POOL, new ModifyCachePoolOp());
inst.put(OP_REMOVE_CACHE_POOL, new RemoveCachePoolOp());
inst.put(OP_SET_ACL, new SetAclOp());
inst.put(OP_ROLLING_UPGRADE_START, new RollingUpgradeOp(
OP_ROLLING_UPGRADE_START, "start"));
inst.put(OP_ROLLING_UPGRADE_FINALIZE, new RollingUpgradeOp(
OP_ROLLING_UPGRADE_FINALIZE, "finalize"));
inst.put(OP_SET_XATTR, new SetXAttrOp());
inst.put(OP_REMOVE_XATTR, new RemoveXAttrOp());
inst.put(OP_SET_STORAGE_POLICY, new SetStoragePolicyOp());
}
public FSEditLogOp get(FSEditLogOpCodes opcode) {
return inst.get(opcode);
}
}
private static ImmutableMap<String, FsAction> fsActionMap() {
ImmutableMap.Builder<String, FsAction> b = ImmutableMap.builder();
for (FsAction v : FsAction.values())
b.put(v.SYMBOL, v);
return b.build();
}
private static final ImmutableMap<String, FsAction> FSACTION_SYMBOL_MAP
= fsActionMap();
/**
* Constructor for an EditLog Op. EditLog ops cannot be constructed
* directly, but only through Reader#readOp.
*/
@VisibleForTesting
protected FSEditLogOp(FSEditLogOpCodes opCode) {
this.opCode = opCode;
}
public long getTransactionId() {
Preconditions.checkState(txid != HdfsConstants.INVALID_TXID);
return txid;
}
public String getTransactionIdStr() {
return (txid == HdfsConstants.INVALID_TXID) ? "(none)" : "" + txid;
}
public boolean hasTransactionId() {
return (txid != HdfsConstants.INVALID_TXID);
}
public void setTransactionId(long txid) {
this.txid = txid;
}
public boolean hasRpcIds() {
return rpcClientId != RpcConstants.DUMMY_CLIENT_ID
&& rpcCallId != RpcConstants.INVALID_CALL_ID;
}
/** this has to be called after calling {@link #hasRpcIds()} */
public byte[] getClientId() {
Preconditions.checkState(rpcClientId != RpcConstants.DUMMY_CLIENT_ID);
return rpcClientId;
}
public void setRpcClientId(byte[] clientId) {
this.rpcClientId = clientId;
}
/** this has to be called after calling {@link #hasRpcIds()} */
public int getCallId() {
Preconditions.checkState(rpcCallId != RpcConstants.INVALID_CALL_ID);
return rpcCallId;
}
public void setRpcCallId(int callId) {
this.rpcCallId = callId;
}
abstract void readFields(DataInputStream in, int logVersion)
throws IOException;
public abstract void writeFields(DataOutputStream out)
throws IOException;
static interface BlockListUpdatingOp {
Block[] getBlocks();
String getPath();
boolean shouldCompleteLastBlock();
}
private static void writeRpcIds(final byte[] clientId, final int callId,
DataOutputStream out) throws IOException {
FSImageSerialization.writeBytes(clientId, out);
FSImageSerialization.writeInt(callId, out);
}
void readRpcIds(DataInputStream in, int logVersion)
throws IOException {
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_SUPPORT_RETRYCACHE, logVersion)) {
this.rpcClientId = FSImageSerialization.readBytes(in);
this.rpcCallId = FSImageSerialization.readInt(in);
}
}
void readRpcIdsFromXml(Stanza st) {
this.rpcClientId = st.hasChildren("RPC_CLIENTID") ?
ClientId.toBytes(st.getValue("RPC_CLIENTID"))
: RpcConstants.DUMMY_CLIENT_ID;
this.rpcCallId = st.hasChildren("RPC_CALLID") ?
Integer.parseInt(st.getValue("RPC_CALLID"))
: RpcConstants.INVALID_CALL_ID;
}
private static void appendRpcIdsToString(final StringBuilder builder,
final byte[] clientId, final int callId) {
builder.append(", RpcClientId=");
builder.append(ClientId.toString(clientId));
builder.append(", RpcCallId=");
builder.append(callId);
}
private static void appendRpcIdsToXml(ContentHandler contentHandler,
final byte[] clientId, final int callId) throws SAXException {
XMLUtils.addSaxString(contentHandler, "RPC_CLIENTID",
ClientId.toString(clientId));
XMLUtils.addSaxString(contentHandler, "RPC_CALLID",
Integer.toString(callId));
}
private static final class AclEditLogUtil {
private static final int ACL_EDITLOG_ENTRY_HAS_NAME_OFFSET = 6;
private static final int ACL_EDITLOG_ENTRY_TYPE_OFFSET = 3;
private static final int ACL_EDITLOG_ENTRY_SCOPE_OFFSET = 5;
private static final int ACL_EDITLOG_PERM_MASK = 7;
private static final int ACL_EDITLOG_ENTRY_TYPE_MASK = 3;
private static final int ACL_EDITLOG_ENTRY_SCOPE_MASK = 1;
private static final FsAction[] FSACTION_VALUES = FsAction.values();
private static final AclEntryScope[] ACL_ENTRY_SCOPE_VALUES = AclEntryScope
.values();
private static final AclEntryType[] ACL_ENTRY_TYPE_VALUES = AclEntryType
.values();
private static List<AclEntry> read(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(Feature.EXTENDED_ACL, logVersion)) {
return null;
}
int size = in.readInt();
if (size == 0) {
return null;
}
List<AclEntry> aclEntries = Lists.newArrayListWithCapacity(size);
for (int i = 0; i < size; ++i) {
int v = in.read();
int p = v & ACL_EDITLOG_PERM_MASK;
int t = (v >> ACL_EDITLOG_ENTRY_TYPE_OFFSET)
& ACL_EDITLOG_ENTRY_TYPE_MASK;
int s = (v >> ACL_EDITLOG_ENTRY_SCOPE_OFFSET)
& ACL_EDITLOG_ENTRY_SCOPE_MASK;
boolean hasName = ((v >> ACL_EDITLOG_ENTRY_HAS_NAME_OFFSET) & 1) == 1;
String name = hasName ? FSImageSerialization.readString(in) : null;
aclEntries.add(new AclEntry.Builder().setName(name)
.setPermission(FSACTION_VALUES[p])
.setScope(ACL_ENTRY_SCOPE_VALUES[s])
.setType(ACL_ENTRY_TYPE_VALUES[t]).build());
}
return aclEntries;
}
private static void write(List<AclEntry> aclEntries, DataOutputStream out)
throws IOException {
if (aclEntries == null) {
out.writeInt(0);
return;
}
out.writeInt(aclEntries.size());
for (AclEntry e : aclEntries) {
boolean hasName = e.getName() != null;
int v = (e.getScope().ordinal() << ACL_EDITLOG_ENTRY_SCOPE_OFFSET)
| (e.getType().ordinal() << ACL_EDITLOG_ENTRY_TYPE_OFFSET)
| e.getPermission().ordinal();
if (hasName) {
v |= 1 << ACL_EDITLOG_ENTRY_HAS_NAME_OFFSET;
}
out.write(v);
if (hasName) {
FSImageSerialization.writeString(e.getName(), out);
}
}
}
}
private static List<XAttr> readXAttrsFromEditLog(DataInputStream in,
int logVersion) throws IOException {
if (!NameNodeLayoutVersion.supports(NameNodeLayoutVersion.Feature.XATTRS,
logVersion)) {
return null;
}
XAttrEditLogProto proto = XAttrEditLogProto.parseDelimitedFrom(in);
return PBHelper.convertXAttrs(proto.getXAttrsList());
}
@SuppressWarnings("unchecked")
static abstract class AddCloseOp extends FSEditLogOp implements BlockListUpdatingOp {
int length;
long inodeId;
String path;
short replication;
long mtime;
long atime;
long blockSize;
Block[] blocks;
PermissionStatus permissions;
List<AclEntry> aclEntries;
List<XAttr> xAttrs;
String clientName;
String clientMachine;
boolean overwrite;
byte storagePolicyId;
private AddCloseOp(FSEditLogOpCodes opCode) {
super(opCode);
storagePolicyId = BlockStoragePolicySuite.ID_UNSPECIFIED;
assert(opCode == OP_ADD || opCode == OP_CLOSE);
}
<T extends AddCloseOp> T reset() {
this.aclEntries = null;
this.xAttrs = null;
return (T)this;
}
<T extends AddCloseOp> T setInodeId(long inodeId) {
this.inodeId = inodeId;
return (T)this;
}
<T extends AddCloseOp> T setPath(String path) {
this.path = path;
return (T)this;
}
@Override
public String getPath() {
return path;
}
<T extends AddCloseOp> T setReplication(short replication) {
this.replication = replication;
return (T)this;
}
<T extends AddCloseOp> T setModificationTime(long mtime) {
this.mtime = mtime;
return (T)this;
}
<T extends AddCloseOp> T setAccessTime(long atime) {
this.atime = atime;
return (T)this;
}
<T extends AddCloseOp> T setBlockSize(long blockSize) {
this.blockSize = blockSize;
return (T)this;
}
<T extends AddCloseOp> T setBlocks(Block[] blocks) {
if (blocks.length > MAX_BLOCKS) {
throw new RuntimeException("Can't have more than " + MAX_BLOCKS +
" in an AddCloseOp.");
}
this.blocks = blocks;
return (T)this;
}
@Override
public Block[] getBlocks() {
return blocks;
}
<T extends AddCloseOp> T setPermissionStatus(PermissionStatus permissions) {
this.permissions = permissions;
return (T)this;
}
<T extends AddCloseOp> T setAclEntries(List<AclEntry> aclEntries) {
this.aclEntries = aclEntries;
return (T)this;
}
<T extends AddCloseOp> T setXAttrs(List<XAttr> xAttrs) {
this.xAttrs = xAttrs;
return (T)this;
}
<T extends AddCloseOp> T setClientName(String clientName) {
this.clientName = clientName;
return (T)this;
}
<T extends AddCloseOp> T setClientMachine(String clientMachine) {
this.clientMachine = clientMachine;
return (T)this;
}
<T extends AddCloseOp> T setOverwrite(boolean overwrite) {
this.overwrite = overwrite;
return (T)this;
}
<T extends AddCloseOp> T setStoragePolicyId(byte storagePolicyId) {
this.storagePolicyId = storagePolicyId;
return (T)this;
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(inodeId, out);
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeShort(replication, out);
FSImageSerialization.writeLong(mtime, out);
FSImageSerialization.writeLong(atime, out);
FSImageSerialization.writeLong(blockSize, out);
new ArrayWritable(Block.class, blocks).write(out);
permissions.write(out);
if (this.opCode == OP_ADD) {
AclEditLogUtil.write(aclEntries, out);
XAttrEditLogProto.Builder b = XAttrEditLogProto.newBuilder();
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
b.build().writeDelimitedTo(out);
FSImageSerialization.writeString(clientName,out);
FSImageSerialization.writeString(clientMachine,out);
FSImageSerialization.writeBoolean(overwrite, out);
FSImageSerialization.writeByte(storagePolicyId, out);
// write clientId and callId
writeRpcIds(rpcClientId, rpcCallId, out);
}
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
}
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.ADD_INODE_ID, logVersion)) {
this.inodeId = in.readLong();
} else {
// The inodeId should be updated when this editLogOp is applied
this.inodeId = INodeId.GRANDFATHER_INODE_ID;
}
if ((-17 < logVersion && length != 4) ||
(logVersion <= -17 && length != 5 && !NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion))) {
throw new IOException("Incorrect data format." +
" logVersion is " + logVersion +
" but writables.length is " +
length + ". ");
}
this.path = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.replication = FSImageSerialization.readShort(in);
this.mtime = FSImageSerialization.readLong(in);
} else {
this.replication = readShort(in);
this.mtime = readLong(in);
}
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.FILE_ACCESS_TIME, logVersion)) {
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.atime = FSImageSerialization.readLong(in);
} else {
this.atime = readLong(in);
}
} else {
this.atime = 0;
}
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.blockSize = FSImageSerialization.readLong(in);
} else {
this.blockSize = readLong(in);
}
this.blocks = readBlocks(in, logVersion);
this.permissions = PermissionStatus.read(in);
if (this.opCode == OP_ADD) {
aclEntries = AclEditLogUtil.read(in, logVersion);
this.xAttrs = readXAttrsFromEditLog(in, logVersion);
this.clientName = FSImageSerialization.readString(in);
this.clientMachine = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
NameNodeLayoutVersion.Feature.CREATE_OVERWRITE, logVersion)) {
this.overwrite = FSImageSerialization.readBoolean(in);
} else {
this.overwrite = false;
}
if (NameNodeLayoutVersion.supports(
NameNodeLayoutVersion.Feature.BLOCK_STORAGE_POLICY, logVersion)) {
this.storagePolicyId = FSImageSerialization.readByte(in);
} else {
this.storagePolicyId = BlockStoragePolicySuite.ID_UNSPECIFIED;
}
// read clientId and callId
readRpcIds(in, logVersion);
} else {
this.clientName = "";
this.clientMachine = "";
}
}
static final public int MAX_BLOCKS = 1024 * 1024 * 64;
private static Block[] readBlocks(
DataInputStream in,
int logVersion) throws IOException {
int numBlocks = in.readInt();
if (numBlocks < 0) {
throw new IOException("invalid negative number of blocks");
} else if (numBlocks > MAX_BLOCKS) {
throw new IOException("invalid number of blocks: " + numBlocks +
". The maximum number of blocks per file is " + MAX_BLOCKS);
}
Block[] blocks = new Block[numBlocks];
for (int i = 0; i < numBlocks; i++) {
Block blk = new Block();
blk.readFields(in);
blocks[i] = blk;
}
return blocks;
}
public String stringifyMembers() {
StringBuilder builder = new StringBuilder();
builder.append("[length=");
builder.append(length);
builder.append(", inodeId=");
builder.append(inodeId);
builder.append(", path=");
builder.append(path);
builder.append(", replication=");
builder.append(replication);
builder.append(", mtime=");
builder.append(mtime);
builder.append(", atime=");
builder.append(atime);
builder.append(", blockSize=");
builder.append(blockSize);
builder.append(", blocks=");
builder.append(Arrays.toString(blocks));
builder.append(", permissions=");
builder.append(permissions);
builder.append(", aclEntries=");
builder.append(aclEntries);
builder.append(", clientName=");
builder.append(clientName);
builder.append(", clientMachine=");
builder.append(clientMachine);
builder.append(", overwrite=");
builder.append(overwrite);
if (this.opCode == OP_ADD) {
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
}
builder.append(", storagePolicyId=");
builder.append(storagePolicyId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "INODEID",
Long.toString(inodeId));
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "REPLICATION",
Short.valueOf(replication).toString());
XMLUtils.addSaxString(contentHandler, "MTIME",
Long.toString(mtime));
XMLUtils.addSaxString(contentHandler, "ATIME",
Long.toString(atime));
XMLUtils.addSaxString(contentHandler, "BLOCKSIZE",
Long.toString(blockSize));
XMLUtils.addSaxString(contentHandler, "CLIENT_NAME", clientName);
XMLUtils.addSaxString(contentHandler, "CLIENT_MACHINE", clientMachine);
XMLUtils.addSaxString(contentHandler, "OVERWRITE",
Boolean.toString(overwrite));
for (Block b : blocks) {
FSEditLogOp.blockToXml(contentHandler, b);
}
FSEditLogOp.permissionStatusToXml(contentHandler, permissions);
if (this.opCode == OP_ADD) {
if (aclEntries != null) {
appendAclEntriesToXml(contentHandler, aclEntries);
}
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.inodeId = Long.parseLong(st.getValue("INODEID"));
this.path = st.getValue("PATH");
this.replication = Short.valueOf(st.getValue("REPLICATION"));
this.mtime = Long.parseLong(st.getValue("MTIME"));
this.atime = Long.parseLong(st.getValue("ATIME"));
this.blockSize = Long.parseLong(st.getValue("BLOCKSIZE"));
this.clientName = st.getValue("CLIENT_NAME");
this.clientMachine = st.getValue("CLIENT_MACHINE");
this.overwrite = Boolean.parseBoolean(st.getValueOrNull("OVERWRITE"));
if (st.hasChildren("BLOCK")) {
List<Stanza> blocks = st.getChildren("BLOCK");
this.blocks = new Block[blocks.size()];
for (int i = 0; i < blocks.size(); i++) {
this.blocks[i] = FSEditLogOp.blockFromXml(blocks.get(i));
}
} else {
this.blocks = new Block[0];
}
this.permissions = permissionStatusFromXml(st);
aclEntries = readAclEntriesFromXml(st);
readRpcIdsFromXml(st);
}
}
/**
* {@literal @AtMostOnce} for {@link ClientProtocol#create} and
* {@link ClientProtocol#append}
*/
static class AddOp extends AddCloseOp {
private AddOp() {
super(OP_ADD);
}
static AddOp getInstance(OpInstanceCache cache) {
return (AddOp)cache.get(OP_ADD);
}
@Override
public boolean shouldCompleteLastBlock() {
return false;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AddOp ");
builder.append(stringifyMembers());
return builder.toString();
}
}
/**
* Although {@link ClientProtocol#appendFile} may also log a close op, we do
* not need to record the rpc ids here since a successful appendFile op will
* finally log an AddOp.
*/
static class CloseOp extends AddCloseOp {
private CloseOp() {
super(OP_CLOSE);
}
static CloseOp getInstance(OpInstanceCache cache) {
return (CloseOp)cache.get(OP_CLOSE);
}
@Override
public boolean shouldCompleteLastBlock() {
return true;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CloseOp ");
builder.append(stringifyMembers());
return builder.toString();
}
}
static class AddBlockOp extends FSEditLogOp {
private String path;
private Block penultimateBlock;
private Block lastBlock;
private AddBlockOp() {
super(OP_ADD_BLOCK);
}
static AddBlockOp getInstance(OpInstanceCache cache) {
return (AddBlockOp) cache.get(OP_ADD_BLOCK);
}
AddBlockOp setPath(String path) {
this.path = path;
return this;
}
public String getPath() {
return path;
}
AddBlockOp setPenultimateBlock(Block pBlock) {
this.penultimateBlock = pBlock;
return this;
}
Block getPenultimateBlock() {
return penultimateBlock;
}
AddBlockOp setLastBlock(Block lastBlock) {
this.lastBlock = lastBlock;
return this;
}
Block getLastBlock() {
return lastBlock;
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(path, out);
int size = penultimateBlock != null ? 2 : 1;
Block[] blocks = new Block[size];
if (penultimateBlock != null) {
blocks[0] = penultimateBlock;
}
blocks[size - 1] = lastBlock;
FSImageSerialization.writeCompactBlockArray(blocks, out);
// clientId and callId
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
path = FSImageSerialization.readString(in);
Block[] blocks = FSImageSerialization.readCompactBlockArray(in,
logVersion);
Preconditions.checkState(blocks.length == 2 || blocks.length == 1);
penultimateBlock = blocks.length == 1 ? null : blocks[0];
lastBlock = blocks[blocks.length - 1];
readRpcIds(in, logVersion);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("AddBlockOp [path=")
.append(path)
.append(", penultimateBlock=")
.append(penultimateBlock == null ? "NULL" : penultimateBlock)
.append(", lastBlock=")
.append(lastBlock);
appendRpcIdsToString(sb, rpcClientId, rpcCallId);
sb.append("]");
return sb.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "PATH", path);
if (penultimateBlock != null) {
FSEditLogOp.blockToXml(contentHandler, penultimateBlock);
}
FSEditLogOp.blockToXml(contentHandler, lastBlock);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.path = st.getValue("PATH");
List<Stanza> blocks = st.getChildren("BLOCK");
int size = blocks.size();
Preconditions.checkState(size == 1 || size == 2);
this.penultimateBlock = size == 2 ?
FSEditLogOp.blockFromXml(blocks.get(0)) : null;
this.lastBlock = FSEditLogOp.blockFromXml(blocks.get(size - 1));
readRpcIdsFromXml(st);
}
}
/**
* {@literal @AtMostOnce} for {@link ClientProtocol#updatePipeline}, but
* {@literal @Idempotent} for some other ops.
*/
static class UpdateBlocksOp extends FSEditLogOp implements BlockListUpdatingOp {
String path;
Block[] blocks;
private UpdateBlocksOp() {
super(OP_UPDATE_BLOCKS);
}
static UpdateBlocksOp getInstance(OpInstanceCache cache) {
return (UpdateBlocksOp)cache.get(OP_UPDATE_BLOCKS);
}
UpdateBlocksOp setPath(String path) {
this.path = path;
return this;
}
@Override
public String getPath() {
return path;
}
UpdateBlocksOp setBlocks(Block[] blocks) {
this.blocks = blocks;
return this;
}
@Override
public Block[] getBlocks() {
return blocks;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeCompactBlockArray(blocks, out);
// clientId and callId
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
path = FSImageSerialization.readString(in);
this.blocks = FSImageSerialization.readCompactBlockArray(
in, logVersion);
readRpcIds(in, logVersion);
}
@Override
public boolean shouldCompleteLastBlock() {
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("UpdateBlocksOp [path=")
.append(path)
.append(", blocks=")
.append(Arrays.toString(blocks));
appendRpcIdsToString(sb, rpcClientId, rpcCallId);
sb.append("]");
return sb.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "PATH", path);
for (Block b : blocks) {
FSEditLogOp.blockToXml(contentHandler, b);
}
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.path = st.getValue("PATH");
List<Stanza> blocks = st.getChildren("BLOCK");
this.blocks = new Block[blocks.size()];
for (int i = 0; i < blocks.size(); i++) {
this.blocks[i] = FSEditLogOp.blockFromXml(blocks.get(i));
}
readRpcIdsFromXml(st);
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#setReplication} */
static class SetReplicationOp extends FSEditLogOp {
String path;
short replication;
private SetReplicationOp() {
super(OP_SET_REPLICATION);
}
static SetReplicationOp getInstance(OpInstanceCache cache) {
return (SetReplicationOp)cache.get(OP_SET_REPLICATION);
}
SetReplicationOp setPath(String path) {
this.path = path;
return this;
}
SetReplicationOp setReplication(short replication) {
this.replication = replication;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeShort(replication, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.path = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.replication = FSImageSerialization.readShort(in);
} else {
this.replication = readShort(in);
}
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetReplicationOp [path=");
builder.append(path);
builder.append(", replication=");
builder.append(replication);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "REPLICATION",
Short.valueOf(replication).toString());
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.path = st.getValue("PATH");
this.replication = Short.valueOf(st.getValue("REPLICATION"));
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#concat} */
static class ConcatDeleteOp extends FSEditLogOp {
int length;
String trg;
String[] srcs;
long timestamp;
final static public int MAX_CONCAT_SRC = 1024 * 1024;
private ConcatDeleteOp() {
super(OP_CONCAT_DELETE);
}
static ConcatDeleteOp getInstance(OpInstanceCache cache) {
return (ConcatDeleteOp)cache.get(OP_CONCAT_DELETE);
}
ConcatDeleteOp setTarget(String trg) {
this.trg = trg;
return this;
}
ConcatDeleteOp setSources(String[] srcs) {
if (srcs.length > MAX_CONCAT_SRC) {
throw new RuntimeException("ConcatDeleteOp can only have " +
MAX_CONCAT_SRC + " sources at most.");
}
this.srcs = srcs;
return this;
}
ConcatDeleteOp setTimestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(trg, out);
DeprecatedUTF8 info[] = new DeprecatedUTF8[srcs.length];
int idx = 0;
for(int i=0; i<srcs.length; i++) {
info[idx++] = new DeprecatedUTF8(srcs[i]);
}
new ArrayWritable(DeprecatedUTF8.class, info).write(out);
FSImageSerialization.writeLong(timestamp, out);
// rpc ids
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
if (length < 3) { // trg, srcs.., timestamp
throw new IOException("Incorrect data format " +
"for ConcatDeleteOp.");
}
}
this.trg = FSImageSerialization.readString(in);
int srcSize = 0;
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
srcSize = in.readInt();
} else {
srcSize = this.length - 1 - 1; // trg and timestamp
}
if (srcSize < 0) {
throw new IOException("Incorrect data format. "
+ "ConcatDeleteOp cannot have a negative number of data " +
" sources.");
} else if (srcSize > MAX_CONCAT_SRC) {
throw new IOException("Incorrect data format. "
+ "ConcatDeleteOp can have at most " + MAX_CONCAT_SRC +
" sources, but we tried to have " + (length - 3) + " sources.");
}
this.srcs = new String [srcSize];
for(int i=0; i<srcSize;i++) {
srcs[i]= FSImageSerialization.readString(in);
}
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.timestamp = FSImageSerialization.readLong(in);
} else {
this.timestamp = readLong(in);
}
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ConcatDeleteOp [length=");
builder.append(length);
builder.append(", trg=");
builder.append(trg);
builder.append(", srcs=");
builder.append(Arrays.toString(srcs));
builder.append(", timestamp=");
builder.append(timestamp);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "TRG", trg);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.toString(timestamp));
contentHandler.startElement("", "", "SOURCES", new AttributesImpl());
for (int i = 0; i < srcs.length; ++i) {
XMLUtils.addSaxString(contentHandler,
"SOURCE" + (i + 1), srcs[i]);
}
contentHandler.endElement("", "", "SOURCES");
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.trg = st.getValue("TRG");
this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
List<Stanza> sources = st.getChildren("SOURCES");
int i = 0;
while (true) {
if (!sources.get(0).hasChildren("SOURCE" + (i + 1)))
break;
i++;
}
srcs = new String[i];
for (i = 0; i < srcs.length; i++) {
srcs[i] = sources.get(0).getValue("SOURCE" + (i + 1));
}
readRpcIdsFromXml(st);
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#rename} */
static class RenameOldOp extends FSEditLogOp {
int length;
String src;
String dst;
long timestamp;
private RenameOldOp() {
super(OP_RENAME_OLD);
}
static RenameOldOp getInstance(OpInstanceCache cache) {
return (RenameOldOp)cache.get(OP_RENAME_OLD);
}
RenameOldOp setSource(String src) {
this.src = src;
return this;
}
RenameOldOp setDestination(String dst) {
this.dst = dst;
return this;
}
RenameOldOp setTimestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(src, out);
FSImageSerialization.writeString(dst, out);
FSImageSerialization.writeLong(timestamp, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
if (this.length != 3) {
throw new IOException("Incorrect data format. "
+ "Old rename operation.");
}
}
this.src = FSImageSerialization.readString(in);
this.dst = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.timestamp = FSImageSerialization.readLong(in);
} else {
this.timestamp = readLong(in);
}
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RenameOldOp [length=");
builder.append(length);
builder.append(", src=");
builder.append(src);
builder.append(", dst=");
builder.append(dst);
builder.append(", timestamp=");
builder.append(timestamp);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "DST", dst);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.toString(timestamp));
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.src = st.getValue("SRC");
this.dst = st.getValue("DST");
this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
readRpcIdsFromXml(st);
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#delete} */
static class DeleteOp extends FSEditLogOp {
int length;
String path;
long timestamp;
private DeleteOp() {
super(OP_DELETE);
}
static DeleteOp getInstance(OpInstanceCache cache) {
return (DeleteOp)cache.get(OP_DELETE);
}
DeleteOp setPath(String path) {
this.path = path;
return this;
}
DeleteOp setTimestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeLong(timestamp, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
if (this.length != 2) {
throw new IOException("Incorrect data format. " + "delete operation.");
}
}
this.path = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.timestamp = FSImageSerialization.readLong(in);
} else {
this.timestamp = readLong(in);
}
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DeleteOp [length=");
builder.append(length);
builder.append(", path=");
builder.append(path);
builder.append(", timestamp=");
builder.append(timestamp);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.toString(timestamp));
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.path = st.getValue("PATH");
this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
readRpcIdsFromXml(st);
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#mkdirs} */
static class MkdirOp extends FSEditLogOp {
int length;
long inodeId;
String path;
long timestamp;
PermissionStatus permissions;
List<AclEntry> aclEntries;
List<XAttr> xAttrs;
private MkdirOp() {
super(OP_MKDIR);
}
static MkdirOp getInstance(OpInstanceCache cache) {
return (MkdirOp)cache.get(OP_MKDIR);
}
MkdirOp reset() {
this.aclEntries = null;
this.xAttrs = null;
return this;
}
MkdirOp setInodeId(long inodeId) {
this.inodeId = inodeId;
return this;
}
MkdirOp setPath(String path) {
this.path = path;
return this;
}
MkdirOp setTimestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
MkdirOp setPermissionStatus(PermissionStatus permissions) {
this.permissions = permissions;
return this;
}
MkdirOp setAclEntries(List<AclEntry> aclEntries) {
this.aclEntries = aclEntries;
return this;
}
MkdirOp setXAttrs(List<XAttr> xAttrs) {
this.xAttrs = xAttrs;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(inodeId, out);
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeLong(timestamp, out); // mtime
FSImageSerialization.writeLong(timestamp, out); // atime, unused at this
permissions.write(out);
AclEditLogUtil.write(aclEntries, out);
XAttrEditLogProto.Builder b = XAttrEditLogProto.newBuilder();
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
b.build().writeDelimitedTo(out);
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
}
if (-17 < logVersion && length != 2 ||
logVersion <= -17 && length != 3
&& !NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
throw new IOException("Incorrect data format. Mkdir operation.");
}
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.ADD_INODE_ID, logVersion)) {
this.inodeId = FSImageSerialization.readLong(in);
} else {
// This id should be updated when this editLogOp is applied
this.inodeId = INodeId.GRANDFATHER_INODE_ID;
}
this.path = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.timestamp = FSImageSerialization.readLong(in);
} else {
this.timestamp = readLong(in);
}
// The disk format stores atimes for directories as well.
// However, currently this is not being updated/used because of
// performance reasons.
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.FILE_ACCESS_TIME, logVersion)) {
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
FSImageSerialization.readLong(in);
} else {
readLong(in);
}
}
this.permissions = PermissionStatus.read(in);
aclEntries = AclEditLogUtil.read(in, logVersion);
xAttrs = readXAttrsFromEditLog(in, logVersion);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("MkdirOp [length=");
builder.append(length);
builder.append(", inodeId=");
builder.append(inodeId);
builder.append(", path=");
builder.append(path);
builder.append(", timestamp=");
builder.append(timestamp);
builder.append(", permissions=");
builder.append(permissions);
builder.append(", aclEntries=");
builder.append(aclEntries);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append(", xAttrs=");
builder.append(xAttrs);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "INODEID",
Long.toString(inodeId));
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.toString(timestamp));
FSEditLogOp.permissionStatusToXml(contentHandler, permissions);
if (aclEntries != null) {
appendAclEntriesToXml(contentHandler, aclEntries);
}
if (xAttrs != null) {
appendXAttrsToXml(contentHandler, xAttrs);
}
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.inodeId = Long.parseLong(st.getValue("INODEID"));
this.path = st.getValue("PATH");
this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
this.permissions = permissionStatusFromXml(st);
aclEntries = readAclEntriesFromXml(st);
xAttrs = readXAttrsFromXml(st);
}
}
/**
* The corresponding operations are either {@literal @Idempotent} (
* {@link ClientProtocol#updateBlockForPipeline},
* {@link ClientProtocol#recoverLease}, {@link ClientProtocol#addBlock}) or
* already bound with other editlog op which records rpc ids (
* {@link ClientProtocol#startFile}). Thus no need to record rpc ids here.
*/
static class SetGenstampV1Op extends FSEditLogOp {
long genStampV1;
private SetGenstampV1Op() {
super(OP_SET_GENSTAMP_V1);
}
static SetGenstampV1Op getInstance(OpInstanceCache cache) {
return (SetGenstampV1Op)cache.get(OP_SET_GENSTAMP_V1);
}
SetGenstampV1Op setGenerationStamp(long genStamp) {
this.genStampV1 = genStamp;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(genStampV1, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.genStampV1 = FSImageSerialization.readLong(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetGenstampOp [GenStamp=");
builder.append(genStampV1);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "GENSTAMP",
Long.toString(genStampV1));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.genStampV1 = Long.parseLong(st.getValue("GENSTAMP"));
}
}
/** Similar with {@link SetGenstampV1Op} */
static class SetGenstampV2Op extends FSEditLogOp {
long genStampV2;
private SetGenstampV2Op() {
super(OP_SET_GENSTAMP_V2);
}
static SetGenstampV2Op getInstance(OpInstanceCache cache) {
return (SetGenstampV2Op)cache.get(OP_SET_GENSTAMP_V2);
}
SetGenstampV2Op setGenerationStamp(long genStamp) {
this.genStampV2 = genStamp;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(genStampV2, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.genStampV2 = FSImageSerialization.readLong(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetGenstampV2Op [GenStampV2=");
builder.append(genStampV2);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "GENSTAMPV2",
Long.toString(genStampV2));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.genStampV2 = Long.parseLong(st.getValue("GENSTAMPV2"));
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#addBlock} */
static class AllocateBlockIdOp extends FSEditLogOp {
long blockId;
private AllocateBlockIdOp() {
super(OP_ALLOCATE_BLOCK_ID);
}
static AllocateBlockIdOp getInstance(OpInstanceCache cache) {
return (AllocateBlockIdOp)cache.get(OP_ALLOCATE_BLOCK_ID);
}
AllocateBlockIdOp setBlockId(long blockId) {
this.blockId = blockId;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(blockId, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.blockId = FSImageSerialization.readLong(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AllocateBlockIdOp [blockId=");
builder.append(blockId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "BLOCK_ID",
Long.toString(blockId));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.blockId = Long.parseLong(st.getValue("BLOCK_ID"));
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#setPermission} */
static class SetPermissionsOp extends FSEditLogOp {
String src;
FsPermission permissions;
private SetPermissionsOp() {
super(OP_SET_PERMISSIONS);
}
static SetPermissionsOp getInstance(OpInstanceCache cache) {
return (SetPermissionsOp)cache.get(OP_SET_PERMISSIONS);
}
SetPermissionsOp setSource(String src) {
this.src = src;
return this;
}
SetPermissionsOp setPermissions(FsPermission permissions) {
this.permissions = permissions;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(src, out);
permissions.write(out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.src = FSImageSerialization.readString(in);
this.permissions = FsPermission.read(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetPermissionsOp [src=");
builder.append(src);
builder.append(", permissions=");
builder.append(permissions);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "MODE",
Short.valueOf(permissions.toShort()).toString());
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC");
this.permissions = new FsPermission(
Short.valueOf(st.getValue("MODE")));
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#setOwner} */
static class SetOwnerOp extends FSEditLogOp {
String src;
String username;
String groupname;
private SetOwnerOp() {
super(OP_SET_OWNER);
}
static SetOwnerOp getInstance(OpInstanceCache cache) {
return (SetOwnerOp)cache.get(OP_SET_OWNER);
}
SetOwnerOp setSource(String src) {
this.src = src;
return this;
}
SetOwnerOp setUser(String username) {
this.username = username;
return this;
}
SetOwnerOp setGroup(String groupname) {
this.groupname = groupname;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(src, out);
FSImageSerialization.writeString(username == null ? "" : username, out);
FSImageSerialization.writeString(groupname == null ? "" : groupname, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.src = FSImageSerialization.readString(in);
this.username = FSImageSerialization.readString_EmptyAsNull(in);
this.groupname = FSImageSerialization.readString_EmptyAsNull(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetOwnerOp [src=");
builder.append(src);
builder.append(", username=");
builder.append(username);
builder.append(", groupname=");
builder.append(groupname);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
if (username != null) {
XMLUtils.addSaxString(contentHandler, "USERNAME", username);
}
if (groupname != null) {
XMLUtils.addSaxString(contentHandler, "GROUPNAME", groupname);
}
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC");
this.username = (st.hasChildren("USERNAME")) ?
st.getValue("USERNAME") : null;
this.groupname = (st.hasChildren("GROUPNAME")) ?
st.getValue("GROUPNAME") : null;
}
}
static class SetNSQuotaOp extends FSEditLogOp {
String src;
long nsQuota;
private SetNSQuotaOp() {
super(OP_SET_NS_QUOTA);
}
static SetNSQuotaOp getInstance(OpInstanceCache cache) {
return (SetNSQuotaOp)cache.get(OP_SET_NS_QUOTA);
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
throw new IOException("Deprecated");
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.src = FSImageSerialization.readString(in);
this.nsQuota = FSImageSerialization.readLong(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetNSQuotaOp [src=");
builder.append(src);
builder.append(", nsQuota=");
builder.append(nsQuota);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "NSQUOTA",
Long.toString(nsQuota));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC");
this.nsQuota = Long.parseLong(st.getValue("NSQUOTA"));
}
}
static class ClearNSQuotaOp extends FSEditLogOp {
String src;
private ClearNSQuotaOp() {
super(OP_CLEAR_NS_QUOTA);
}
static ClearNSQuotaOp getInstance(OpInstanceCache cache) {
return (ClearNSQuotaOp)cache.get(OP_CLEAR_NS_QUOTA);
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
throw new IOException("Deprecated");
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.src = FSImageSerialization.readString(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ClearNSQuotaOp [src=");
builder.append(src);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC");
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#setQuota} */
static class SetQuotaOp extends FSEditLogOp {
String src;
long nsQuota;
long dsQuota;
private SetQuotaOp() {
super(OP_SET_QUOTA);
}
static SetQuotaOp getInstance(OpInstanceCache cache) {
return (SetQuotaOp)cache.get(OP_SET_QUOTA);
}
SetQuotaOp setSource(String src) {
this.src = src;
return this;
}
SetQuotaOp setNSQuota(long nsQuota) {
this.nsQuota = nsQuota;
return this;
}
SetQuotaOp setDSQuota(long dsQuota) {
this.dsQuota = dsQuota;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(src, out);
FSImageSerialization.writeLong(nsQuota, out);
FSImageSerialization.writeLong(dsQuota, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.src = FSImageSerialization.readString(in);
this.nsQuota = FSImageSerialization.readLong(in);
this.dsQuota = FSImageSerialization.readLong(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetQuotaOp [src=");
builder.append(src);
builder.append(", nsQuota=");
builder.append(nsQuota);
builder.append(", dsQuota=");
builder.append(dsQuota);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "NSQUOTA",
Long.toString(nsQuota));
XMLUtils.addSaxString(contentHandler, "DSQUOTA",
Long.toString(dsQuota));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.src = st.getValue("SRC");
this.nsQuota = Long.parseLong(st.getValue("NSQUOTA"));
this.dsQuota = Long.parseLong(st.getValue("DSQUOTA"));
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#setTimes} */
static class TimesOp extends FSEditLogOp {
int length;
String path;
long mtime;
long atime;
private TimesOp() {
super(OP_TIMES);
}
static TimesOp getInstance(OpInstanceCache cache) {
return (TimesOp)cache.get(OP_TIMES);
}
TimesOp setPath(String path) {
this.path = path;
return this;
}
TimesOp setModificationTime(long mtime) {
this.mtime = mtime;
return this;
}
TimesOp setAccessTime(long atime) {
this.atime = atime;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeLong(mtime, out);
FSImageSerialization.writeLong(atime, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
if (length != 3) {
throw new IOException("Incorrect data format. " + "times operation.");
}
}
this.path = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.mtime = FSImageSerialization.readLong(in);
this.atime = FSImageSerialization.readLong(in);
} else {
this.mtime = readLong(in);
this.atime = readLong(in);
}
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("TimesOp [length=");
builder.append(length);
builder.append(", path=");
builder.append(path);
builder.append(", mtime=");
builder.append(mtime);
builder.append(", atime=");
builder.append(atime);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "MTIME",
Long.toString(mtime));
XMLUtils.addSaxString(contentHandler, "ATIME",
Long.toString(atime));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.path = st.getValue("PATH");
this.mtime = Long.parseLong(st.getValue("MTIME"));
this.atime = Long.parseLong(st.getValue("ATIME"));
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#createSymlink} */
static class SymlinkOp extends FSEditLogOp {
int length;
long inodeId;
String path;
String value;
long mtime;
long atime;
PermissionStatus permissionStatus;
private SymlinkOp() {
super(OP_SYMLINK);
}
static SymlinkOp getInstance(OpInstanceCache cache) {
return (SymlinkOp)cache.get(OP_SYMLINK);
}
SymlinkOp setId(long inodeId) {
this.inodeId = inodeId;
return this;
}
SymlinkOp setPath(String path) {
this.path = path;
return this;
}
SymlinkOp setValue(String value) {
this.value = value;
return this;
}
SymlinkOp setModificationTime(long mtime) {
this.mtime = mtime;
return this;
}
SymlinkOp setAccessTime(long atime) {
this.atime = atime;
return this;
}
SymlinkOp setPermissionStatus(PermissionStatus permissionStatus) {
this.permissionStatus = permissionStatus;
return this;
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(inodeId, out);
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeString(value, out);
FSImageSerialization.writeLong(mtime, out);
FSImageSerialization.writeLong(atime, out);
permissionStatus.write(out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
if (this.length != 4) {
throw new IOException("Incorrect data format. "
+ "symlink operation.");
}
}
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.ADD_INODE_ID, logVersion)) {
this.inodeId = FSImageSerialization.readLong(in);
} else {
// This id should be updated when the editLogOp is applied
this.inodeId = INodeId.GRANDFATHER_INODE_ID;
}
this.path = FSImageSerialization.readString(in);
this.value = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.mtime = FSImageSerialization.readLong(in);
this.atime = FSImageSerialization.readLong(in);
} else {
this.mtime = readLong(in);
this.atime = readLong(in);
}
this.permissionStatus = PermissionStatus.read(in);
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SymlinkOp [length=");
builder.append(length);
builder.append(", inodeId=");
builder.append(inodeId);
builder.append(", path=");
builder.append(path);
builder.append(", value=");
builder.append(value);
builder.append(", mtime=");
builder.append(mtime);
builder.append(", atime=");
builder.append(atime);
builder.append(", permissionStatus=");
builder.append(permissionStatus);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "INODEID",
Long.toString(inodeId));
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "VALUE", value);
XMLUtils.addSaxString(contentHandler, "MTIME",
Long.toString(mtime));
XMLUtils.addSaxString(contentHandler, "ATIME",
Long.toString(atime));
FSEditLogOp.permissionStatusToXml(contentHandler, permissionStatus);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.inodeId = Long.parseLong(st.getValue("INODEID"));
this.path = st.getValue("PATH");
this.value = st.getValue("VALUE");
this.mtime = Long.parseLong(st.getValue("MTIME"));
this.atime = Long.parseLong(st.getValue("ATIME"));
this.permissionStatus = permissionStatusFromXml(st);
readRpcIdsFromXml(st);
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#rename2} */
static class RenameOp extends FSEditLogOp {
int length;
String src;
String dst;
long timestamp;
Rename[] options;
private RenameOp() {
super(OP_RENAME);
}
static RenameOp getInstance(OpInstanceCache cache) {
return (RenameOp)cache.get(OP_RENAME);
}
RenameOp setSource(String src) {
this.src = src;
return this;
}
RenameOp setDestination(String dst) {
this.dst = dst;
return this;
}
RenameOp setTimestamp(long timestamp) {
this.timestamp = timestamp;
return this;
}
RenameOp setOptions(Rename[] options) {
this.options = options;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(src, out);
FSImageSerialization.writeString(dst, out);
FSImageSerialization.writeLong(timestamp, out);
toBytesWritable(options).write(out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
if (this.length != 3) {
throw new IOException("Incorrect data format. " + "Rename operation.");
}
}
this.src = FSImageSerialization.readString(in);
this.dst = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.timestamp = FSImageSerialization.readLong(in);
} else {
this.timestamp = readLong(in);
}
this.options = readRenameOptions(in);
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
private static Rename[] readRenameOptions(DataInputStream in) throws IOException {
BytesWritable writable = new BytesWritable();
writable.readFields(in);
byte[] bytes = writable.getBytes();
Rename[] options = new Rename[bytes.length];
for (int i = 0; i < bytes.length; i++) {
options[i] = Rename.valueOf(bytes[i]);
}
return options;
}
static BytesWritable toBytesWritable(Rename... options) {
byte[] bytes = new byte[options.length];
for (int i = 0; i < options.length; i++) {
bytes[i] = options[i].value();
}
return new BytesWritable(bytes);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RenameOp [length=");
builder.append(length);
builder.append(", src=");
builder.append(src);
builder.append(", dst=");
builder.append(dst);
builder.append(", timestamp=");
builder.append(timestamp);
builder.append(", options=");
builder.append(Arrays.toString(options));
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LENGTH",
Integer.toString(length));
XMLUtils.addSaxString(contentHandler, "SRC", src);
XMLUtils.addSaxString(contentHandler, "DST", dst);
XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
Long.toString(timestamp));
StringBuilder bld = new StringBuilder();
String prefix = "";
for (Rename r : options) {
bld.append(prefix).append(r.toString());
prefix = "|";
}
XMLUtils.addSaxString(contentHandler, "OPTIONS", bld.toString());
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.src = st.getValue("SRC");
this.dst = st.getValue("DST");
this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
String opts = st.getValue("OPTIONS");
String o[] = opts.split("\\|");
this.options = new Rename[o.length];
for (int i = 0; i < o.length; i++) {
if (o[i].equals(""))
continue;
try {
this.options[i] = Rename.valueOf(o[i]);
} finally {
if (this.options[i] == null) {
System.err.println("error parsing Rename value: \"" + o[i] + "\"");
}
}
}
readRpcIdsFromXml(st);
}
}
/**
* {@literal @Idempotent} for {@link ClientProtocol#recoverLease}. In the
* meanwhile, startFile and appendFile both have their own corresponding
* editlog op.
*/
static class ReassignLeaseOp extends FSEditLogOp {
String leaseHolder;
String path;
String newHolder;
private ReassignLeaseOp() {
super(OP_REASSIGN_LEASE);
}
static ReassignLeaseOp getInstance(OpInstanceCache cache) {
return (ReassignLeaseOp)cache.get(OP_REASSIGN_LEASE);
}
ReassignLeaseOp setLeaseHolder(String leaseHolder) {
this.leaseHolder = leaseHolder;
return this;
}
ReassignLeaseOp setPath(String path) {
this.path = path;
return this;
}
ReassignLeaseOp setNewHolder(String newHolder) {
this.newHolder = newHolder;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(leaseHolder, out);
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeString(newHolder, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.leaseHolder = FSImageSerialization.readString(in);
this.path = FSImageSerialization.readString(in);
this.newHolder = FSImageSerialization.readString(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ReassignLeaseOp [leaseHolder=");
builder.append(leaseHolder);
builder.append(", path=");
builder.append(path);
builder.append(", newHolder=");
builder.append(newHolder);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "LEASEHOLDER", leaseHolder);
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "NEWHOLDER", newHolder);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.leaseHolder = st.getValue("LEASEHOLDER");
this.path = st.getValue("PATH");
this.newHolder = st.getValue("NEWHOLDER");
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#getDelegationToken} */
static class GetDelegationTokenOp extends FSEditLogOp {
DelegationTokenIdentifier token;
long expiryTime;
private GetDelegationTokenOp() {
super(OP_GET_DELEGATION_TOKEN);
}
static GetDelegationTokenOp getInstance(OpInstanceCache cache) {
return (GetDelegationTokenOp)cache.get(OP_GET_DELEGATION_TOKEN);
}
GetDelegationTokenOp setDelegationTokenIdentifier(
DelegationTokenIdentifier token) {
this.token = token;
return this;
}
GetDelegationTokenOp setExpiryTime(long expiryTime) {
this.expiryTime = expiryTime;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
token.write(out);
FSImageSerialization.writeLong(expiryTime, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.token = new DelegationTokenIdentifier();
this.token.readFields(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.expiryTime = FSImageSerialization.readLong(in);
} else {
this.expiryTime = readLong(in);
}
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GetDelegationTokenOp [token=");
builder.append(token);
builder.append(", expiryTime=");
builder.append(expiryTime);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSEditLogOp.delegationTokenToXml(contentHandler, token);
XMLUtils.addSaxString(contentHandler, "EXPIRY_TIME",
Long.toString(expiryTime));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.token = delegationTokenFromXml(st.getChildren(
"DELEGATION_TOKEN_IDENTIFIER").get(0));
this.expiryTime = Long.parseLong(st.getValue("EXPIRY_TIME"));
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#renewDelegationToken} */
static class RenewDelegationTokenOp extends FSEditLogOp {
DelegationTokenIdentifier token;
long expiryTime;
private RenewDelegationTokenOp() {
super(OP_RENEW_DELEGATION_TOKEN);
}
static RenewDelegationTokenOp getInstance(OpInstanceCache cache) {
return (RenewDelegationTokenOp)cache.get(OP_RENEW_DELEGATION_TOKEN);
}
RenewDelegationTokenOp setDelegationTokenIdentifier(
DelegationTokenIdentifier token) {
this.token = token;
return this;
}
RenewDelegationTokenOp setExpiryTime(long expiryTime) {
this.expiryTime = expiryTime;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
token.write(out);
FSImageSerialization.writeLong(expiryTime, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.token = new DelegationTokenIdentifier();
this.token.readFields(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.expiryTime = FSImageSerialization.readLong(in);
} else {
this.expiryTime = readLong(in);
}
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RenewDelegationTokenOp [token=");
builder.append(token);
builder.append(", expiryTime=");
builder.append(expiryTime);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSEditLogOp.delegationTokenToXml(contentHandler, token);
XMLUtils.addSaxString(contentHandler, "EXPIRY_TIME",
Long.toString(expiryTime));
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.token = delegationTokenFromXml(st.getChildren(
"DELEGATION_TOKEN_IDENTIFIER").get(0));
this.expiryTime = Long.parseLong(st.getValue("EXPIRY_TIME"));
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#cancelDelegationToken} */
static class CancelDelegationTokenOp extends FSEditLogOp {
DelegationTokenIdentifier token;
private CancelDelegationTokenOp() {
super(OP_CANCEL_DELEGATION_TOKEN);
}
static CancelDelegationTokenOp getInstance(OpInstanceCache cache) {
return (CancelDelegationTokenOp)cache.get(OP_CANCEL_DELEGATION_TOKEN);
}
CancelDelegationTokenOp setDelegationTokenIdentifier(
DelegationTokenIdentifier token) {
this.token = token;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
token.write(out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.token = new DelegationTokenIdentifier();
this.token.readFields(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CancelDelegationTokenOp [token=");
builder.append(token);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSEditLogOp.delegationTokenToXml(contentHandler, token);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.token = delegationTokenFromXml(st.getChildren(
"DELEGATION_TOKEN_IDENTIFIER").get(0));
}
}
static class UpdateMasterKeyOp extends FSEditLogOp {
DelegationKey key;
private UpdateMasterKeyOp() {
super(OP_UPDATE_MASTER_KEY);
}
static UpdateMasterKeyOp getInstance(OpInstanceCache cache) {
return (UpdateMasterKeyOp)cache.get(OP_UPDATE_MASTER_KEY);
}
UpdateMasterKeyOp setDelegationKey(DelegationKey key) {
this.key = key;
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
key.write(out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.key = new DelegationKey();
this.key.readFields(in);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("UpdateMasterKeyOp [key=");
builder.append(key);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSEditLogOp.delegationKeyToXml(contentHandler, key);
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.key = delegationKeyFromXml(st.getChildren(
"DELEGATION_KEY").get(0));
}
}
static class LogSegmentOp extends FSEditLogOp {
private LogSegmentOp(FSEditLogOpCodes code) {
super(code);
assert code == OP_START_LOG_SEGMENT ||
code == OP_END_LOG_SEGMENT : "Bad op: " + code;
}
static LogSegmentOp getInstance(OpInstanceCache cache,
FSEditLogOpCodes code) {
return (LogSegmentOp)cache.get(code);
}
@Override
public void readFields(DataInputStream in, int logVersion)
throws IOException {
// no data stored in these ops yet
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
// no data stored
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("LogSegmentOp [opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
// no data stored
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
// do nothing
}
}
static class InvalidOp extends FSEditLogOp {
private InvalidOp() {
super(OP_INVALID);
}
static InvalidOp getInstance(OpInstanceCache cache) {
return (InvalidOp)cache.get(OP_INVALID);
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
// nothing to read
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("InvalidOp [opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
// no data stored
}
@Override void fromXml(Stanza st) throws InvalidXmlException {
// do nothing
}
}
/**
* Operation corresponding to creating a snapshot.
* {@literal @AtMostOnce} for {@link ClientProtocol#createSnapshot}.
*/
static class CreateSnapshotOp extends FSEditLogOp {
String snapshotRoot;
String snapshotName;
public CreateSnapshotOp() {
super(OP_CREATE_SNAPSHOT);
}
static CreateSnapshotOp getInstance(OpInstanceCache cache) {
return (CreateSnapshotOp)cache.get(OP_CREATE_SNAPSHOT);
}
CreateSnapshotOp setSnapshotName(String snapName) {
this.snapshotName = snapName;
return this;
}
public CreateSnapshotOp setSnapshotRoot(String snapRoot) {
snapshotRoot = snapRoot;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
snapshotRoot = FSImageSerialization.readString(in);
snapshotName = FSImageSerialization.readString(in);
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(snapshotRoot, out);
FSImageSerialization.writeString(snapshotName, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
XMLUtils.addSaxString(contentHandler, "SNAPSHOTNAME", snapshotName);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
snapshotRoot = st.getValue("SNAPSHOTROOT");
snapshotName = st.getValue("SNAPSHOTNAME");
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("CreateSnapshotOp [snapshotRoot=");
builder.append(snapshotRoot);
builder.append(", snapshotName=");
builder.append(snapshotName);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/**
* Operation corresponding to delete a snapshot.
* {@literal @AtMostOnce} for {@link ClientProtocol#deleteSnapshot}.
*/
static class DeleteSnapshotOp extends FSEditLogOp {
String snapshotRoot;
String snapshotName;
DeleteSnapshotOp() {
super(OP_DELETE_SNAPSHOT);
}
static DeleteSnapshotOp getInstance(OpInstanceCache cache) {
return (DeleteSnapshotOp)cache.get(OP_DELETE_SNAPSHOT);
}
DeleteSnapshotOp setSnapshotName(String snapName) {
this.snapshotName = snapName;
return this;
}
DeleteSnapshotOp setSnapshotRoot(String snapRoot) {
snapshotRoot = snapRoot;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
snapshotRoot = FSImageSerialization.readString(in);
snapshotName = FSImageSerialization.readString(in);
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(snapshotRoot, out);
FSImageSerialization.writeString(snapshotName, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
XMLUtils.addSaxString(contentHandler, "SNAPSHOTNAME", snapshotName);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
snapshotRoot = st.getValue("SNAPSHOTROOT");
snapshotName = st.getValue("SNAPSHOTNAME");
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DeleteSnapshotOp [snapshotRoot=");
builder.append(snapshotRoot);
builder.append(", snapshotName=");
builder.append(snapshotName);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/**
* Operation corresponding to rename a snapshot.
* {@literal @AtMostOnce} for {@link ClientProtocol#renameSnapshot}.
*/
static class RenameSnapshotOp extends FSEditLogOp {
String snapshotRoot;
String snapshotOldName;
String snapshotNewName;
RenameSnapshotOp() {
super(OP_RENAME_SNAPSHOT);
}
static RenameSnapshotOp getInstance(OpInstanceCache cache) {
return (RenameSnapshotOp) cache.get(OP_RENAME_SNAPSHOT);
}
RenameSnapshotOp setSnapshotOldName(String snapshotOldName) {
this.snapshotOldName = snapshotOldName;
return this;
}
RenameSnapshotOp setSnapshotNewName(String snapshotNewName) {
this.snapshotNewName = snapshotNewName;
return this;
}
RenameSnapshotOp setSnapshotRoot(String snapshotRoot) {
this.snapshotRoot = snapshotRoot;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
snapshotRoot = FSImageSerialization.readString(in);
snapshotOldName = FSImageSerialization.readString(in);
snapshotNewName = FSImageSerialization.readString(in);
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(snapshotRoot, out);
FSImageSerialization.writeString(snapshotOldName, out);
FSImageSerialization.writeString(snapshotNewName, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
XMLUtils.addSaxString(contentHandler, "SNAPSHOTOLDNAME", snapshotOldName);
XMLUtils.addSaxString(contentHandler, "SNAPSHOTNEWNAME", snapshotNewName);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
snapshotRoot = st.getValue("SNAPSHOTROOT");
snapshotOldName = st.getValue("SNAPSHOTOLDNAME");
snapshotNewName = st.getValue("SNAPSHOTNEWNAME");
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RenameSnapshotOp [snapshotRoot=");
builder.append(snapshotRoot);
builder.append(", snapshotOldName=");
builder.append(snapshotOldName);
builder.append(", snapshotNewName=");
builder.append(snapshotNewName);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/**
* Operation corresponding to allow creating snapshot on a directory
*/
static class AllowSnapshotOp extends FSEditLogOp { // @Idempotent
String snapshotRoot;
public AllowSnapshotOp() {
super(OP_ALLOW_SNAPSHOT);
}
public AllowSnapshotOp(String snapRoot) {
super(OP_ALLOW_SNAPSHOT);
snapshotRoot = snapRoot;
}
static AllowSnapshotOp getInstance(OpInstanceCache cache) {
return (AllowSnapshotOp) cache.get(OP_ALLOW_SNAPSHOT);
}
public AllowSnapshotOp setSnapshotRoot(String snapRoot) {
snapshotRoot = snapRoot;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
snapshotRoot = FSImageSerialization.readString(in);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(snapshotRoot, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
snapshotRoot = st.getValue("SNAPSHOTROOT");
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AllowSnapshotOp [snapshotRoot=");
builder.append(snapshotRoot);
builder.append("]");
return builder.toString();
}
}
/**
* Operation corresponding to disallow creating snapshot on a directory
*/
static class DisallowSnapshotOp extends FSEditLogOp { // @Idempotent
String snapshotRoot;
public DisallowSnapshotOp() {
super(OP_DISALLOW_SNAPSHOT);
}
public DisallowSnapshotOp(String snapRoot) {
super(OP_DISALLOW_SNAPSHOT);
snapshotRoot = snapRoot;
}
static DisallowSnapshotOp getInstance(OpInstanceCache cache) {
return (DisallowSnapshotOp) cache.get(OP_DISALLOW_SNAPSHOT);
}
public DisallowSnapshotOp setSnapshotRoot(String snapRoot) {
snapshotRoot = snapRoot;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
snapshotRoot = FSImageSerialization.readString(in);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(snapshotRoot, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
snapshotRoot = st.getValue("SNAPSHOTROOT");
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DisallowSnapshotOp [snapshotRoot=");
builder.append(snapshotRoot);
builder.append("]");
return builder.toString();
}
}
/**
* {@literal @AtMostOnce} for
* {@link ClientProtocol#addCacheDirective}
*/
static class AddCacheDirectiveInfoOp extends FSEditLogOp {
CacheDirectiveInfo directive;
public AddCacheDirectiveInfoOp() {
super(OP_ADD_CACHE_DIRECTIVE);
}
static AddCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (AddCacheDirectiveInfoOp) cache
.get(OP_ADD_CACHE_DIRECTIVE);
}
public AddCacheDirectiveInfoOp setDirective(
CacheDirectiveInfo directive) {
this.directive = directive;
assert(directive.getId() != null);
assert(directive.getPath() != null);
assert(directive.getReplication() != null);
assert(directive.getPool() != null);
assert(directive.getExpiration() != null);
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
directive = FSImageSerialization.readCacheDirectiveInfo(in);
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeCacheDirectiveInfo(out, directive);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSImageSerialization.writeCacheDirectiveInfo(contentHandler, directive);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
directive = FSImageSerialization.readCacheDirectiveInfo(st);
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AddCacheDirectiveInfo [");
builder.append("id=" + directive.getId() + ",");
builder.append("path=" + directive.getPath().toUri().getPath() + ",");
builder.append("replication=" + directive.getReplication() + ",");
builder.append("pool=" + directive.getPool() + ",");
builder.append("expiration=" + directive.getExpiration().getMillis());
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/**
* {@literal @AtMostOnce} for
* {@link ClientProtocol#modifyCacheDirective}
*/
static class ModifyCacheDirectiveInfoOp extends FSEditLogOp {
CacheDirectiveInfo directive;
public ModifyCacheDirectiveInfoOp() {
super(OP_MODIFY_CACHE_DIRECTIVE);
}
static ModifyCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (ModifyCacheDirectiveInfoOp) cache
.get(OP_MODIFY_CACHE_DIRECTIVE);
}
public ModifyCacheDirectiveInfoOp setDirective(
CacheDirectiveInfo directive) {
this.directive = directive;
assert(directive.getId() != null);
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
this.directive = FSImageSerialization.readCacheDirectiveInfo(in);
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeCacheDirectiveInfo(out, directive);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSImageSerialization.writeCacheDirectiveInfo(contentHandler, directive);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.directive = FSImageSerialization.readCacheDirectiveInfo(st);
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ModifyCacheDirectiveInfoOp[");
builder.append("id=").append(directive.getId());
if (directive.getPath() != null) {
builder.append(",").append("path=").append(directive.getPath());
}
if (directive.getReplication() != null) {
builder.append(",").append("replication=").
append(directive.getReplication());
}
if (directive.getPool() != null) {
builder.append(",").append("pool=").append(directive.getPool());
}
if (directive.getExpiration() != null) {
builder.append(",").append("expiration=").
append(directive.getExpiration().getMillis());
}
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/**
* {@literal @AtMostOnce} for
* {@link ClientProtocol#removeCacheDirective}
*/
static class RemoveCacheDirectiveInfoOp extends FSEditLogOp {
long id;
public RemoveCacheDirectiveInfoOp() {
super(OP_REMOVE_CACHE_DIRECTIVE);
}
static RemoveCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (RemoveCacheDirectiveInfoOp) cache
.get(OP_REMOVE_CACHE_DIRECTIVE);
}
public RemoveCacheDirectiveInfoOp setId(long id) {
this.id = id;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
this.id = FSImageSerialization.readLong(in);
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(id, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "ID", Long.toString(id));
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.id = Long.parseLong(st.getValue("ID"));
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RemoveCacheDirectiveInfo [");
builder.append("id=" + Long.toString(id));
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#addCachePool} */
static class AddCachePoolOp extends FSEditLogOp {
CachePoolInfo info;
public AddCachePoolOp() {
super(OP_ADD_CACHE_POOL);
}
static AddCachePoolOp getInstance(OpInstanceCache cache) {
return (AddCachePoolOp) cache.get(OP_ADD_CACHE_POOL);
}
public AddCachePoolOp setPool(CachePoolInfo info) {
this.info = info;
assert(info.getPoolName() != null);
assert(info.getOwnerName() != null);
assert(info.getGroupName() != null);
assert(info.getMode() != null);
assert(info.getLimit() != null);
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
info = FSImageSerialization.readCachePoolInfo(in);
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeCachePoolInfo(out, info);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSImageSerialization.writeCachePoolInfo(contentHandler, info);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.info = FSImageSerialization.readCachePoolInfo(st);
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AddCachePoolOp [");
builder.append("poolName=" + info.getPoolName() + ",");
builder.append("ownerName=" + info.getOwnerName() + ",");
builder.append("groupName=" + info.getGroupName() + ",");
builder.append("mode=" + Short.toString(info.getMode().toShort()) + ",");
builder.append("limit=" + Long.toString(info.getLimit()));
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#modifyCachePool} */
static class ModifyCachePoolOp extends FSEditLogOp {
CachePoolInfo info;
public ModifyCachePoolOp() {
super(OP_MODIFY_CACHE_POOL);
}
static ModifyCachePoolOp getInstance(OpInstanceCache cache) {
return (ModifyCachePoolOp) cache.get(OP_MODIFY_CACHE_POOL);
}
public ModifyCachePoolOp setInfo(CachePoolInfo info) {
this.info = info;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
info = FSImageSerialization.readCachePoolInfo(in);
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeCachePoolInfo(out, info);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
FSImageSerialization.writeCachePoolInfo(contentHandler, info);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.info = FSImageSerialization.readCachePoolInfo(st);
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ModifyCachePoolOp [");
ArrayList<String> fields = new ArrayList<String>(5);
if (info.getPoolName() != null) {
fields.add("poolName=" + info.getPoolName());
}
if (info.getOwnerName() != null) {
fields.add("ownerName=" + info.getOwnerName());
}
if (info.getGroupName() != null) {
fields.add("groupName=" + info.getGroupName());
}
if (info.getMode() != null) {
fields.add("mode=" + info.getMode().toString());
}
if (info.getLimit() != null) {
fields.add("limit=" + info.getLimit());
}
builder.append(Joiner.on(",").join(fields));
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
/** {@literal @AtMostOnce} for {@link ClientProtocol#removeCachePool} */
static class RemoveCachePoolOp extends FSEditLogOp {
String poolName;
public RemoveCachePoolOp() {
super(OP_REMOVE_CACHE_POOL);
}
static RemoveCachePoolOp getInstance(OpInstanceCache cache) {
return (RemoveCachePoolOp) cache.get(OP_REMOVE_CACHE_POOL);
}
public RemoveCachePoolOp setPoolName(String poolName) {
this.poolName = poolName;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
poolName = FSImageSerialization.readString(in);
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(poolName, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "POOLNAME", poolName);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.poolName = st.getValue("POOLNAME");
readRpcIdsFromXml(st);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("RemoveCachePoolOp [");
builder.append("poolName=" + poolName);
appendRpcIdsToString(builder, rpcClientId, rpcCallId);
builder.append("]");
return builder.toString();
}
}
static class RemoveXAttrOp extends FSEditLogOp {
List<XAttr> xAttrs;
String src;
private RemoveXAttrOp() {
super(OP_REMOVE_XATTR);
}
static RemoveXAttrOp getInstance() {
return new RemoveXAttrOp();
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
XAttrEditLogProto p = XAttrEditLogProto.parseDelimitedFrom(in);
src = p.getSrc();
xAttrs = PBHelper.convertXAttrs(p.getXAttrsList());
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
XAttrEditLogProto.Builder b = XAttrEditLogProto.newBuilder();
if (src != null) {
b.setSrc(src);
}
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
b.build().writeDelimitedTo(out);
// clientId and callId
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
appendXAttrsToXml(contentHandler, xAttrs);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
src = st.getValue("SRC");
xAttrs = readXAttrsFromXml(st);
readRpcIdsFromXml(st);
}
}
static class SetXAttrOp extends FSEditLogOp {
List<XAttr> xAttrs;
String src;
private SetXAttrOp() {
super(OP_SET_XATTR);
}
static SetXAttrOp getInstance() {
return new SetXAttrOp();
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
XAttrEditLogProto p = XAttrEditLogProto.parseDelimitedFrom(in);
src = p.getSrc();
xAttrs = PBHelper.convertXAttrs(p.getXAttrsList());
readRpcIds(in, logVersion);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
XAttrEditLogProto.Builder b = XAttrEditLogProto.newBuilder();
if (src != null) {
b.setSrc(src);
}
b.addAllXAttrs(PBHelper.convertXAttrProto(xAttrs));
b.build().writeDelimitedTo(out);
// clientId and callId
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
appendXAttrsToXml(contentHandler, xAttrs);
appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
src = st.getValue("SRC");
xAttrs = readXAttrsFromXml(st);
readRpcIdsFromXml(st);
}
}
static class SetAclOp extends FSEditLogOp {
List<AclEntry> aclEntries = Lists.newArrayList();
String src;
private SetAclOp() {
super(OP_SET_ACL);
}
static SetAclOp getInstance() {
return new SetAclOp();
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
AclEditLogProto p = AclEditLogProto.parseDelimitedFrom(in);
if (p == null) {
throw new IOException("Failed to read fields from SetAclOp");
}
src = p.getSrc();
aclEntries = PBHelper.convertAclEntry(p.getEntriesList());
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
AclEditLogProto.Builder b = AclEditLogProto.newBuilder();
if (src != null)
b.setSrc(src);
b.addAllEntries(PBHelper.convertAclEntryProto(aclEntries));
b.build().writeDelimitedTo(out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SRC", src);
appendAclEntriesToXml(contentHandler, aclEntries);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
src = st.getValue("SRC");
aclEntries = readAclEntriesFromXml(st);
if (aclEntries == null) {
aclEntries = Lists.newArrayList();
}
}
}
static private short readShort(DataInputStream in) throws IOException {
return Short.parseShort(FSImageSerialization.readString(in));
}
static private long readLong(DataInputStream in) throws IOException {
return Long.parseLong(FSImageSerialization.readString(in));
}
/**
* A class to read in blocks stored in the old format. The only two
* fields in the block were blockid and length.
*/
static class BlockTwo implements Writable {
long blkid;
long len;
static { // register a ctor
WritableFactories.setFactory
(BlockTwo.class,
new WritableFactory() {
@Override
public Writable newInstance() { return new BlockTwo(); }
});
}
BlockTwo() {
blkid = 0;
len = 0;
}
/////////////////////////////////////
// Writable
/////////////////////////////////////
@Override
public void write(DataOutput out) throws IOException {
out.writeLong(blkid);
out.writeLong(len);
}
@Override
public void readFields(DataInput in) throws IOException {
this.blkid = in.readLong();
this.len = in.readLong();
}
}
/**
* Operation corresponding to upgrade
*/
static class RollingUpgradeOp extends FSEditLogOp { // @Idempotent
private final String name;
private long time;
public RollingUpgradeOp(FSEditLogOpCodes code, String name) {
super(code);
this.name = name.toUpperCase();
}
static RollingUpgradeOp getStartInstance(OpInstanceCache cache) {
return (RollingUpgradeOp) cache.get(OP_ROLLING_UPGRADE_START);
}
static RollingUpgradeOp getFinalizeInstance(OpInstanceCache cache) {
return (RollingUpgradeOp) cache.get(OP_ROLLING_UPGRADE_FINALIZE);
}
long getTime() {
return time;
}
void setTime(long time) {
this.time = time;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
time = in.readLong();
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeLong(time, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, name + "TIME",
Long.toString(time));
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.time = Long.parseLong(st.getValue(name + "TIME"));
}
@Override
public String toString() {
return new StringBuilder().append("RollingUpgradeOp [").append(name)
.append(", time=").append(time).append("]").toString();
}
static class RollbackException extends IOException {
private static final long serialVersionUID = 1L;
}
}
/** {@literal @Idempotent} for {@link ClientProtocol#setStoragePolicy} */
static class SetStoragePolicyOp extends FSEditLogOp {
String path;
byte policyId;
private SetStoragePolicyOp() {
super(OP_SET_STORAGE_POLICY);
}
static SetStoragePolicyOp getInstance(OpInstanceCache cache) {
return (SetStoragePolicyOp) cache.get(OP_SET_STORAGE_POLICY);
}
SetStoragePolicyOp setPath(String path) {
this.path = path;
return this;
}
SetStoragePolicyOp setPolicyId(byte policyId) {
this.policyId = policyId;
return this;
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(path, out);
out.writeByte(policyId);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
this.path = FSImageSerialization.readString(in);
this.policyId = in.readByte();
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SetStoragePolicyOp [path=");
builder.append(path);
builder.append(", policyId=");
builder.append(policyId);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
return builder.toString();
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "PATH", path);
XMLUtils.addSaxString(contentHandler, "POLICYID",
Byte.valueOf(policyId).toString());
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.path = st.getValue("PATH");
this.policyId = Byte.valueOf(st.getValue("POLICYID"));
}
}
/**
* Class for writing editlog ops
*/
public static class Writer {
private final DataOutputBuffer buf;
private final Checksum checksum;
public Writer(DataOutputBuffer out) {
this.buf = out;
this.checksum = DataChecksum.newCrc32();
}
/**
* Write an operation to the output stream
*
* @param op The operation to write
* @throws IOException if an error occurs during writing.
*/
public void writeOp(FSEditLogOp op) throws IOException {
int start = buf.getLength();
// write the op code first to make padding and terminator verification
// work
buf.writeByte(op.opCode.getOpCode());
buf.writeInt(0); // write 0 for the length first
buf.writeLong(op.txid);
op.writeFields(buf);
int end = buf.getLength();
// write the length back: content of the op + 4 bytes checksum - op_code
int length = end - start - 1;
buf.writeInt(length, start + 1);
checksum.reset();
checksum.update(buf.getData(), start, end-start);
int sum = (int)checksum.getValue();
buf.writeInt(sum);
}
}
/**
* Class for reading editlog ops from a stream
*/
public static class Reader {
private final DataInputStream in;
private final StreamLimiter limiter;
private final int logVersion;
private final Checksum checksum;
private final OpInstanceCache cache;
private int maxOpSize;
private final boolean supportEditLogLength;
/**
* Construct the reader
* @param in The stream to read from.
* @param logVersion The version of the data coming from the stream.
*/
public Reader(DataInputStream in, StreamLimiter limiter, int logVersion) {
this.logVersion = logVersion;
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITS_CHESKUM, logVersion)) {
this.checksum = DataChecksum.newCrc32();
} else {
this.checksum = null;
}
// It is possible that the logVersion is actually a future layoutversion
// during the rolling upgrade (e.g., the NN gets upgraded first). We
// assume future layout will also support length of editlog op.
this.supportEditLogLength = NameNodeLayoutVersion.supports(
NameNodeLayoutVersion.Feature.EDITLOG_LENGTH, logVersion)
|| logVersion < NameNodeLayoutVersion.CURRENT_LAYOUT_VERSION;
if (this.checksum != null) {
this.in = new DataInputStream(
new CheckedInputStream(in, this.checksum));
} else {
this.in = in;
}
this.limiter = limiter;
this.cache = new OpInstanceCache();
this.maxOpSize = DFSConfigKeys.DFS_NAMENODE_MAX_OP_SIZE_DEFAULT;
}
public void setMaxOpSize(int maxOpSize) {
this.maxOpSize = maxOpSize;
}
/**
* Read an operation from the input stream.
*
* Note that the objects returned from this method may be re-used by future
* calls to the same method.
*
* @param skipBrokenEdits If true, attempt to skip over damaged parts of
* the input stream, rather than throwing an IOException
* @return the operation read from the stream, or null at the end of the
* file
* @throws IOException on error. This function should only throw an
* exception when skipBrokenEdits is false.
*/
public FSEditLogOp readOp(boolean skipBrokenEdits) throws IOException {
while (true) {
try {
return decodeOp();
} catch (IOException e) {
in.reset();
if (!skipBrokenEdits) {
throw e;
}
} catch (RuntimeException e) {
// FSEditLogOp#decodeOp is not supposed to throw RuntimeException.
// However, we handle it here for recovery mode, just to be more
// robust.
in.reset();
if (!skipBrokenEdits) {
throw e;
}
} catch (Throwable e) {
in.reset();
if (!skipBrokenEdits) {
throw new IOException("got unexpected exception " +
e.getMessage(), e);
}
}
// Move ahead one byte and re-try the decode process.
if (in.skip(1) < 1) {
return null;
}
}
}
private void verifyTerminator() throws IOException {
/** The end of the edit log should contain only 0x00 or 0xff bytes.
* If it contains other bytes, the log itself may be corrupt.
* It is important to check this; if we don't, a stray OP_INVALID byte
* could make us stop reading the edit log halfway through, and we'd never
* know that we had lost data.
*/
byte[] buf = new byte[4096];
limiter.clearLimit();
int numRead = -1, idx = 0;
while (true) {
try {
numRead = -1;
idx = 0;
numRead = in.read(buf);
if (numRead == -1) {
return;
}
while (idx < numRead) {
if ((buf[idx] != (byte)0) && (buf[idx] != (byte)-1)) {
throw new IOException("Read extra bytes after " +
"the terminator!");
}
idx++;
}
} finally {
// After reading each group of bytes, we reposition the mark one
// byte before the next group. Similarly, if there is an error, we
// want to reposition the mark one byte before the error
if (numRead != -1) {
in.reset();
IOUtils.skipFully(in, idx);
in.mark(buf.length + 1);
IOUtils.skipFully(in, 1);
}
}
}
}
/**
* Read an opcode from the input stream.
*
* @return the opcode, or null on EOF.
*
* If an exception is thrown, the stream's mark will be set to the first
* problematic byte. This usually means the beginning of the opcode.
*/
private FSEditLogOp decodeOp() throws IOException {
limiter.setLimit(maxOpSize);
in.mark(maxOpSize);
if (checksum != null) {
checksum.reset();
}
byte opCodeByte;
try {
opCodeByte = in.readByte();
} catch (EOFException eof) {
// EOF at an opcode boundary is expected.
return null;
}
FSEditLogOpCodes opCode = FSEditLogOpCodes.fromByte(opCodeByte);
if (opCode == OP_INVALID) {
verifyTerminator();
return null;
}
FSEditLogOp op = cache.get(opCode);
if (op == null) {
throw new IOException("Read invalid opcode " + opCode);
}
if (supportEditLogLength) {
in.readInt();
}
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.STORED_TXIDS, logVersion)) {
// Read the txid
op.setTransactionId(in.readLong());
} else {
op.setTransactionId(HdfsConstants.INVALID_TXID);
}
op.readFields(in, logVersion);
validateChecksum(in, checksum, op.txid);
return op;
}
/**
* Similar with decodeOp(), but instead of doing the real decoding, we skip
* the content of the op if the length of the editlog is supported.
* @return the last txid of the segment, or INVALID_TXID on exception
*/
public long scanOp() throws IOException {
if (supportEditLogLength) {
limiter.setLimit(maxOpSize);
in.mark(maxOpSize);
final byte opCodeByte;
try {
opCodeByte = in.readByte(); // op code
} catch (EOFException e) {
return HdfsConstants.INVALID_TXID;
}
FSEditLogOpCodes opCode = FSEditLogOpCodes.fromByte(opCodeByte);
if (opCode == OP_INVALID) {
verifyTerminator();
return HdfsConstants.INVALID_TXID;
}
int length = in.readInt(); // read the length of the op
long txid = in.readLong(); // read the txid
// skip the remaining content
IOUtils.skipFully(in, length - 8);
// TODO: do we want to verify checksum for JN? For now we don't.
return txid;
} else {
FSEditLogOp op = decodeOp();
return op == null ? HdfsConstants.INVALID_TXID : op.getTransactionId();
}
}
/**
* Validate a transaction's checksum
*/
private void validateChecksum(DataInputStream in,
Checksum checksum,
long txid)
throws IOException {
if (checksum != null) {
int calculatedChecksum = (int)checksum.getValue();
int readChecksum = in.readInt(); // read in checksum
if (readChecksum != calculatedChecksum) {
throw new ChecksumException(
"Transaction is corrupt. Calculated checksum is " +
calculatedChecksum + " but read checksum " + readChecksum, txid);
}
}
}
}
public void outputToXml(ContentHandler contentHandler) throws SAXException {
contentHandler.startElement("", "", "RECORD", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "OPCODE", opCode.toString());
contentHandler.startElement("", "", "DATA", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "TXID", "" + txid);
toXml(contentHandler);
contentHandler.endElement("", "", "DATA");
contentHandler.endElement("", "", "RECORD");
}
protected abstract void toXml(ContentHandler contentHandler)
throws SAXException;
abstract void fromXml(Stanza st) throws InvalidXmlException;
public void decodeXml(Stanza st) throws InvalidXmlException {
this.txid = Long.parseLong(st.getValue("TXID"));
fromXml(st);
}
public static void blockToXml(ContentHandler contentHandler, Block block)
throws SAXException {
contentHandler.startElement("", "", "BLOCK", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "BLOCK_ID",
Long.toString(block.getBlockId()));
XMLUtils.addSaxString(contentHandler, "NUM_BYTES",
Long.toString(block.getNumBytes()));
XMLUtils.addSaxString(contentHandler, "GENSTAMP",
Long.toString(block.getGenerationStamp()));
contentHandler.endElement("", "", "BLOCK");
}
public static Block blockFromXml(Stanza st)
throws InvalidXmlException {
long blockId = Long.parseLong(st.getValue("BLOCK_ID"));
long numBytes = Long.parseLong(st.getValue("NUM_BYTES"));
long generationStamp = Long.parseLong(st.getValue("GENSTAMP"));
return new Block(blockId, numBytes, generationStamp);
}
public static void delegationTokenToXml(ContentHandler contentHandler,
DelegationTokenIdentifier token) throws SAXException {
contentHandler.startElement("", "", "DELEGATION_TOKEN_IDENTIFIER", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "KIND", token.getKind().toString());
XMLUtils.addSaxString(contentHandler, "SEQUENCE_NUMBER",
Integer.toString(token.getSequenceNumber()));
XMLUtils.addSaxString(contentHandler, "OWNER",
token.getOwner().toString());
XMLUtils.addSaxString(contentHandler, "RENEWER",
token.getRenewer().toString());
XMLUtils.addSaxString(contentHandler, "REALUSER",
token.getRealUser().toString());
XMLUtils.addSaxString(contentHandler, "ISSUE_DATE",
Long.toString(token.getIssueDate()));
XMLUtils.addSaxString(contentHandler, "MAX_DATE",
Long.toString(token.getMaxDate()));
XMLUtils.addSaxString(contentHandler, "MASTER_KEY_ID",
Integer.toString(token.getMasterKeyId()));
contentHandler.endElement("", "", "DELEGATION_TOKEN_IDENTIFIER");
}
public static DelegationTokenIdentifier delegationTokenFromXml(Stanza st)
throws InvalidXmlException {
String kind = st.getValue("KIND");
if (!kind.equals(DelegationTokenIdentifier.
HDFS_DELEGATION_KIND.toString())) {
throw new InvalidXmlException("can't understand " +
"DelegationTokenIdentifier KIND " + kind);
}
int seqNum = Integer.parseInt(st.getValue("SEQUENCE_NUMBER"));
String owner = st.getValue("OWNER");
String renewer = st.getValue("RENEWER");
String realuser = st.getValue("REALUSER");
long issueDate = Long.parseLong(st.getValue("ISSUE_DATE"));
long maxDate = Long.parseLong(st.getValue("MAX_DATE"));
int masterKeyId = Integer.parseInt(st.getValue("MASTER_KEY_ID"));
DelegationTokenIdentifier token =
new DelegationTokenIdentifier(new Text(owner),
new Text(renewer), new Text(realuser));
token.setSequenceNumber(seqNum);
token.setIssueDate(issueDate);
token.setMaxDate(maxDate);
token.setMasterKeyId(masterKeyId);
return token;
}
public static void delegationKeyToXml(ContentHandler contentHandler,
DelegationKey key) throws SAXException {
contentHandler.startElement("", "", "DELEGATION_KEY", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "KEY_ID",
Integer.toString(key.getKeyId()));
XMLUtils.addSaxString(contentHandler, "EXPIRY_DATE",
Long.toString(key.getExpiryDate()));
if (key.getEncodedKey() != null) {
XMLUtils.addSaxString(contentHandler, "KEY",
Hex.encodeHexString(key.getEncodedKey()));
}
contentHandler.endElement("", "", "DELEGATION_KEY");
}
public static DelegationKey delegationKeyFromXml(Stanza st)
throws InvalidXmlException {
int keyId = Integer.parseInt(st.getValue("KEY_ID"));
long expiryDate = Long.parseLong(st.getValue("EXPIRY_DATE"));
byte key[] = null;
try {
key = Hex.decodeHex(st.getValue("KEY").toCharArray());
} catch (DecoderException e) {
throw new InvalidXmlException(e.toString());
} catch (InvalidXmlException e) {
}
return new DelegationKey(keyId, expiryDate, key);
}
public static void permissionStatusToXml(ContentHandler contentHandler,
PermissionStatus perm) throws SAXException {
contentHandler.startElement("", "", "PERMISSION_STATUS", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "USERNAME", perm.getUserName());
XMLUtils.addSaxString(contentHandler, "GROUPNAME", perm.getGroupName());
fsPermissionToXml(contentHandler, perm.getPermission());
contentHandler.endElement("", "", "PERMISSION_STATUS");
}
public static PermissionStatus permissionStatusFromXml(Stanza st)
throws InvalidXmlException {
Stanza status = st.getChildren("PERMISSION_STATUS").get(0);
String username = status.getValue("USERNAME");
String groupname = status.getValue("GROUPNAME");
FsPermission mode = fsPermissionFromXml(status);
return new PermissionStatus(username, groupname, mode);
}
public static void fsPermissionToXml(ContentHandler contentHandler,
FsPermission mode) throws SAXException {
XMLUtils.addSaxString(contentHandler, "MODE", Short.valueOf(mode.toShort())
.toString());
}
public static FsPermission fsPermissionFromXml(Stanza st)
throws InvalidXmlException {
short mode = Short.valueOf(st.getValue("MODE"));
return new FsPermission(mode);
}
private static void fsActionToXml(ContentHandler contentHandler, FsAction v)
throws SAXException {
XMLUtils.addSaxString(contentHandler, "PERM", v.SYMBOL);
}
private static FsAction fsActionFromXml(Stanza st) throws InvalidXmlException {
FsAction v = FSACTION_SYMBOL_MAP.get(st.getValue("PERM"));
if (v == null)
throw new InvalidXmlException("Invalid value for FsAction");
return v;
}
private static void appendAclEntriesToXml(ContentHandler contentHandler,
List<AclEntry> aclEntries) throws SAXException {
for (AclEntry e : aclEntries) {
contentHandler.startElement("", "", "ENTRY", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "SCOPE", e.getScope().name());
XMLUtils.addSaxString(contentHandler, "TYPE", e.getType().name());
if (e.getName() != null) {
XMLUtils.addSaxString(contentHandler, "NAME", e.getName());
}
fsActionToXml(contentHandler, e.getPermission());
contentHandler.endElement("", "", "ENTRY");
}
}
private static List<AclEntry> readAclEntriesFromXml(Stanza st) {
List<AclEntry> aclEntries = Lists.newArrayList();
if (!st.hasChildren("ENTRY"))
return null;
List<Stanza> stanzas = st.getChildren("ENTRY");
for (Stanza s : stanzas) {
AclEntry e = new AclEntry.Builder()
.setScope(AclEntryScope.valueOf(s.getValue("SCOPE")))
.setType(AclEntryType.valueOf(s.getValue("TYPE")))
.setName(s.getValueOrNull("NAME"))
.setPermission(fsActionFromXml(s)).build();
aclEntries.add(e);
}
return aclEntries;
}
private static void appendXAttrsToXml(ContentHandler contentHandler,
List<XAttr> xAttrs) throws SAXException {
for (XAttr xAttr: xAttrs) {
contentHandler.startElement("", "", "XATTR", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "NAMESPACE",
xAttr.getNameSpace().toString());
XMLUtils.addSaxString(contentHandler, "NAME", xAttr.getName());
if (xAttr.getValue() != null) {
try {
XMLUtils.addSaxString(contentHandler, "VALUE",
XAttrCodec.encodeValue(xAttr.getValue(), XAttrCodec.HEX));
} catch (IOException e) {
throw new SAXException(e);
}
}
contentHandler.endElement("", "", "XATTR");
}
}
private static List<XAttr> readXAttrsFromXml(Stanza st)
throws InvalidXmlException {
if (!st.hasChildren("XATTR")) {
return null;
}
List<Stanza> stanzas = st.getChildren("XATTR");
List<XAttr> xattrs = Lists.newArrayListWithCapacity(stanzas.size());
for (Stanza a: stanzas) {
XAttr.Builder builder = new XAttr.Builder();
builder.setNameSpace(XAttr.NameSpace.valueOf(a.getValue("NAMESPACE"))).
setName(a.getValue("NAME"));
String v = a.getValueOrNull("VALUE");
if (v != null) {
try {
builder.setValue(XAttrCodec.decodeValue(v));
} catch (IOException e) {
throw new InvalidXmlException(e.toString());
}
}
xattrs.add(builder.build());
}
return xattrs;
}
}
| {
"content_hash": "ce7877dd1b1e61d257b38008277632ef",
"timestamp": "",
"source": "github",
"line_count": 4391,
"max_line_length": 98,
"avg_line_length": 32.240491915281254,
"alnum_prop": 0.6614206600361664,
"repo_name": "DislabNJU/Hadoop",
"id": "45ea168e4fa4aa78e110e62778bf831be19b1d00",
"size": "142374",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AspectJ",
"bytes": "31146"
},
{
"name": "Batchfile",
"bytes": "62129"
},
{
"name": "C",
"bytes": "1360000"
},
{
"name": "C++",
"bytes": "95352"
},
{
"name": "CMake",
"bytes": "38954"
},
{
"name": "CSS",
"bytes": "44021"
},
{
"name": "Java",
"bytes": "47649954"
},
{
"name": "JavaScript",
"bytes": "22681"
},
{
"name": "Perl",
"bytes": "18992"
},
{
"name": "Python",
"bytes": "11309"
},
{
"name": "Shell",
"bytes": "182021"
},
{
"name": "TLA",
"bytes": "14993"
},
{
"name": "TeX",
"bytes": "19322"
},
{
"name": "XSLT",
"bytes": "34239"
}
],
"symlink_target": ""
} |
<?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
// Create the email and send the message
$to = 'ritairwin4clerk@gmail.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form: $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?> | {
"content_hash": "5e21c405717cdbf36fc07c5bcb078a57",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 187,
"avg_line_length": 42.26923076923077,
"alnum_prop": 0.6760691537761602,
"repo_name": "ahwolf/rita_irwin",
"id": "c1bf5233c1977c8fa020ef8d897c46bbd4f4be76",
"size": "1099",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "static/js/contact_me.php",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "127237"
},
{
"name": "HTML",
"bytes": "28160"
},
{
"name": "JavaScript",
"bytes": "43701"
},
{
"name": "PHP",
"bytes": "1099"
},
{
"name": "Python",
"bytes": "1059"
}
],
"symlink_target": ""
} |
<!--
~ Copyright 2000-2007 JetBrains s.r.o.
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<html>
<body>
<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td colspan="3">
<font face="verdana" size="-1">
This is a built-in template used by <b>IDEA</b> each time you create a
Gant build script
</font>
</td>
</tr>
</table>
</body>
</html> | {
"content_hash": "f5f36c13ab8074c8c2f6dcef7234702d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 106,
"avg_line_length": 32.56666666666667,
"alnum_prop": 0.6683725690890481,
"repo_name": "jexp/idea2",
"id": "a71f386311ed3cb876ca544e4a6ac19c5995fa35",
"size": "977",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "plugins/groovy/resources/fileTemplates/j2ee/GantScript.gant.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "6350"
},
{
"name": "C#",
"bytes": "103"
},
{
"name": "C++",
"bytes": "30760"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "Java",
"bytes": "72888555"
},
{
"name": "JavaScript",
"bytes": "910"
},
{
"name": "PHP",
"bytes": "133"
},
{
"name": "Perl",
"bytes": "6523"
},
{
"name": "Shell",
"bytes": "4068"
}
],
"symlink_target": ""
} |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.android_webview.test;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.support.test.InstrumentationRegistry;
import android.view.View;
import androidx.test.filters.SmallTest;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.AwContents.VisualStateCallback;
import org.chromium.android_webview.test.util.GraphicsTestUtils;
import org.chromium.base.test.util.CriteriaHelper;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.content_public.common.ContentUrlConstants;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
* AwContents rendering / pixel tests.
*/
@RunWith(AwJUnit4ClassRunner.class)
public class AwContentsRenderTest {
@Rule
public AwActivityTestRule mActivityTestRule = new AwActivityTestRule();
private TestAwContentsClient mContentsClient;
private AwContents mAwContents;
private AwTestContainerView mContainerView;
@Before
public void setUp() {
mContentsClient = new TestAwContentsClient();
mContainerView = mActivityTestRule.createAwTestContainerViewOnMainSync(mContentsClient);
mAwContents = mContainerView.getAwContents();
}
void setBackgroundColorOnUiThread(final int c) {
TestThreadUtils.runOnUiThreadBlocking(() -> mAwContents.setBackgroundColor(c));
}
@Test
@SmallTest
@Feature({"AndroidWebView"})
public void testSetGetBackgroundColor() throws Throwable {
setBackgroundColorOnUiThread(Color.MAGENTA);
GraphicsTestUtils.pollForBackgroundColor(mAwContents, Color.MAGENTA);
setBackgroundColorOnUiThread(Color.CYAN);
GraphicsTestUtils.pollForBackgroundColor(mAwContents, Color.CYAN);
mActivityTestRule.loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
ContentUrlConstants.ABOUT_BLANK_DISPLAY_URL);
GraphicsTestUtils.pollForBackgroundColor(mAwContents, Color.CYAN);
setBackgroundColorOnUiThread(Color.YELLOW);
GraphicsTestUtils.pollForBackgroundColor(mAwContents, Color.YELLOW);
final String html_meta = "<html><head><meta name=color-scheme content=dark></head></html>";
mActivityTestRule.loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
"data:text/html," + html_meta);
final int dark_scheme_color = 0xFF121212;
GraphicsTestUtils.pollForBackgroundColor(mAwContents, dark_scheme_color);
final String html = "<html><head><style>body {background-color:#227788}</style></head>"
+ "<body></body></html>";
// Loading the html via a data URI requires us to encode '#' symbols as '%23'.
mActivityTestRule.loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
"data:text/html," + html.replace("#", "%23"));
final int teal = 0xFF227788;
GraphicsTestUtils.pollForBackgroundColor(mAwContents, teal);
// Changing the base background should not override CSS background.
setBackgroundColorOnUiThread(Color.MAGENTA);
Assert.assertEquals(teal, GraphicsTestUtils.sampleBackgroundColorOnUiThread(mAwContents));
// ...setting the background is asynchronous, so pause a bit and retest just to be sure.
Thread.sleep(500);
Assert.assertEquals(teal, GraphicsTestUtils.sampleBackgroundColorOnUiThread(mAwContents));
}
@Test
@SmallTest
@Feature({"AndroidWebView"})
public void testPictureListener() throws Throwable {
TestThreadUtils.runOnUiThreadBlocking(() -> mAwContents.enableOnNewPicture(true, true));
int pictureCount = mContentsClient.getPictureListenerHelper().getCallCount();
mActivityTestRule.loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
ContentUrlConstants.ABOUT_BLANK_DISPLAY_URL);
mContentsClient.getPictureListenerHelper().waitForCallback(pictureCount, 1);
// Invalidation only, so picture should be null.
Assert.assertNull(mContentsClient.getPictureListenerHelper().getPicture());
}
@Test
@SmallTest
@Feature({"AndroidWebView"})
public void testForceDrawWhenInvisible() throws Throwable {
final String html = "<html><head><style>body {background-color:#227788}</style></head>"
+ "<body>Hello world!</body></html>";
// Loading the html via a data URI requires us to encode '#' symbols as '%23'.
mActivityTestRule.loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
"data:text/html," + html.replace("#", "%23"));
Bitmap visibleBitmap = null;
Bitmap invisibleBitmap = null;
final CountDownLatch latch = new CountDownLatch(1);
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
final long requestId1 = 1;
mAwContents.insertVisualStateCallback(requestId1, new VisualStateCallback() {
@Override
public void onComplete(long id) {
Assert.assertEquals(requestId1, id);
latch.countDown();
}
});
});
Assert.assertTrue(
latch.await(AwActivityTestRule.SCALED_WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS));
final int width =
TestThreadUtils.runOnUiThreadBlockingNoException(() -> mContainerView.getWidth());
final int height =
TestThreadUtils.runOnUiThreadBlockingNoException(() -> mContainerView.getHeight());
visibleBitmap = GraphicsTestUtils.drawAwContentsOnUiThread(mAwContents, width, height);
// Things that affect DOM page visibility:
// 1. isPaused
// 2. window's visibility, if the webview is attached to a window.
// Note android.view.View's visibility does not affect DOM page visibility.
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
mContainerView.setVisibility(View.INVISIBLE);
Assert.assertTrue(mAwContents.isPageVisible());
mAwContents.onPause();
Assert.assertFalse(mAwContents.isPageVisible());
mAwContents.onResume();
Assert.assertTrue(mAwContents.isPageVisible());
// Simulate a window visiblity change. WebView test app can't
// manipulate the window visibility directly.
mAwContents.onWindowVisibilityChanged(View.INVISIBLE);
Assert.assertFalse(mAwContents.isPageVisible());
});
// VisualStateCallback#onComplete won't be called when WebView is
// invisible. So there is no reliable way to tell if View#setVisibility
// has taken effect. Just sleep the test thread for 500ms.
Thread.sleep(500);
invisibleBitmap = GraphicsTestUtils.drawAwContentsOnUiThread(mAwContents, width, height);
Assert.assertNotNull(invisibleBitmap);
Assert.assertTrue(invisibleBitmap.sameAs(visibleBitmap));
}
@Test
@SmallTest
@Feature({"AndroidWebView"})
public void testSoftwareCanvas() throws Throwable {
TestThreadUtils.runOnUiThreadBlocking(
() -> mAwContents.setLayerType(View.LAYER_TYPE_SOFTWARE, null));
String testFile = "android_webview/test/data/green_canvas.html";
String url = UrlUtils.getIsolatedTestFileUrl(testFile);
AwActivityTestRule.enableJavaScriptOnUiThread(mAwContents);
mActivityTestRule.loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), url);
mActivityTestRule.waitForVisualStateCallback(mAwContents);
CriteriaHelper.pollInstrumentationThread(() -> {
Bitmap bitmap = GraphicsTestUtils.drawAwContentsOnUiThread(mAwContents, 500, 500);
return Color.GREEN == bitmap.getPixel(250, 250);
});
}
}
| {
"content_hash": "af4d40766382868acb8131d2f84e8e69",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 99,
"avg_line_length": 44.4331550802139,
"alnum_prop": 0.7042965459140691,
"repo_name": "scheib/chromium",
"id": "ac9d30519d621b592a670b1670182885dedda0a2",
"size": "8309",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
using ManagerShop.Infrastructure.Core;
using ManagerShop.Infrastructure.Core.Web;
using ManagerShop.DTOModel.Model.RaKuTen;
using ManagerShop.Service.Contract;
using ManagerShop.wcfService.Product;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
namespace ManagerShop.UI.Areas.Product.Controllers
{
public class ProductInfoController : BaseController
{
private String ProductFileInfoCache
{
get
{
return Core.DESEncrypt.Encrypt($"ProductFileInfoCache");
}
}
private String ProductFilePageInfoCache
{
get
{
return Core.DESEncrypt.Encrypt($"ProductFilePageInfoCache");
}
}
// GET: Orders/Orders
public ActionResult ProductInfoView()
{
return PartialView();
}
[HttpPost]
public JsonResult GetUProductInfoDatalist(int limit, int offset, string searchcolumn = "", string search = "", string order = "", string orderName = "")
{
IProductInfoService productinfoservice = new ProductInfoService();
List<DTO_RAKUTEN_PRODUCTINFO> listProductinfo = productinfoservice.GetProductInfoFormDB();
if (listProductinfo == null)
{
listProductinfo = new List<DTO_RAKUTEN_PRODUCTINFO>();
}
listProductinfo = base.QueryAndOrderRos<DTO_RAKUTEN_PRODUCTINFO>(listProductinfo, searchcolumn, search, order, orderName);
var total = listProductinfo.Count;
var rows = listProductinfo.Skip(offset).Take(limit).ToList();
return Json(new { total = total, rows = rows }, JsonRequestBehavior.AllowGet);
}
public ActionResult ProductFileUpload()
{
HttpRuntimeCache.Remove(ProductFileInfoCache);
HttpRuntimeCache.Remove(ProductFilePageInfoCache);
return PartialView();
}
public async Task<ActionResult> UploadFileAsync()
{
try
{
var excelFile = HttpContext.Request.Files[0];
DataTable productTb = ExcelUtility.ExcelToDataTable(excelFile.FileName, excelFile.InputStream);
ConcurrentBag<String> productOrderlist = new ConcurrentBag<String>();
List<DTO_RAKUTEN_PRODUCTINFO> ProductInofModelList = new List<DTO_RAKUTEN_PRODUCTINFO>();
Dictionary<String, List<DTO_RAKUTEN_ITEMSTOCK>> ItemStockModelDic = new Dictionary<String, List<DTO_RAKUTEN_ITEMSTOCK>>();
Parallel.ForEach(productTb.AsEnumerable(), row =>
{
String OrderNo = Convert.ToString(row[0]);
if (!productOrderlist.Contains(OrderNo))
productOrderlist.Add(OrderNo);
});
foreach (var productOrder in productOrderlist)
{
String productXml = await WebCommon.webApiGetAsync($"https://api.rms.RaKuTen.co.jp/es/1.0/item/get?itemUrl={productOrder}");
//var ProductInofModel = XmlUtil.Deserialize(typeof(DTO_RAKUTEN_PRODUCTINFO), productXml);
//商品一覧
DTO_RAKUTEN_PRODUCTINFO ProductInofModel = XmlUtil<DTO_RAKUTEN_PRODUCTINFO>.GetValueToModel(productXml);
ProductInofModelList.Add(ProductInofModel);
//在庫更新
string StartFlg = "inventory";
List<DTO_RAKUTEN_ITEMSTOCK> ProductStockModel = XmlUtil<DTO_RAKUTEN_ITEMSTOCK>.GetValueToPageInfoModel(productXml, StartFlg);
foreach (var item in ProductStockModel)
{
item.itemUrl = ProductInofModel.itemUrl;
item.optionNo = Guid.NewGuid().ToString();
item.itemName = ProductInofModel.itemName;
item.inventoryType = ProductInofModel.inventoryType;
if (String.IsNullOrEmpty(item.childNoVertical) || item.childNoVertical.Trim() == "-")
{
item.childNoVertical = "";
}
if (String.IsNullOrEmpty(item.childNoHorizontal) || item.childNoHorizontal.Trim() == "-")
{
item.childNoHorizontal = "";
}
}
switch (ProductInofModel.inventoryType)
{
case 0:
break;
case 1:
ProductInofModel.inventoryCount = ProductStockModel.FirstOrDefault()?.inventoryCount.ToString();
break;
case 2:
var liststockcount = ProductStockModel.Select(x => x.inventoryCount);
if (liststockcount.Count() > 0)
{
ProductInofModel.inventoryCount = $"{liststockcount.Sum()}({liststockcount.Min()}-{liststockcount.Max()})";
}
break;
}
ItemStockModelDic.Add(productOrder, ProductStockModel);
}
HttpRuntimeCache.Set(ProductFileInfoCache, ProductInofModelList);
HttpRuntimeCache.Set(ProductFilePageInfoCache, ItemStockModelDic);
return Json(new { status = "ok" }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(new { status = "err", errmsg = ex.Message.ToString() }, JsonRequestBehavior.AllowGet);
}
}
[HttpPost]
public JsonResult GetUploadProductInfo(int limit, int offset, string searchcolumn = "", string search = "", string order = "", string orderName = "")
{
List<DTO_RAKUTEN_PRODUCTINFO> listUploadProductinfo = HttpRuntimeCache.Get<List<DTO_RAKUTEN_PRODUCTINFO>>(ProductFileInfoCache);
if (listUploadProductinfo == null)
{
listUploadProductinfo = new List<DTO_RAKUTEN_PRODUCTINFO>();
}
listUploadProductinfo = base.QueryAndOrderRos<DTO_RAKUTEN_PRODUCTINFO>(listUploadProductinfo, searchcolumn, search, order, orderName);
var total = listUploadProductinfo.Count;
var rows = listUploadProductinfo.Skip(offset).Take(limit).ToList();
return Json(new { total = total, rows = rows }, JsonRequestBehavior.AllowGet);
}
[HttpPost]
public JsonResult UploadProductInfoFromlist(List<DTO_RAKUTEN_PRODUCTINFO> selectdata)
{
try
{
List<object> rtninfolist = new List<object>();
IProductInfoService productinfoservice = new ProductInfoService();
Dictionary<String, List<DTO_RAKUTEN_ITEMSTOCK>> ItemStockCache1 = HttpRuntimeCache.Get<Dictionary<String, List<DTO_RAKUTEN_ITEMSTOCK>>>(ProductFilePageInfoCache);
String rtn = productinfoservice.UploadProductInfo(selectdata, ItemStockCache1);
if (!String.IsNullOrEmpty(rtn))
{
return Json(new { state = "error", message = rtn }, JsonRequestBehavior.AllowGet);
}
return Json(new { state = "ok", rtninfo = rtninfolist }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(new { state = "error", message = ex.ToString() }, JsonRequestBehavior.AllowGet);
}
}
[HttpGet]
public async Task<ActionResult> SynchronousProductInfo()
{
try
{
IProductInfoService _ProductInfoService = new ProductInfoService();
var itemUrlList = _ProductInfoService.GetProductInfoFormDB().Select(x => x.itemUrl).Distinct().ToList();
foreach (var item in itemUrlList)
{
var productOrder = item;
String productXml = await WebCommon.webApiGetAsync($"https://api.rms.RaKuTen.co.jp/es/1.0/item/get?itemUrl={productOrder}");
//商品一覧
DTO_RAKUTEN_PRODUCTINFO ProductInofModel = XmlUtil<DTO_RAKUTEN_PRODUCTINFO>.GetValueToModel(productXml);
//在庫情報
string StartFlg = "inventory";
List<DTO_RAKUTEN_ITEMSTOCK> ItemStockModel = XmlUtil<DTO_RAKUTEN_ITEMSTOCK>.GetValueToPageInfoModel(productXml, StartFlg);
Dictionary<String, List<DTO_RAKUTEN_ITEMSTOCK>> inputmodel = new Dictionary<string, List<DTO_RAKUTEN_ITEMSTOCK>>();
List<DTO_RAKUTEN_PRODUCTINFO> ProductInofModelList = new List<DTO_RAKUTEN_PRODUCTINFO>();
inputmodel.Add(item, ItemStockModel);
ProductInofModelList.Add(ProductInofModel);
foreach (var _item in ItemStockModel)
{
_item.itemUrl = ProductInofModel.itemUrl;
_item.optionNo = Guid.NewGuid().ToString();
_item.itemName = ProductInofModel.itemName;
_item.inventoryType = ProductInofModel.inventoryType;
if (String.IsNullOrEmpty(_item.optionNameVertical) || _item.optionNameVertical.Trim() == "-")
{
_item.optionNameVertical = "";
}
if (String.IsNullOrEmpty(_item.optionNameHorizontal) || _item.optionNameHorizontal.Trim() == "-")
{
_item.optionNameHorizontal = "";
}
}
_ProductInfoService.UploadProductInfo(ProductInofModelList, inputmodel);
}
return Json(new { state = "ok", message = "ok" }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
return Json(new { state = "error", message = ex.ToString() }, JsonRequestBehavior.AllowGet);
}
}
}
} | {
"content_hash": "c158bf12cd76e8b9354893405b32c533",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 178,
"avg_line_length": 43.483333333333334,
"alnum_prop": 0.560367957071675,
"repo_name": "dawutao/ManagerShop",
"id": "95bc3319ccfe66631d898b2149dd01f33947f7f9",
"size": "10470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ManagerShop.UI/ManagerShop.UI/Areas/Product-再修正/Controllers/ProductInfoController.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "105"
},
{
"name": "C#",
"bytes": "1371996"
},
{
"name": "CSS",
"bytes": "909418"
},
{
"name": "JavaScript",
"bytes": "1294163"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54d.c
Label Definition File: CWE789_Uncontrolled_Mem_Alloc__malloc.label.xml
Template File: sources-sinks-54d.tmpl.c
*/
/*
* @description
* CWE: 789 Uncontrolled Memory Allocation
* BadSource: fscanf Read data from the console using fscanf()
* GoodSource: Small number greater than zero
* Sinks:
* GoodSink: Allocate memory with malloc() and check the size of the memory to be allocated
* BadSink : Allocate memory with malloc(), but incorrectly check the size of the memory to be allocated
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
#define HELLO_STRING L"hello"
#ifndef OMITBAD
/* bad function declaration */
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54e_badSink(size_t data);
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54d_badSink(size_t data)
{
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54e_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54e_goodG2BSink(size_t data);
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54d_goodG2BSink(size_t data)
{
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54e_goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54e_goodB2GSink(size_t data);
void CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54d_goodB2GSink(size_t data)
{
CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54e_goodB2GSink(data);
}
#endif /* OMITGOOD */
| {
"content_hash": "454eeee142630fb98f8d1ed4bb08bc0c",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 157,
"avg_line_length": 34.107142857142854,
"alnum_prop": 0.7371727748691099,
"repo_name": "JianpingZeng/xcc",
"id": "8f136b50c870f90f04e6d26b8a813dc53df2dd85",
"size": "1910",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE789_Uncontrolled_Mem_Alloc/s01/CWE789_Uncontrolled_Mem_Alloc__malloc_wchar_t_fscanf_54d.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
FROM local/base
MAINTAINER Keith Hamilton <keith.hamilton@wk.com>
# Install git
RUN apt-get install -y git
# Install Maven
RUN add-apt-repository "deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main"
RUN apt-get update && apt-get -y --force-yes install maven3
RUN ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn
# Install Tomcat
RUN wget -O /tmp/tomcat7.tar.gz http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.tar.gz
RUN (cd /opt && tar zxf /tmp/tomcat7.tar.gz)
RUN (mv /opt/apache-tomcat* /opt/tomcat)
RUN (rm /opt/tomcat/bin/*.bat)
# Install Oracle Java 7
RUN add-apt-repository ppa:webupd8team/java
RUN apt-get update
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-get -y install oracle-java7-installer && apt-get clean
RUN update-alternatives --display java
RUN echo "JAVA_HOME=/usr/lib/jvm/java-7-oracle" >> /etc/environment
# Add tomcat start script
ADD run_server /usr/local/bin/run_server
RUN chmod +x /usr/local/bin/run_server
# Update path
RUN echo "PATH=$PATH:/opt/tomcat/bin:/usr/bin" >> /home/vagrant/.bashrc
EXPOSE 22 8080
CMD ["run_server"]
| {
"content_hash": "5793907f90b0a2a9dc0146ba7c664c7e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 118,
"avg_line_length": 34.02857142857143,
"alnum_prop": 0.7439126784214946,
"repo_name": "wieden-kennedy/composite-demo",
"id": "aa330e135736eb1dc2299299b7adb8b61f0f6c5f",
"size": "1231",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "composite/Dockerfile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "12384"
},
{
"name": "JavaScript",
"bytes": "49784"
},
{
"name": "Python",
"bytes": "16478"
},
{
"name": "Shell",
"bytes": "11865"
}
],
"symlink_target": ""
} |
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.clouddebugger.v2.model;
/**
* A generic empty message that you can re-use to avoid defining duplicated empty messages in your
* APIs. A typical example is to use it as the request or the response type of an API method. For
* instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The
* JSON representation for `Empty` is empty JSON object `{}`.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Debugger API. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class Empty extends com.google.api.client.json.GenericJson {
@Override
public Empty set(String fieldName, Object value) {
return (Empty) super.set(fieldName, value);
}
@Override
public Empty clone() {
return (Empty) super.clone();
}
}
| {
"content_hash": "0b82a7a6d77f808ccc0edd2d59c06e50",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 182,
"avg_line_length": 40.51111111111111,
"alnum_prop": 0.7383433900164564,
"repo_name": "googleapis/google-api-java-client-services",
"id": "92c4960b12d2ff2416e6b4019eba2bc9f6adb6f1",
"size": "1823",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "clients/google-api-services-clouddebugger/v2/1.30.1/com/google/api/services/clouddebugger/v2/model/Empty.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
ACCEPTED
#### According to
GRIN Taxonomy for Plants
#### Published in
Feddes Repert. 74:30. 1967
#### Original name
null
### Remarks
null | {
"content_hash": "9d3fc1ddeeda628d258cf2913bdcdcc0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 26,
"avg_line_length": 10.846153846153847,
"alnum_prop": 0.6950354609929078,
"repo_name": "mdoering/backbone",
"id": "7af8f439611a02460edcf117ca53ead5b1beb01e",
"size": "235",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Violaceae/Viola/Viola tricolor/Viola tricolor macedonica/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
/**
* @author: Thomas Prelot <tprelot@gmail.com>
* @author: Brahim BOUKOUFALLAH <brahim.boukoufallah@idci-consulting.fr>
* @license: MIT
*/
namespace IDCI\Bundle\StepBundle\Flow;
use IDCI\Bundle\StepBundle\Step\StepInterface;
interface FlowHistoryInterface
{
/**
* Store the current step into the history.
*
* @param StepInterface $step the step
*
* @return FlowHistoryInterface
*/
public function setCurrentStep(StepInterface $step);
/**
* Add a taken path.
*
* @param StepInterface $step the step
* @param int $pathId the identifier of the path
*/
public function addTakenPath(StepInterface $step, $pathId = 0);
/**
* Retrace to a step.
*
* @param string $sourceStepName the source step name
* @param StepInterface $destinationStep the destination step
*/
public function retraceTakenPath($sourceStepName, StepInterface $destinationStep);
/**
* Get the last taken path.
*
* @return array|null The last taken path under the form array('source' => ..., 'index' => ...).
*/
public function getLastTakenPath();
/**
* Get the taken paths.
*
* @return array the taken paths
*/
public function getTakenPaths();
/**
* Get the full taken paths.
*
* @return array the full taken paths
*/
public function getFullTakenPaths();
/**
* Whether or not a step has been done.
*
* @param StepInterface $step the step
* @param bool $full whether or not checking in the full history
*
* @return bool true if the step has been done, false otherwise
*/
public function hasDoneStep(StepInterface $step, $full = false);
/**
* Get all the history in an array.
*
* @return array the history
*/
public function getAll();
}
| {
"content_hash": "08ed0bba671d3607f8635f27e9df901c",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 100,
"avg_line_length": 24.77922077922078,
"alnum_prop": 0.6137316561844863,
"repo_name": "IDCI-Consulting/StepBundle",
"id": "ab320c685441f42c03e25d025e875914b98ded23",
"size": "1908",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Flow/FlowHistoryInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2862"
},
{
"name": "Dockerfile",
"bytes": "1371"
},
{
"name": "JavaScript",
"bytes": "89789"
},
{
"name": "Makefile",
"bytes": "1876"
},
{
"name": "PHP",
"bytes": "318252"
},
{
"name": "Roff",
"bytes": "1738"
},
{
"name": "Shell",
"bytes": "593"
},
{
"name": "Twig",
"bytes": "14964"
},
{
"name": "Vue",
"bytes": "57154"
}
],
"symlink_target": ""
} |
import os
from django.utils import six
from django.core.files.base import File, ContentFile
from django.core.files.storage import (
default_storage, Storage)
from django.db.models.fields.files import ImageFieldFile, FieldFile
from django.core.files.images import get_image_dimensions
from django.utils.safestring import mark_safe
from django.utils.html import escape
from django.utils import timezone
from easy_thumbnails import engine, exceptions, models, utils, signals, storage
from easy_thumbnails.alias import aliases
from easy_thumbnails.conf import settings
from easy_thumbnails.options import ThumbnailOptions
def get_thumbnailer(obj, relative_name=None):
"""
Get a :class:`Thumbnailer` for a source file.
The ``obj`` argument is usually either one of the following:
* ``FieldFile`` instance (i.e. a model instance file/image field
property).
* A string, which will be used as the relative name (the source will be
set to the default storage).
* ``Storage`` instance - the ``relative_name`` argument must also be
provided.
Or it could be:
* A file-like instance - the ``relative_name`` argument must also be
provided.
In this case, the thumbnailer won't use or create a cached reference
to the thumbnail (i.e. a new thumbnail will be created for every
:meth:`Thumbnailer.get_thumbnail` call).
If ``obj`` is a ``Thumbnailer`` instance, it will just be returned. If it's
an object with an ``easy_thumbnails_thumbnailer`` then the attribute is
simply returned under the assumption it is a Thumbnailer instance)
"""
if hasattr(obj, 'easy_thumbnails_thumbnailer'):
return obj.easy_thumbnails_thumbnailer
if isinstance(obj, Thumbnailer):
return obj
elif isinstance(obj, FieldFile):
if not relative_name:
relative_name = obj.name
return ThumbnailerFieldFile(obj.instance, obj.field, relative_name)
source_storage = None
if isinstance(obj, six.string_types):
relative_name = obj
obj = None
if not relative_name:
raise ValueError(
"If object is not a FieldFile or Thumbnailer instance, the "
"relative name must be provided")
if isinstance(obj, File):
obj = obj.file
if isinstance(obj, Storage) or obj == default_storage:
source_storage = obj
obj = None
return Thumbnailer(
file=obj, name=relative_name, source_storage=source_storage,
remote_source=obj is not None)
def generate_all_aliases(fieldfile, include_global):
"""
Generate all of a file's aliases.
:param fieldfile: A ``FieldFile`` instance.
:param include_global: A boolean which determines whether to generate
thumbnails for project-wide aliases in addition to field, model, and
app specific aliases.
"""
all_options = aliases.all(fieldfile, include_global=include_global)
if all_options:
thumbnailer = get_thumbnailer(fieldfile)
for options in all_options.values():
thumbnailer.get_thumbnail(options)
def database_get_image_dimensions(file, close=False, dimensions=None):
"""
Returns the (width, height) of an image, given ThumbnailFile. Set
'close' to True to close the file at the end if it is initially in an open
state.
Will attempt to get the dimensions from the file itself if they aren't
in the db.
"""
storage_hash = utils.get_storage_hash(file.storage)
dimensions = None
dimensions_cache = None
try:
thumbnail = models.Thumbnail.objects.select_related('dimensions').get(
storage_hash=storage_hash, name=file.name)
except models.Thumbnail.DoesNotExist:
thumbnail = None
else:
try:
dimensions_cache = thumbnail.dimensions
except models.ThumbnailDimensions.DoesNotExist:
dimensions_cache = None
if dimensions_cache:
return dimensions_cache.width, dimensions_cache.height
dimensions = get_image_dimensions(file, close=close)
if settings.THUMBNAIL_CACHE_DIMENSIONS and thumbnail:
dimensions_cache = models.ThumbnailDimensions(thumbnail=thumbnail)
dimensions_cache.width, dimensions_cache.height = dimensions
dimensions_cache.save()
return dimensions
class FakeField(object):
name = 'fake'
def __init__(self, storage=None):
if storage is None:
storage = default_storage
self.storage = storage
def generate_filename(self, instance, name, *args, **kwargs):
return name
class FakeInstance(object):
def save(self, *args, **kwargs):
pass
class ThumbnailFile(ImageFieldFile):
"""
A thumbnailed file.
This can be used just like a Django model instance's property for a file
field (i.e. an ``ImageFieldFile`` object).
"""
def __init__(self, name, file=None, storage=None, thumbnail_options=None,
*args, **kwargs):
fake_field = FakeField(storage=storage)
super(ThumbnailFile, self).__init__(
FakeInstance(), fake_field, name, *args, **kwargs)
del self.field
if file:
self.file = file
if thumbnail_options is None:
thumbnail_options = ThumbnailOptions()
elif not isinstance(thumbnail_options, ThumbnailOptions):
thumbnail_options = ThumbnailOptions(thumbnail_options)
self.thumbnail_options = thumbnail_options
def save(self, *args, **kwargs):
# Can't save a ``ThumbnailFile`` directly.
raise NotImplementedError()
def delete(self, *args, **kwargs):
# Can't delete a ``ThumbnailFile`` directly, it doesn't have a
# reference to the source image, so it can't update the cache. If you
# really need to do this, do it with ``self.storage.delete`` directly.
raise NotImplementedError()
# Be consistant with standard behaviour, even though these methods don't
# actually alter data any more.
save.alters_data = True
delete.alters_data = True
def _get_image(self):
"""
Get a PIL Image instance of this file.
The image is cached to avoid the file needing to be read again if the
function is called again.
"""
if not hasattr(self, '_image_cache'):
from easy_thumbnails.source_generators import pil_image
self.image = pil_image(self)
return self._image_cache
def _set_image(self, image):
"""
Set the image for this file.
This also caches the dimensions of the image.
"""
if image:
self._image_cache = image
self._dimensions_cache = image.size
else:
if hasattr(self, '_image_cache'):
del self._cached_image
if hasattr(self, '_dimensions_cache'):
del self._dimensions_cache
image = property(_get_image, _set_image)
def tag(self, alt='', use_size=None, **attrs):
"""
Return a standard XHTML ``<img ... />`` tag for this field.
:param alt: The ``alt=""`` text for the tag. Defaults to ``''``.
:param use_size: Whether to get the size of the thumbnail image for use
in the tag attributes. If ``None`` (default), the size will only
be used it if won't result in a remote file retrieval.
All other keyword parameters are added as (properly escaped) extra
attributes to the `img` tag.
"""
if use_size is None:
if getattr(self, '_dimensions_cache', None):
use_size = True
else:
try:
self.storage.path(self.name)
use_size = True
except NotImplementedError:
use_size = False
attrs['alt'] = alt
attrs['src'] = self.url
if use_size:
attrs.update(dict(width=self.width, height=self.height))
attrs = ' '.join(['%s="%s"' % (key, escape(value))
for key, value in sorted(attrs.items())])
return mark_safe('<img %s />' % attrs)
def _get_file(self):
self._require_file()
if not hasattr(self, '_file') or self._file is None:
self._file = self.storage.open(self.name, 'rb')
return self._file
def _set_file(self, value):
if value is not None and not isinstance(value, File):
value = File(value)
self._file = value
self._committed = False
def _del_file(self):
del self._file
file = property(_get_file, _set_file, _del_file)
def open(self, mode=None, *args, **kwargs):
if self.closed and self.name:
mode = mode or getattr(self, 'mode', None) or 'rb'
self.file = self.storage.open(self.name, mode)
else:
return super(ThumbnailFile, self).open(mode, *args, **kwargs)
def _get_image_dimensions(self):
if not hasattr(self, '_dimensions_cache'):
close = self.closed
self.open()
self._dimensions_cache = database_get_image_dimensions(
self, close=close)
return self._dimensions_cache
def set_image_dimensions(self, thumbnail):
"""
Set image dimensions from the cached dimensions of a ``Thumbnail``
model instance.
"""
try:
dimensions = getattr(thumbnail, 'dimensions', None)
except models.ThumbnailDimensions.DoesNotExist:
dimensions = None
if not dimensions:
return False
self._dimensions_cache = dimensions.size
return self._dimensions_cache
class Thumbnailer(File):
"""
A file-like object which provides some methods to generate thumbnail
images.
You can subclass this object and override the following properties to
change the defaults (pulled from the default settings):
* source_generators
* thumbnail_processors
"""
#: A list of source generators to use. If ``None``, will use the default
#: generators defined in settings.
source_generators = None
#: A list of thumbnail processors. If ``None``, will use the default
#: processors defined in settings.
thumbnail_processors = None
def __init__(self, file=None, name=None, source_storage=None,
thumbnail_storage=None, remote_source=False, generate=True,
*args, **kwargs):
super(Thumbnailer, self).__init__(file, name, *args, **kwargs)
if source_storage is None:
source_storage = default_storage
self.source_storage = source_storage
if thumbnail_storage is None:
thumbnail_storage = storage.thumbnail_default_storage
self.thumbnail_storage = thumbnail_storage
self.remote_source = remote_source
self.alias_target = None
self.generate = generate
# Set default properties. For backwards compatibilty, check to see
# if the attribute exists already (it could be set as a class property
# on a subclass) before getting it from settings.
for default in (
'basedir', 'subdir', 'prefix', 'quality', 'extension',
'preserve_extensions', 'transparency_extension',
'check_cache_miss', 'high_resolution', 'highres_infix',
'namer'):
attr_name = 'thumbnail_%s' % default
if getattr(self, attr_name, None) is None:
value = getattr(settings, attr_name.upper())
setattr(self, attr_name, value)
def __getitem__(self, alias):
"""
Retrieve a thumbnail matching the alias options (or raise a
``KeyError`` if no such alias exists).
"""
options = aliases.get(alias, target=self.alias_target)
if not options:
raise KeyError(alias)
return self.get_thumbnail(options, silent_template_exception=True)
def get_options(self, thumbnail_options, **kwargs):
"""
Get the thumbnail options that includes the default options for this
thumbnailer (and the project-wide default options).
"""
if isinstance(thumbnail_options, ThumbnailOptions):
return thumbnail_options
args = []
if thumbnail_options is not None:
args.append(thumbnail_options)
opts = ThumbnailOptions(*args, **kwargs)
if 'quality' not in thumbnail_options:
opts['quality'] = self.thumbnail_quality
return opts
def generate_thumbnail(self, thumbnail_options, high_resolution=False,
silent_template_exception=False):
"""
Return an unsaved ``ThumbnailFile`` containing a thumbnail image.
The thumbnail image is generated using the ``thumbnail_options``
dictionary.
"""
thumbnail_options = self.get_options(thumbnail_options)
orig_size = thumbnail_options['size'] # remember original size
# Size sanity check.
min_dim, max_dim = 0, 0
for dim in orig_size:
try:
dim = int(dim)
except (TypeError, ValueError):
continue
min_dim, max_dim = min(min_dim, dim), max(max_dim, dim)
if max_dim == 0 or min_dim < 0:
raise exceptions.EasyThumbnailsError(
"The source image is an invalid size (%sx%s)" % orig_size)
if high_resolution:
thumbnail_options['size'] = (orig_size[0] * 2, orig_size[1] * 2)
image = engine.generate_source_image(
self, thumbnail_options, self.source_generators,
fail_silently=silent_template_exception)
if image is None:
raise exceptions.InvalidImageFormatError(
"The source file does not appear to be an image")
thumbnail_image = engine.process_image(image, thumbnail_options,
self.thumbnail_processors)
if high_resolution:
thumbnail_options['size'] = orig_size # restore original size
filename = self.get_thumbnail_name(
thumbnail_options,
transparent=utils.is_transparent(thumbnail_image),
high_resolution=high_resolution)
quality = thumbnail_options['quality']
subsampling = thumbnail_options['subsampling']
img = engine.save_image(
thumbnail_image, filename=filename, quality=quality,
subsampling=subsampling)
data = img.read()
thumbnail = ThumbnailFile(
filename, file=ContentFile(data), storage=self.thumbnail_storage,
thumbnail_options=thumbnail_options)
thumbnail.image = thumbnail_image
thumbnail._committed = False
return thumbnail
def get_thumbnail_name(self, thumbnail_options, transparent=False,
high_resolution=False):
"""
Return a thumbnail filename for the given ``thumbnail_options``
dictionary and ``source_name`` (which defaults to the File's ``name``
if not provided).
"""
thumbnail_options = self.get_options(thumbnail_options)
path, source_filename = os.path.split(self.name)
source_extension = os.path.splitext(source_filename)[1][1:]
preserve_extensions = self.thumbnail_preserve_extensions
if preserve_extensions and (
preserve_extensions is True or
source_extension.lower() in preserve_extensions):
extension = source_extension
elif transparent:
extension = self.thumbnail_transparency_extension
else:
extension = self.thumbnail_extension
extension = extension or 'jpg'
prepared_opts = thumbnail_options.prepared_options()
opts_text = '_'.join(prepared_opts)
data = {'opts': opts_text}
basedir = self.thumbnail_basedir % data
subdir = self.thumbnail_subdir % data
if isinstance(self.thumbnail_namer, six.string_types):
namer_func = utils.dynamic_import(self.thumbnail_namer)
else:
namer_func = self.thumbnail_namer
filename = namer_func(
thumbnailer=self,
source_filename=source_filename,
thumbnail_extension=extension,
thumbnail_options=thumbnail_options,
prepared_options=prepared_opts,
)
if high_resolution:
filename = self.thumbnail_highres_infix.join(
os.path.splitext(filename))
filename = '%s%s' % (self.thumbnail_prefix, filename)
return os.path.join(basedir, path, subdir, filename)
def get_existing_thumbnail(self, thumbnail_options, high_resolution=False):
"""
Return a ``ThumbnailFile`` containing an existing thumbnail for a set
of thumbnail options, or ``None`` if not found.
"""
thumbnail_options = self.get_options(thumbnail_options)
names = [
self.get_thumbnail_name(
thumbnail_options, transparent=False,
high_resolution=high_resolution)]
transparent_name = self.get_thumbnail_name(
thumbnail_options, transparent=True,
high_resolution=high_resolution)
if transparent_name not in names:
names.append(transparent_name)
for filename in names:
exists = self.thumbnail_exists(filename)
if exists:
thumbnail_file = ThumbnailFile(
name=filename, storage=self.thumbnail_storage,
thumbnail_options=thumbnail_options)
if settings.THUMBNAIL_CACHE_DIMENSIONS:
# If this wasn't local storage, exists will be a thumbnail
# instance so we can store the image dimensions now to save
# a future potential query.
thumbnail_file.set_image_dimensions(exists)
return thumbnail_file
def get_thumbnail(self, thumbnail_options, save=True, generate=None,
silent_template_exception=False):
"""
Return a ``ThumbnailFile`` containing a thumbnail.
If a matching thumbnail already exists, it will simply be returned.
By default (unless the ``Thumbnailer`` was instanciated with
``generate=False``), thumbnails that don't exist are generated.
Otherwise ``None`` is returned.
Force the generation behaviour by setting the ``generate`` param to
either ``True`` or ``False`` as required.
The new thumbnail image is generated using the ``thumbnail_options``
dictionary. If the ``save`` argument is ``True`` (default), the
generated thumbnail will be saved too.
"""
thumbnail_options = self.get_options(thumbnail_options)
if generate is None:
generate = self.generate
thumbnail = self.get_existing_thumbnail(thumbnail_options)
if not thumbnail:
if generate:
thumbnail = self.generate_thumbnail(
thumbnail_options,
silent_template_exception=silent_template_exception)
if save:
self.save_thumbnail(thumbnail)
else:
signals.thumbnail_missed.send(
sender=self, options=thumbnail_options,
high_resolution=False)
if 'HIGH_RESOLUTION' in thumbnail_options:
generate_high_resolution = thumbnail_options.get('HIGH_RESOLUTION')
else:
generate_high_resolution = self.thumbnail_high_resolution
if generate_high_resolution:
thumbnail.high_resolution = self.get_existing_thumbnail(
thumbnail_options, high_resolution=True)
if not thumbnail.high_resolution:
if generate:
thumbnail.high_resolution = self.generate_thumbnail(
thumbnail_options, high_resolution=True,
silent_template_exception=silent_template_exception)
if save:
self.save_thumbnail(thumbnail.high_resolution)
else:
signals.thumbnail_missed.send(
sender=self, options=thumbnail_options,
high_resolution=False)
return thumbnail
def save_thumbnail(self, thumbnail):
"""
Save a thumbnail to the thumbnail_storage.
Also triggers the ``thumbnail_created`` signal and caches the
thumbnail values and dimensions for future lookups.
"""
filename = thumbnail.name
try:
self.thumbnail_storage.delete(filename)
except Exception:
pass
self.thumbnail_storage.save(filename, thumbnail)
thumb_cache = self.get_thumbnail_cache(
thumbnail.name, create=True, update=True)
# Cache thumbnail dimensions.
if settings.THUMBNAIL_CACHE_DIMENSIONS:
dimensions_cache, created = (
models.ThumbnailDimensions.objects.get_or_create(
thumbnail=thumb_cache,
defaults={'width': thumbnail.width,
'height': thumbnail.height}))
if not created:
dimensions_cache.width = thumbnail.width
dimensions_cache.height = thumbnail.height
dimensions_cache.save()
signals.thumbnail_created.send(sender=thumbnail)
def thumbnail_exists(self, thumbnail_name):
"""
Calculate whether the thumbnail already exists and that the source is
not newer than the thumbnail.
If the source and thumbnail file storages are local, their file
modification times are used. Otherwise the database cached modification
times are used.
"""
if self.remote_source:
return False
if utils.is_storage_local(self.source_storage):
source_modtime = utils.get_modified_time(
self.source_storage, self.name)
else:
source = self.get_source_cache()
if not source:
return False
source_modtime = source.modified
if not source_modtime:
return False
local_thumbnails = utils.is_storage_local(self.thumbnail_storage)
if local_thumbnails:
thumbnail_modtime = utils.get_modified_time(
self.thumbnail_storage, thumbnail_name)
if not thumbnail_modtime:
return False
return source_modtime <= thumbnail_modtime
thumbnail = self.get_thumbnail_cache(thumbnail_name)
if not thumbnail:
return False
thumbnail_modtime = thumbnail.modified
if thumbnail.modified and source_modtime <= thumbnail.modified:
return thumbnail
return False
def get_source_cache(self, create=False, update=False):
if self.remote_source:
return None
if hasattr(self, '_source_cache') and not update:
if self._source_cache or not create:
return self._source_cache
update_modified = (update or create) and timezone.now()
self._source_cache = models.Source.objects.get_file(
create=create, update_modified=update_modified,
storage=self.source_storage, name=self.name,
check_cache_miss=self.thumbnail_check_cache_miss)
return self._source_cache
def get_thumbnail_cache(self, thumbnail_name, create=False, update=False):
if self.remote_source:
return None
source = self.get_source_cache(create=True)
update_modified = (update or create) and timezone.now()
return models.Thumbnail.objects.get_file(
create=create, update_modified=update_modified,
storage=self.thumbnail_storage, source=source, name=thumbnail_name,
check_cache_miss=self.thumbnail_check_cache_miss)
def open(self, mode=None):
if self.closed:
mode = mode or getattr(self, 'mode', None) or 'rb'
self.file = self.source_storage.open(self.name, mode)
else:
self.seek(0)
# open() doesn't alter the file's contents, but it does reset the pointer.
open.alters_data = True
class ThumbnailerFieldFile(FieldFile, Thumbnailer):
"""
A field file which provides some methods for generating (and returning)
thumbnail images.
"""
def __init__(self, *args, **kwargs):
super(ThumbnailerFieldFile, self).__init__(*args, **kwargs)
self.source_storage = self.field.storage
thumbnail_storage = getattr(self.field, 'thumbnail_storage', None)
if thumbnail_storage:
self.thumbnail_storage = thumbnail_storage
self.alias_target = self
def save(self, name, content, *args, **kwargs):
"""
Save the file, also saving a reference to the thumbnail cache Source
model.
"""
super(ThumbnailerFieldFile, self).save(name, content, *args, **kwargs)
self.get_source_cache(create=True, update=True)
def delete(self, *args, **kwargs):
"""
Delete the image, along with any generated thumbnails.
"""
source_cache = self.get_source_cache()
# First, delete any related thumbnails.
self.delete_thumbnails(source_cache)
# Next, delete the source image.
super(ThumbnailerFieldFile, self).delete(*args, **kwargs)
# Finally, delete the source cache entry.
if source_cache:
source_cache.delete()
delete.alters_data = True
def delete_thumbnails(self, source_cache=None):
"""
Delete any thumbnails generated from the source image.
:arg source_cache: An optional argument only used for optimisation
where the source cache instance is already known.
:returns: The number of files deleted.
"""
source_cache = self.get_source_cache()
deleted = 0
if source_cache:
thumbnail_storage_hash = utils.get_storage_hash(
self.thumbnail_storage)
for thumbnail_cache in source_cache.thumbnails.all():
# Only attempt to delete the file if it was stored using the
# same storage as is currently used.
if thumbnail_cache.storage_hash == thumbnail_storage_hash:
self.thumbnail_storage.delete(thumbnail_cache.name)
# Delete the cache thumbnail instance too.
thumbnail_cache.delete()
deleted += 1
return deleted
delete_thumbnails.alters_data = True
def get_thumbnails(self, *args, **kwargs):
"""
Return an iterator which returns ThumbnailFile instances.
"""
# First, delete any related thumbnails.
source_cache = self.get_source_cache()
if source_cache:
thumbnail_storage_hash = utils.get_storage_hash(
self.thumbnail_storage)
for thumbnail_cache in source_cache.thumbnails.all():
# Only iterate files which are stored using the current
# thumbnail storage.
if thumbnail_cache.storage_hash == thumbnail_storage_hash:
yield ThumbnailFile(name=thumbnail_cache.name,
storage=self.thumbnail_storage)
class ThumbnailerImageFieldFile(ImageFieldFile, ThumbnailerFieldFile):
"""
A field file which provides some methods for generating (and returning)
thumbnail images.
"""
def save(self, name, content, *args, **kwargs):
"""
Save the image.
The image will be resized down using a ``ThumbnailField`` if
``resize_source`` (a dictionary of thumbnail options) is provided by
the field.
"""
options = getattr(self.field, 'resize_source', None)
if options:
if 'quality' not in options:
options['quality'] = self.thumbnail_quality
content = Thumbnailer(content, name).generate_thumbnail(options)
# If the generated extension differs from the original, use it
# instead.
orig_name, ext = os.path.splitext(name)
generated_ext = os.path.splitext(content.name)[1]
if generated_ext.lower() != ext.lower():
name = orig_name + generated_ext
super(ThumbnailerImageFieldFile, self).save(name, content, *args,
**kwargs)
| {
"content_hash": "6c7b121d0812d4c8ff6c89f4a2e98ce0",
"timestamp": "",
"source": "github",
"line_count": 753,
"max_line_length": 79,
"avg_line_length": 38.45683930942895,
"alnum_prop": 0.6095379515159887,
"repo_name": "sandow-digital/easy-thumbnails-cropman",
"id": "796527962b8ccf7c380b598f7f7f4b59764256d8",
"size": "28958",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "easy_thumbnails/files.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "257367"
},
{
"name": "Shell",
"bytes": "2975"
}
],
"symlink_target": ""
} |
if (TARGET libzmijcmake)
return()
endif()
find_program(GIT_EXECUTABLE git)
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/cmake-scripts)
execute_process(COMMAND ${GIT_EXECUTABLE} pull
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cmake-scripts)
else()
execute_process(COMMAND ${GIT_EXECUTABLE} clone -b develop https://github.com/zmij/cmake-scripts.git cmake-scripts
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
set(ZMIJ_CMAKE_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/cmake-scripts)
add_library(libzmijcmake IMPORTED INTERFACE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${ZMIJ_CMAKE_SCRIPTS}/modules")
| {
"content_hash": "645b7e9c32aa5c5b1c796c44a1012e01",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 118,
"avg_line_length": 37.11764705882353,
"alnum_prop": 0.7464342313787639,
"repo_name": "zmij/math",
"id": "e0ffb5cdf1f918b0a3958604f96e47d2c518506a",
"size": "722",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "cmake/modules/FindExternalProjectZmijModules.cmake",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "348110"
},
{
"name": "CMake",
"bytes": "4211"
},
{
"name": "Shell",
"bytes": "113"
}
],
"symlink_target": ""
} |
<?php
namespace Symfony\Bundle\WebConfiguratorBundle\Step;
use Symfony\Component\Form\FormContext;
use Symfony\Bundle\WebConfiguratorBundle\Form\DoctrineForm;
use Symfony\Bundle\WebConfiguratorBundle\Exception\StepRequirementException;
/**
* Doctrine Step.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class DoctrineStep implements StepInterface
{
/**
* @validation:Choice(callback="getDriverKeys")
*/
public $driver;
/**
* @validation:NotBlank
*/
public $host;
/**
* @validation:NotBlank
*/
public $name;
/**
* @validation:NotBlank
*/
public $user;
public $password;
public function __construct(array $parameters)
{
foreach ($parameters as $key => $value) {
if (0 === strpos($key, 'database_')) {
$parameters[substr($key, 9)] = $value;
$key = substr($key, 9);
$this->$key = $value;
}
}
}
/**
* @see StepInterface
*/
public function getForm(FormContext $context)
{
return DoctrineForm::create($context, 'config');
}
/**
* @see StepInterface
*/
public function checkRequirements()
{
$messages = array();
if (!class_exists('\PDO')) {
$messages[] = 'PDO extension is mandatory.';
} else {
$drivers = \PDO::getAvailableDrivers();
if (0 == count($drivers)) {
$messages[] = 'Please install PDO drivers.';
}
}
return $messages;
}
/**
* @see StepInterface
*/
public function checkOptionalSettings()
{
return array();
}
/**
* @see StepInterface
*/
public function update(StepInterface $data)
{
$parameters = array();
foreach ($data as $key => $value) {
$parameters['database_'.$key] = $value;
}
return $parameters;
}
/**
* @see StepInterface
*/
public function getTemplate()
{
return 'SymfonyWebConfigurator:Step:doctrine.html.twig';
}
/**
* @return array
*/
static public function getDriverKeys()
{
return array_keys(static::getDrivers());
}
/**
* @return array
*/
static public function getDrivers()
{
return array(
'pdo_mysql' => 'MySQL (PDO)',
'pdo_sqlite' => 'SQLite (PDO)',
'pdo_pgsql' => 'PosgreSQL (PDO)',
'oci8' => 'Oracle (native)',
'ibm_db2' => 'IBM DB2 (native)',
'pdo_oci' => 'Oracle (PDO)',
'pdo_ibm' => 'IBM DB2 (PDO)',
'pdo_sqlsrv' => 'SQLServer (PDO)',
);
}
}
| {
"content_hash": "bda5bdf3d7f7563d92c6d5a502d4e995",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 76,
"avg_line_length": 20.96969696969697,
"alnum_prop": 0.5122832369942196,
"repo_name": "ivanrey/Symfony-Community",
"id": "eaee60341ba8c5a917bdbe5fa334c7e047069aff",
"size": "2997",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/bundles/Symfony/Bundle/WebConfiguratorBundle/Step/DoctrineStep.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "41324"
},
{
"name": "Shell",
"bytes": "2252"
}
],
"symlink_target": ""
} |
module Bitfinex
module RESTv1Orders
# Submit a new order
# @param symbol [string] The name of the symbol (see `#symbols`)
# @param amount [decimal] Order size: how much to buy or sell
# @param type [string] Either “market” / “limit” / “stop” / “trailing-stop” / “fill-or-kill” / “exchange market” / “exchange limit” / “exchange stop” / “exchange trailing-stop” / “exchange fill-or-kill”. (type starting by “exchange ” are exchange orders, others are margin trading orders)
# @param side [string] Either “buy” or “sell”
# @param price [decimal] Price to buy or sell at. Must be positive. Use random number for market orders.
# @param params :is_hidden [bool] (optional) true if the order should be hidden. Default is false
# @param params :is_postonly [bool] (optional) true if the order should be post only. Default is false. Only relevant for limit orders
# @param params :ocoorder [bool] Set an additional STOP OCO order that will be linked with the current order
# @param params :buy_price_oco [decimal] If ocoorder is true, this field represent the price of the OCO stop order to place
# @param params :sell_price_oco [decimal] If ocoorder is true, this field represent the price of the OCO stop order to place
# @return [Hash]
# @example:
# client.new_order("usdbtc", 100, "market", "sell", 0)
def new_order(symbol, amount, type, side, price = nil, params = {})
check_params(params, %i{is_hidden is_postonly ocoorder buy_price_oco use_all_available sell_price_oco})
# for 'market' order, we need to pass a random positive price, not nil
price ||= 0.001 if type == "market" || type == "exchange market"
params.merge!({
symbol: symbol,
amount: amount.to_s,
type: type,
side: side,
exchange: 'bitfinex',
price: "%.10f" % price.to_f.round(10) # Decimalize float price (necessary for small numbers)
})
authenticated_post("order/new", params: params).body
end
# Submit several new orders at once
#
# @param orders [Array] Array of Hash with the following elements
# @param orders :symbol [string] The name of the symbol
# @param orders :amount [decimal] Order size: how much to buy or sell
# @param orders :price [decimal] Price to buy or sell at. May omit if a market order
# @param orders :exchange [string] "bitfinex"
# @param orders :side [string] Either “buy” or “sell”
# @param orders :type [string] Either “market” / “limit” / “stop” / “trailing-stop” / “fill-or-kill”
# @return [Hash] with a `object_id` that is an `Array`
# @example:
# client.multiple_orders([{symbol: "usdbtc", amount: 10, price: 0, exchange: "bitfinex", side: "buy", type: "market"}])
def multiple_orders(orders)
authenticated_post("order/new/multi", params: {orders: orders}).body
end
# Cancel an order
#
# @param ids [Array] or [integer] or nil
# if it's Array it's supposed to specify a list of IDS
# if it's an integer it's supposed to be a single ID
# if it's not specified it deletes all the orders placed
# @return [Hash]
# @example
# client.cancel_orders([100,231,400])
def cancel_orders(ids=nil)
case ids
when Array
authenticated_post("order/cancel/multi", params: {order_ids: ids.map(&:to_i)}).body
when Numeric, String
authenticated_post("order/cancel", params: {order_id: ids.to_i}).body
when NilClass
authenticated_post("order/cancel/all").body
else
raise ParamsError
end
end
# Replace an orders with a new one
#
# @param id [int] the ID of the order to replace
# @param symbol [string] the name of the symbol
# @param amount [decimal] Order size: how much to buy or sell
# @param type [string] Either “market” / “limit” / “stop” / “trailing-stop” / “fill-or-kill” / “exchange market” / “exchange limit” / “exchange stop” / “exchange trailing-stop” / “exchange fill-or-kill”. (type starting by “exchange ” are exchange orders, others are margin trading orders)
# @param side [string] Either “buy” or “sell”
# @param price [decimal] Price to buy or sell at. May omit if a market order
# @param is_hidden [bool] (optional) true if the order should be hidden. Default is false
# @param use_remaining [bool] (optional) will use the amount remaining of the canceled order as the amount of the new order. Default is false
# @return [Hash] the order
# @example:
# client.replace_order(100,"usdbtc", 10, "market", "buy", 0)
def replace_order(id, symbol, amount, type, side, price, is_hidden=false, use_remaining=false)
params = {
order_id: id.to_i,
symbol: symbol,
amount: amount.to_s,
type: type,
side: side,
exchange: 'bitfinex',
is_hidden: is_hidden,
use_remaining: use_remaining,
price: price.to_s
}
authenticated_post("order/cancel/replace", params: params).body
end
# Get the status of an order. Is it active? Was it cancelled? To what extent has it been executed? etc.
#
# @param id
# @return [Hash]
# @exmaple:
# client.order_status(100)
def order_status(id)
authenticated_post("order/status", params: {order_id: id.to_i}).body
end
# View your active orders.
#
# @return [Hash]
# @example:
# client.orders
def orders
authenticated_post("orders").body
end
end
end
| {
"content_hash": "fc8235367356adf6295c8335d57afa7e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 292,
"avg_line_length": 46.05833333333333,
"alnum_prop": 0.6457390989686991,
"repo_name": "bitfinexcom/bitfinex-api-rb",
"id": "fe5b3e1bbf1fc4a51b38fe27af50f3af9c33813c",
"size": "5659",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/rest/v1/orders.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "96783"
}
],
"symlink_target": ""
} |
struct linux_platform;
struct droid_platform {
struct wcore_platform wcore;
struct linux_platform *linux;
};
DEFINE_CONTAINER_CAST_FUNC(droid_platform,
struct droid_platform,
struct wcore_platform,
wcore)
struct wcore_platform*
droid_platform_create(void);
| {
"content_hash": "14587d4a4503509854a8e00df8c4e9c8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 49,
"avg_line_length": 24.928571428571427,
"alnum_prop": 0.5931232091690545,
"repo_name": "maurossi/waffle",
"id": "e5c2ff85c0c9d22df9cbf4f712127502f931e618",
"size": "1802",
"binary": false,
"copies": "8",
"ref": "refs/heads/android-x86",
"path": "src/waffle/android/droid_platform.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "583202"
},
{
"name": "C++",
"bytes": "57163"
},
{
"name": "CSS",
"bytes": "906"
},
{
"name": "Makefile",
"bytes": "4156"
},
{
"name": "Objective-C",
"bytes": "40490"
},
{
"name": "Shell",
"bytes": "3884"
},
{
"name": "XSLT",
"bytes": "5554"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>112D</logradouro><bairro>Acaracuzinho</bairro><cidade>Maracanaú</cidade><uf>CE</uf><cep>61920510</cep></feed>
| {
"content_hash": "1d3eca006bbedb6ebfe48d8dd0203a4a",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 143,
"avg_line_length": 100,
"alnum_prop": 0.725,
"repo_name": "chesarex/webservice-cep",
"id": "84716533db8f790ef9dfd8a570ac355c5d2624a6",
"size": "201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/ceps/61/920/510/cep.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
from __future__ import absolute_import
import os
import shutil
import nox
LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core"))
@nox.session(python="3.7")
def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("flake8", "black", *LOCAL_DEPS)
session.run(
"black",
"--check",
"google",
"tests",
"docs",
)
session.run("flake8", "google", "tests")
@nox.session(python="3.6")
def blacken(session):
"""Run black.
Format code to uniform standard.
This currently uses Python 3.6 due to the automated Kokoro run of synthtool.
That run uses an image that doesn't have 3.6 installed. Before updating this
check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
"""
session.install("black")
session.run(
"black",
"google",
"tests",
"docs",
)
@nox.session(python="3.7")
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.install("docutils", "pygments")
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
def default(session):
# Install all test dependencies, then install this package in-place.
session.install("mock", "pytest", "pytest-cov")
for local_dep in LOCAL_DEPS:
session.install("-e", local_dep)
session.install("-e", ".")
# Run py.test against the unit tests.
session.run(
"py.test",
"--quiet",
"--cov=google.cloud",
"--cov=tests.unit",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=97",
os.path.join("tests", "unit"),
*session.posargs,
)
@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
def unit(session):
"""Run the unit test suite."""
default(session)
@nox.session(python=["2.7", "3.7"])
def system(session):
"""Run the system test suite."""
system_test_path = os.path.join("tests", "system.py")
system_test_folder_path = os.path.join("tests", "system")
# Sanity check: Only run tests if the environment variable is set.
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
session.skip("Credentials must be set via environment variable")
system_test_exists = os.path.exists(system_test_path)
system_test_folder_exists = os.path.exists(system_test_folder_path)
# Sanity check: only run tests if found.
if not system_test_exists and not system_test_folder_exists:
session.skip("System tests were not found")
# Use pre-release gRPC for system tests.
session.install("--pre", "grpcio")
# Install all test dependencies, then install this package into the
# virtualenv's dist-packages.
session.install("mock", "pytest")
for local_dep in LOCAL_DEPS:
session.install("-e", local_dep)
session.install("-e", "../test_utils/")
session.install("-e", ".")
# Run py.test against the system tests.
if system_test_exists:
session.run("py.test", "--quiet", system_test_path, *session.posargs)
if system_test_folder_exists:
session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)
@nox.session(python="3.7")
def cover(session):
"""Run the final coverage report.
This outputs the coverage report aggregating coverage from the unit
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=100")
session.run("coverage", "erase")
@nox.session(python="3.7")
def docs(session):
"""Build the docs for this library."""
session.install('-e', '.')
session.install('sphinx', 'alabaster', 'recommonmark')
shutil.rmtree(os.path.join('docs', '_build'), ignore_errors=True)
session.run(
'sphinx-build',
'-W', # warnings as errors
'-T', # show full traceback on exception
'-N', # no colors
'-b', 'html',
'-d', os.path.join('docs', '_build', 'doctrees', ''),
os.path.join('docs', ''),
os.path.join('docs', '_build', 'html', ''),
)
| {
"content_hash": "4de065bbffef44d93cd81da0e6470a5f",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 84,
"avg_line_length": 30.07638888888889,
"alnum_prop": 0.612791503117063,
"repo_name": "tswast/google-cloud-python",
"id": "0f528b7f3902a3125b02718b92dd0ccdb51edc45",
"size": "4933",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "trace/noxfile.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1094"
},
{
"name": "Python",
"bytes": "33785371"
},
{
"name": "Shell",
"bytes": "9148"
}
],
"symlink_target": ""
} |
#include BLIK_OPENSSL_V_openssl__e_os2_h //original-code:<openssl/e_os2.h>
#include <string.h>
#include BLIK_OPENSSL_V_openssl__crypto_h //original-code:<openssl/crypto.h>
#ifdef OPENSSL_SYS_VMS
# if __CRTL_VER >= 70000000 && \
(defined _POSIX_C_SOURCE || !defined _ANSI_C_SOURCE)
# define VMS_GMTIME_OK
# endif
# ifndef VMS_GMTIME_OK
# include <libdtdef.h>
# include <lib$routines.h>
# include <lnmdef.h>
# include <starlet.h>
# include <descrip.h>
# include <stdlib.h>
# endif /* ndef VMS_GMTIME_OK */
/*
* Needed to pick up the correct definitions and declarations in some of the
* DEC C Header Files (*.H).
*/
# define __NEW_STARLET 1
# if (defined(__alpha) || defined(__ia64))
# include <iledef.h>
# else
/* VAX */
typedef struct _ile3 { /* Copied from ILEDEF.H for Alpha */
# pragma __nomember_alignment
unsigned short int ile3$w_length; /* Length of buffer in bytes */
unsigned short int ile3$w_code; /* Item code value */
void *ile3$ps_bufaddr; /* Buffer address */
unsigned short int *ile3$ps_retlen_addr; /* Address of word for returned length */
} ILE3;
# endif /* alpha || ia64 */
#endif /* OPENSSL_SYS_VMS */
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
{
struct tm *ts = NULL;
#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX)
/*
* should return &data, but doesn't on some systems, so we don't even
* look at the return value
*/
gmtime_r(timer, result);
ts = result;
#elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK)
ts = gmtime(timer);
if (ts == NULL)
return NULL;
memcpy(result, ts, sizeof(struct tm));
ts = result;
#endif
#if defined( OPENSSL_SYS_VMS) && !defined( VMS_GMTIME_OK)
if (ts == NULL) {
static $DESCRIPTOR(tabnam, "LNM$DCL_LOGICAL");
static $DESCRIPTOR(lognam, "SYS$TIMEZONE_DIFFERENTIAL");
char logvalue[256];
unsigned int reslen = 0;
# if __INITIAL_POINTER_SIZE == 64
ILEB_64 itemlist[2], *pitem;
# else
ILE3 itemlist[2], *pitem;
# endif
int status;
time_t t;
/*
* Setup an itemlist for the call to $TRNLNM - Translate Logical Name.
*/
pitem = itemlist;
# if __INITIAL_POINTER_SIZE == 64
pitem->ileb_64$w_mbo = 1;
pitem->ileb_64$w_code = LNM$_STRING;
pitem->ileb_64$l_mbmo = -1;
pitem->ileb_64$q_length = sizeof (logvalue);
pitem->ileb_64$pq_bufaddr = logvalue;
pitem->ileb_64$pq_retlen_addr = (unsigned __int64 *) &reslen;
pitem++;
/* Last item of the item list is null terminated */
pitem->ileb_64$q_length = pitem->ileb_64$w_code = 0;
# else
pitem->ile3$w_length = sizeof (logvalue);
pitem->ile3$w_code = LNM$_STRING;
pitem->ile3$ps_bufaddr = logvalue;
pitem->ile3$ps_retlen_addr = (unsigned short int *) &reslen;
pitem++;
/* Last item of the item list is null terminated */
pitem->ile3$w_length = pitem->ile3$w_code = 0;
# endif
/* Get the value for SYS$TIMEZONE_DIFFERENTIAL */
status = sys$trnlnm(0, &tabnam, &lognam, 0, itemlist);
if (!(status & 1))
return NULL;
logvalue[reslen] = '\0';
t = *timer;
/* The following is extracted from the DEC C header time.h */
/*
** Beginning in OpenVMS Version 7.0 mktime, time, ctime, strftime
** have two implementations. One implementation is provided
** for compatibility and deals with time in terms of local time,
** the other __utc_* deals with time in terms of UTC.
*/
/*
* We use the same conditions as in said time.h to check if we should
* assume that t contains local time (and should therefore be
* adjusted) or UTC (and should therefore be left untouched).
*/
# if __CRTL_VER < 70000000 || defined _VMS_V6_SOURCE
/* Get the numerical value of the equivalence string */
status = atoi(logvalue);
/* and use it to move time to GMT */
t -= status;
# endif
/* then convert the result to the time structure */
/*
* Since there was no gmtime_r() to do this stuff for us, we have to
* do it the hard way.
*/
{
/*-
* The VMS epoch is the astronomical Smithsonian date,
if I remember correctly, which is November 17, 1858.
Furthermore, time is measure in tenths of microseconds
and stored in quadwords (64 bit integers). unix_epoch
below is January 1st 1970 expressed as a VMS time. The
following code was used to get this number:
#include <stdio.h>
#include <stdlib.h>
#include <lib$routines.h>
#include <starlet.h>
main()
{
unsigned long systime[2];
unsigned short epoch_values[7] =
{ 1970, 1, 1, 0, 0, 0, 0 };
lib$cvt_vectim(epoch_values, systime);
printf("%u %u", systime[0], systime[1]);
}
*/
unsigned long unix_epoch[2] = { 1273708544, 8164711 };
unsigned long deltatime[2];
unsigned long systime[2];
struct vms_vectime {
short year, month, day, hour, minute, second, centi_second;
} time_values;
long operation;
/*
* Turn the number of seconds since January 1st 1970 to an
* internal delta time. Note that lib$cvt_to_internal_time() will
* assume that t is signed, and will therefore break on 32-bit
* systems some time in 2038.
*/
operation = LIB$K_DELTA_SECONDS;
status = lib$cvt_to_internal_time(&operation, &t, deltatime);
/*
* Add the delta time with the Unix epoch and we have the current
* UTC time in internal format
*/
status = lib$add_times(unix_epoch, deltatime, systime);
/* Turn the internal time into a time vector */
status = sys$numtim(&time_values, systime);
/* Fill in the struct tm with the result */
result->tm_sec = time_values.second;
result->tm_min = time_values.minute;
result->tm_hour = time_values.hour;
result->tm_mday = time_values.day;
result->tm_mon = time_values.month - 1;
result->tm_year = time_values.year - 1900;
operation = LIB$K_DAY_OF_WEEK;
status = lib$cvt_from_internal_time(&operation,
&result->tm_wday, systime);
result->tm_wday %= 7;
operation = LIB$K_DAY_OF_YEAR;
status = lib$cvt_from_internal_time(&operation,
&result->tm_yday, systime);
result->tm_yday--;
result->tm_isdst = 0; /* There's no way to know... */
ts = result;
}
}
#endif
return ts;
}
/*
* Take a tm structure and add an offset to it. This avoids any OS issues
* with restricted date types and overflows which cause the year 2038
* problem.
*/
#define SECS_PER_DAY (24 * 60 * 60)
static long date_to_julian(int y, int m, int d);
static void julian_to_date(long jd, int *y, int *m, int *d);
static int julian_adj(const struct tm *tm, int off_day, long offset_sec,
long *pday, int *psec);
int OPENSSL_gmtime_adj(struct tm *tm, int off_day, long offset_sec)
{
int time_sec, time_year, time_month, time_day;
long time_jd;
/* Convert time and offset into Julian day and seconds */
if (!julian_adj(tm, off_day, offset_sec, &time_jd, &time_sec))
return 0;
/* Convert Julian day back to date */
julian_to_date(time_jd, &time_year, &time_month, &time_day);
if (time_year < 1900 || time_year > 9999)
return 0;
/* Update tm structure */
tm->tm_year = time_year - 1900;
tm->tm_mon = time_month - 1;
tm->tm_mday = time_day;
tm->tm_hour = time_sec / 3600;
tm->tm_min = (time_sec / 60) % 60;
tm->tm_sec = time_sec % 60;
return 1;
}
int OPENSSL_gmtime_diff(int *pday, int *psec,
const struct tm *from, const struct tm *to)
{
int from_sec, to_sec, diff_sec;
long from_jd, to_jd, diff_day;
if (!julian_adj(from, 0, 0, &from_jd, &from_sec))
return 0;
if (!julian_adj(to, 0, 0, &to_jd, &to_sec))
return 0;
diff_day = to_jd - from_jd;
diff_sec = to_sec - from_sec;
/* Adjust differences so both positive or both negative */
if (diff_day > 0 && diff_sec < 0) {
diff_day--;
diff_sec += SECS_PER_DAY;
}
if (diff_day < 0 && diff_sec > 0) {
diff_day++;
diff_sec -= SECS_PER_DAY;
}
if (pday)
*pday = (int)diff_day;
if (psec)
*psec = diff_sec;
return 1;
}
/* Convert tm structure and offset into julian day and seconds */
static int julian_adj(const struct tm *tm, int off_day, long offset_sec,
long *pday, int *psec)
{
int offset_hms, offset_day;
long time_jd;
int time_year, time_month, time_day;
/* split offset into days and day seconds */
offset_day = offset_sec / SECS_PER_DAY;
/* Avoid sign issues with % operator */
offset_hms = offset_sec - (offset_day * SECS_PER_DAY);
offset_day += off_day;
/* Add current time seconds to offset */
offset_hms += tm->tm_hour * 3600 + tm->tm_min * 60 + tm->tm_sec;
/* Adjust day seconds if overflow */
if (offset_hms >= SECS_PER_DAY) {
offset_day++;
offset_hms -= SECS_PER_DAY;
} else if (offset_hms < 0) {
offset_day--;
offset_hms += SECS_PER_DAY;
}
/*
* Convert date of time structure into a Julian day number.
*/
time_year = tm->tm_year + 1900;
time_month = tm->tm_mon + 1;
time_day = tm->tm_mday;
time_jd = date_to_julian(time_year, time_month, time_day);
/* Work out Julian day of new date */
time_jd += offset_day;
if (time_jd < 0)
return 0;
*pday = time_jd;
*psec = offset_hms;
return 1;
}
/*
* Convert date to and from julian day Uses Fliegel & Van Flandern algorithm
*/
static long date_to_julian(int y, int m, int d)
{
return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +
(367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -
(3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 + d - 32075;
}
static void julian_to_date(long jd, int *y, int *m, int *d)
{
long L = jd + 68569;
long n = (4 * L) / 146097;
long i, j;
L = L - (146097 * n + 3) / 4;
i = (4000 * (L + 1)) / 1461001;
L = L - (1461 * i) / 4 + 31;
j = (80 * L) / 2447;
*d = L - (2447 * j) / 80;
L = j / 11;
*m = j + 2 - (12 * L);
*y = 100 * (n - 49) + i + L;
}
| {
"content_hash": "7a4506d6af2c766967ea33239c65435c",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 143,
"avg_line_length": 31.45505617977528,
"alnum_prop": 0.5512591534202537,
"repo_name": "BonexGu/Blik2D-SDK",
"id": "bb9cc965d5ab1af1da0646ddf11701d7ce0b38d9",
"size": "11530",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Blik2D/addon/openssl-1.1.0c_for_blik/crypto/o_time.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "4569427"
},
{
"name": "Awk",
"bytes": "4272"
},
{
"name": "Batchfile",
"bytes": "85058"
},
{
"name": "C",
"bytes": "84540340"
},
{
"name": "C#",
"bytes": "87505"
},
{
"name": "C++",
"bytes": "70828907"
},
{
"name": "CMake",
"bytes": "981401"
},
{
"name": "CSS",
"bytes": "6672"
},
{
"name": "Clojure",
"bytes": "1487"
},
{
"name": "Cuda",
"bytes": "1651996"
},
{
"name": "DIGITAL Command Language",
"bytes": "236265"
},
{
"name": "Emacs Lisp",
"bytes": "3938"
},
{
"name": "Go",
"bytes": "849619"
},
{
"name": "HLSL",
"bytes": "3314"
},
{
"name": "HTML",
"bytes": "1490174"
},
{
"name": "Java",
"bytes": "1266242"
},
{
"name": "JavaScript",
"bytes": "31070"
},
{
"name": "Jupyter Notebook",
"bytes": "1833654"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "M4",
"bytes": "606846"
},
{
"name": "Makefile",
"bytes": "1016819"
},
{
"name": "Module Management System",
"bytes": "1313"
},
{
"name": "Objective-C",
"bytes": "532198"
},
{
"name": "Objective-C++",
"bytes": "233973"
},
{
"name": "Perl",
"bytes": "1915573"
},
{
"name": "Perl 6",
"bytes": "3092647"
},
{
"name": "PowerShell",
"bytes": "38571"
},
{
"name": "Prolog",
"bytes": "364914"
},
{
"name": "Protocol Buffer",
"bytes": "218531"
},
{
"name": "Python",
"bytes": "22465245"
},
{
"name": "QMake",
"bytes": "10557"
},
{
"name": "Roff",
"bytes": "1213119"
},
{
"name": "Scala",
"bytes": "5683"
},
{
"name": "Shell",
"bytes": "968715"
},
{
"name": "TeX",
"bytes": "33751"
},
{
"name": "TypeScript",
"bytes": "1593696"
},
{
"name": "Verilog",
"bytes": "1215"
},
{
"name": "Visual Basic",
"bytes": "16186"
},
{
"name": "eC",
"bytes": "4556"
}
],
"symlink_target": ""
} |
package com.easyooo.framework.sharding;
import java.io.Serializable;
/**
*
* 数据源 Key
*
* @author Killer
*/
@SuppressWarnings("serial")
public class DataSourceKey implements Serializable {
private String key;
public DataSourceKey(String key){
this.key = key;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DataSourceKey other = (DataSourceKey) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
return true;
}
}
| {
"content_hash": "2dde2e165137315f8faae15544d9e13d",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 65,
"avg_line_length": 16.962264150943398,
"alnum_prop": 0.6418242491657397,
"repo_name": "leopardoooo/easyooo-framework",
"id": "9d5a562b3d536510a2833d8e46cc0e173c3d1175",
"size": "905",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/easyooo/framework/sharding/DataSourceKey.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "269029"
}
],
"symlink_target": ""
} |
package rtdc.android.voip;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import rtdc.android.impl.AndroidVoipController;
import rtdc.android.impl.voip.AndroidVoIPThread;
import rtdc.core.impl.voip.VoIPManager;
import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
/*
This class takes care of keeping track of network changes for the VOIP library.
It is also responsible to drop all calls in progress after a certain amount of time if the network is declared unreachable
*/
public class VoipConnectionManager extends BroadcastReceiver {
private final int CALL_TIMEOUT = 5; // The time (in seconds) it takes after the network is declared unreachable to hangup all calls
private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
@Override
public void onReceive(Context context, Intent intent) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo eventInfo = cm.getActiveNetworkInfo();
if (eventInfo == null || (eventInfo.getState() == NetworkInfo.State.DISCONNECTED && eventInfo.getType() == ConnectivityManager.TYPE_WIFI)) {
final VoIPManager vm = AndroidVoIPThread.getInstance().getVoIPManager();
Logger.getLogger(VoipConnectionManager.class.getName()).warning("No connectivity: setting network to unreachable");
vm.setNetworkReachable(false);
executor.schedule(new Callable(){
@Override
public Object call() throws Exception {
// Check if network is still unreachable. If its not, drop all calls
if(AndroidVoIPThread.getInstance().getCall() != null && !vm.isNetworkReachable()){
AndroidVoipController.get().hangup();
}
return null;
}
}, CALL_TIMEOUT, TimeUnit.SECONDS);
} else if (eventInfo.getState() == NetworkInfo.State.CONNECTED && eventInfo.getType() == ConnectivityManager.TYPE_WIFI){
Logger.getLogger(VoipConnectionManager.class.getName()).info("Wifi is now connected: setting network to reachable");
AndroidVoIPThread.getInstance().getVoIPManager().setNetworkReachable(true);
}
}
}
| {
"content_hash": "248540b2de0ab944dd23c41bc0716c0c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 148,
"avg_line_length": 46.14545454545455,
"alnum_prop": 0.7072498029944838,
"repo_name": "Bathlamos/RTDC",
"id": "e12183f42b9a1a987cd7c2d6f49eae1370eba721",
"size": "3761",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "android/src/main/java/rtdc/android/voip/VoipConnectionManager.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "184"
},
{
"name": "HTML",
"bytes": "1239"
},
{
"name": "Java",
"bytes": "836404"
},
{
"name": "Objective-C",
"bytes": "557782"
},
{
"name": "Swift",
"bytes": "17297"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<RelativeLayout
android:id="@+id/surface_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
</RelativeLayout>
<ImageView
android:id="@+id/thumb"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:background="#000000"
android:scaleType="fitCenter" />
<LinearLayout
android:id="@+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#99000000"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="invisible">
<TextView
android:id="@+id/current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:text="00:00"
android:textColor="#ffffff" />
<SeekBar
android:id="@+id/progress"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1.0"
android:background="@null"
android:max="100"
android:maxHeight="4dp"
android:minHeight="4dp"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:progressDrawable="@drawable/jc_seek_progress"
android:thumb="@drawable/jc_seek_thumb" />
<TextView
android:id="@+id/total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:text="00:00"
android:textColor="#ffffff" />
<ImageView
android:id="@+id/fullscreen"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingRight="16dp"
android:scaleType="center"
android:src="@drawable/jc_enlarge" />
</LinearLayout>
<ProgressBar
android:id="@+id/bottom_progressbar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="1.5dp"
android:layout_alignParentBottom="true"
android:max="100"
android:progressDrawable="@drawable/jc_progress" />
<ImageView
android:id="@+id/back_tiny"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="6dp"
android:background="@drawable/share_selector"
android:visibility="visible" />
<RelativeLayout
android:id="@+id/layout_top"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/jc_title_bg"
android:gravity="center_vertical">
<ImageView
android:id="@+id/back"
android:layout_width="48dp"
android:layout_height="48dp"
android:paddingLeft="10dp"
android:scaleType="centerInside"
android:src="@drawable/jc_back" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/back"
android:layout_toRightOf="@+id/back"
android:paddingLeft="10dp"
android:textColor="@android:color/white"
android:textSize="18sp" />
<ImageView
android:id="@+id/share"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:padding="6dp"
android:src="@drawable/share_selector" />
</RelativeLayout>
<ProgressBar
android:id="@+id/loading"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@drawable/jc_loading"
android:visibility="invisible" />
<ImageView
android:id="@+id/start"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:src="@drawable/jc_click_play_selector" />
</RelativeLayout>
| {
"content_hash": "75693063daac494a1b397781fae06233",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 74,
"avg_line_length": 35.43421052631579,
"alnum_prop": 0.6080579279613814,
"repo_name": "huunghiapn/giaitriviet",
"id": "bcd7b30475f2bb05a90b7548c174c0cbef79b98a",
"size": "5386",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/layout_standard_with_share_button.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "759324"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "8968ab5f960c79f5de678380fd3357c9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "828958f83c11ae7505d0bbc020703066152d136a",
"size": "188",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Bacteria/Cyanobacteria/Chroococcales/Merismopediaceae/Gomphosphaeria/Gomphosphaeria lilacea/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.R.Components.Test.Fakes.Undo {
/// <summary>
/// This class is to make it easy to catch new undo/redo operations while a delegated primitive
/// is in progress--it is called from DelegatedUndoPrimitive.Undo and .Redo with the IDispose
/// using pattern to set up the history to send operations our way.
/// </summary>
[ExcludeFromCodeCoverage]
internal class CatchOperationsFromHistoryForDelegatedPrimitive : IDisposable {
private readonly UndoHistoryImpl _history;
private readonly DelegatedUndoPrimitiveImpl _primitive;
public CatchOperationsFromHistoryForDelegatedPrimitive(UndoHistoryImpl history, DelegatedUndoPrimitiveImpl primitive, DelegatedUndoPrimitiveState state) {
_history = history;
_primitive = primitive;
primitive.State = state;
history.ForwardToUndoOperation(primitive);
}
public void Dispose() {
_history.EndForwardToUndoOperation(_primitive);
_primitive.State = DelegatedUndoPrimitiveState.Inactive;
GC.SuppressFinalize(this);
}
}
}
| {
"content_hash": "cc77c06c34623f7fd052472cdf5d5b3c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 162,
"avg_line_length": 42.15625,
"alnum_prop": 0.7131208302446257,
"repo_name": "AlexanderSher/RTVS",
"id": "3345e0fbe28a7e6529b5898629cd76dfee5cd94b",
"size": "1351",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/Windows/R/Components/Test/Fakes/Undo/CatchOperationsFromHistoryForDelegatedPrimitive.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "189"
},
{
"name": "C",
"bytes": "14326"
},
{
"name": "C#",
"bytes": "8026418"
},
{
"name": "C++",
"bytes": "31801"
},
{
"name": "CMake",
"bytes": "1617"
},
{
"name": "CSS",
"bytes": "4389"
},
{
"name": "HTML",
"bytes": "8339"
},
{
"name": "M4",
"bytes": "1854"
},
{
"name": "PLSQL",
"bytes": "283"
},
{
"name": "PowerShell",
"bytes": "729"
},
{
"name": "R",
"bytes": "332447"
},
{
"name": "Rebol",
"bytes": "436"
},
{
"name": "Roff",
"bytes": "2612"
},
{
"name": "SQLPL",
"bytes": "1116"
},
{
"name": "Shell",
"bytes": "13837"
},
{
"name": "TypeScript",
"bytes": "22792"
},
{
"name": "XSLT",
"bytes": "421"
}
],
"symlink_target": ""
} |
import mock
from rdomanager_oscplugin.tests.v1.overcloud_node import fakes
from rdomanager_oscplugin.v1 import overcloud_node
class TestDeleteNode(fakes.TestDeleteNode):
def setUp(self):
super(TestDeleteNode, self).setUp()
# Get the command object to test
self.cmd = overcloud_node.DeleteNode(self.app, None)
# TODO(someone): This test does not pass with autospec=True, it should
# probably be fixed so that it can pass with that.
@mock.patch('tripleo_common.scale.ScaleManager')
def test_node_delete(self, scale_manager):
argslist = ['instance1', 'instance2', '--plan', 'overcloud',
'--stack', 'overcloud']
verifylist = [
('plan', 'overcloud'),
('stack', 'overcloud'),
('nodes', ['instance1', 'instance2'])
]
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
self.cmd.take_action(parsed_args)
scale_manager.scaledown(parsed_args.nodes)
scale_manager.scaledown.assert_called_once_with(['instance1',
'instance2'])
| {
"content_hash": "290e9353022891cb5a2483fcf5332025",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 74,
"avg_line_length": 38.2,
"alnum_prop": 0.6116928446771379,
"repo_name": "rdo-management/python-rdomanager-oscplugin",
"id": "5433a0a62dd611be0b2fe96b90a962085da3fbb1",
"size": "1747",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rdomanager_oscplugin/tests/v1/overcloud_node/test_overcloud_node.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "280242"
}
],
"symlink_target": ""
} |
<section class="content-login remodal" data-remodal-id="doi-mat-khau" >
<form method="post" action="<?php echo base_url() ?>default/login/changepass?url=<?php echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>">
<h1>ĐỔI MẬT KHẨU</h1>
<?php
if($this->session->flashdata('ses_changepass')){
echo "<div class='login-error'>".$this->session->flashdata('ses_changepass')."</div>";
}
?>
<div>
<input name="old-pass" placeholder="Mật Khẩu Cũ" type="password" required="" class="password" />
</div>
<div>
<input name="user_pass" placeholder="Mật Khẩu Mới" type="password" required="" class="password" />
</div>
<div>
<input name="re-password" placeholder="Xác Nhận Mật Khẩu " type="password" required="" class="password" />
</div>
<div>
<input type="submit" value="Xác Nhận" />
</div>
</form><!-- form -->
<div class="button" style="height: 90px">
</div><!-- button -->
</section>
<section class="content-login remodal" data-remodal-id="dang-nhap" >
<form method="post" action="<?php echo base_url() ?>default/login?url=<?php echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>">
<h1>ĐĂNG NHẬP</h1>
<?php
if($this->session->flashdata('ses_login')){
echo "<div class='login-error'>Thông Tin Đăng Nhập Không Chính Xác</div>";
}
?>
<div>
<input type="text" placeholder="Tài Khoản" name="username" required="" id="username" />
</div>
<div>
<input type="password" placeholder="Mật Khẩu" name="password" required="" id="password" />
</div>
<div>
<input type="submit" value="Đăng Nhập" />
<a href="#quen-mat-khau">Quên Mật Khẩu</a>
<a href="#dang-ky">Đăng Ký</a>
</div>
</form><!-- form -->
<div class="button" style="height: 90px">
</div><!-- button -->
</section>
<section class="content-login remodal" data-remodal-id="dang-ky" >
<form action="<?php echo base_url() ?>default/login/register?url=<?php echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>" method="post">
<h1>ĐĂNG KÝ</h1>
<?php
if($this->session->flashdata('ses_register')){
echo "<div class='login-error'>".$this->session->flashdata('ses_register')."</div>";
}
?>
<div>
<input name="user_name" type="text" placeholder="Tài Khoản" required="" id="username" />
</div>
<div>
<input name="name" type="text" placeholder="Họ Và Tên" required="" id="username" />
</div>
<div>
<input name="user_pass" type="password" placeholder="Mật Khẩu" required="" id="password" />
</div>
<div>
<input name="user_address" type="text" placeholder="Địa Chỉ " required="" id="address" />
</div>
<div>
<input name="user_email" type="text" placeholder="Email " required="" id="email" />
</div>
<div>
<input name="user_phone" type="text" placeholder="Điện Thoại " required="" id="phone" />
</div>
<div>
<input type="submit" value="Đăng Ký" />
<a href="#dang-nhap">Đăng Nhập</a>
</div>
</form><!-- form -->
<div class="button" style="height: 90px">
</div><!-- button -->
</section>
<section class="content-login remodal" data-remodal-id="quen-mat-khau" >
<form method="post" action="<?php echo base_url() ?>default/login/getpass?url=<?php echo "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>">
<h1>QUÊN MẬT KHẨU</h1>
<?php
if($this->session->flashdata('ses_getpass')){
echo "<div class='login-error'>".$this->session->flashdata('ses_getpass')."</div>";
}
?>
<div>
<input name="user_email" placeholder="Email Đăng Ký" type="email" required="" class="password" />
</div>
<div>
<input type="submit" value="Xác Nhận" />
<a href="#dang-nhap">Đăng Nhập</a>
</div>
</form><!-- form -->
<div class="button" style="height: 90px">
</div><!-- button -->
</section> | {
"content_hash": "5d7cc01b667c0977a0b11bb2a9b12236",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 155,
"avg_line_length": 39.11818181818182,
"alnum_prop": 0.5335812224029747,
"repo_name": "hellohello101093/anco-website",
"id": "da7a93857cd12bc9f50b93a22bb7aeb32e38f72a",
"size": "4409",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "application/views/layout/login.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "301"
},
{
"name": "CSS",
"bytes": "1163714"
},
{
"name": "CoffeeScript",
"bytes": "4704"
},
{
"name": "Go",
"bytes": "6808"
},
{
"name": "HTML",
"bytes": "1686781"
},
{
"name": "JavaScript",
"bytes": "10931682"
},
{
"name": "Makefile",
"bytes": "448"
},
{
"name": "PHP",
"bytes": "8526416"
},
{
"name": "Python",
"bytes": "5596"
},
{
"name": "Shell",
"bytes": "3553"
}
],
"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_65) on Wed Dec 03 19:50:46 CET 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class net.sourceforge.pmd.util.designer.CodeEditorTextPane (PMD Core 5.2.2 API)</title>
<meta name="date" content="2014-12-03">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class net.sourceforge.pmd.util.designer.CodeEditorTextPane (PMD Core 5.2.2 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../net/sourceforge/pmd/util/designer/CodeEditorTextPane.html" title="class in net.sourceforge.pmd.util.designer">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?net/sourceforge/pmd/util/designer/class-use/CodeEditorTextPane.html" target="_top">Frames</a></li>
<li><a href="CodeEditorTextPane.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class net.sourceforge.pmd.util.designer.CodeEditorTextPane" class="title">Uses of Class<br>net.sourceforge.pmd.util.designer.CodeEditorTextPane</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../net/sourceforge/pmd/util/designer/CodeEditorTextPane.html" title="class in net.sourceforge.pmd.util.designer">CodeEditorTextPane</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="#net.sourceforge.pmd.util.designer">net.sourceforge.pmd.util.designer</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="net.sourceforge.pmd.util.designer">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../net/sourceforge/pmd/util/designer/CodeEditorTextPane.html" title="class in net.sourceforge.pmd.util.designer">CodeEditorTextPane</a> in <a href="../../../../../../net/sourceforge/pmd/util/designer/package-summary.html">net.sourceforge.pmd.util.designer</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../../net/sourceforge/pmd/util/designer/package-summary.html">net.sourceforge.pmd.util.designer</a> with parameters of type <a href="../../../../../../net/sourceforge/pmd/util/designer/CodeEditorTextPane.html" title="class in net.sourceforge.pmd.util.designer">CodeEditorTextPane</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><strong><a href="../../../../../../net/sourceforge/pmd/util/designer/CreateXMLRulePanel.html#CreateXMLRulePanel(javax.swing.JTextArea,%20net.sourceforge.pmd.util.designer.CodeEditorTextPane)">CreateXMLRulePanel</a></strong>(<a href="http://docs.oracle.com/javase/6/docs/api/javax/swing/JTextArea.html?is-external=true" title="class or interface in javax.swing">JTextArea</a> xpathQueryArea,
<a href="../../../../../../net/sourceforge/pmd/util/designer/CodeEditorTextPane.html" title="class in net.sourceforge.pmd.util.designer">CodeEditorTextPane</a> codeEditorPane)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../net/sourceforge/pmd/util/designer/CodeEditorTextPane.html" title="class in net.sourceforge.pmd.util.designer">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?net/sourceforge/pmd/util/designer/class-use/CodeEditorTextPane.html" target="_top">Frames</a></li>
<li><a href="CodeEditorTextPane.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 © 2002–2014 <a href="http://pmd.sourceforge.net/">InfoEther</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "c0fdd4301879685cacac80843f965e15",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 421,
"avg_line_length": 44.65384615384615,
"alnum_prop": 0.6487223657766293,
"repo_name": "byronka/xenos",
"id": "4ea67990f2a9ec84eb0c45b54c95587c6c02f59e",
"size": "6966",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "utils/pmd-bin-5.2.2/docs/pmd-core/apidocs/net/sourceforge/pmd/util/designer/class-use/CodeEditorTextPane.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "102953"
},
{
"name": "C++",
"bytes": "436"
},
{
"name": "CSS",
"bytes": "482910"
},
{
"name": "HTML",
"bytes": "220459885"
},
{
"name": "Java",
"bytes": "31611126"
},
{
"name": "JavaScript",
"bytes": "19708"
},
{
"name": "NSIS",
"bytes": "38770"
},
{
"name": "PLSQL",
"bytes": "19219"
},
{
"name": "Perl",
"bytes": "23704"
},
{
"name": "Python",
"bytes": "3299"
},
{
"name": "SQLPL",
"bytes": "54633"
},
{
"name": "Shell",
"bytes": "192465"
},
{
"name": "XSLT",
"bytes": "499720"
}
],
"symlink_target": ""
} |
package cn.wizzer.modules.models.sys;
import cn.wizzer.common.base.Model;
import org.nutz.dao.entity.annotation.*;
import java.io.Serializable;
/**
* Created by wizzer on 2016/8/11.
*/
@Table("sys_api")
public class Sys_api extends Model implements Serializable {
private static final long serialVersionUID = 1L;
@Column
@Name
@ColDefine(type = ColType.VARCHAR, width = 32)
@Prev(els = {@EL("uuid()")})
private String id;
@Column
@Comment("appName")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String appName;
@Column
@Comment("appId")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String appId;
@Column
@Comment("appSecret")
@ColDefine(type = ColType.VARCHAR, width = 255)
private String appSecret;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getAppSecret() {
return appSecret;
}
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
}
| {
"content_hash": "f1cefb2b5326899f9fe7fddcf832516e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 60,
"avg_line_length": 20.681818181818183,
"alnum_prop": 0.6241758241758242,
"repo_name": "EternityTony/acc_cloud",
"id": "977b5102e5218a9630d68fdeb2df01870e524c34",
"size": "1365",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/cn/wizzer/modules/models/sys/Sys_api.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "383798"
},
{
"name": "HTML",
"bytes": "1033488"
},
{
"name": "Java",
"bytes": "651950"
},
{
"name": "JavaScript",
"bytes": "2836684"
},
{
"name": "PHP",
"bytes": "19768"
}
],
"symlink_target": ""
} |
class SetDefaultProjectDays < ActiveRecord::Migration[5.1]
def change
ActiveRecord::Base.connection.execute(
"UPDATE projects SET days_to_keep_sample_private = 365
WHERE days_to_keep_sample_private is null"
)
change_column :projects, :days_to_keep_sample_private, :integer, :default => 365 , :null => false
end
end
| {
"content_hash": "230b551c6d255f27ea2e851f3e41ce7c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 101,
"avg_line_length": 38.333333333333336,
"alnum_prop": 0.7043478260869566,
"repo_name": "chanzuckerberg/idseq-web",
"id": "d1e09485767fe9c943cb86555e81fd0ca8ea15a5",
"size": "345",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "db/migrate/20180129204945_set_default_project_days.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Awk",
"bytes": "691"
},
{
"name": "CSS",
"bytes": "292"
},
{
"name": "Dockerfile",
"bytes": "2856"
},
{
"name": "HTML",
"bytes": "50789"
},
{
"name": "JavaScript",
"bytes": "2319352"
},
{
"name": "Python",
"bytes": "20830"
},
{
"name": "Ruby",
"bytes": "2301328"
},
{
"name": "SCSS",
"bytes": "256271"
},
{
"name": "Shell",
"bytes": "46117"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" />
<link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/>
<link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/>
<!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]-->
<style type="text/css" media="all">
@import url('../../../../../style.css');
@import url('../../../../../tree.css');
</style>
<script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script>
<script src="../../../../../package-nodes-tree.js" type="text/javascript"></script>
<script src="../../../../../clover-tree.js" type="text/javascript"></script>
<script src="../../../../../clover.js" type="text/javascript"></script>
<script src="../../../../../clover-descriptions.js" type="text/javascript"></script>
<script src="../../../../../cloud.js" type="text/javascript"></script>
<title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title>
</head>
<body>
<div id="page">
<header id="header" role="banner">
<nav class="aui-header aui-dropdown2-trigger-group" role="navigation">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo aui-header-logo-clover">
<a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a>
</h1>
</div>
<div class="aui-header-secondary">
<ul class="aui-nav">
<li id="system-help-menu">
<a class="aui-nav-link" title="Open online documentation" target="_blank"
href="http://openclover.org/documentation">
<span class="aui-icon aui-icon-small aui-iconfont-help"> Help</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="aui-page-panel">
<div class="aui-page-panel-inner">
<div class="aui-page-panel-nav aui-page-panel-nav-clover">
<div class="aui-page-header-inner" style="margin-bottom: 20px;">
<div class="aui-page-header-image">
<a href="http://cardatechnologies.com" target="_top">
<div class="aui-avatar aui-avatar-large aui-avatar-project">
<div class="aui-avatar-inner">
<img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/>
</div>
</div>
</a>
</div>
<div class="aui-page-header-main" >
<h1>
<a href="http://cardatechnologies.com" target="_top">
ABA Route Transit Number Validator 1.0.1-SNAPSHOT
</a>
</h1>
</div>
</div>
<nav class="aui-navgroup aui-navgroup-vertical">
<div class="aui-navgroup-inner">
<ul class="aui-nav">
<li class="">
<a href="../../../../../dashboard.html">Project overview</a>
</li>
</ul>
<div class="aui-nav-heading packages-nav-heading">
<strong>Packages</strong>
</div>
<div class="aui-nav project-packages">
<form method="get" action="#" class="aui package-filter-container">
<input type="text" autocomplete="off" class="package-filter text"
placeholder="Type to filter packages..." name="package-filter" id="package-filter"
title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/>
</form>
<p class="package-filter-no-results-message hidden">
<small>No results found.</small>
</p>
<div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator">
<div class="packages-tree-container"></div>
<div class="clover-packages-lozenges"></div>
</div>
</div>
</div>
</nav> </div>
<section class="aui-page-panel-content">
<div class="aui-page-panel-content-clover">
<div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs">
<li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li>
<li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li>
<li><a href="test-Test_AbaRouteValidator_08.html">Class Test_AbaRouteValidator_08</a></li>
</ol></div>
<h1 class="aui-h2-clover">
Test testAbaNumberCheck_16973_good
</h1>
<table class="aui">
<thead>
<tr>
<th>Test</th>
<th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th>
<th><label title="When the test execution was started">Start time</label></th>
<th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th>
<th><label title="A failure or error message if the test is not successful.">Message</label></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_08.html?line=47416#src-47416" >testAbaNumberCheck_16973_good</a>
</td>
<td>
<span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span>
</td>
<td>
7 Aug 12:38:17
</td>
<td>
0.0 </td>
<td>
<div></div>
<div class="errorMessage"></div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<table class="aui aui-table-sortable">
<thead>
<tr>
<th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th>
<th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_16973_good</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=12795#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a>
</td>
<td>
<span class="sortValue">0.7352941</span>73.5%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td>
</tr>
</tbody>
</table>
</div> <!-- class="aui-page-panel-content-clover" -->
<footer id="footer" role="contentinfo">
<section class="footer-body">
<ul>
<li>
Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1
on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT.
</li>
</ul>
<ul>
<li>OpenClover is free and open-source software. </li>
</ul>
</section>
</footer> </section> <!-- class="aui-page-panel-content" -->
</div> <!-- class="aui-page-panel-inner" -->
</div> <!-- class="aui-page-panel" -->
</div> <!-- id="page" -->
</body>
</html> | {
"content_hash": "833aaba6832a60e951991459bdde906f",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 297,
"avg_line_length": 43.92822966507177,
"alnum_prop": 0.5097483934211959,
"repo_name": "dcarda/aba.route.validator",
"id": "05131b4cfb214c30706e8e310d3345213b60b456",
"size": "9181",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_08_testAbaNumberCheck_16973_good_9vf.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "18715254"
}
],
"symlink_target": ""
} |
using System;
using System.Collections;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Provider;
using MS.Win32;
namespace MS.Internal.AutomationProxies
{
class WindowsNonControl: ProxyHwnd
{
// ------------------------------------------------------
//
// Constructors
//
// ------------------------------------------------------
#region Constructors
WindowsNonControl(IntPtr hwnd, ProxyFragment parent, int item)
: base(hwnd, parent, item)
{
_fIsContent = false;
}
#endregion
#region Proxy Create
// Static Create method called by UIAutomation to create this proxy.
// returns null if unsuccessful
internal static IRawElementProviderSimple Create(IntPtr hwnd, int idChild, int idObject)
{
return Create(hwnd, idChild);
}
private static IRawElementProviderSimple Create(IntPtr hwnd, int idChild)
{
// Something is wrong if idChild is not zero
if (idChild != 0)
{
System.Diagnostics.Debug.Assert(idChild == 0, "Invalid Child Id, idChild != 0");
throw new ArgumentOutOfRangeException("idChild", idChild, SR.Get(SRID.ShouldBeZero));
}
return new WindowsNonControl(hwnd, null, idChild);
}
#endregion
//------------------------------------------------------
//
// Patterns Implementation
//
//------------------------------------------------------
#region ProxySimple Interface
// Process all the Logical and Raw Element Properties
internal override object GetElementProperty (AutomationProperty idProp)
{
if (idProp == AutomationElement.IsControlElementProperty)
{
return false;
}
return base.GetElementProperty (idProp);
}
#endregion
}
}
| {
"content_hash": "1f8d51a386cad182e4b70bf8c3b47446",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 101,
"avg_line_length": 28,
"alnum_prop": 0.5181017612524462,
"repo_name": "mind0n/hive",
"id": "6c87cd71aae8af8c2b43b96a4f6cfac78e107416",
"size": "2610",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Cache/Libs/net46/wpf/src/UIAutomation/Win32Providers/MS/Internal/AutomationProxies/WindowsNonControl.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "670329"
},
{
"name": "ActionScript",
"bytes": "7830"
},
{
"name": "ApacheConf",
"bytes": "47"
},
{
"name": "Batchfile",
"bytes": "18096"
},
{
"name": "C",
"bytes": "19746409"
},
{
"name": "C#",
"bytes": "258148996"
},
{
"name": "C++",
"bytes": "48534520"
},
{
"name": "CSS",
"bytes": "933736"
},
{
"name": "ColdFusion",
"bytes": "10780"
},
{
"name": "GLSL",
"bytes": "3935"
},
{
"name": "HTML",
"bytes": "4631854"
},
{
"name": "Java",
"bytes": "10881"
},
{
"name": "JavaScript",
"bytes": "10250558"
},
{
"name": "Logos",
"bytes": "1526844"
},
{
"name": "MAXScript",
"bytes": "18182"
},
{
"name": "Mathematica",
"bytes": "1166912"
},
{
"name": "Objective-C",
"bytes": "2937200"
},
{
"name": "PHP",
"bytes": "81898"
},
{
"name": "Perl",
"bytes": "9496"
},
{
"name": "PowerShell",
"bytes": "44339"
},
{
"name": "Python",
"bytes": "188058"
},
{
"name": "Shell",
"bytes": "758"
},
{
"name": "Smalltalk",
"bytes": "5818"
},
{
"name": "TypeScript",
"bytes": "50090"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace CloudStack.Net
{
public class NicSecondaryIpResponse
{
/// <summary>
/// the ID of the secondary private IP addr
/// </summary>
public string Id { get; set; }
/// <summary>
/// Secondary IP address
/// </summary>
public string Ipaddress { get; set; }
/// <summary>
/// the ID of the network
/// </summary>
public string Networkid { get; set; }
/// <summary>
/// the ID of the nic
/// </summary>
public string NicId { get; set; }
/// <summary>
/// the ID of the vm
/// </summary>
public string Virtualmachineid { get; set; }
public override string ToString() => JsonConvert.SerializeObject(this, Formatting.Indented);
}
}
| {
"content_hash": "4fc11aae838e2a6b6acd80128bf4b708",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 100,
"avg_line_length": 25.157894736842106,
"alnum_prop": 0.5658995815899581,
"repo_name": "richardlawley/cloudstack.net",
"id": "7f282a09e03ead32e8dbca7f70b7760590a59676",
"size": "956",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/CloudStack.Net/Generated/NicSecondaryIpResponse.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "34"
},
{
"name": "C#",
"bytes": "1822509"
},
{
"name": "Java",
"bytes": "75375"
},
{
"name": "PowerShell",
"bytes": "3037"
}
],
"symlink_target": ""
} |
function setup()
end
function execute(deltaT)
sysLoad("asset://Polyline.lua")
end
function leave()
end
| {
"content_hash": "23e2582c912aaddace5df44aedf3f6a0",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 32,
"avg_line_length": 10.7,
"alnum_prop": 0.7383177570093458,
"repo_name": "kennykwok1/PlaygroundOSS",
"id": "bf94338df8d925d2661ae283776107a66b8062dc",
"size": "107",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Tutorial/05.Polyline/.publish/iphone/start.lua",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "98823"
},
{
"name": "Batchfile",
"bytes": "125"
},
{
"name": "C",
"bytes": "22444144"
},
{
"name": "C#",
"bytes": "505788"
},
{
"name": "C++",
"bytes": "9825726"
},
{
"name": "CMake",
"bytes": "18668"
},
{
"name": "CSS",
"bytes": "18102"
},
{
"name": "HTML",
"bytes": "421281"
},
{
"name": "Java",
"bytes": "218931"
},
{
"name": "JavaScript",
"bytes": "4351"
},
{
"name": "Lex",
"bytes": "23271"
},
{
"name": "Lua",
"bytes": "300504"
},
{
"name": "Makefile",
"bytes": "65938"
},
{
"name": "Objective-C",
"bytes": "223143"
},
{
"name": "Objective-C++",
"bytes": "298681"
},
{
"name": "Python",
"bytes": "376651"
},
{
"name": "Shell",
"bytes": "348831"
},
{
"name": "Yacc",
"bytes": "62717"
}
],
"symlink_target": ""
} |
import {escapeCssSelectorIdent} from '#core/dom/css-selectors';
import {parseQueryString} from '#core/types/string/url';
import {toWin} from '#core/window';
/**
* Returns true if the page should be prerendered (for being an active page or
* first page).
* @param {!AmpElement} pageElement
* @return {boolean}
*/
export function isPrerenderActivePage(pageElement) {
const win = toWin(pageElement.ownerDocument.defaultView);
const hashId = parseQueryString(win.location.href)['page'];
let selector = 'amp-story-page:first-of-type';
if (hashId) {
selector += `, amp-story-page#${escapeCssSelectorIdent(hashId)}`;
}
const selectorNodes = win.document.querySelectorAll(selector);
return selectorNodes[selectorNodes.length - 1] === pageElement;
}
| {
"content_hash": "a407adfb570c69bd6df5c5dde145721d",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 34.86363636363637,
"alnum_prop": 0.7327249022164276,
"repo_name": "rsimha-amp/amphtml",
"id": "cbd65463b3267693ad65a19a2ad79177aa4d52cc",
"size": "1394",
"binary": false,
"copies": "1",
"ref": "refs/heads/2021-06-29-CrossBrowserTests",
"path": "extensions/amp-story/1.0/prerender-active-page.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "195514"
},
{
"name": "Go",
"bytes": "15254"
},
{
"name": "HTML",
"bytes": "1018438"
},
{
"name": "Java",
"bytes": "36670"
},
{
"name": "JavaScript",
"bytes": "9464137"
},
{
"name": "Python",
"bytes": "80044"
},
{
"name": "Ruby",
"bytes": "14445"
},
{
"name": "Shell",
"bytes": "12162"
},
{
"name": "Yacc",
"bytes": "22292"
}
],
"symlink_target": ""
} |
<!-- Modal -->
<div class="modal fade" id="modal_wipeHours" tabindex="-1" role="dialog" aria-labelledby="modal-title" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Wipe Hours <small> This will set your hours to 0 for the specified date</small></h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form" id="wipeHoursDate">
<div class="form-group">
<label for="wipeHoursDatePicker" class="col-lg-2 control-label">Date</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="wipeHoursDatePicker" name="wipeHoursDatePicker">
</div>
</div>
<div class="form-group">
<label for="wipeHoursComment" class="col-lg-2 control-label">Comment</label>
<div class="col-lg-10">
<textarea id="wipeHoursComment" name="wipeHoursComment" cols="5" class="boxsizingBorder width100" placeholder="What is the reason for wiping the hours?"></textarea>
</div>
</div>
</form>
<div id="wipeTaskHoursErrorMessage"></div>
<!-- end error -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button id="wipeHoursButton" type="button" class="btn btn-primary">Wipe Hours</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
function validateModalWipeHours() {
if( $("#wipeHoursDate").valid() )
{
$("#modal_wipeHours").modal('hide');
return true;
}else
{
return false;
}
}
$(document).ready(function(){
var wipeHoursContainer = $('div.wipeTaskHoursErrorMessage');
errorLabelContainer: $("#wipeHoursDate div.wipeTaskHoursErrorMessage")
$("#wipeHoursDate").validate({
errorContainer: wipeHoursContainer,
errorLabelContainer: $("div", wipeHoursContainer),
wrapper: 'p',
rules: {
wipeHoursDatePicker: {
required: true,
date: true
},
wipeHoursComment: {
maxlength: 255
}
},
messages: {
wipeHoursDatePicker: {
required: 'What date would you like to wipe?.',
date: 'Please only enter in a date.'
},
wipeHoursComment: {
maxlength: 'I appreciate the effort, but try and make it shorter (<=255)'
}
}
});
});
</script> | {
"content_hash": "a27d75c1c9f180fabc8cf980fe26ef0f",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 168,
"avg_line_length": 31.58974358974359,
"alnum_prop": 0.6359577922077922,
"repo_name": "HexagonSystems/website",
"id": "916411cefcc6e14f110c8e2ccd661f1b5ebe851b",
"size": "2466",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "App/Package/Task/View/Template/modal_wipeHours.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "696411"
},
{
"name": "JavaScript",
"bytes": "104103"
},
{
"name": "PHP",
"bytes": "396262"
},
{
"name": "Perl",
"bytes": "398"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.